Disable the default analytics configurations for forks. (#5688)

* Disable the default analytics configurations for forks.

* Check the analytics configuration instead of the PostHog Config.
This commit is contained in:
Doug
2022-02-24 15:46:18 +00:00
committed by GitHub
parent 02693de1d0
commit 69f9a92a47
5 changed files with 37 additions and 20 deletions
+2 -2
View File
@@ -50,8 +50,8 @@ import AnalyticsEvents
/// Whether to show the user the analytics opt in prompt.
var shouldShowAnalyticsPrompt: Bool {
// Only show the prompt once, and when analytics are configured in BuildSettings.
!RiotSettings.shared.hasSeenAnalyticsPrompt && PHGPostHogConfiguration.standard != nil
// Only show the prompt once, and when analytics are enabled in BuildSettings.
!RiotSettings.shared.hasSeenAnalyticsPrompt && BuildSettings.analyticsConfiguration.isEnabled
}
/// Indicates whether the user previously accepted Matomo analytics and should be shown the upgrade prompt.
@@ -18,11 +18,12 @@ import PostHog
extension PHGPostHogConfiguration {
static var standard: PHGPostHogConfiguration? {
guard let apiKey = BuildSettings.analyticsKey, let host = BuildSettings.analyticsHost else { return nil }
let analyticsConfiguration = BuildSettings.analyticsConfiguration
guard analyticsConfiguration.isEnabled else { return nil }
let configuration = PHGPostHogConfiguration(apiKey: apiKey, host: host)
configuration.shouldSendDeviceID = false
let postHogConfiguration = PHGPostHogConfiguration(apiKey: analyticsConfiguration.apiKey, host: analyticsConfiguration.host)
postHogConfiguration.shouldSendDeviceID = false
return configuration
return postHogConfiguration
}
}