@@ -25,6 +25,7 @@ import androidx.compose.runtime.getValue
2525import androidx.compose.runtime.mutableStateOf
2626import androidx.compose.runtime.remember
2727import androidx.compose.runtime.rememberCoroutineScope
28+ import androidx.compose.runtime.rememberUpdatedState
2829import androidx.compose.runtime.saveable.rememberSaveable
2930import androidx.compose.runtime.setValue
3031import androidx.compose.ui.Alignment
@@ -95,9 +96,9 @@ fun SendConfirmScreen(
9596 onNavigateToPin : () -> Unit ,
9697) {
9798 val scope = rememberCoroutineScope()
98- // TODO handle loading via uiState?
9999 var isLoading by rememberSaveable { mutableStateOf(false ) }
100100 var showBiometrics by remember { mutableStateOf(false ) }
101+ val currentOnEvent by rememberUpdatedState(onEvent)
101102
102103 val settings = settingsViewModel ? : return
103104 val isPinEnabled by settings.isPinEnabled.collectAsStateWithLifecycle()
@@ -115,18 +116,22 @@ fun SendConfirmScreen(
115116 }
116117 }
117118
118- // Handle pay confirm with auth check if needed
119+ // Confirm with pin or bio if required
119120 LaunchedEffect (uiState.shouldConfirmPay) {
120- if (uiState.shouldConfirmPay) {
121- if (isPinEnabled && pinForPayments) {
122- if (isBiometricEnabled && isBiometrySupported) {
123- showBiometrics = true
124- } else {
125- onNavigateToPin()
126- }
121+ if (! uiState.shouldConfirmPay) {
122+ isLoading = false
123+ return @LaunchedEffect
124+ }
125+
126+ if (isPinEnabled && pinForPayments) {
127+ currentOnEvent(SendEvent .ClearPayConfirmation )
128+ if (isBiometricEnabled && isBiometrySupported) {
129+ showBiometrics = true
127130 } else {
128- onEvent( SendEvent . PayConfirmed )
131+ onNavigateToPin( )
129132 }
133+ } else {
134+ currentOnEvent(SendEvent .PayConfirmed )
130135 }
131136 }
132137
0 commit comments