admin channel not case-sensitive

This commit is contained in:
andrekir
2022-10-16 12:36:21 -03:00
parent f310bb2019
commit d29c86ee74
2 changed files with 4 additions and 3 deletions

View File

@@ -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) {
try {

View File

@@ -930,7 +930,7 @@ class MeshService : Service(), Logging {
}
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 {
channelSetRepository.addSettings(ch)
}
@@ -1354,7 +1354,7 @@ class MeshService : Service(), Logging {
}
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) {
setChannel = ch
})