Browse Source

Added build id

CPKreuz 1 year ago
parent
commit
6b84c0cf4f

+ 19 - 1
src/PixiEditor/Helpers/VersionHelpers.cs

@@ -13,7 +13,7 @@ internal static class VersionHelpers
     {
         StringBuilder builder = new($"{GetCurrentAssemblyVersion().ToString()} Closed Beta");
 
-        // Dev Build removed for closed beta
+        // TODO: Dev Build removed for closed beta
 #if MSIX_DEBUG
         builder.Append(" MSIX Debug Build");
         return builder.ToString();
@@ -34,4 +34,22 @@ internal static class VersionHelpers
 #endif
         return builder.ToString();
     }
+
+    // BuildId should not contain spaces
+    public static string GetBuildId()
+    {
+#if DEBUG
+        return "ClosedBetaDebug";
+#elif DEVRELEASE
+        return "ClosedBetaDevRelease";
+#elif RELEASE
+        return "ClosedBetaRelease";
+#elif STEAM
+        return "ClosedBetaStream";
+#elif MSIX
+        return "ClosedBetaMSIX";
+#else
+        #error No build name configured for this configuration
+#endif
+    }
 }

+ 1 - 1
src/PixiEditor/Models/AnalyticsAPI/AnalyticsClient.cs

@@ -25,7 +25,7 @@ public class AnalyticsClient
 
     public async Task<Guid?> CreateSessionAsync(CancellationToken cancellationToken = default)
     {
-        var response = await _client.GetAsync($"init-session?version={VersionHelpers.GetCurrentAssemblyVersion()}", cancellationToken);
+        var response = await _client.GetAsync($"init-session?version={VersionHelpers.GetCurrentAssemblyVersion()}&buildId={VersionHelpers.GetBuildId()}", cancellationToken);
 
         if (response.IsSuccessStatusCode)
         {