Updated on 2026-08-14

This commit is contained in:
Tangem 2023-10-11 21:55:11 +08:00
parent 1cdc5b5ab9
commit 7141c0e6ee
16 changed files with 59 additions and 16 deletions

View file

@ -13,8 +13,9 @@ import com.tangem.feature.wallet.impl.R
*/
internal object WalletImageResolver {
private const val DOUBLE_WALLET_SET_BACKUP_COUNT = 2
private const val TRIPLE_WALLET_SET_BACKUP_COUNT = 3
private const val WALLET_WITHOUT_BACKUP_COUNT = 1
private const val WALLET_WITH_ONE_BACKUP_COUNT = 2
private const val WALLET_WITH_TWO_BACKUPS_COUNT = 3
/** Get a specified wallet [userWallet] image */
@DrawableRes
@ -22,9 +23,10 @@ internal object WalletImageResolver {
val cardTypesResolver = userWallet.scanResponse.cardTypesResolver
return when {
cardTypesResolver.isWallet2() -> userWallet.resolveWallet2()
cardTypesResolver.isTangemWallet() -> R.drawable.ill_wallet_120_106
cardTypesResolver.isWhiteWallet() -> R.drawable.ill_old_wallet_120_106
cardTypesResolver.isTangemTwins() -> R.drawable.ill_twin_120_106
cardTypesResolver.isShibaWallet() -> userWallet.resolveShibaWallet()
cardTypesResolver.isTangemWallet() -> userWallet.resolveWallet1()
cardTypesResolver.isWhiteWallet() -> R.drawable.ill_wallet_old_white_120_106
cardTypesResolver.isTangemTwins() -> R.drawable.ill_twins_120_106
cardTypesResolver.isStart2Coin() -> R.drawable.ill_start2coin_120_106
cardTypesResolver.isTangemNote() -> resolveNote(blockchain = cardTypesResolver.getBlockchain())
cardTypesResolver.isDevKit() -> R.drawable.ill_dev_120_106
@ -33,19 +35,42 @@ internal object WalletImageResolver {
}
private fun UserWallet.resolveWallet2(): Int? {
val count = getCardsCount()
return if (count != null) {
return resolveWalletWithBackups { count ->
when (count) {
DOUBLE_WALLET_SET_BACKUP_COUNT -> R.drawable.ill_wallet2_cards2_120_106
TRIPLE_WALLET_SET_BACKUP_COUNT -> R.drawable.ill_wallet2_cards3_120_106
WALLET_WITH_ONE_BACKUP_COUNT -> R.drawable.ill_wallet2_cards2_120_106
WALLET_WITH_TWO_BACKUPS_COUNT -> R.drawable.ill_wallet2_cards3_120_106
else -> null
}
} else {
null
}
}
private fun UserWallet.resolveShibaWallet(): Int? {
return resolveWalletWithBackups { count ->
when (count) {
WALLET_WITH_ONE_BACKUP_COUNT -> R.drawable.ill_shiba_card2_120_106
WALLET_WITH_TWO_BACKUPS_COUNT -> R.drawable.ill_shiba_card3_120_106
else -> null
}
}
}
private fun UserWallet.resolveWallet1(): Int? {
return resolveWalletWithBackups { count ->
when (count) {
WALLET_WITHOUT_BACKUP_COUNT -> R.drawable.ill_wallet1_cards1_120_106
WALLET_WITH_ONE_BACKUP_COUNT -> R.drawable.ill_wallet1_cards2_120_106
WALLET_WITH_TWO_BACKUPS_COUNT -> R.drawable.ill_wallet1_cards3_120_106
else -> null
}
}
}
private fun UserWallet.resolveWalletWithBackups(resolve: (Int) -> Int?): Int? {
val count = getCardsCount()
return if (count != null) resolve(count) else null
}
private fun resolveNote(blockchain: Blockchain): Int? {
return when (blockchain) {
Blockchain.Bitcoin -> R.drawable.ill_note_btc_120_106

View file

@ -137,7 +137,7 @@ sealed class WalletNotification(val config: NotificationConfig) {
val onCloseClick: () -> Unit,
) : WalletNotification(
config = NotificationConfig(
title = resourceReference(id = R.string.warning_rate_app_title),
title = resourceReference(id = R.string.warning_rate_app_title_new),
subtitle = resourceReference(id = R.string.warning_rate_app_message),
iconResId = R.drawable.ic_star_24,
buttonsState = NotificationConfig.ButtonsState.PairButtonsConfig(

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB