Merge remote-tracking branch 'refs/remotes/origin/main'

This commit is contained in:
Garth Vander Houwen 2024-07-07 10:02:24 -07:00
commit ea677b4cee
4 changed files with 43 additions and 6 deletions

View file

@ -20839,7 +20839,7 @@
"There has been no response to a request for device metadata over the admin channel for this node." : {
},
"These settings will %@ channels. The current LoRa Config will be replaced. After everything saves your device will reboot." : {
"These settings will %@ channels. The current LoRa Config will be replaced, if there are substantial changes to the LoRa config the device will reboot" : {
},
"Thirty Minutes" : {

View file

@ -172,7 +172,8 @@ struct Channels: View {
return
}
if mutableChannels.contains(selectedChannel as Any) {
mutableChannels.replaceObject(at: Int(channel.index), with: selectedChannel as Any)
let replaceChannel = mutableChannels.first(where: { selectedChannel?.psk == ($0 as AnyObject).psk && selectedChannel?.name == ($0 as AnyObject).name})
mutableChannels.replaceObject(at: mutableChannels.index(of: replaceChannel as Any), with: selectedChannel as Any)
} else {
mutableChannels.add(selectedChannel as Any)
}

View file

@ -20,7 +20,7 @@ struct SaveChannelQRCode: View {
VStack {
Text("\(addChannels ? "Add" : "Replace all") Channels?")
.font(.title)
Text("These settings will \(addChannels ? "add" : "replace all") channels. The current LoRa Config will be replaced. After everything saves your device will reboot.")
Text("These settings will \(addChannels ? "add" : "replace all") channels. The current LoRa Config will be replaced, if there are substantial changes to the LoRa config the device will reboot")
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(.gray)
.font(.title3)

View file

@ -270,9 +270,45 @@ struct ShareChannels: View {
loRaConfig.ignoreMqtt = node?.loRaConfig?.ignoreMqtt ?? false
channelSet.loraConfig = loRaConfig
if node?.myInfo?.channels != nil && node?.myInfo?.channels?.count ?? 0 > 0 {
for ch in node?.myInfo?.channels?.array as? [ChannelEntity] ?? [] {
if ch.role > 0, ch.index == 0 && includeChannel0 || ch.index == 1 && includeChannel1 || ch.index == 2 && includeChannel2 || ch.index == 3 && includeChannel3 ||
ch.index == 4 && includeChannel4 || ch.index == 5 && includeChannel5 || ch.index == 6 && includeChannel6 || ch.index == 7 && includeChannel7 {
for ch in node?.myInfo?.channels?.array as? [ChannelEntity] ?? [] where ch.role > 0 {
var includeChannel = false
switch ch.index {
case 0:
if includeChannel0 {
includeChannel = true
}
case 1:
if includeChannel1 {
includeChannel = true
}
case 2:
if includeChannel2 {
includeChannel = true
}
case 3:
if includeChannel3 {
includeChannel = true
}
case 4:
if includeChannel4 {
includeChannel = true
}
case 5:
if includeChannel5 {
includeChannel = true
}
case 6:
if includeChannel6 {
includeChannel = true
}
case 7:
if includeChannel7 {
includeChannel = true
}
default:
includeChannel = false
}
if includeChannel {
var channelSettings = ChannelSettings()
channelSettings.name = ch.name!
channelSettings.psk = ch.psk!