Updated on 2026-08-14

This commit is contained in:
Tangem 2025-04-29 16:50:04 +05:00
parent 8619b424f5
commit f955a8d40b
10 changed files with 26 additions and 62 deletions

View file

@ -38,8 +38,6 @@ internal interface WalletContentClickIntents {
fun onOrganizeTokensClick()
fun onOnrampSuccessClick(txId: String)
fun onDismissMarketsOnboarding()
fun onTokenItemClick(currencyStatus: CryptoCurrencyStatus)
@ -116,10 +114,6 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
router.openOrganizeTokensScreen(userWalletId = stateHolder.getSelectedWalletId())
}
override fun onOnrampSuccessClick(txId: String) {
router.openOnrampSuccessScreen(txId = txId)
}
override fun onDismissMarketsOnboarding() {
stateHolder.update { it.copy(showMarketsOnboarding = false) }
modelScope.launch {

View file

@ -11,7 +11,6 @@ import com.tangem.domain.tokens.GetCryptoCurrencyUseCase
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.features.onramp.OnrampFeatureToggles
import com.tangem.utils.coroutines.launchOnCancellation
import kotlinx.coroutines.CoroutineScope
@ -24,7 +23,6 @@ internal class WalletDeepLinksHandler @Inject constructor(
private val deepLinksRegistry: DeepLinksRegistry,
private val analyticsEventHandler: AnalyticsEventHandler,
private val getCryptoCurrencyUseCase: GetCryptoCurrencyUseCase,
private val clickIntents: WalletClickIntents,
private val onrampFeatureToggles: OnrampFeatureToggles,
private val router: AppRouter,
) {
@ -55,11 +53,11 @@ internal class WalletDeepLinksHandler @Inject constructor(
return buildList {
add(sellCurrencyDeepLink)
if (onrampFeatureToggles.isFeatureEnabled || !userWallet.isMultiCurrency) {
if (!onrampFeatureToggles.isFeatureEnabled && !userWallet.isMultiCurrency) {
add(
BuyCurrencyDeepLink(
onReceive = { externalTxId ->
scope.launch { onBuyCurrencyDeepLink(externalTxId, userWallet) }
onReceive = {
scope.launch { onBuyCurrencyDeepLink(userWallet) }
},
),
)
@ -87,12 +85,8 @@ internal class WalletDeepLinksHandler @Inject constructor(
router.push(route)
}
private suspend fun onBuyCurrencyDeepLink(externalTxId: String, userWallet: UserWallet) {
if (onrampFeatureToggles.isFeatureEnabled) {
clickIntents.onOnrampSuccessClick(externalTxId)
} else {
val cryptoCurrency = getCryptoCurrencyUseCase(userWallet.walletId).getOrNull() ?: return
analyticsEventHandler.send(TokenScreenAnalyticsEvent.Bought(cryptoCurrency.symbol))
}
private suspend fun onBuyCurrencyDeepLink(userWallet: UserWallet) {
val cryptoCurrency = getCryptoCurrencyUseCase(userWallet.walletId).getOrNull() ?: return
analyticsEventHandler.send(TokenScreenAnalyticsEvent.Bought(cryptoCurrency.symbol))
}
}

View file

@ -58,17 +58,6 @@ internal class DefaultWalletRouter @Inject constructor(
)
}
override fun openOnrampSuccessScreen(txId: String) {
// finish current onramp flow and show onramp success screen
val replaceOnrampScreens = router.stack
.filterNot { it is AppRoute.Onramp }
.toMutableList()
replaceOnrampScreens.add(AppRoute.OnrampSuccess(txId))
router.replaceAll(*replaceOnrampScreens.toTypedArray())
}
override fun openUrl(url: String) {
urlOpener.openUrl(url)
}

View file

@ -34,9 +34,6 @@ internal interface InnerWalletRouter {
/** Open onboarding screen */
fun openOnboardingScreen(scanResponse: ScanResponse, continueBackup: Boolean = false)
/** Open onramp success screen for [txId] */
fun openOnrampSuccessScreen(txId: String)
/** Open transaction history website by [url] */
fun openUrl(url: String)