Skip to content

Commit

Permalink
Move the google app analytics api key to an environment variable pick…
Browse files Browse the repository at this point in the history
…ed up at build time.
  • Loading branch information
clovett committed Oct 23, 2023
1 parent 53a1f53 commit 73651b4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,4 @@ _site/
/publish_appx
/src/Application/Samples/rss.htm
src/XmlNotepadSetup/build.cmd
/src/Model/ApiKey.cs
1 change: 1 addition & 0 deletions publish.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ if ERRORLEVEL 1 goto :eof
src\UpdateVersions\bin\Release\UpdateVersions.exe
if ERRORLEVEL 1 goto :eof

echo namespace XmlNotepad { public partial class AppAnalytics { private const string ApiKey="%XMLNOTEPAD_ANALYTICSKEY%"; } } > src\model\ApiKey.cs
msbuild /target:rebuild src\xmlnotepad.sln /p:Configuration=Release "/p:Platform=Any CPU"
if ERRORLEVEL 1 goto :nobits
msbuild /target:publish src\xmlnotepad.sln /p:Configuration=Release "/p:Platform=Any CPU"
Expand Down
3 changes: 1 addition & 2 deletions src/Model/AppAnalytics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

namespace XmlNotepad
{
public class AppAnalytics
public partial class AppAnalytics
{
private const string HostName = "microsoft.github.io";
private const string TrackingId = "G-130J0SE94H";
private const string ApiKey = "DGyp7J4BQw-h8s-vlH_BDw";
private string _clientId;
private bool _formOptions; // did they use the options dialog during this session?
private bool _formSchemas;
Expand Down
4 changes: 4 additions & 0 deletions src/Model/Model.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@
</EmbeddedResource>
</ItemGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="echo namespace XmlNotepad { public partial class AppAnalytics { private const string ApiKey=&quot;%25XMLNOTEPAD_ANALYTICSKEY%25&quot;; } } &gt; $(MSBuildThisFileDirectory)ApiKey.cs " />
</Target>

</Project>
5 changes: 1 addition & 4 deletions src/XmlNotepadBundle/Bundle.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx48Web" />
<MsiPackage Id="XmlNotepad"
SourceFile="..\XmlNotepadSetup\bin\Release\XmlNotepadSetup.msi"
DisplayName="XML Notepad"
EnableFeatureSelection="yes"/>
<MsiPackage Id="XmlNotepad" SourceFile="..\XmlNotepadSetup\bin\Release\XmlNotepadSetup.msi" DisplayName="XML Notepad" EnableFeatureSelection="yes" />
</Chain>
</Bundle>
</Wix>

0 comments on commit 73651b4

Please sign in to comment.