summaryrefslogtreecommitdiffhomepage
path: root/android/app/src
diff options
context:
space:
mode:
authorJonatan Rhodin <jonatan.rhodin@mullvad.net>2023-11-17 20:09:19 +0100
committerJonatan Rhodin <jonatan.rhodin@mullvad.net>2023-11-21 16:42:44 +0100
commit657f1c3c4dc5b3ed3eeb113eb27285e4d0c991ee (patch)
treeee33a84e1a31e449b78c5b42fc686af57fa64c88 /android/app/src
parente98cececf47881900ffae5990260458c02cc4d76 (diff)
downloadmullvadvpn-657f1c3c4dc5b3ed3eeb113eb27285e4d0c991ee.tar.xz
mullvadvpn-657f1c3c4dc5b3ed3eeb113eb27285e4d0c991ee.zip
Fix issue with the welcome screen showing up after buying time
Diffstat (limited to 'android/app/src')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/AccountRepository.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt6
-rw-r--r--android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt2
3 files changed, 8 insertions, 2 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/AccountRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/AccountRepository.kt
index eb618ea0f8..1d2a9ca818 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/AccountRepository.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/AccountRepository.kt
@@ -91,7 +91,7 @@ class AccountRepository(
messageHandler.trySendRequest(Request.ClearAccountHistory)
}
- private fun clearCreatedAccountCache() {
+ fun clearCreatedAccountCache() {
_cachedCreatedAccount.value = null
}
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt
index 9f6cec8391..89b83d9f11 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt
@@ -133,6 +133,12 @@ class ConnectViewModel(
.debounce(UI_STATE_DEBOUNCE_DURATION_MILLIS)
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), ConnectUiState.INITIAL)
+ init {
+ // The create account cache is no longer needed as we have successfully reached the connect
+ // screen
+ accountRepository.clearCreatedAccountCache()
+ }
+
private fun LocationInfoCache.locationCallbackFlow() = callbackFlow {
onNewLocation = { this.trySend(it) }
awaitClose { onNewLocation = null }
diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt
index 1b2e262b3d..f6157431db 100644
--- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt
+++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt
@@ -78,7 +78,7 @@ class ConnectViewModelTest {
private val mockLocation: GeoIpLocation = mockk(relaxed = true)
// Account Repository
- private val mockAccountRepository: AccountRepository = mockk()
+ private val mockAccountRepository: AccountRepository = mockk(relaxed = true)
// Device Repository
private val mockDeviceRepository: DeviceRepository = mockk()