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

@ -16,6 +16,7 @@ import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.feature.tokendetails.presentation.tokendetails.model.TokenDetailsModel
import com.tangem.feature.tokendetails.presentation.tokendetails.ui.TokenDetailsScreen
import com.tangem.features.markets.token.block.TokenMarketBlockComponent
import com.tangem.features.onramp.OnrampFeatureToggles
import com.tangem.features.tokendetails.TokenDetailsComponent
import com.tangem.features.txhistory.TxHistoryFeatureToggles
import com.tangem.features.txhistory.component.TxHistoryComponent
@ -23,12 +24,14 @@ import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
@Suppress("LongParameterList")
internal class DefaultTokenDetailsComponent @AssistedInject constructor(
@Assisted appComponentContext: AppComponentContext,
@Assisted params: TokenDetailsComponent.Params,
tokenMarketBlockComponentFactory: TokenMarketBlockComponent.Factory,
txHistoryComponentFactory: TxHistoryComponent.Factory,
txHistoryFeatureToggles: TxHistoryFeatureToggles,
onrampFeatureToggles: OnrampFeatureToggles,
deepLinksRegistry: DeepLinksRegistry,
) : TokenDetailsComponent, AppComponentContext by appComponentContext {
@ -48,11 +51,19 @@ internal class DefaultTokenDetailsComponent @AssistedInject constructor(
onResume = model::onResume,
)
val deeplinks = buildList {
if (!onrampFeatureToggles.isFeatureEnabled) {
add(
BuyCurrencyDeepLink(
onReceive = model::onBuyCurrencyDeepLink,
),
)
}
}
registerDeepLinks(
registry = deepLinksRegistry,
BuyCurrencyDeepLink(
onReceive = model::onBuyCurrencyDeepLink,
),
deeplinks,
)
}

View file

@ -46,15 +46,4 @@ internal class DefaultTokenDetailsRouter @Inject constructor(
),
)
}
override fun openOnrampSuccess(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())
}
}

View file

@ -17,6 +17,4 @@ internal interface InnerTokenDetailsRouter {
fun openTokenDetails(userWalletId: UserWalletId, currency: CryptoCurrency)
fun openStaking(userWalletId: UserWalletId, cryptoCurrency: CryptoCurrency, yieldId: String)
fun openOnrampSuccess(txId: String)
}

View file

@ -195,13 +195,9 @@ internal class TokenDetailsModel @Inject constructor(
handleBalanceHiding()
}
fun onBuyCurrencyDeepLink(txId: String) {
if (onrampFeatureToggles.isFeatureEnabled) {
router.openOnrampSuccess(txId)
} else {
val currency = cryptoCurrencyStatus?.currency ?: return
analyticsEventsHandler.send(TokenScreenAnalyticsEvent.Bought(currency.symbol))
}
fun onBuyCurrencyDeepLink() {
val currency = cryptoCurrencyStatus?.currency ?: return
analyticsEventsHandler.send(TokenScreenAnalyticsEvent.Bought(currency.symbol))
}
fun onPause() {