Updated on 2026-08-14
This commit is contained in:
parent
1d8463c950
commit
0980f8464c
2 changed files with 20 additions and 16 deletions
|
|
@ -56,6 +56,7 @@ private const val HALF_OF_ITEM_WIDTH = 0.5
|
|||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
internal fun WalletCard(state: WalletCardState, isBalanceHidden: Boolean, modifier: Modifier = Modifier) {
|
||||
@Suppress("DestructuringDeclarationWithTooManyEntries")
|
||||
|
|
@ -93,25 +94,29 @@ internal fun WalletCard(state: WalletCardState, isBalanceHidden: Boolean, modifi
|
|||
},
|
||||
)
|
||||
|
||||
val additionalText by remember(state.additionalInfo, isBalanceHidden) {
|
||||
mutableStateOf(
|
||||
if (state.additionalInfo?.hideable == true && isBalanceHidden) {
|
||||
WalletCardState.HIDDEN_BALANCE_TEXT
|
||||
} else {
|
||||
state.additionalInfo?.content
|
||||
},
|
||||
)
|
||||
}
|
||||
AdditionalInfo(
|
||||
text = if (state.additionalInfo?.hideable == true && isBalanceHidden) {
|
||||
WalletCardState.HIDDEN_BALANCE_TEXT
|
||||
} else {
|
||||
state.additionalInfo?.content
|
||||
},
|
||||
text = additionalText,
|
||||
modifier = Modifier.constrainAs(additionalTextRef) {
|
||||
start.linkTo(parent.start)
|
||||
top.linkTo(balanceRef.bottom)
|
||||
bottom.linkTo(anchor = parent.bottom, margin = contentVerticalMargin)
|
||||
|
||||
when (state) {
|
||||
is WalletCardState.Content,
|
||||
is WalletCardState.Error,
|
||||
-> {
|
||||
if (additionalText != null) {
|
||||
width = if (state.imageResId != null) {
|
||||
end.linkTo(imageRef.start)
|
||||
width = Dimension.fillToConstraints
|
||||
Dimension.fillToConstraints
|
||||
} else {
|
||||
Dimension.wrapContent
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -782,7 +782,7 @@ internal class WalletViewModel @Inject constructor(
|
|||
|
||||
viewModelScope.launch(dispatchers.main) {
|
||||
singleWalletCryptoCurrencyStatus?.let {
|
||||
updateButtons(wallet.walletId, it)
|
||||
updateButtons(userWallet = wallet, currencyStatus = it)
|
||||
}
|
||||
val result = fetchCurrencyStatusUseCase(wallet.walletId, refresh = true)
|
||||
|
||||
|
|
@ -1183,7 +1183,7 @@ internal class WalletViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
updateNotifications(index)
|
||||
updateButtons(wallet.walletId, status)
|
||||
updateButtons(userWallet = wallet, currencyStatus = status)
|
||||
updateTxHistory(wallet.walletId, status.currency, refresh = false)
|
||||
}
|
||||
}
|
||||
|
|
@ -1265,10 +1265,9 @@ internal class WalletViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun updateButtons(userWalletId: UserWalletId, currencyStatus: CryptoCurrencyStatus) {
|
||||
val userWallet = getSelectedWallet()
|
||||
private suspend fun updateButtons(userWallet: UserWallet, currencyStatus: CryptoCurrencyStatus) {
|
||||
getCryptoCurrencyActionsUseCase(
|
||||
userWalletId = userWalletId,
|
||||
userWalletId = userWallet.walletId,
|
||||
cryptoCurrencyStatus = currencyStatus,
|
||||
isSingleWalletWithTokens = userWallet.scanResponse.cardTypesResolver.isSingleWalletWithToken(),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue