Add option to disable automatic crash reporting

This commit is contained in:
Shadowfacts 2022-10-30 18:17:53 -04:00
parent 91450ced7c
commit c5921bc4cb
3 changed files with 22 additions and 0 deletions

View File

@ -70,6 +70,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
options.enableNetworkTracking = false
options.enableAppHangTracking = false
options.enableCoreDataTracking = false
options.beforeSend = { event in
Preferences.shared.reportErrorsAutomatically ? event : nil
}
}
}

View File

@ -149,6 +149,7 @@ class Preferences: Codable, ObservableObject {
// MARK: Advanced
@Published var statusContentType: StatusContentType = .plain
@Published var reportErrorsAutomatically = true
// MARK:
@Published var hasShownLocalTimelineDescription = false

View File

@ -15,6 +15,7 @@ struct AdvancedPrefsView : View {
var body: some View {
List {
formattingSection
errorReportingSection
cachingSection
}
.listStyle(InsetGroupedListStyle())
@ -36,6 +37,22 @@ struct AdvancedPrefsView : View {
}
}
var errorReportingSection: some View {
Section {
Toggle("Report Errors Automatically", isOn: $preferences.reportErrorsAutomatically)
} footer: {
var privacyPolicy: AttributedString = "Privacy Policy"
let _ = privacyPolicy.link = URL(string: "https://vaccor.space/tusker#privacy")!
if preferences.reportErrorsAutomatically {
Text(AttributedString("App crashes and errors will be automatically reported to the developer. You may be prompted to add additional information.\n") + privacyPolicy)
.lineLimit(nil)
} else {
Text(AttributedString("Errors will not be reported automatically. When a crash occurs, you may be asked to report it manually.\n") + privacyPolicy)
.lineLimit(nil)
}
}
}
var cachingSection: some View {
Section(header: Text("Caching"), footer: Text("Clearing caches will restart the app.")) {
Button(action: clearCache) {