Updated on 2026-08-14
This commit is contained in:
commit
1146554992
1461 changed files with 62266 additions and 17096 deletions
|
|
@ -169,7 +169,7 @@ class CryptoCurrencyFactory(
|
|||
id = cryptoCurrency.id.rawCurrencyId?.value,
|
||||
)
|
||||
val blockchain =
|
||||
Blockchain.fromNetworkId(cryptoCurrency.network.backendId) ?: Blockchain.Unknown
|
||||
Blockchain.fromNetworkId(cryptoCurrency.network.rawId) ?: Blockchain.Unknown
|
||||
val id = getTokenId(network, sdkToken)
|
||||
return CryptoCurrency.Token(
|
||||
id = id,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ internal class DefaultCardCryptoCurrencyFactory(
|
|||
|
||||
// check if the blockchain of single-currency wallet is the same as network
|
||||
val cardNetworkId = userWallet.scanResponse.cardTypesResolver.getBlockchain().toNetworkId()
|
||||
val cardNetwork = networks.firstOrNull { it.backendId == cardNetworkId }
|
||||
val cardNetwork = networks.firstOrNull { it.rawId == cardNetworkId }
|
||||
|
||||
if (cardNetwork == null) return emptyMap()
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ internal class DefaultCardCryptoCurrencyFactory(
|
|||
responseCryptoCurrenciesFactory.createCurrencies(
|
||||
tokens = accountDTO.tokens.orEmpty().filter { token ->
|
||||
networks.any {
|
||||
it.backendId == token.networkId && it.derivationPath.value == token.derivationPath
|
||||
it.rawId == token.networkId && it.derivationPath.value == token.derivationPath
|
||||
}
|
||||
},
|
||||
userWallet = userWallet,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class UserTokensResponseFactory @Inject constructor() {
|
|||
UserTokensResponse.Token(
|
||||
id = id.rawCurrencyId?.value,
|
||||
accountId = accountId?.value,
|
||||
networkId = network.backendId,
|
||||
networkId = network.rawId,
|
||||
derivationPath = network.derivationPath.value,
|
||||
name = name,
|
||||
symbol = symbol,
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
package com.tangem.data.common.locale
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
internal class DefaultLocaleProvider : LocaleProvider {
|
||||
|
||||
override fun getLocale(): Locale {
|
||||
return Locale.getDefault()
|
||||
}
|
||||
|
||||
override fun getWebUriLocaleLanguage(): String {
|
||||
val language = getLocale().language
|
||||
return if (LOCALE_LANG_RU.equals(language, true) || LOCALE_LANG_BY.equals(language, true)) {
|
||||
LOCALE_LANG_RU
|
||||
} else {
|
||||
LOCALE_LANG_EN
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val LOCALE_LANG_RU = "ru"
|
||||
const val LOCALE_LANG_BY = "by"
|
||||
const val LOCALE_LANG_EN = "en"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.tangem.data.common.locale
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
interface LocaleProvider {
|
||||
|
||||
fun getLocale(): Locale
|
||||
|
||||
fun getWebUriLocaleLanguage(): String
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.tangem.data.common.locale.di
|
||||
|
||||
import com.tangem.data.common.locale.DefaultLocaleProvider
|
||||
import com.tangem.data.common.locale.LocaleProvider
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
internal object LocaleProviderModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideCacheRegistry(): LocaleProvider {
|
||||
return DefaultLocaleProvider()
|
||||
}
|
||||
}
|
||||
|
|
@ -136,8 +136,7 @@ class NetworkFactory @Inject constructor(
|
|||
|
||||
return runCatching {
|
||||
Network(
|
||||
id = Network.ID(value = blockchain.id, derivationPath = derivationPath),
|
||||
backendId = blockchain.toNetworkId(),
|
||||
id = Network.ID(value = blockchain.toNetworkId(), derivationPath = derivationPath),
|
||||
name = blockchain.fullName,
|
||||
isTestnet = blockchain.isTestnet(),
|
||||
derivationPath = derivationPath,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.tangem.data.common.network
|
|||
import com.google.common.truth.Truth
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
|
||||
import com.tangem.blockchainsdk.utils.toNetworkId
|
||||
import com.tangem.common.test.domain.card.MockScanResponseFactory
|
||||
import com.tangem.common.test.domain.token.MockCryptoCurrencyFactory
|
||||
import com.tangem.common.test.domain.wallet.MockUserWalletFactory
|
||||
|
|
@ -187,7 +188,7 @@ class NetworkFactoryTest {
|
|||
userWallet = userWallet,
|
||||
expected = MockCryptoCurrencyFactory().ethereum.network.copy(
|
||||
id = Network.ID(
|
||||
value = Blockchain.Ethereum.id,
|
||||
value = Blockchain.Ethereum.toNetworkId(),
|
||||
derivationPath = expectedDerivationPath,
|
||||
),
|
||||
derivationPath = expectedDerivationPath,
|
||||
|
|
@ -201,12 +202,12 @@ class NetworkFactoryTest {
|
|||
derivationPath: Network.DerivationPath,
|
||||
): CreateTestModel.Second {
|
||||
return CreateTestModel.Second(
|
||||
networkId = Network.ID(value = Blockchain.Ethereum.id, derivationPath = derivationPath),
|
||||
networkId = Network.ID(value = Blockchain.Ethereum.toNetworkId(), derivationPath = derivationPath),
|
||||
derivationPath = derivationPath,
|
||||
userWallet = userWallet,
|
||||
expected = MockCryptoCurrencyFactory().ethereum.network.copy(
|
||||
id = Network.ID(
|
||||
value = Blockchain.Ethereum.id,
|
||||
value = Blockchain.Ethereum.toNetworkId(),
|
||||
derivationPath = derivationPath,
|
||||
),
|
||||
derivationPath = derivationPath,
|
||||
|
|
@ -227,7 +228,7 @@ class NetworkFactoryTest {
|
|||
derivationStyleProvider = derivationStyleProvider,
|
||||
canHandleTokens = canHandleTokens,
|
||||
expected = MockCryptoCurrencyFactory().ethereum.network.copy(
|
||||
id = Network.ID(value = Blockchain.Ethereum.id, derivationPath = expectedDerivationPath),
|
||||
id = Network.ID(value = Blockchain.Ethereum.toNetworkId(), derivationPath = expectedDerivationPath),
|
||||
derivationPath = expectedDerivationPath,
|
||||
canHandleTokens = canHandleTokens,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue