summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-11-20 15:27:10 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-12-04 12:55:02 +0000
commit90e6841ade11408fdb4753b0f61db6fe491cc24d (patch)
tree62238233759f4770fd5c2483325610609625405e
parentaabf51c5d161cf02de1082451ce251a6490d3654 (diff)
downloadmullvadvpn-90e6841ade11408fdb4753b0f61db6fe491cc24d.tar.xz
mullvadvpn-90e6841ade11408fdb4753b0f61db6fe491cc24d.zip
Try to fetch location when connectivity returns
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt8
1 files changed, 8 insertions, 0 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt
index a749e036ef..9c9e339541 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt
@@ -23,6 +23,14 @@ class LocationInfoCache(
private var lastKnownRealLocation: GeoIpLocation? = null
private var activeFetch: Job? = null
+ private val connectivityListenerId = GlobalScope.async(Dispatchers.Default) {
+ connectivityListener.await().connectivityNotifier.subscribe { isConnected ->
+ if (isConnected) {
+ fetchLocation()
+ }
+ }
+ }
+
var onNewLocation: ((GeoIpLocation?) -> Unit)? = null
set(value) {
field = value