admin channel not case-sensitive

pull/500/head
andrekir 2022-10-16 12:36:21 -03:00
rodzic f310bb2019
commit d29c86ee74
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -383,7 +383,8 @@ class UIViewModel @Inject constructor(
} }
} }
val adminChannelIndex: Int get() = channelSet.settingsList.map { it.name }.indexOf("admin") val adminChannelIndex: Int
get() = channelSet.settingsList.map { it.name.lowercase() }.indexOf("admin")
fun requestShutdown(idNum: Int) { fun requestShutdown(idNum: Int) {
try { try {

Wyświetl plik

@ -930,7 +930,7 @@ class MeshService : Service(), Logging {
} }
private fun addChannelSettings(ch: ChannelProtos.Channel) { private fun addChannelSettings(ch: ChannelProtos.Channel) {
if (ch.index == 0 || ch.settings.name == "admin") adminChannelIndex = ch.index if (ch.index == 0 || ch.settings.name.lowercase() == "admin") adminChannelIndex = ch.index
serviceScope.handledLaunch { serviceScope.handledLaunch {
channelSetRepository.addSettings(ch) channelSetRepository.addSettings(ch)
} }
@ -1354,7 +1354,7 @@ class MeshService : Service(), Logging {
} }
private fun setChannel(ch: ChannelProtos.Channel) { private fun setChannel(ch: ChannelProtos.Channel) {
if (ch.index == 0 || ch.settings.name == "admin") adminChannelIndex = ch.index if (ch.index == 0 || ch.settings.name.lowercase() == "admin") adminChannelIndex = ch.index
sendToRadio(newMeshPacketTo(myNodeNum).buildAdminPacket(wantResponse = true) { sendToRadio(newMeshPacketTo(myNodeNum).buildAdminPacket(wantResponse = true) {
setChannel = ch setChannel = ch
}) })