Listen for persistent group changes

This commit is contained in:
Mygod
2018-12-21 15:58:52 +08:00
parent 7b8c3f5b73
commit 5281f14e0f
5 changed files with 47 additions and 42 deletions

View File

@@ -30,7 +30,7 @@ class ClientViewModel : ViewModel(), ServiceConnection, IpNeighbourMonitor.Callb
private fun populateClients() {
val clients = HashMap<Pair<String, String>, Client>()
val group = repeater?.service?.group
val group = repeater?.group
val p2pInterface = group?.`interface`
if (p2pInterface != null) {
for (client in p2p) clients[Pair(p2pInterface, client.deviceAddress)] = WifiP2pClient(p2pInterface, client)
@@ -50,7 +50,7 @@ class ClientViewModel : ViewModel(), ServiceConnection, IpNeighbourMonitor.Callb
private fun refreshP2p() {
val repeater = repeater
p2p = (if (repeater?.active != true) null else repeater.service.group?.clientList) ?: emptyList()
p2p = (if (repeater?.active != true) null else repeater.group?.clientList) ?: emptyList()
populateClients()
}