From bf2c65eca37f1dd64d61870c1654d689c54ae8b7 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 16 Dec 2024 20:14:07 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../tangem/core/deeplink/global/BuyCurrencyDeepLink.kt | 9 ++------- .../com/tangem/data/onramp/DefaultOnrampRepository.kt | 2 +- .../presentation/tokendetails/TokenDetailsPreviewData.kt | 2 ++ .../presentation/tokendetails/state/TokenDetailsState.kt | 1 + .../state/factory/TokenDetailsSkeletonStateConverter.kt | 1 + .../state/factory/express/ExpressStatusFactory.kt | 7 +++++++ .../state/factory/express/OnrampStatusFactory.kt | 2 +- .../presentation/tokendetails/ui/TokenDetailsScreen.kt | 2 +- .../tokendetails/viewmodels/TokenDetailsViewModel.kt | 4 ++-- .../presentation/deeplink/WalletDeepLinksHandler.kt | 1 - 10 files changed, 18 insertions(+), 13 deletions(-) diff --git a/core/deep-links/global/src/main/kotlin/com/tangem/core/deeplink/global/BuyCurrencyDeepLink.kt b/core/deep-links/global/src/main/kotlin/com/tangem/core/deeplink/global/BuyCurrencyDeepLink.kt index b9427aee10..259ffd2cbb 100644 --- a/core/deep-links/global/src/main/kotlin/com/tangem/core/deeplink/global/BuyCurrencyDeepLink.kt +++ b/core/deep-links/global/src/main/kotlin/com/tangem/core/deeplink/global/BuyCurrencyDeepLink.kt @@ -3,15 +3,10 @@ package com.tangem.core.deeplink.global import com.tangem.core.deeplink.DeepLink class BuyCurrencyDeepLink( - isOnrampFeatureEnabled: Boolean, val onReceive: (externalTxId: String) -> Unit, ) : DeepLink { - override val uri: String = if (isOnrampFeatureEnabled) { - ONRAMP_REDIRECT_DEEPLINK - } else { - BUY_REDIRECT_DEEPLINK - } + override val uri = BUY_REDIRECT_DEEPLINK override fun onReceive(params: Map) { onReceive( @@ -20,7 +15,7 @@ class BuyCurrencyDeepLink( } companion object { - const val ONRAMP_REDIRECT_DEEPLINK = "tangem://onramp-success?" + const val ONRAMP_REDIRECT_DEEPLINK = "https://tangem.com/success?action=dismissBrowser" private const val BUY_REDIRECT_DEEPLINK = "tangem://redirect?action=dismissBrowser" } } \ No newline at end of file diff --git a/data/onramp/src/main/java/com/tangem/data/onramp/DefaultOnrampRepository.kt b/data/onramp/src/main/java/com/tangem/data/onramp/DefaultOnrampRepository.kt index ca78dbeca6..1ada8bde19 100644 --- a/data/onramp/src/main/java/com/tangem/data/onramp/DefaultOnrampRepository.kt +++ b/data/onramp/src/main/java/com/tangem/data/onramp/DefaultOnrampRepository.kt @@ -415,7 +415,7 @@ internal class DefaultOnrampRepository( fromCurrency = currency, toAmount = quote.toAmount.value, toCurrencyId = cryptoCurrency.id.value, - status = OnrampStatus.Status.Expired, + status = OnrampStatus.Status.Created, externalTxUrl = onrampDataJson.externalTxUrl, externalTxId = onrampDataJson.externalTxId, timestamp = DateTime.now().millis, diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt index 625959ab86..358d295129 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt @@ -308,6 +308,7 @@ internal object TokenDetailsPreviewData { dialogConfig = null, pendingTxs = persistentListOf(), expressTxs = persistentListOf(), + expressTxsToDisplay = persistentListOf(), pullToRefreshConfig = pullToRefreshConfig, bottomSheetConfig = null, isBalanceHidden = false, @@ -338,6 +339,7 @@ internal object TokenDetailsPreviewData { dialogConfig = null, pendingTxs = persistentListOf(), expressTxs = persistentListOf(), + expressTxsToDisplay = persistentListOf(), pullToRefreshConfig = pullToRefreshConfig, bottomSheetConfig = null, isBalanceHidden = false, diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/TokenDetailsState.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/TokenDetailsState.kt index 8ece0d02e9..d285c89fc9 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/TokenDetailsState.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/TokenDetailsState.kt @@ -21,6 +21,7 @@ internal data class TokenDetailsState( val stakingBlocksState: StakingBlockUM?, val notifications: ImmutableList, val pendingTxs: PersistentList, + val expressTxsToDisplay: PersistentList, val expressTxs: PersistentList, val txHistoryState: TxHistoryState, val dialogConfig: TokenDetailsDialogConfig?, diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt index 07f98c6f10..f22431609c 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt @@ -67,6 +67,7 @@ internal class TokenDetailsSkeletonStateConverter( notifications = persistentListOf(), pendingTxs = persistentListOf(), expressTxs = persistentListOf(), + expressTxsToDisplay = persistentListOf(), txHistoryState = TxHistoryState.Content( contentItems = MutableStateFlow( value = TxHistoryState.getDefaultLoadingTransactions(clickIntents::onExploreClick), diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/express/ExpressStatusFactory.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/express/ExpressStatusFactory.kt index 92a6a2508c..aa5d0ecc92 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/express/ExpressStatusFactory.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/express/ExpressStatusFactory.kt @@ -98,8 +98,15 @@ internal class ExpressStatusFactory @AssistedInject constructor( if (currentTx is ExpressTransactionStateUM.ExchangeUM && currentTx.activeStatus == ExchangeStatus.Finished) { updateBalance(currentTx.toCryptoCurrency) } + val expressTxsToDisplay = expressTxs.filterNot { + when (it) { + is ExpressTransactionStateUM.ExchangeUM -> false + is ExpressTransactionStateUM.OnrampUM -> it.activeStatus.isHidden + } + }.toPersistentList() return state.copy( expressTxs = expressTxs, + expressTxsToDisplay = expressTxsToDisplay, bottomSheetConfig = currentTx?.let( ::updateStateWithExpressStatusBottomSheet, ) ?: config, diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/express/OnrampStatusFactory.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/express/OnrampStatusFactory.kt index eca24c7c13..3e2cbe8813 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/express/OnrampStatusFactory.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/express/OnrampStatusFactory.kt @@ -61,7 +61,7 @@ internal class OnrampStatusFactory @AssistedInject constructor( ifRight = { onrampTxs -> val transactions = onrampTransactionStateConverter.convertList(onrampTxs) transactions.clearHiddenTerminal() - transactions.filterNot { it.activeStatus.isHidden } + transactions }, ifLeft = { persistentListOf() }, ) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/TokenDetailsScreen.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/TokenDetailsScreen.kt index a22b97d642..a522838fe3 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/TokenDetailsScreen.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/TokenDetailsScreen.kt @@ -178,7 +178,7 @@ internal fun TokenDetailsScreen(state: TokenDetailsState, tokenMarketBlockCompon } expressTransactionsItems( - expressTxs = state.expressTxs, + expressTxs = state.expressTxsToDisplay, modifier = itemModifier, ) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt index 480de2e7f2..55d9d5ecb8 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt @@ -198,7 +198,6 @@ internal class TokenDetailsViewModel @Inject constructor( viewModel = this, deepLinks = listOf( BuyCurrencyDeepLink( - isOnrampFeatureEnabled = onrampFeatureToggles.isFeatureEnabled, onReceive = ::onBuyCurrencyDeepLink, ), ), @@ -336,6 +335,7 @@ internal class TokenDetailsViewModel @Inject constructor( expressTxStatusTaskScheduler.scheduleTask( viewModelScope, PeriodicTask( + isDelayFirst = false, delay = EXPRESS_STATUS_UPDATE_DELAY, task = { runCatching { @@ -805,7 +805,7 @@ internal class TokenDetailsViewModel @Inject constructor( } override fun onExpressTransactionClick(txId: String) { - val expressTxState = internalUiState.value.expressTxs.first { it.info.txId == txId } + val expressTxState = internalUiState.value.expressTxsToDisplay.first { it.info.txId == txId } internalUiState.value = expressStatusFactory.getStateWithExpressStatusBottomSheet(expressTxState) } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/deeplink/WalletDeepLinksHandler.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/deeplink/WalletDeepLinksHandler.kt index c9abd72ef6..d729196c4f 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/deeplink/WalletDeepLinksHandler.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/deeplink/WalletDeepLinksHandler.kt @@ -65,7 +65,6 @@ internal class WalletDeepLinksHandler @Inject constructor( if (onrampFeatureToggles.isFeatureEnabled || !userWallet.isMultiCurrency) { add( BuyCurrencyDeepLink( - isOnrampFeatureEnabled = onrampFeatureToggles.isFeatureEnabled, onReceive = { externalTxId -> scope.launch { onBuyCurrencyDeepLink(externalTxId, userWallet) } },