refactor: remote admin channel validation

pull/908/head
andrekir 2024-03-11 22:27:14 -03:00
rodzic 902d1697a9
commit 5983424d48
2 zmienionych plików z 3 dodań i 4 usunięć

Wyświetl plik

@ -423,9 +423,8 @@ class UIViewModel @Inject constructor(
}
}
val adminChannelIndex: Int /** matches [MeshService.adminChannelIndex] **/
get() = channelSet.settingsList.indexOfFirst { it.name.equals("admin", ignoreCase = true) }
.coerceAtLeast(0)
val hasAdminChannel: Boolean
get() = channelSet.settingsList.any { it.name.equals("admin", ignoreCase = true) }
/**
* Write the persisted packet data out to a CSV file in the specified location.

Wyświetl plik

@ -101,7 +101,7 @@ class UsersFragment : ScreenFragment("Users"), Logging {
if (!model.isConnected()) return
val node = nodes[position]
val user = node.user ?: return
val showAdmin = position == 0 || model.adminChannelIndex > 0
val showAdmin = position == 0 || model.hasAdminChannel
val isIgnored = ignoreIncomingList.contains(node.num)
val popup = PopupMenu(requireContext(), view)
popup.inflate(R.menu.menu_nodes)