summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2021-01-07 17:43:36 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2021-04-16 16:06:00 +0000
commitae5dcf72024b1af7413d7cdf97499d247ff4e60c (patch)
treebfab975e9766718495153e7ad726ade79c76cfd5 /android
parent0e40d87c7fd7e5e8998df9a7d3ff7151a47f5afb (diff)
downloadmullvadvpn-ae5dcf72024b1af7413d7cdf97499d247ff4e60c.tar.xz
mullvadvpn-ae5dcf72024b1af7413d7cdf97499d247ff4e60c.zip
Send relay list update messages
Diffstat (limited to 'android')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ipc/Event.kt4
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/RelayListListener.kt6
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt3
3 files changed, 12 insertions, 1 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 c9a039be70..28f180ac04 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ipc/Event.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ipc/Event.kt
@@ -6,6 +6,7 @@ import net.mullvad.mullvadvpn.model.AppVersionInfo as AppVersionInfoData
import net.mullvad.mullvadvpn.model.GeoIpLocation
import net.mullvad.mullvadvpn.model.KeygenEvent
import net.mullvad.mullvadvpn.model.LoginStatus as LoginStatusData
+import net.mullvad.mullvadvpn.model.RelayList
import net.mullvad.mullvadvpn.model.Settings
import net.mullvad.mullvadvpn.model.TunnelState
@@ -32,6 +33,9 @@ sealed class Event : Message.EventMessage() {
data class NewLocation(val location: GeoIpLocation?) : Event()
@Parcelize
+ data class NewRelayList(val relayList: RelayList?) : Event()
+
+ @Parcelize
data class SettingsUpdate(val settings: Settings?) : Event()
@Parcelize
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/RelayListListener.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/RelayListListener.kt
index 866ffe46c8..bb5434e3e7 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/RelayListListener.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/RelayListListener.kt
@@ -1,12 +1,16 @@
package net.mullvad.mullvadvpn.service.endpoint
+import kotlin.properties.Delegates.observable
+import net.mullvad.mullvadvpn.ipc.Event
import net.mullvad.mullvadvpn.model.RelayList
import net.mullvad.mullvadvpn.service.MullvadDaemon
class RelayListListener(endpoint: ServiceEndpoint) {
val daemon = endpoint.intermittentDaemon
- var relayList: RelayList? = null
+ var relayList by observable<RelayList?>(null) { _, _, relays ->
+ endpoint.sendEvent(Event.NewRelayList(relays))
+ }
private set
init {
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 4a753bc01d..da0926034b 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
@@ -44,6 +44,7 @@ class ServiceEndpoint(
val customDns = CustomDns(this)
val keyStatusListener = KeyStatusListener(this)
val locationInfoCache = LocationInfoCache(this)
+ val relayListListener = RelayListListener(this)
val splitTunneling = SplitTunneling(SplitTunnelingPersistence(context), this)
init {
@@ -62,6 +63,7 @@ class ServiceEndpoint(
customDns.onDestroy()
keyStatusListener.onDestroy()
locationInfoCache.onDestroy()
+ relayListListener.onDestroy()
settingsListener.onDestroy()
splitTunneling.onDestroy()
}
@@ -113,6 +115,7 @@ class ServiceEndpoint(
Event.SplitTunnelingUpdate(splitTunneling.onChange.latestEvent),
Event.CurrentVersion(appVersionInfoCache.currentVersion),
Event.AppVersionInfo(appVersionInfoCache.appVersionInfo),
+ Event.NewRelayList(relayListListener.relayList),
Event.ListenerReady
)