diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index 0cd583537f..bf609352e5 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -200,8 +200,8 @@ final class AppSettings { // MARK: - Bug report - let bugReportServiceBaseURL: URL = "https://riot.im/bugreports" - let bugReportSentryURL: URL = "https://f39ac49e97714316965b777d9f3d6cd8@sentry.tools.element.io/44" + let bugReportServiceBaseURL: URL! = URL(string: Secrets.rageshakeServerURL) + let bugReportSentryURL: URL! = URL(string: Secrets.sentryDSN) // Use the name allocated by the bug report server let bugReportApplicationId = "element-x-ios" /// The maximum size of the upload request. Default value is just below CloudFlare's max request size. @@ -209,22 +209,15 @@ final class AppSettings { // MARK: - Analytics - #if DEBUG - /// The configuration to use for analytics during development. Set `isEnabled` to false to disable analytics in debug builds. - /// **Note:** Analytics are disabled by default for forks. If you are maintaining a fork, set custom configurations. - let analyticsConfiguration = AnalyticsConfiguration(isEnabled: InfoPlistReader.main.bundleIdentifier.starts(with: "io.element."), - host: "https://posthog.element.dev", - apiKey: "phc_VtA1L35nw3aeAtHIx1ayrGdzGkss7k1xINeXcoIQzXN", - termsURL: "https://element.io/cookie-policy") - #else /// The configuration to use for analytics. Set `isEnabled` to false to disable analytics. - /// **Note:** Analytics are disabled by default for forks. If you are maintaining a fork, set custom configurations. - let analyticsConfiguration = AnalyticsConfiguration(isEnabled: InfoPlistReader.main.bundleIdentifier.starts(with: "io.element."), - host: "https://posthog.element.io", - apiKey: "phc_Jzsm6DTm6V2705zeU5dcNvQDlonOR68XvX2sh1sEOHO", - termsURL: URL("https://element.io/cookie-policy")) - #endif - + /// + /// **Note:** Analytics are disabled by default for forks. If you are maintaining a fork + /// you will need to update the Secrets file with your PostHog server and API key. + let analyticsConfiguration = AnalyticsConfiguration(isEnabled: !Secrets.postHogHost.contains("localhost"), + host: Secrets.postHogHost, + apiKey: Secrets.postHogAPIKey, + termsURL: "https://element.io/cookie-policy") + /// Whether the user has opted in to send analytics. @UserPreference(key: UserDefaultsKeys.analyticsConsentState, defaultValue: AnalyticsConsentState.unknown, storageType: .userDefaults(store)) var analyticsConsentState diff --git a/Secrets/Secrets.pkl b/Secrets/Secrets.pkl index 822c14500f..699aea99a6 100644 --- a/Secrets/Secrets.pkl +++ b/Secrets/Secrets.pkl @@ -5,4 +5,13 @@ // Please see LICENSE files in the repository root for full details. // +// Analytics and Diagnostics + +sentryDSN = read("env:SENTRY_DSN") +postHogAPIKey = read("env:POSTHOG_API_KEY") +postHogHost = read("env:POSTHOG_HOST") +rageshakeServerURL = read("env:RAGESHAKE_SERVER_URL") + +// Maps + mapLibreAPIKey = read("env:MAPLIBRE_API_KEY") diff --git a/Secrets/Secrets.swift b/Secrets/Secrets.swift index 4bfd24bbc1..b7e0a68efd 100644 --- a/Secrets/Secrets.swift +++ b/Secrets/Secrets.swift @@ -11,5 +11,9 @@ import Foundation // swiftlint:disable identifier_name line_length number_separator type_body_length internal enum Secrets { internal static let mapLibreAPIKey: String = "your_key" + internal static let postHogAPIKey: String = "your_key" + internal static let postHogHost: String = "https://get.your.own.io" + internal static let rageshakeServerURL: String = "https://⁦bring.your.own.and.en.joy" + internal static let sentryDSN: String = "https://⁦insert.your.hearts.desire.here" } // swiftlint:enable identifier_name line_length number_separator type_body_length