summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2021-01-13 20:10:34 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2021-03-31 14:36:30 +0000
commit71a6c78a374abc95fed0f48653770ebaf862907e (patch)
tree0925f8e4e7927981129dc77498abbd835d10b368 /android
parent4dd20a2f2b56ba900ff2915629ef5d18064a8b4a (diff)
downloadmullvadvpn-71a6c78a374abc95fed0f48653770ebaf862907e.tar.xz
mullvadvpn-71a6c78a374abc95fed0f48653770ebaf862907e.zip
Send login status events
Diffstat (limited to 'android')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt5
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt1
2 files changed, 6 insertions, 0 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt
index ec750fbfc5..9c582480b7 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt
@@ -7,6 +7,7 @@ import kotlinx.coroutines.channels.ClosedReceiveChannelException
import kotlinx.coroutines.channels.actor
import kotlinx.coroutines.channels.sendBlocking
import kotlinx.coroutines.delay
+import net.mullvad.mullvadvpn.ipc.Event
import net.mullvad.mullvadvpn.ipc.Request
import net.mullvad.mullvadvpn.model.GetAccountDataResult
import net.mullvad.mullvadvpn.model.LoginStatus
@@ -64,6 +65,10 @@ class AccountCache(private val endpoint: ServiceEndpoint) {
handleNewAccountNumber(accountNumber)
}
+ onLoginStatusChange.subscribe(this) { status ->
+ endpoint.sendEvent(Event.LoginStatus(status))
+ }
+
endpoint.dispatcher.apply {
registerHandler(Request.CreateAccount::class) { _ ->
commandChannel.sendBlocking(Command.CreateAccount)
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt
index aee7d21d39..d95e2cf6ec 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt
@@ -91,6 +91,7 @@ class ServiceEndpoint(
listeners.add(listener)
val initialEvents = listOf(
+ Event.LoginStatus(accountCache.onLoginStatusChange.latestEvent),
Event.SettingsUpdate(settingsListener.settings),
Event.NewLocation(locationInfoCache.location),
Event.WireGuardKeyStatus(keyStatusListener.keyStatus),