diff options
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt | 2 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt index a12b7c5f94..83c62cd5f3 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt @@ -243,8 +243,6 @@ class MullvadVpnService : TalpidVpnService() { handlePendingAction(settings) - endpoint.locationInfoCache.stateEvents = connectionProxy.onStateChange - if (state == State.Running) { instance = ServiceInstance( endpoint.messenger, 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 2f118ede6d..df769abad9 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 @@ -20,7 +20,6 @@ import net.mullvad.mullvadvpn.model.RelaySettings import net.mullvad.mullvadvpn.model.TunnelState import net.mullvad.mullvadvpn.util.ExponentialBackoff import net.mullvad.talpid.tunnel.ActionAfterDisconnect -import net.mullvad.talpid.util.autoSubscribable class LocationInfoCache(private val endpoint: ServiceEndpoint) { companion object { @@ -70,11 +69,11 @@ class LocationInfoCache(private val endpoint: ServiceEndpoint) { } } - var stateEvents by autoSubscribable<TunnelState>(this, TunnelState.Disconnected) { newState -> - state = newState - } - init { + endpoint.connectionProxy.onStateChange.subscribe(this) { newState -> + state = newState + } + endpoint.connectivityListener.connectivityNotifier.subscribe(this) { isConnected -> if (isConnected && state is TunnelState.Disconnected) { fetchRequestChannel.sendBlocking(RequestFetch.ForRealLocation) @@ -85,9 +84,9 @@ class LocationInfoCache(private val endpoint: ServiceEndpoint) { } fun onDestroy() { + endpoint.connectionProxy.onStateChange.unsubscribe(this) endpoint.connectivityListener.connectivityNotifier.unsubscribe(this) endpoint.settingsListener.relaySettingsNotifier.unsubscribe(this) - stateEvents = null fetchRequestChannel.close() } |
