Updated on 2026-08-14
This commit is contained in:
parent
2c8c2cb579
commit
3f20fb5bac
12 changed files with 15 additions and 90 deletions
|
|
@ -81,6 +81,7 @@ internal class SendViewModel @Inject constructor(
|
|||
userWalletId = userWalletId,
|
||||
currencyId = cryptoCurrency.id,
|
||||
derivationPath = cryptoCurrency.network.derivationPath,
|
||||
contractAddress = (cryptoCurrency as? CryptoCurrency.Token)?.contractAddress,
|
||||
isSingleWalletWithTokens = isSingleWallet,
|
||||
)
|
||||
.flowWithLifecycle(owner.lifecycle)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ internal sealed class TokenDetailsNotification(val config: NotificationConfig) {
|
|||
iconResId = iconResId,
|
||||
buttonsState = buttonsState,
|
||||
),
|
||||
) {
|
||||
)
|
||||
|
||||
sealed class Informational(
|
||||
title: TextReference,
|
||||
|
|
@ -108,35 +108,5 @@ internal sealed class TokenDetailsNotification(val config: NotificationConfig) {
|
|||
id = R.string.warning_send_blocked_pending_transactions_message,
|
||||
formatArgs = wrappedList(coinSymbol),
|
||||
),
|
||||
) {
|
||||
data class RentInfo(
|
||||
private val rentInfo: CryptoCurrencyWarning.Rent,
|
||||
private val onCloseClick: () -> Unit,
|
||||
) : Informational(
|
||||
title = TextReference.Res(R.string.warning_rent_fee_title),
|
||||
subtitle = TextReference.Res(
|
||||
id = R.string.warning_solana_rent_fee_message,
|
||||
formatArgs = wrappedList(rentInfo.rent, rentInfo.exemptionAmount),
|
||||
),
|
||||
onCloseClick = onCloseClick,
|
||||
)
|
||||
|
||||
data class ExistentialDeposit(
|
||||
private val existentialInfo: CryptoCurrencyWarning.ExistentialDeposit,
|
||||
) : Informational(
|
||||
title = resourceReference(R.string.warning_existential_deposit_title),
|
||||
subtitle = TextReference.Res(
|
||||
id = R.string.warning_existential_deposit_message,
|
||||
formatArgs = wrappedList(existentialInfo.currencyName, existentialInfo.edStringValueWithSymbol),
|
||||
),
|
||||
)
|
||||
|
||||
class NetworksNoAccount(val network: String, val symbol: String, val amount: String) : Informational(
|
||||
title = resourceReference(R.string.warning_no_account_title),
|
||||
subtitle = resourceReference(
|
||||
R.string.no_account_generic,
|
||||
wrappedList(network, amount, symbol),
|
||||
),
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ internal class TokenDetailsLoadedBalanceConverter(
|
|||
return state.copy(
|
||||
tokenBalanceBlockState = TokenDetailsBalanceBlockState.Error(state.tokenBalanceBlockState.actionButtons),
|
||||
marketPriceBlockState = MarketPriceBlockState.Error(state.marketPriceBlockState.currencySymbol),
|
||||
notifications = persistentListOf(TokenDetailsNotification.Warning.NetworksUnreachable),
|
||||
notifications = persistentListOf(TokenDetailsNotification.NetworksUnreachable),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,20 +19,20 @@ internal class TokenDetailsNotificationConverter(
|
|||
|
||||
fun removeRentInfo(currentState: TokenDetailsState): ImmutableList<TokenDetailsNotification> {
|
||||
val newNotifications = currentState.notifications.toMutableList()
|
||||
newNotifications.removeBy { it is TokenDetailsNotification.Informational.RentInfo }
|
||||
newNotifications.removeBy { it is TokenDetailsNotification.RentInfo }
|
||||
return newNotifications.toImmutableList()
|
||||
}
|
||||
|
||||
private fun mapToNotification(warning: CryptoCurrencyWarning): TokenDetailsNotification {
|
||||
return when (warning) {
|
||||
is CryptoCurrencyWarning.BalanceNotEnoughForFee -> TokenDetailsNotification.Warning.NetworkFee(
|
||||
is CryptoCurrencyWarning.BalanceNotEnoughForFee -> TokenDetailsNotification.NetworkFee(
|
||||
feeInfo = warning,
|
||||
onBuyClick = { clickIntents.onBuyCoinClick(warning.coinCurrency) },
|
||||
)
|
||||
is CryptoCurrencyWarning.ExistentialDeposit -> TokenDetailsNotification.Informational.ExistentialDeposit(
|
||||
is CryptoCurrencyWarning.ExistentialDeposit -> TokenDetailsNotification.ExistentialDeposit(
|
||||
existentialInfo = warning,
|
||||
)
|
||||
is CryptoCurrencyWarning.Rent -> TokenDetailsNotification.Informational.RentInfo(
|
||||
is CryptoCurrencyWarning.Rent -> TokenDetailsNotification.RentInfo(
|
||||
rentInfo = warning,
|
||||
onCloseClick = clickIntents::onCloseRentInfoNotification,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -159,18 +159,6 @@ internal class WalletNotificationsListFactory(
|
|||
addMissingAddressesNotification(maybeMissedAddressCurrencies)
|
||||
}
|
||||
|
||||
private fun MutableList<WalletNotification>.addInformationalNotifications(
|
||||
cardTypesResolver: CardTypesResolver,
|
||||
maybeMissedAddressCurrencies: Either<GetCurrenciesError, List<CryptoCurrency>>,
|
||||
) {
|
||||
addIf(
|
||||
element = WalletNotification.Informational.DemoCard,
|
||||
condition = isDemoCardUseCase(cardId = cardTypesResolver.getCardId()),
|
||||
)
|
||||
|
||||
addMissingAddressesNotification(maybeMissedAddressCurrencies)
|
||||
}
|
||||
|
||||
private fun MutableList<WalletNotification>.addIf(element: WalletNotification, condition: Boolean) {
|
||||
if (condition) {
|
||||
add(element = element)
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ internal class WalletViewModel @Inject constructor(
|
|||
private val shouldShowSaveWalletScreenUseCase: ShouldShowSaveWalletScreenUseCase,
|
||||
private val canUseBiometryUseCase: CanUseBiometryUseCase,
|
||||
private val shouldSaveUserWalletsUseCase: ShouldSaveUserWalletsUseCase,
|
||||
private val isBalanceHiddenUseCase: IsBalanceHiddenUseCase,
|
||||
private val getBalanceHidingSettingsUseCase: GetBalanceHidingSettingsUseCase,
|
||||
private val listenToFlipsUseCase: ListenToFlipsUseCase,
|
||||
private val removeCurrencyUseCase: RemoveCurrencyUseCase,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue