Updated on 2026-08-14

This commit is contained in:
Tangem 2024-08-28 19:47:42 +05:00
parent e69ba66a59
commit b890e45ece
8 changed files with 32 additions and 0 deletions

View file

@ -882,6 +882,8 @@
<string name="warning_low_signatures_message">На этой карте осталось всего %s подписей. Вам следует вывести все ваши средства.</string>
<string name="warning_low_signatures_title">Малое количество подписей</string>
<string name="warning_manage_tokens_legacy_derivation_message">Токены на разных сетях могут иметь разные адреса. Пожалуйста, убедитесь при переводе средств, что ваш адрес соответствует сети.</string>
<string name="warning_matic_migration_title">Миграция MATIC в POL</string>
<string name="warning_matic_migration_message">Токен MATIC мигрирует на POL. Однако крайний срок не установлен, и MATIC пока не устарел. Вы можете спокойно продолжать использовать токен MATIC или воспользоваться биржами, чтобы обменять его на POL.</string>
<plurals name="warning_missing_derivation_message">
<item quantity="one">Используйте вашу карту, чтобы получить адрес для %d сети</item>
<item quantity="few">Используйте вашу карту, чтобы получить адреса для %d сетей</item>

View file

@ -875,6 +875,8 @@
<string name="warning_low_signatures_message">Only %s signatures are left on this card. You must withdraw all of your funds.</string>
<string name="warning_low_signatures_title">Low signature count</string>
<string name="warning_manage_tokens_legacy_derivation_message">Tokens on different networks can have different addresses. Double-check that your address matches the network when you transfer funds.</string>
<string name="warning_matic_migration_title">MATIC to POL Migration</string>
<string name="warning_matic_migration_message">MATIC is being migrated to POL. However there is no deadline set and MATIC isn\'t being deprecated yet. You can safely continue using MATIC token or use exchanges to swap it for POL.</string>
<plurals name="warning_missing_derivation_message">
<item quantity="one">Use your card to get an address for %d network</item>
<item quantity="other">Use your card to get an addresses for %d networks</item>

View file

@ -48,6 +48,8 @@ sealed class CryptoCurrencyWarning {
data object BeaconChainShutdown : CryptoCurrencyWarning()
data object MigrationMaticToPol : CryptoCurrencyWarning()
/**
* Shows a warning about an available fee resource for a transaction in several blockchains (ex. Koinos)
*/

View file

@ -76,6 +76,7 @@ class GetCurrencyWarningsUseCase(
getNetworkNoAccountWarning(currencyStatus),
getBeaconChainShutdownWarning(currency.network.id),
getAssetRequirementsWarning(userWalletId = userWalletId, currency = currency),
getMigrationFromMaticToPolWarning(currency),
)
}.flowOn(dispatchers.io)
}
@ -304,7 +305,19 @@ class GetCurrencyWarningsUseCase(
}
}
private fun getMigrationFromMaticToPolWarning(currency: CryptoCurrency): CryptoCurrencyWarning? {
return if (currency.symbol == MATIC_SYMBOL && !BlockchainUtils.isPolygonChain(currency.network.id.value)) {
CryptoCurrencyWarning.MigrationMaticToPol
} else {
null
}
}
private fun BigDecimal?.isZero(): Boolean {
return this?.signum() == 0
}
companion object {
private const val MATIC_SYMBOL = "MATIC"
}
}

View file

@ -49,6 +49,7 @@ internal class TokenDetailsNotificationsAnalyticsSender(
is TokenDetailsNotification.NetworkShutdown,
is TokenDetailsNotification.HederaAssociateWarning,
is TokenDetailsNotification.KoinosMana,
is TokenDetailsNotification.MigrationMaticToPol,
-> null
}
}

View file

@ -201,4 +201,9 @@ internal sealed class TokenDetailsNotification(val config: NotificationConfig) {
formatArgs = wrappedList(manaBalanceAmount, maxManaBalanceAmount),
),
)
data object MigrationMaticToPol : Warning(
title = resourceReference(id = R.string.warning_matic_migration_title),
subtitle = resourceReference(id = R.string.warning_matic_migration_message),
)
}

View file

@ -122,6 +122,7 @@ internal class TokenDetailsNotificationConverter(
""
},
)
is CryptoCurrencyWarning.MigrationMaticToPol -> MigrationMaticToPol
}
}

View file

@ -55,4 +55,10 @@ object BlockchainUtils {
val blockchain = Blockchain.fromId(networkId)
return blockchain == Blockchain.Binance || blockchain == Blockchain.BinanceTestnet
}
/** If current [networkId] is Polygon */
fun isPolygonChain(networkId: String): Boolean {
val blockchain = Blockchain.fromId(networkId)
return blockchain == Blockchain.Polygon || blockchain == Blockchain.PolygonTestnet
}
}