Updated on 2026-08-14
This commit is contained in:
parent
44509cd614
commit
451fb80c83
4 changed files with 19 additions and 16 deletions
|
|
@ -36,18 +36,16 @@ sealed class GlobalAction : Action {
|
|||
sealed class Onboarding : GlobalAction() {
|
||||
/**
|
||||
* Initiate an onboarding process.
|
||||
* For SaltPay cards it's additionally checks for unfinished backup.
|
||||
* For resuming unfinished backup for standard Wallet cards see CheckForUnfinishedBackup and
|
||||
* StartForUnfinishedBackup
|
||||
* For resuming unfinished backup of standard Wallet and SaltPay cards see
|
||||
* BackupAction.CheckForUnfinishedBackup, GlobalAction.Onboarding.StartForUnfinishedBackup
|
||||
*/
|
||||
data class Start(val scanResponse: ScanResponse, val canSkipBackup: Boolean = true) : Onboarding()
|
||||
|
||||
/**
|
||||
* Initiate resuming of unfinished backup only for standard Wallet cards.
|
||||
* For SaltPay cards unfinished backup resumed after scanning the card on HomeScreen through Onboarding.Start.
|
||||
* See more Onboarding.Start, CheckForUnfinishedBackup
|
||||
* Initiate resuming of unfinished backup for standard Wallet and SaltPay cards.
|
||||
* See more BackupAction.CheckForUnfinishedBackup
|
||||
*/
|
||||
object StartForUnfinishedBackup : Onboarding()
|
||||
data class StartForUnfinishedBackup(val isSaltPayVisa: Boolean) : Onboarding()
|
||||
object Stop : Onboarding()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,8 @@ sealed class BackupAction : Action {
|
|||
object ScanPrimaryCard : BackupAction()
|
||||
|
||||
/**
|
||||
* Check for unfinished backup of standard Wallet cards.
|
||||
* For SaltPay cards unfinished backup resumed after scanning the card on HomeScreen through Onboarding.Start.
|
||||
* See more Onboarding.Start, CheckForUnfinishedBackup, StartForUnfinishedBackup
|
||||
* Check for unfinished backup of standard Wallets and SaltPay cards
|
||||
* See more GlobalAction.Onboarding.StartForUnfinishedBackup
|
||||
*/
|
||||
object CheckForUnfinishedBackup : BackupAction()
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ private fun handleWalletAction(action: Action, state: () -> AppState?, dispatch:
|
|||
}
|
||||
when {
|
||||
card == null -> {
|
||||
// it's possible when found unfinished backup for standard Wallet cards
|
||||
// it's possible when found unfinished backup
|
||||
store.dispatch(OnboardingWalletAction.ResumeBackup)
|
||||
}
|
||||
card.wallets.isNotEmpty() && card.backupStatus == CardDTO.BackupStatus.NoBackup -> {
|
||||
|
|
@ -342,12 +342,16 @@ private fun handleBackupAction(appState: () -> AppState?, action: BackupAction)
|
|||
backupService.discardSavedBackup()
|
||||
}
|
||||
is BackupAction.CheckForUnfinishedBackup -> {
|
||||
if (backupService.hasIncompletedBackup && !backupService.primaryCardIsSaltPayVisa()) {
|
||||
if (backupService.hasIncompletedBackup) {
|
||||
store.dispatch(GlobalAction.ShowDialog(BackupDialog.UnfinishedBackupFound))
|
||||
}
|
||||
}
|
||||
is BackupAction.ResumeFoundUnfinishedBackup -> {
|
||||
store.dispatch(GlobalAction.Onboarding.StartForUnfinishedBackup)
|
||||
store.dispatch(
|
||||
GlobalAction.Onboarding.StartForUnfinishedBackup(
|
||||
isSaltPayVisa = backupService.primaryCardIsSaltPayVisa(),
|
||||
),
|
||||
)
|
||||
store.dispatch(NavigationAction.NavigateTo(AppScreen.OnboardingWallet))
|
||||
}
|
||||
is BackupAction.DismissBackup -> {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ private class ReducerForGlobalAction {
|
|||
is GlobalAction.Onboarding.Start -> {
|
||||
OnboardingWalletState(
|
||||
backupState = state.backupState.copy(
|
||||
maxBackupCards = if (action.scanResponse.isSaltPay()) 1 else 2,
|
||||
maxBackupCards = maxBackupCards(action.scanResponse.isSaltPay()),
|
||||
canSkipBackup = if (action.scanResponse.isSaltPay()) false else action.canSkipBackup,
|
||||
),
|
||||
isSaltPay = action.scanResponse.isSaltPay(),
|
||||
|
|
@ -52,15 +52,17 @@ private class ReducerForGlobalAction {
|
|||
is GlobalAction.Onboarding.StartForUnfinishedBackup -> {
|
||||
OnboardingWalletState(
|
||||
backupState = state.backupState.copy(
|
||||
maxBackupCards = 2,
|
||||
maxBackupCards = maxBackupCards(action.isSaltPayVisa),
|
||||
canSkipBackup = false,
|
||||
),
|
||||
isSaltPay = false,
|
||||
isSaltPay = action.isSaltPayVisa,
|
||||
)
|
||||
}
|
||||
else -> state
|
||||
}
|
||||
}
|
||||
|
||||
private fun maxBackupCards(isSaltPay: Boolean): Int = if (isSaltPay) 1 else 2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue