diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-01-25 20:06:34 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-04-16 12:14:04 +0000 |
| commit | 4c612986b5784fdd23f0a0e1ccef2ac6603993ea (patch) | |
| tree | 7b9e1e437d4612793aec0c8d8cf83623fdc3d5cc /android | |
| parent | c56a36f6be4f24b7647866ebd802fcd56e588364 (diff) | |
| download | mullvadvpn-4c612986b5784fdd23f0a0e1ccef2ac6603993ea.tar.xz mullvadvpn-4c612986b5784fdd23f0a0e1ccef2ac6603993ea.zip | |
Send current version through the message channel
Diffstat (limited to 'android')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ipc/Event.kt | 3 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ipc/Event.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ipc/Event.kt index 1211e88d04..9369027b2a 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ipc/Event.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ipc/Event.kt @@ -16,6 +16,9 @@ sealed class Event : Message.EventMessage() { data class AccountHistory(val history: List<String>?) : Event() @Parcelize + data class CurrentVersion(val version: String?) : Event() + + @Parcelize object ListenerReady : Event() @Parcelize 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 0f583d1fc9..f44b045a15 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 @@ -28,6 +28,8 @@ class ServiceEndpoint( private val listeners = mutableSetOf<Messenger>() private val registrationQueue: SendChannel<Messenger> = startRegistrator() + private var version: String? = null + internal val dispatcher = DispatchingHandler(looper) { message -> Request.fromMessage(message) } @@ -49,6 +51,13 @@ class ServiceEndpoint( dispatcher.registerHandler(Request.RegisterListener::class) { request -> registrationQueue.sendBlocking(request.listener) } + + intermittentDaemon.registerListener(this) { newDaemon -> + if (version == null && newDaemon != null) { + version = newDaemon.getCurrentVersion() + sendEvent(Event.CurrentVersion(version)) + } + } } fun onDestroy() { @@ -109,6 +118,7 @@ class ServiceEndpoint( Event.NewLocation(locationInfoCache.location), Event.WireGuardKeyStatus(keyStatusListener.keyStatus), Event.SplitTunnelingUpdate(splitTunneling.onChange.latestEvent), + Event.CurrentVersion(version), Event.ListenerReady ) |
