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