diff --git a/src/ParquetViewer.Tests/TestAmplitudeEvent.cs b/src/ParquetViewer.Tests/TestAmplitudeEvent.cs index 1be63e4..40669cd 100644 --- a/src/ParquetViewer.Tests/TestAmplitudeEvent.cs +++ b/src/ParquetViewer.Tests/TestAmplitudeEvent.cs @@ -20,6 +20,7 @@ public TestAmplitudeEvent(string dummyApiKey) : base(EVENT_TYPE) public void SwapHttpClientHandler(HttpMessageHandler mockHandler) { HttpMessageHandler = mockHandler; + BypassConsentRequirement = true; } } } diff --git a/src/ParquetViewer/Analytics/AmplitudeEvent.cs b/src/ParquetViewer/Analytics/AmplitudeEvent.cs index 985f862..08f2897 100644 --- a/src/ParquetViewer/Analytics/AmplitudeEvent.cs +++ b/src/ParquetViewer/Analytics/AmplitudeEvent.cs @@ -17,6 +17,7 @@ public abstract class AmplitudeEvent private static readonly int _systemRAM = (int)(GC.GetGCMemoryInfo().TotalAvailableMemoryBytes / 1048576.0 /*magic number*/); protected HttpMessageHandler HttpMessageHandler { get; set; } = new HttpClientHandler(); + protected bool BypassConsentRequirement { get; set; } [JsonIgnore] public string DeviceId => AppSettings.AnalyticsDeviceId.ToString(); @@ -48,7 +49,7 @@ public async Task Record() { try { - if (AMPLITUDE_API_KEY.Length == 0 || !AppSettings.AnalyticsDataGatheringConsent) + if (!BypassConsentRequirement && (AMPLITUDE_API_KEY.Length == 0 || !AppSettings.AnalyticsDataGatheringConsent)) return false; var request = new