From 8b89cf3612d1c2f11e932302687fb6f1e4a98fa0 Mon Sep 17 00:00:00 2001 From: Jonatan Rhodin Date: Mon, 20 Nov 2023 11:59:10 +0100 Subject: [PATCH] Reset purchase state when automatically leaving a screen --- .../net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModel.kt | 2 ++ .../kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModel.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModel.kt index e570f7a0fe5d..675ca7ef9439 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModel.kt @@ -76,6 +76,8 @@ class OutOfTimeViewModel( val tomorrow = DateTime.now().plusHours(20) if (expiry.isAfter(tomorrow)) { + // Reset purchase state + paymentUseCase.resetPurchaseResult() _uiSideEffect.tryEmit(UiSideEffect.OpenConnectScreen) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModel.kt index b02a1599a4c3..566aa319819f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModel.kt @@ -82,6 +82,8 @@ class WelcomeViewModel( val tomorrow = DateTime.now().plusHours(20) if (expiry.isAfter(tomorrow)) { + // Reset purchase state + paymentUseCase.resetPurchaseResult() _uiSideEffect.tryEmit(UiSideEffect.OpenConnectScreen) } }