mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Update app settings clear button
This commit is contained in:
parent
d3a7de2f76
commit
698eb7b5d0
3 changed files with 19 additions and 19 deletions
|
|
@ -78,8 +78,11 @@ struct AppSettings: View {
|
|||
context.refreshAllObjects()
|
||||
}
|
||||
}
|
||||
Button("Reset App Settings", systemImage: "clipboard") {
|
||||
Button {
|
||||
UserDefaults.standard.reset()
|
||||
} label: {
|
||||
Label("Reset App Settings", systemImage: "arrow.counterclockwise.circle")
|
||||
.foregroundColor(.red)
|
||||
}
|
||||
}
|
||||
if totalDownloadedTileSize != "0MB" {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,11 @@ struct Channels: View {
|
|||
positionPrecision = 32
|
||||
preciseLocation = true
|
||||
positionsEnabled = true
|
||||
|
||||
if channelKey == "AQ==" {
|
||||
positionPrecision = 13
|
||||
preciseLocation = false
|
||||
positionsEnabled = true
|
||||
}
|
||||
} else if !supportedVersion && channelRole == 2 {
|
||||
positionPrecision = 0
|
||||
preciseLocation = false
|
||||
|
|
|
|||
|
|
@ -157,20 +157,12 @@ struct ChannelForm: View {
|
|||
if !preciseLocation {
|
||||
VStack(alignment: .leading) {
|
||||
Label("Approximate Location", systemImage: "location.slash.circle.fill")
|
||||
if channelKeySize == -1 {
|
||||
Slider(value: $positionPrecision, in: 10...16, step: 1) {
|
||||
} minimumValueLabel: {
|
||||
Image(systemName: "minus")
|
||||
} maximumValueLabel: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
} else {
|
||||
Slider(value: $positionPrecision, in: 10...19, step: 1) {
|
||||
} minimumValueLabel: {
|
||||
Image(systemName: "minus")
|
||||
} maximumValueLabel: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
|
||||
Slider(value: $positionPrecision, in: 10...16, step: 1) {
|
||||
} minimumValueLabel: {
|
||||
Image(systemName: "minus")
|
||||
} maximumValueLabel: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
Text(PositionPrecision(rawValue: Int(positionPrecision))?.description ?? "")
|
||||
.foregroundColor(.gray)
|
||||
|
|
@ -211,6 +203,7 @@ struct ChannelForm: View {
|
|||
.onChange(of: channelKeySize) { _ in
|
||||
if channelKeySize == -1 {
|
||||
preciseLocation = false
|
||||
channelKey = "AQ=="
|
||||
}
|
||||
}
|
||||
.onChange(of: channelRole) { _ in
|
||||
|
|
@ -220,7 +213,7 @@ struct ChannelForm: View {
|
|||
if loc == true {
|
||||
positionPrecision = 32
|
||||
} else {
|
||||
positionPrecision = 14
|
||||
positionPrecision = 13
|
||||
}
|
||||
hasChanges = true
|
||||
}
|
||||
|
|
@ -230,7 +223,7 @@ struct ChannelForm: View {
|
|||
.onChange(of: positionsEnabled) { pe in
|
||||
if pe {
|
||||
if positionPrecision == 0 {
|
||||
positionPrecision = 32
|
||||
positionPrecision = 13
|
||||
}
|
||||
} else {
|
||||
positionPrecision = 0
|
||||
|
|
@ -243,7 +236,7 @@ struct ChannelForm: View {
|
|||
.onChange(of: downlink) { _ in
|
||||
hasChanges = true
|
||||
}
|
||||
.onAppear {
|
||||
.onFirstAppear {
|
||||
let tempKey = Data(base64Encoded: channelKey) ?? Data()
|
||||
if tempKey.count == channelKeySize || channelKeySize == -1 {
|
||||
hasValidKey = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue