diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt index daff3e13873d..5af5e4305d70 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt @@ -25,6 +25,7 @@ import net.mullvad.mullvadvpn.lib.payment.model.ProductId import net.mullvad.mullvadvpn.lib.theme.AppTheme import net.mullvad.mullvadvpn.lib.theme.color.AlphaDescription import net.mullvad.mullvadvpn.util.getActivity +import net.mullvad.mullvadvpn.viewmodel.PaymentUiSideEffect import net.mullvad.mullvadvpn.viewmodel.PaymentViewModel import org.koin.androidx.compose.koinViewModel @@ -125,7 +126,11 @@ fun Payment(productId: ProductId, resultBackNavigator: ResultBackNavigator() val state by vm.uiState.collectAsStateWithLifecycle() - LaunchedEffectCollect(vm.uiSideEffect) { resultBackNavigator.navigateBack(result = false) } + LaunchedEffectCollect(vm.uiSideEffect) { sideEffect -> + when (sideEffect) { + PaymentUiSideEffect.PaymentCancelled -> resultBackNavigator.navigateBack(result = false) + } + } val context = LocalContext.current LaunchedEffect(Unit) { vm.startBillingPayment(productId) { context.getActivity()!! } }