Updated on 2026-08-14
This commit is contained in:
parent
be84c35579
commit
d5027aa5f0
3 changed files with 27 additions and 14 deletions
|
|
@ -35,6 +35,10 @@ internal class WalletStateController @Inject constructor() {
|
|||
mutableUiState.update(function = transformer::transform)
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
mutableUiState.update { getInitialState() }
|
||||
}
|
||||
|
||||
fun getSelectedWallet(): WalletState {
|
||||
return with(value) { wallets[selectedWalletIndex] }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,9 +212,9 @@ internal class WalletsUpdateActionResolverV2 @Inject constructor(
|
|||
override fun toString(): String {
|
||||
return """
|
||||
Initialize(
|
||||
selectedWalletIndex=$selectedWalletIndex,
|
||||
selectedWallet=${selectedWallet.walletId},
|
||||
wallets=${wallets.joinToString { it.walletId.toString() }}
|
||||
selectedWalletIndex = $selectedWalletIndex,
|
||||
selectedWallet = ${selectedWallet.walletId},
|
||||
wallets = ${wallets.joinToString { it.walletId.toString() }}
|
||||
)
|
||||
""".trimIndent()
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ internal class WalletsUpdateActionResolverV2 @Inject constructor(
|
|||
data class ReinitializeWallets(val selectedWallet: UserWallet) : Action() {
|
||||
|
||||
override fun toString(): String {
|
||||
return "Reinitialize(selectedWallet=${selectedWallet.walletId})"
|
||||
return "Reinitialize(selectedWallet = ${selectedWallet.walletId})"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -241,14 +241,14 @@ internal class WalletsUpdateActionResolverV2 @Inject constructor(
|
|||
data class ReinitializeWallet(val prevWalletId: UserWalletId, val selectedWallet: UserWallet) : Action() {
|
||||
|
||||
override fun toString(): String {
|
||||
return "ReinitializeWallet(prevWalletId=$prevWalletId, selectedWallet=${selectedWallet.walletId})"
|
||||
return "ReinitializeWallet(prevWalletId = $prevWalletId, selectedWallet = ${selectedWallet.walletId})"
|
||||
}
|
||||
}
|
||||
|
||||
data class UpdateWalletName(val selectedWalletId: UserWalletId, val name: String) : Action() {
|
||||
|
||||
override fun toString(): String {
|
||||
return "UpdateWalletName(selectedWalletId=$selectedWalletId, name=$name)"
|
||||
return "UpdateWalletName(selectedWalletId = $selectedWalletId, name = $name)"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -257,8 +257,8 @@ internal class WalletsUpdateActionResolverV2 @Inject constructor(
|
|||
override fun toString(): String {
|
||||
return """
|
||||
UnlockWallet(
|
||||
selectedWallet=${selectedWallet.walletId},
|
||||
unlockedWallets=${unlockedWallets.joinToString { it.walletId.toString() }}
|
||||
selectedWallet = ${selectedWallet.walletId},
|
||||
unlockedWallets = ${unlockedWallets.joinToString { it.walletId.toString() }}
|
||||
)
|
||||
""".trimIndent()
|
||||
}
|
||||
|
|
@ -273,9 +273,9 @@ internal class WalletsUpdateActionResolverV2 @Inject constructor(
|
|||
override fun toString(): String {
|
||||
return """
|
||||
DeleteWallet(
|
||||
selectedWallet=${selectedWallet.walletId},
|
||||
selectedWalletIndex=$selectedWalletIndex,
|
||||
deletedWalletId=$deletedWalletId
|
||||
selectedWallet = ${selectedWallet.walletId},
|
||||
selectedWalletIndex = $selectedWalletIndex,
|
||||
deletedWalletId = $deletedWalletId
|
||||
)
|
||||
""".trimIndent()
|
||||
}
|
||||
|
|
@ -284,7 +284,12 @@ internal class WalletsUpdateActionResolverV2 @Inject constructor(
|
|||
data class AddWallet(val selectedWalletIndex: Int, val selectedWallet: UserWallet) : Action() {
|
||||
|
||||
override fun toString(): String {
|
||||
return "AddWallet(selectedWalletIndex=$selectedWalletIndex, selectedWallet=${selectedWallet.walletId})"
|
||||
return """
|
||||
AddWallet(
|
||||
selectedWalletIndex = $selectedWalletIndex,
|
||||
selectedWallet = ${selectedWallet.walletId}
|
||||
)
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -296,10 +301,12 @@ internal class WalletsUpdateActionResolverV2 @Inject constructor(
|
|||
data class UpdateWalletCardCount(val selectedWallet: UserWallet) : Action() {
|
||||
|
||||
override fun toString(): String {
|
||||
return "UpdateWalletCardCount(selectedWallet=${selectedWallet.walletId})"
|
||||
return "UpdateWalletCardCount(selectedWallet = ${selectedWallet.walletId})"
|
||||
}
|
||||
}
|
||||
|
||||
object Unknown : Action()
|
||||
object Unknown : Action() {
|
||||
override fun toString(): String = "Unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +64,8 @@ internal class WalletCardClickIntentsImplementor @Inject constructor(
|
|||
val unlockedWallet = wallets.count { it !is WalletCardState.LockedContent }
|
||||
|
||||
if (unlockedWallet == 1) {
|
||||
stateHolder.clear()
|
||||
|
||||
router.popBackStack(
|
||||
screen = if (wallets.size > 1) AppScreen.Welcome else AppScreen.Home,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue