Updated on 2026-08-14
This commit is contained in:
parent
b538cc76e1
commit
dbb8ab5d50
11 changed files with 133 additions and 53 deletions
|
|
@ -302,21 +302,27 @@ internal class WalletViewModel @Inject constructor(
|
|||
)
|
||||
|
||||
/*
|
||||
* If card is reset to factory settings, then Compose need some time to draw the WalletScreen.
|
||||
* Otherwise, scroll isn't happened
|
||||
* Should not show scroll animation if WalletScreen isn't in the background.
|
||||
* Example, reset card
|
||||
*/
|
||||
withContext(dispatchers.io) { delay(timeMillis = 1000) }
|
||||
if (screenLifecycleProvider.isBackgroundState.value) {
|
||||
updateStateByDeleteWalletTransformer(action)
|
||||
} else {
|
||||
withContext(dispatchers.io) { delay(timeMillis = 1000) }
|
||||
|
||||
scrollToWallet(
|
||||
index = action.selectedWalletIndex,
|
||||
onConsume = {
|
||||
stateHolder.update(
|
||||
DeleteWalletTransformer(
|
||||
selectedWalletIndex = action.selectedWalletIndex,
|
||||
deletedWalletId = action.deletedWalletId,
|
||||
),
|
||||
)
|
||||
},
|
||||
scrollToWallet(
|
||||
index = action.selectedWalletIndex,
|
||||
onConsume = { updateStateByDeleteWalletTransformer(action) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateStateByDeleteWalletTransformer(action: WalletsUpdateActionResolver.Action.DeleteWallet) {
|
||||
stateHolder.update(
|
||||
DeleteWalletTransformer(
|
||||
selectedWalletIndex = action.selectedWalletIndex,
|
||||
deletedWalletId = action.deletedWalletId,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ internal class WalletsUpdateActionResolver @Inject constructor(
|
|||
|
||||
fun resolve(wallets: List<UserWallet>, currentState: WalletScreenState): Action {
|
||||
val selectedWallet = getSelectedWalletSyncUseCase().getOrElse {
|
||||
error("Unable to find selected wallet: $it")
|
||||
/* Selected user wallet can be null after reset if remaining user wallets is locked */
|
||||
return Action.Unknown
|
||||
}
|
||||
|
||||
val action = if (isFirstInitialization(currentState)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue