summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2022-11-30 13:34:01 +0100
committerAlbin <albin@mullvad.net>2022-12-01 08:05:34 +0100
commit2214e8dff957539b193f9c7c6373d05dc2b9eef9 (patch)
treeffb30a70931bb53aa3ef269c726f3cc6fadea56b
parentec41ff7423de7338e95923304d0e0cdc44fa816b (diff)
downloadmullvadvpn-2214e8dff957539b193f9c7c6373d05dc2b9eef9.tar.xz
mullvadvpn-2214e8dff957539b193f9c7c6373d05dc2b9eef9.zip
Remove connect view expiry check scheduling
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt31
1 files changed, 0 insertions, 31 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt
index ea048c4802..5dc832eaa1 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt
@@ -12,7 +12,6 @@ import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.awaitClose
-import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.collect
@@ -20,7 +19,6 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.emptyFlow
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
-import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.shareIn
import kotlinx.coroutines.launch
import net.mullvad.mullvadvpn.R
@@ -45,7 +43,6 @@ import net.mullvad.mullvadvpn.util.appVersionCallbackFlow
import net.mullvad.mullvadvpn.util.callbackFlowFromNotifier
import net.mullvad.mullvadvpn.viewmodel.ConnectViewModel
import net.mullvad.talpid.tunnel.ErrorStateCause
-import org.joda.time.DateTime
import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.viewModel
@@ -146,7 +143,6 @@ class ConnectFragment : BaseFragment(), NavigationBarPainter {
private fun CoroutineScope.launchUiSubscriptionsOnResume() = launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
- launchScheduledExpiryCheck()
launchLocationSubscription()
launchRelayLocationSubscription()
launchTunnelStateSubscription()
@@ -156,17 +152,6 @@ class ConnectFragment : BaseFragment(), NavigationBarPainter {
}
}
- private fun CoroutineScope.launchScheduledExpiryCheck() = launch {
- accountRepository.accountExpiryState
- .map { state -> state.date() }
- .collect { expiryDate ->
- if (expiryDate?.isBeforeNow == true) {
- openOutOfTimeScreen()
- } else if (expiryDate != null)
- scheduleNextAccountExpiryCheck(expiryDate)
- }
- }
-
private fun CoroutineScope.launchLocationSubscription() = launch {
shared
.flatMapLatest { it.locationInfoCache.locationCallbackFlow() }
@@ -265,22 +250,6 @@ class ConnectFragment : BaseFragment(), NavigationBarPainter {
}
}
- private fun scheduleNextAccountExpiryCheck(expiration: DateTime) {
- jobTracker.newBackgroundJob("refetchAccountExpiry") {
- val millisUntilExpiration = expiration.millis - DateTime.now().millis
-
- delay(millisUntilExpiration)
- accountRepository.fetchAccountExpiry()
-
- // If the account ran out of time but is still connected, fetching the expiry again will
- // fail. Therefore, after a timeout of 5 seconds the app will assume the account time
- // really expired and move to the out of time screen. However, if fetching the expiry
- // succeeds, this job is cancelled and replaced with a new scheduled check.
- delay(5_000)
- openOutOfTimeScreen()
- }
- }
-
private fun TunnelState.isTunnelErrorStateDueToExpiredAccount(): Boolean {
return ((this as? TunnelState.Error)?.errorState?.cause as? ErrorStateCause.AuthFailed)
?.isCausedByExpiredAccount() ?: false