mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Fix add qr acting like replace instead of add (#3823)
Co-authored-by: Dane <dane@goneepic.com>
This commit is contained in:
parent
13452edba6
commit
7fd1f19e18
1 changed files with 14 additions and 4 deletions
|
|
@ -115,10 +115,20 @@ fun ScannedQrCodeDialog(
|
|||
remember(channelSet) { mutableStateListOf(elements = Array(size = channelSet.settingsCount, init = { true })) }
|
||||
|
||||
val selectedChannelSet =
|
||||
channelSet.copy {
|
||||
val result = settings.filterIndexed { i, _ -> channelSelections.getOrNull(i) == true }
|
||||
settings.clear()
|
||||
settings.addAll(result)
|
||||
if (shouldReplace) {
|
||||
channelSet.copy {
|
||||
val result = settings.filterIndexed { i, _ -> channelSelections.getOrNull(i) == true }
|
||||
settings.clear()
|
||||
settings.addAll(result)
|
||||
}
|
||||
} else {
|
||||
channelSet.copy {
|
||||
// When adding (not replacing), include all previous channels + selected new channels
|
||||
val selectedNewChannels =
|
||||
incoming.settingsList.filterIndexed { i, _ -> channelSelections.getOrNull(i) == true }
|
||||
settings.clear()
|
||||
settings.addAll(channels.settingsList + selectedNewChannels)
|
||||
}
|
||||
}
|
||||
|
||||
// Compute LoRa configuration changes when in replace mode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue