Fix / prevent cancel when in conclusion fragment

This commit is contained in:
Valere 2020-03-26 14:09:41 +01:00
parent 1de57bbf3b
commit acd90657c7
1 changed files with 9 additions and 4 deletions

View File

@ -142,17 +142,22 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
args: VerificationBottomSheet.VerificationArgs): VerificationBottomSheetViewModel
}
fun queryCancel() = withState {
if (it.userThinkItsNotHim) {
fun queryCancel() = withState { state ->
if (state.userThinkItsNotHim) {
setState {
copy(userThinkItsNotHim = false)
}
} else {
// if the verification is already done you can't cancel anymore
if (state.pendingRequest.invoke()?.cancelConclusion != null || state.sasTransactionState is VerificationTxState.TerminalTxState) {
// you cannot cancel anymore
} else {
setState {
copy(userWantsToCancel = true)
}
}
}
}
fun confirmCancel() = withState { state ->
cancelAllPendingVerifications(state)