Updated on 2026-08-14

This commit is contained in:
Tangem 2026-04-19 23:59:39 +05:00
parent c3a687213f
commit 02a90d4be3

View file

@ -20,6 +20,7 @@ import com.tangem.domain.models.wallet.isMultiCurrency
import com.tangem.domain.notifications.models.NotificationType
import com.tangem.domain.account.status.utils.CryptoCurrencyBalanceFetcher
import com.tangem.domain.tokens.wallet.WalletBalanceFetcher
import com.tangem.domain.wallets.usecase.GetSelectedWalletSyncUseCase
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
import com.tangem.domain.wallets.usecase.SelectWalletUseCase
import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnalyticEvents
@ -45,6 +46,7 @@ internal class DefaultTokenDetailsDeepLinkHandler @AssistedInject constructor(
private val walletDeepLinkActionTrigger: WalletDeepLinkActionTrigger,
private val analyticsEventHandler: AnalyticsEventHandler,
private val getUserWalletUseCase: GetUserWalletUseCase,
private val getSelectedWalletSyncUseCase: GetSelectedWalletSyncUseCase,
private val walletBalanceFetcher: WalletBalanceFetcher,
private val tangemPayFeatureToggles: TangemPayFeatureToggles,
private val singleAccountListSupplier: SingleAccountListSupplier,
@ -63,15 +65,23 @@ internal class DefaultTokenDetailsDeepLinkHandler @AssistedInject constructor(
scope.launch {
val userWalletId = walletId?.let(::UserWalletId)
val userWallet = userWalletId?.let { getUserWalletUseCase(userWalletId) }?.getOrNull()
val selectedUserWallet = getSelectedWalletSyncUseCase().getOrNull()
val userWallet = if (userWalletId != null) {
getUserWalletUseCase(userWalletId).getOrNull()
} else {
selectedUserWallet
}
// If wallet to select is null or locked, ignore deeplink
if (userWallet == null || userWallet.isLocked) {
TangemLogger.e("Error on getting user wallet")
return@launch
}
if (selectWalletUseCase(userWalletId).getOrNull() == null) {
TangemLogger.e("Error on selecting user wallet")
return@launch
if (userWalletId != null && selectedUserWallet?.walletId != userWalletId) {
val isSelectionFailed = selectWalletUseCase(userWalletId).getOrNull() == null
if (isSelectionFailed) {
TangemLogger.e("Error on selecting user wallet")
return@launch
}
}
val cryptoCurrency = findCryptoCurrency(userWallet = userWallet, networkId = networkId, tokenId = tokenId)