diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-12-04 21:59:11 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-03-25 18:19:59 +0000 |
| commit | b8232dd52f5b57e56020de6f980f1e4cbd4259f0 (patch) | |
| tree | 7e27b416dc093f990589d47bcf3268813767d045 /android/src/main | |
| parent | 3b48618bd6ed593e0a2e0777e4a05039b00a6f9a (diff) | |
| download | mullvadvpn-b8232dd52f5b57e56020de6f980f1e4cbd4259f0.tar.xz mullvadvpn-b8232dd52f5b57e56020de6f980f1e4cbd4259f0.zip | |
Send location events from the service
Diffstat (limited to 'android/src/main')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt index ce1edd1b3f..ad35039b16 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt @@ -10,6 +10,7 @@ import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.channels.actor import kotlinx.coroutines.channels.sendBlocking import kotlinx.coroutines.withTimeout +import net.mullvad.mullvadvpn.ipc.Event import net.mullvad.mullvadvpn.model.Constraint import net.mullvad.mullvadvpn.model.GeoIpLocation import net.mullvad.mullvadvpn.model.RelaySettings @@ -34,12 +35,8 @@ class LocationInfoCache(private val endpoint: ServiceEndpoint) { private var lastKnownRealLocation: GeoIpLocation? = null private var selectedRelayLocation: GeoIpLocation? = null - var onNewLocation by observable<((GeoIpLocation?) -> Unit)?>(null) { _, _, callback -> - callback?.invoke(location) - } - var location: GeoIpLocation? by observable(null) { _, _, newLocation -> - onNewLocation?.invoke(newLocation) + endpoint.sendEvent(Event.NewLocation(newLocation)) } var state by observable<TunnelState>(TunnelState.Disconnected) { _, _, newState -> @@ -84,8 +81,6 @@ class LocationInfoCache(private val endpoint: ServiceEndpoint) { stateEvents = null fetchRequestChannel.close() - - onNewLocation = null } private fun runFetcher() = GlobalScope.actor<RequestFetch>( |
