From d0d78520daceb068174a4d8c303e9cd8d9723d86 Mon Sep 17 00:00:00 2001 From: Mygod Date: Wed, 14 Mar 2018 21:48:26 -0700 Subject: [PATCH] Fix showing notification with null device name --- .../main/java/be/mygod/vpnhotspot/RepeaterService.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt index 29ab412f..6f637f12 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt @@ -272,13 +272,16 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, VpnMonitor.Ca * startService 3rd stop (if a group isn't already available), also called when connection changed */ private fun onP2pConnectionChanged(info: WifiP2pInfo, net: NetworkInfo?, group: WifiP2pGroup) { - if (routing == null) onGroupCreated(info, group) else if (!group.isGroupOwner) { // P2P shutdown - clean() - return + when { + routing == null -> onGroupCreated(info, group) + group.isGroupOwner -> showNotification(group) + else -> { // P2P shutdown + clean() + return + } } this.group = group binder.data?.onGroupChanged(group) - showNotification(group) debugLog(TAG, "P2P connection changed: $info\n$net\n$group") } private fun onGroupCreated(info: WifiP2pInfo, group: WifiP2pGroup) {