summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2022-06-23 11:38:59 +0200
committerAlbin <albin@mullvad.net>2022-06-27 17:21:36 +0200
commit5b9ac64d7cf3eba61612b0433a986bb5a49dc6a3 (patch)
treed23428b4d370278466aba8ee77fc2b64a0133dd5 /android
parent3d49685ca6d6fc51f77dfbf1462db2ef1267af2b (diff)
downloadmullvadvpn-5b9ac64d7cf3eba61612b0433a986bb5a49dc6a3.tar.xz
mullvadvpn-5b9ac64d7cf3eba61612b0433a986bb5a49dc6a3.zip
Fix notification action device state
Diffstat (limited to 'android')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt11
1 files changed, 8 insertions, 3 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt
index b961de947d..0bf7e54606 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt
@@ -8,6 +8,7 @@ import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.actor
import kotlinx.coroutines.channels.sendBlocking
import kotlinx.coroutines.flow.collect
+import kotlinx.coroutines.flow.onStart
import net.mullvad.mullvadvpn.model.DeviceState
import net.mullvad.mullvadvpn.model.TunnelState
import net.mullvad.mullvadvpn.service.endpoint.ConnectionProxy
@@ -55,9 +56,13 @@ class ForegroundNotificationManager(
intermittentDaemon.registerListener(this) { daemon ->
jobTracker.newBackgroundJob("notificationLoggedInJob") {
- daemon?.deviceStateUpdates?.collect { deviceState ->
- loggedIn = deviceState is DeviceState.LoggedIn
- }
+ daemon?.deviceStateUpdates
+ ?.onStart {
+ emit(daemon.getAndEmitDeviceState())
+ }
+ ?.collect { deviceState ->
+ loggedIn = deviceState is DeviceState.LoggedIn
+ }
}
}