From fc958d6b7d4fcc1a5ea08d4526e3ebf8ef6fd135 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Wed, 9 Jul 2025 10:08:25 -0700 Subject: [PATCH] Add a crash reporting opt out --- Localizable.xcstrings | 6 ++++++ Meshtastic/Extensions/UserDefaults.swift | 4 ++++ Meshtastic/MeshtasticApp.swift | 2 +- Meshtastic/Views/Settings/AppSettings.swift | 8 ++++++++ protobufs | 2 +- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 219f123e..05e01396 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -22993,6 +22993,9 @@ } } } + }, + "Provide anonymous usage statistics and crash reports." : { + }, "Provide Confirmation" : { @@ -33157,6 +33160,9 @@ } } } + }, + "Usage and Crash Data" : { + }, "Use a PWM output (like the RAK Buzzer) for tunes instead of an on/off output. This will ignore the output, output duration and active settings and use the device config buzzer GPIO option instead." : { "localizations" : { diff --git a/Meshtastic/Extensions/UserDefaults.swift b/Meshtastic/Extensions/UserDefaults.swift index 11539ab2..0ca337e9 100644 --- a/Meshtastic/Extensions/UserDefaults.swift +++ b/Meshtastic/Extensions/UserDefaults.swift @@ -74,6 +74,7 @@ extension UserDefaults { case environmentEnableWeatherKit case enableAdministration case mapReportingOptIn + case usageDataAndCrashReporting case testIntEnum } @@ -155,6 +156,9 @@ extension UserDefaults { @UserDefault(.mapReportingOptIn, defaultValue: false) static var mapReportingOptIn: Bool + + @UserDefault(.usageDataAndCrashReporting, defaultValue: true) + static var usageDataAndCrashReporting: Bool @UserDefault(.testIntEnum, defaultValue: .one) static var testIntEnum: TestIntEnum diff --git a/Meshtastic/MeshtasticApp.swift b/Meshtastic/MeshtasticApp.swift index 22ea61f3..9ce07142 100644 --- a/Meshtastic/MeshtasticApp.swift +++ b/Meshtastic/MeshtasticApp.swift @@ -41,7 +41,7 @@ struct MeshtasticAppleApp: App { env: environment, site: .us5 ), - trackingConsent: .granted + trackingConsent: UserDefaults.usageDataAndCrashReporting ? .granted : .notGranted ) RUM.enable( diff --git a/Meshtastic/Views/Settings/AppSettings.swift b/Meshtastic/Views/Settings/AppSettings.swift index 93d1e8da..eeddf8d0 100644 --- a/Meshtastic/Views/Settings/AppSettings.swift +++ b/Meshtastic/Views/Settings/AppSettings.swift @@ -16,6 +16,7 @@ struct AppSettings: View { @AppStorage("purgeStaleNodeDays") private var purgeStaleNodeDays: Double = 0 @AppStorage("environmentEnableWeatherKit") private var environmentEnableWeatherKit: Bool = true @AppStorage("enableAdministration") private var enableAdministration: Bool = false + @AppStorage("usageDataAndCrashReporting") private var usageDataAndCrashReporting: Bool = true var body: some View { VStack { Form { @@ -33,6 +34,13 @@ struct AppSettings: View { Text("PKI based node administration, requires firmware version 2.5+") .foregroundStyle(.secondary) .font(.caption) + Toggle(isOn: $usageDataAndCrashReporting) { + Label("Usage and Crash Data", systemImage: "pencil.and.list.clipboard") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + Text("Provide anonymous usage statistics and crash reports.") + .foregroundStyle(.secondary) + .font(.caption) } Section(header: Text("environment")) { VStack(alignment: .leading) { diff --git a/protobufs b/protobufs index 27fac391..816595c8 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 27fac39141d99fe727a0a1824c5397409b1aea75 +Subproject commit 816595c8bbdfc3b4388e11348ccd043294d58705