summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ipc/Event.kt3
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt10
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
)