Align with android on sentry settings.
This commit is contained in:
committed by
Stefan Ceriu
parent
112b9e248f
commit
290721ad90
@@ -949,8 +949,14 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
|
||||
options.dsn = bugReportSentryURL.absoluteString
|
||||
|
||||
if AppSettings.isDevelopmentBuild {
|
||||
options.environment = "development"
|
||||
// Matches android, at least for now.
|
||||
switch AppSettings.appBuildType {
|
||||
case .debug:
|
||||
options.environment = "DEBUG"
|
||||
case .nightly:
|
||||
options.environment = "NIGHTLY"
|
||||
case .release:
|
||||
options.environment = "RELEASE"
|
||||
}
|
||||
|
||||
// Sentry swizzling shows up quite often as the heaviest stack trace when profiling
|
||||
@@ -975,15 +981,9 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
|
||||
// Uniform sample rate: 1.0 captures 100% of transactions
|
||||
// In Production you will probably want a smaller number such as 0.5 for 50%
|
||||
if AppSettings.isDevelopmentBuild {
|
||||
options.sampleRate = 1.0
|
||||
options.tracesSampleRate = 1.0
|
||||
options.configureProfiling = { $0.sessionSampleRate = 1.0 }
|
||||
} else {
|
||||
options.sampleRate = 0.5
|
||||
options.tracesSampleRate = 0.5
|
||||
options.configureProfiling = { $0.sessionSampleRate = 1.0 }
|
||||
}
|
||||
options.sampleRate = 1.0
|
||||
options.tracesSampleRate = 1.0
|
||||
options.configureProfiling = { $0.sessionSampleRate = 1.0 }
|
||||
|
||||
// This callback is only executed once during the entire run of the program to avoid
|
||||
// multiple callbacks if there are multiple crash events to send (see method documentation)
|
||||
|
||||
@@ -25,6 +25,12 @@ protocol CommonSettingsProtocol {
|
||||
var hideQuietNotificationAlerts: Bool { get }
|
||||
}
|
||||
|
||||
enum AppBuildType {
|
||||
case debug
|
||||
case nightly
|
||||
case release
|
||||
}
|
||||
|
||||
/// Store Element specific app settings.
|
||||
final class AppSettings {
|
||||
private enum UserDefaultsKeys: String {
|
||||
@@ -82,16 +88,19 @@ final class AppSettings {
|
||||
/// UserDefaults to be used on reads and writes.
|
||||
private static var store: UserDefaults! = UserDefaults(suiteName: suiteName)
|
||||
|
||||
/// Whether or not the app is a development build that isn't in production.
|
||||
static var isDevelopmentBuild: Bool = {
|
||||
static var appBuildType: AppBuildType {
|
||||
#if DEBUG
|
||||
true
|
||||
return .debug
|
||||
#else
|
||||
let apps = ["io.element.elementx.nightly", "io.element.elementx.pr"]
|
||||
return apps.contains(InfoPlistReader.main.baseBundleIdentifier)
|
||||
switch InfoPlistReader.main.baseBundleIdentifier {
|
||||
case "io.element.elementx.nightly":
|
||||
return .nightly
|
||||
default:
|
||||
return .release
|
||||
}
|
||||
#endif
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
static func resetAllSettings() {
|
||||
MXLog.warning("Resetting the AppSettings.")
|
||||
store.removePersistentDomain(forName: suiteName)
|
||||
@@ -336,7 +345,7 @@ final class AppSettings {
|
||||
|
||||
// MARK: - Room Screen
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.viewSourceEnabled, defaultValue: isDevelopmentBuild, storageType: .userDefaults(store))
|
||||
@UserPreference(key: UserDefaultsKeys.viewSourceEnabled, defaultValue: appBuildType == .debug, storageType: .userDefaults(store))
|
||||
var viewSourceEnabled
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.optimizeMediaUploads, defaultValue: true, storageType: .userDefaults(store))
|
||||
@@ -424,7 +433,7 @@ final class AppSettings {
|
||||
@UserPreference(key: UserDefaultsKeys.spaceFiltersEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var spaceFiltersEnabled
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.developerOptionsEnabled, defaultValue: isDevelopmentBuild, storageType: .userDefaults(store))
|
||||
@UserPreference(key: UserDefaultsKeys.developerOptionsEnabled, defaultValue: appBuildType == .debug, storageType: .userDefaults(store))
|
||||
var developerOptionsEnabled
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user