mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Revert broken channel key validation
Remove block range test Add notes that router role is not for mobile nodes
This commit is contained in:
parent
1bec0dae66
commit
350ec121d7
6 changed files with 19 additions and 60 deletions
|
|
@ -11,7 +11,6 @@ struct AppSettings: View {
|
|||
@State var totalDownloadedTileSize = ""
|
||||
@StateObject var locationHelper = LocationHelper()
|
||||
@State var provideLocation: Bool = UserDefaults.provideLocation
|
||||
@State var blockRangeTest: Bool = UserDefaults.blockRangeTest
|
||||
@State var useLegacyMap: Bool = UserDefaults.mapUseLegacy
|
||||
@State var provideLocationInterval: Int = UserDefaults.provideLocationInterval
|
||||
@State private var isPresentingCoreDataResetConfirm = false
|
||||
|
|
@ -20,12 +19,6 @@ struct AppSettings: View {
|
|||
VStack {
|
||||
Form {
|
||||
Section(header: Text("options")) {
|
||||
|
||||
Toggle(isOn: $blockRangeTest) {
|
||||
Label("range.test.blocked", systemImage: "x.circle")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
|
||||
Toggle(isOn: $useLegacyMap) {
|
||||
Label("map.use.legacy", systemImage: "map")
|
||||
}
|
||||
|
|
@ -151,9 +144,6 @@ struct AppSettings: View {
|
|||
self.bleManager.context = context
|
||||
}
|
||||
}
|
||||
.onChange(of: blockRangeTest) { newBlockRangeTest in
|
||||
UserDefaults.blockRangeTest = newBlockRangeTest
|
||||
}
|
||||
.onChange(of: provideLocation) { newProvideLocation in
|
||||
UserDefaults.provideLocation = newProvideLocation
|
||||
if bleManager.connectedPeripheral != nil {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// ShareChannel.swift
|
||||
// MeshtasticApple
|
||||
// Channels.swift
|
||||
// Meshtastic Apple
|
||||
//
|
||||
// Copyright(c) Garth Vander Houwen 4/8/22.
|
||||
//
|
||||
|
|
@ -25,7 +25,6 @@ struct Channels: View {
|
|||
var node: NodeInfoEntity?
|
||||
|
||||
@State var hasChanges = false
|
||||
@State var hasValidKey = false
|
||||
@State private var isPresentingEditView = false
|
||||
@State private var isPresentingSaveConfirm: Bool = false
|
||||
@State private var channelIndex: Int32 = 0
|
||||
|
|
@ -168,34 +167,16 @@ struct Channels: View {
|
|||
HStack(alignment: .top) {
|
||||
Text("Key")
|
||||
Spacer()
|
||||
TextField(
|
||||
"Key",
|
||||
text: $channelKey
|
||||
)
|
||||
.padding(4)
|
||||
.disableAutocorrection(true)
|
||||
.keyboardType(.alphabet)
|
||||
.foregroundColor(Color.gray)
|
||||
.textSelection(.enabled)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 25.0)
|
||||
.stroke(
|
||||
hasValidKey ?
|
||||
Color.green :
|
||||
Color.red
|
||||
, lineWidth: 2.0)
|
||||
)
|
||||
.onChange(of: channelKey, perform: { _ in
|
||||
let tempKey = Data(base64Encoded: channelKey) ?? Data()
|
||||
if tempKey.count == channelKeySize || channelKeySize == -1{
|
||||
hasValidKey = true
|
||||
}
|
||||
else {
|
||||
hasValidKey = false
|
||||
}
|
||||
hasChanges = true
|
||||
})
|
||||
.disabled(channelKeySize <= 0)
|
||||
Text(channelKey)
|
||||
.foregroundColor(Color.gray)
|
||||
.textSelection(.enabled)
|
||||
// TextField(
|
||||
// "",
|
||||
// text: $channelKey,
|
||||
// axis: .vertical
|
||||
// )
|
||||
// .foregroundColor(Color.gray)
|
||||
// .disabled(true)
|
||||
}
|
||||
Picker("Channel Role", selection: $channelRole) {
|
||||
if channelRole == 1 {
|
||||
|
|
@ -275,7 +256,7 @@ struct Channels: View {
|
|||
} label: {
|
||||
Label("save", systemImage: "square.and.arrow.down")
|
||||
}
|
||||
.disabled(bleManager.connectedPeripheral == nil || !hasChanges || !hasValidKey)
|
||||
.disabled(bleManager.connectedPeripheral == nil || !hasChanges)
|
||||
.buttonStyle(.bordered)
|
||||
.buttonBorderShape(.capsule)
|
||||
.controlSize(.large)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue