mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Firmware pop up and channel button fixes
This commit is contained in:
parent
209b51b7ee
commit
3b6f7fdbee
2 changed files with 42 additions and 42 deletions
|
|
@ -377,12 +377,14 @@ struct Connect: View {
|
|||
} catch {
|
||||
Logger.data.error("💥 Error fetching node info: \(error.localizedDescription, privacy: .public)")
|
||||
}
|
||||
// Check firmware version on connection
|
||||
// Check firmware version on connection (only if version is known)
|
||||
if let firmwareVersion = accessoryManager.activeConnection?.device.firmwareVersion, firmwareVersion != "?.?.?" && !firmwareVersion.isEmpty {
|
||||
let meetsMinimumVersion = accessoryManager.checkIsVersionSupported(forVersion: accessoryManager.minimumVersion)
|
||||
let meetsSecurityVersion = accessoryManager.checkIsVersionSupported(forVersion: accessoryManager.securityVersion)
|
||||
invalidFirmwareVersion = !meetsMinimumVersion
|
||||
showSecurityVersionNag = meetsMinimumVersion && !meetsSecurityVersion
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if !targetEnvironment(macCatalyst)
|
||||
|
|
|
|||
|
|
@ -145,6 +145,45 @@ struct Channels: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
if node.myInfo?.channels?.array.count ?? 0 < 8 {
|
||||
Button {
|
||||
let channelIndexes = node.myInfo?.channels?.compactMap({(ch) -> Int in
|
||||
return (ch as AnyObject).index
|
||||
})
|
||||
let firstChannelIndex = firstMissingChannelIndex(channelIndexes ?? [])
|
||||
channelKeySize = 16
|
||||
let key = generateChannelKey(size: channelKeySize)
|
||||
channelName = ""
|
||||
channelIndex = Int32(firstChannelIndex)
|
||||
channelRole = 2
|
||||
channelKey = key
|
||||
positionsEnabled = false
|
||||
preciseLocation = false
|
||||
positionPrecision = 0
|
||||
uplink = false
|
||||
downlink = false
|
||||
|
||||
let newChannel = ChannelEntity(context: context)
|
||||
newChannel.id = channelIndex
|
||||
newChannel.index = channelIndex
|
||||
newChannel.uplinkEnabled = uplink
|
||||
newChannel.downlinkEnabled = downlink
|
||||
newChannel.name = channelName
|
||||
newChannel.role = Int32(channelRole)
|
||||
newChannel.psk = Data(base64Encoded: channelKey) ?? Data()
|
||||
newChannel.positionPrecision = Int32(positionPrecision)
|
||||
selectedChannel = newChannel
|
||||
hasChanges = true
|
||||
|
||||
} label: {
|
||||
Label("Add Channel", systemImage: "plus.square")
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.buttonBorderShape(.capsule)
|
||||
.controlSize(.large)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
}
|
||||
.sheet(item: $selectedChannel) { _ in
|
||||
#if targetEnvironment(macCatalyst)
|
||||
|
|
@ -246,45 +285,6 @@ struct Channels: View {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
if node.myInfo?.channels?.array.count ?? 0 < 8 {
|
||||
|
||||
Button {
|
||||
let channelIndexes = node.myInfo?.channels?.compactMap({(ch) -> Int in
|
||||
return (ch as AnyObject).index
|
||||
})
|
||||
let firstChannelIndex = firstMissingChannelIndex(channelIndexes ?? [])
|
||||
channelKeySize = 16
|
||||
let key = generateChannelKey(size: channelKeySize)
|
||||
channelName = ""
|
||||
channelIndex = Int32(firstChannelIndex)
|
||||
channelRole = 2
|
||||
channelKey = key
|
||||
positionsEnabled = false
|
||||
preciseLocation = false
|
||||
positionPrecision = 0
|
||||
uplink = false
|
||||
downlink = false
|
||||
|
||||
let newChannel = ChannelEntity(context: context)
|
||||
newChannel.id = channelIndex
|
||||
newChannel.index = channelIndex
|
||||
newChannel.uplinkEnabled = uplink
|
||||
newChannel.downlinkEnabled = downlink
|
||||
newChannel.name = channelName
|
||||
newChannel.role = Int32(channelRole)
|
||||
newChannel.psk = Data(base64Encoded: channelKey) ?? Data()
|
||||
newChannel.positionPrecision = Int32(positionPrecision)
|
||||
selectedChannel = newChannel
|
||||
hasChanges = true
|
||||
|
||||
} label: {
|
||||
Label("Add Channel", systemImage: "plus.square")
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.buttonBorderShape(.capsule)
|
||||
.controlSize(.large)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showingHelp) {
|
||||
ChannelsHelp()
|
||||
|
|
@ -301,9 +301,7 @@ struct Channels: View {
|
|||
Image(systemName: !showingHelp ? "questionmark.circle" : "questionmark.circle.fill")
|
||||
.padding(.vertical, 5)
|
||||
}
|
||||
.tint(Color(UIColor.secondarySystemBackground))
|
||||
.foregroundColor(.accentColor)
|
||||
.buttonStyle(.borderedProminent)
|
||||
}
|
||||
.controlSize(.regular)
|
||||
.padding(5)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue