Skip to content

Commit

Permalink
Fixed thing
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed May 25, 2024
1 parent 5182760 commit 2f79afd
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -125,7 +126,11 @@ fun Payment(productId: ProductId, resultBackNavigator: ResultBackNavigator<Boole
val vm = koinViewModel<PaymentViewModel>()
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()!! } }
Expand Down

0 comments on commit 2f79afd

Please sign in to comment.