Updated on 2026-08-14
This commit is contained in:
commit
649f32a726
5 changed files with 29 additions and 25 deletions
|
|
@ -119,6 +119,8 @@ object TangemSdkErrorMapper {
|
|||
is TangemSdkError.UserCanceledBiometricsAuthentication -> error
|
||||
is TangemSdkError.EncryptionOperationFailed -> error
|
||||
is TangemSdkError.InvalidEncryptionKey -> error
|
||||
is TangemSdkError.KeyGenerationException -> error
|
||||
is TangemSdkError.MnemonicException -> error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com.tangem.tap.features.wallet.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
|
|
@ -10,7 +9,6 @@ import androidx.activity.OnBackPressedCallback
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.transition.TransitionInflater
|
||||
|
|
@ -77,17 +75,10 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
}
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
lifecycle.addObserver(viewModel)
|
||||
lifecycleScope.launchWhenCreated {
|
||||
viewModel.launch()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setHasOptionsMenu(true)
|
||||
activity?.lifecycle?.addObserver(viewModel)
|
||||
|
||||
activity?.onBackPressedDispatcher?.addCallback(
|
||||
this,
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ internal class WalletViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
launch()
|
||||
val scanResponse = store.state.globalState.scanResponse
|
||||
if (scanResponse != null) {
|
||||
val currency = ParamCardCurrencyConverter().convert(scanResponse.cardTypesResolver)
|
||||
|
|
@ -77,7 +78,7 @@ internal class WalletViewModel @Inject constructor(
|
|||
analyticsEventHandler.send(MainScreen.ScreenOpened())
|
||||
}
|
||||
|
||||
fun launch() {
|
||||
private fun launch() {
|
||||
val manager = store.state.globalState.userWalletsListManager
|
||||
if (manager != null) {
|
||||
bootstrapSelectedWalletStoresChanges(manager)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.tangem.blockchain.common.Token
|
|||
import com.tangem.common.card.EllipticCurve
|
||||
import com.tangem.common.card.FirmwareVersion
|
||||
import com.tangem.common.card.WalletData
|
||||
import com.tangem.common.extensions.guard
|
||||
import com.tangem.domain.common.TapWorkarounds.getTangemNoteBlockchain
|
||||
import com.tangem.domain.common.TapWorkarounds.isSaltPay
|
||||
import com.tangem.domain.common.TapWorkarounds.isSaltPayVisa
|
||||
|
|
@ -40,18 +39,14 @@ class TangemCardTypesResolver(
|
|||
return when (productType) {
|
||||
ProductType.Start2Coin -> if (card.isTestCard) Blockchain.BitcoinTestnet else Blockchain.Bitcoin
|
||||
ProductType.SaltPay -> Blockchain.SaltPay
|
||||
ProductType.Note -> card.getTangemNoteBlockchain() ?: Blockchain.Unknown // todo restored old logic
|
||||
else -> {
|
||||
val blockchainName: String = walletData?.blockchain.guard {
|
||||
// TODO(hotfix [REDACTED_TASK_KEY], for note bnb, card determined as beacon blockchain, refactor later)
|
||||
//
|
||||
// if (productType == ProductType.Note) {
|
||||
// return card.getTangemNoteBlockchain() ?: Blockchain.Unknown
|
||||
// } else {
|
||||
// }
|
||||
return Blockchain.Unknown
|
||||
}
|
||||
Blockchain.fromId(blockchainName)
|
||||
val blockchainName: String = walletData?.blockchain
|
||||
?: if (productType == ProductType.Note) {
|
||||
return card.getTangemNoteBlockchain() ?: Blockchain.Unknown
|
||||
} else {
|
||||
return Blockchain.Unknown
|
||||
}
|
||||
Blockchain.fromBlockchainName(blockchainName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -69,6 +64,21 @@ class TangemCardTypesResolver(
|
|||
}
|
||||
}
|
||||
|
||||
private fun Blockchain.Companion.fromBlockchainName(blockchainName: String): Blockchain {
|
||||
// workaround for BSC (BNB) notes cards
|
||||
return when (blockchainName) {
|
||||
"BINANCE" -> {
|
||||
Blockchain.BSC
|
||||
}
|
||||
"BINANCE/test" -> {
|
||||
Blockchain.BSCTestnet
|
||||
}
|
||||
else -> {
|
||||
Blockchain.fromId(blockchainName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum class ProductType {
|
||||
Note, Twins, Wallet, SaltPay, Start2Coin
|
||||
}
|
||||
|
|
@ -68,9 +68,9 @@ kotlinSerialization = "1.4.1"
|
|||
# endregion Other libraries
|
||||
|
||||
# region Tangem
|
||||
tangemBlockchainSdk = "develop-179"
|
||||
tangemBlockchainSdk = "develop-182"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "develop-204"
|
||||
tangemCardSdk = "develop-206"
|
||||
# tangemCardSdk = "0.0.1" # Keep it! - used for local builds
|
||||
# endregion Tangem
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue