mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Try and clear user default values on clear app settings
This commit is contained in:
parent
f1e93733ff
commit
d2b0abee86
3 changed files with 25 additions and 1 deletions
|
|
@ -165,3 +165,25 @@ extension String {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension UserDefaults {
|
||||
|
||||
enum Keys: String, CaseIterable {
|
||||
case meshtasticUsername
|
||||
case preferredPeripheralId
|
||||
case provideLocation
|
||||
case provideLocationInterval
|
||||
case keyboardType
|
||||
case meshMapType
|
||||
case meshMapCenteringMode
|
||||
case meshMapRecentering
|
||||
case meshMapCustomTileServer
|
||||
case meshMapUserTrackingMode
|
||||
case meshMapShowNodeHistory
|
||||
case meshMapShowRouteLines
|
||||
}
|
||||
|
||||
func reset() {
|
||||
Keys.allCases.forEach { removeObject(forKey: $0.rawValue) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ struct DeviceMetricsLog: View {
|
|||
x: .value("Hour", $0.time!.formattedDate(format: "ha")),
|
||||
y: .value("Value", $0.batteryLevel)
|
||||
)
|
||||
.interpolationMethod(.cardinal)
|
||||
.interpolationMethod(.linear)
|
||||
.foregroundStyle(.blue)
|
||||
PointMark(
|
||||
x: .value("Hour", $0.time!.formattedDate(format: "ha")),
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ struct AppSettings: View {
|
|||
Button("Erase all app data?", role: .destructive) {
|
||||
bleManager.disconnectPeripheral()
|
||||
clearCoreDataDatabase(context: context)
|
||||
UserDefaults.standard.reset()
|
||||
UserDefaults.standard.synchronize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue