mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: move ignoreIncoming logic to ViewModel
This commit is contained in:
parent
417523967e
commit
a980441fd1
2 changed files with 22 additions and 47 deletions
|
|
@ -505,14 +505,21 @@ class UIViewModel @Inject constructor(
|
|||
updateLoraConfig { it.copy { region = value } }
|
||||
}
|
||||
|
||||
var ignoreIncomingList: MutableList<Int>
|
||||
get() = config.lora.ignoreIncomingList
|
||||
set(value) = updateLoraConfig {
|
||||
it.copy {
|
||||
ignoreIncoming.clear()
|
||||
ignoreIncoming.addAll(value)
|
||||
fun ignoreNode(nodeNum: Int) = updateLoraConfig {
|
||||
it.copy {
|
||||
val list = ignoreIncoming.toMutableList().apply {
|
||||
if (contains(nodeNum)) {
|
||||
debug("removing node $nodeNum from ignore list")
|
||||
remove(nodeNum)
|
||||
} else {
|
||||
debug("adding node $nodeNum to ignore list")
|
||||
add(nodeNum)
|
||||
}
|
||||
}
|
||||
ignoreIncoming.clear()
|
||||
ignoreIncoming.addAll(list)
|
||||
}
|
||||
}
|
||||
|
||||
// managed mode disables all access to configuration
|
||||
val isManaged: Boolean get() = config.device.isManaged || config.security.isManaged
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue