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