diff --git a/app/src/main/java/com/tangem/tap/routing/utils/DeepLinkFactory.kt b/app/src/main/java/com/tangem/tap/routing/utils/DeepLinkFactory.kt index d749eabc93..45bde26900 100644 --- a/app/src/main/java/com/tangem/tap/routing/utils/DeepLinkFactory.kt +++ b/app/src/main/java/com/tangem/tap/routing/utils/DeepLinkFactory.kt @@ -93,27 +93,27 @@ internal class DeepLinkFactory @Inject constructor( } private fun handleTangemDeepLinks(deeplinkUri: Uri, coroutineScope: CoroutineScope) { - val params = getParams(deeplinkUri) + val queryParams = getQueryParams(deeplinkUri) when (deeplinkUri.host) { - DeepLinkRoute.Onramp.host -> onrampDeepLink.create(coroutineScope, params) - DeepLinkRoute.Sell.host -> sellDeepLink.create(coroutineScope, params) + DeepLinkRoute.Onramp.host -> onrampDeepLink.create(coroutineScope, queryParams) + DeepLinkRoute.Sell.host -> sellDeepLink.create(coroutineScope, queryParams) DeepLinkRoute.Buy.host -> buyDeepLink.create(coroutineScope) DeepLinkRoute.Referral.host -> referralDeepLink.create() DeepLinkRoute.Wallet.host -> walletDeepLink.create() - DeepLinkRoute.TokenDetails.host -> tokenDetailsDeepLink.create(coroutineScope, params) + DeepLinkRoute.TokenDetails.host -> tokenDetailsDeepLink.create(coroutineScope, queryParams) else -> { Timber.i( """ No match found for deep link |- Received URI: $deeplinkUri - |- With params: $params + |- With params: $queryParams """.trimIndent(), ) } } } - private fun getParams(uri: Uri): Map { + private fun getQueryParams(uri: Uri): Map { val params = mutableMapOf() uri.queryParameterNames.forEach { paramName -> diff --git a/features/onramp/api/src/main/kotlin/com/tangem/features/onramp/deeplink/OnrampDeepLink.kt b/features/onramp/api/src/main/kotlin/com/tangem/features/onramp/deeplink/OnrampDeepLink.kt index e590b31392..8a45fc89ef 100644 --- a/features/onramp/api/src/main/kotlin/com/tangem/features/onramp/deeplink/OnrampDeepLink.kt +++ b/features/onramp/api/src/main/kotlin/com/tangem/features/onramp/deeplink/OnrampDeepLink.kt @@ -15,6 +15,6 @@ abstract class OnrampDeepLink : DeepLink() { interface OnrampDeepLinkHandler { interface Factory { - fun create(coroutineScope: CoroutineScope, params: Map): OnrampDeepLinkHandler + fun create(coroutineScope: CoroutineScope, queryParams: Map): OnrampDeepLinkHandler } } \ No newline at end of file diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/deeplink/DefaultOnrampDeepLinkHandler.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/deeplink/DefaultOnrampDeepLinkHandler.kt index 47b4d78b20..035c32ef13 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/deeplink/DefaultOnrampDeepLinkHandler.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/deeplink/DefaultOnrampDeepLinkHandler.kt @@ -12,14 +12,14 @@ import timber.log.Timber internal class DefaultOnrampDeepLinkHandler @AssistedInject constructor( @Assisted scope: CoroutineScope, - @Assisted params: Map, + @Assisted queryParams: Map, appRouter: AppRouter, onrampSuccessScreenTrigger: OnrampSuccessScreenTrigger, ) : OnrampDeepLinkHandler { init { - val txId = params[TX_ID_KEY] - val result = OnrampRedirectResult.getResult(params[RESULT_KEY]) + val txId = queryParams[TX_ID_KEY] + val result = OnrampRedirectResult.getResult(queryParams[RESULT_KEY]) when { !txId.isNullOrEmpty() -> { @@ -39,7 +39,7 @@ internal class DefaultOnrampDeepLinkHandler @AssistedInject constructor( Timber.e( """ Invalid parameters for ONRAMP deeplink - |- Params: $params + |- Params: $queryParams """.trimIndent(), ) } @@ -48,7 +48,10 @@ internal class DefaultOnrampDeepLinkHandler @AssistedInject constructor( @AssistedFactory interface Factory : OnrampDeepLinkHandler.Factory { - override fun create(coroutineScope: CoroutineScope, params: Map): DefaultOnrampDeepLinkHandler + override fun create( + coroutineScope: CoroutineScope, + queryParams: Map, + ): DefaultOnrampDeepLinkHandler } private companion object { diff --git a/features/send-v2/api/src/main/java/com/tangem/features/send/v2/api/deeplink/SellDeepLinkHandler.kt b/features/send-v2/api/src/main/java/com/tangem/features/send/v2/api/deeplink/SellDeepLinkHandler.kt index d645fff429..32d263693a 100644 --- a/features/send-v2/api/src/main/java/com/tangem/features/send/v2/api/deeplink/SellDeepLinkHandler.kt +++ b/features/send-v2/api/src/main/java/com/tangem/features/send/v2/api/deeplink/SellDeepLinkHandler.kt @@ -5,6 +5,6 @@ import kotlinx.coroutines.CoroutineScope interface SellDeepLinkHandler { interface Factory { - fun create(coroutineScope: CoroutineScope, params: Map): SellDeepLinkHandler + fun create(coroutineScope: CoroutineScope, queryParams: Map): SellDeepLinkHandler } } \ No newline at end of file diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/deeplink/DefaultSellDeepLinkHandler.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/deeplink/DefaultSellDeepLinkHandler.kt index e86282c818..49aeba8204 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/deeplink/DefaultSellDeepLinkHandler.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/deeplink/DefaultSellDeepLinkHandler.kt @@ -16,18 +16,18 @@ import timber.log.Timber @Suppress("ComplexCondition") internal class DefaultSellDeepLinkHandler @AssistedInject constructor( @Assisted scope: CoroutineScope, - @Assisted params: Map, + @Assisted queryParams: Map, appRouter: AppRouter, getSelectedWalletSyncUseCase: GetSelectedWalletSyncUseCase, getCryptoCurrencyUseCase: GetCryptoCurrencyUseCase, ) : SellDeepLinkHandler { init { - val currencyId = params[CURRENCY_ID_KEY] - val transactionId = params[TRANSACTION_ID_KEY] - val amount = params[AMOUNT_KEY] - val destinationAddress = params[DESTINATION_ADDRESS_KEY] - val memo = params[MEMO_KEY] + val currencyId = queryParams[CURRENCY_ID_KEY] + val transactionId = queryParams[TRANSACTION_ID_KEY] + val amount = queryParams[AMOUNT_KEY] + val destinationAddress = queryParams[DESTINATION_ADDRESS_KEY] + val memo = queryParams[MEMO_KEY] // It is okay here, we are navigating from outside, and there is no other way to getting UserWallet getSelectedWalletSyncUseCase() @@ -42,7 +42,7 @@ internal class DefaultSellDeepLinkHandler @AssistedInject constructor( Timber.e( """ Invalid parameters for SELL deeplink - |- Params: $params + |- Params: $queryParams """.trimIndent(), ) return@fold @@ -71,7 +71,10 @@ internal class DefaultSellDeepLinkHandler @AssistedInject constructor( @AssistedFactory interface Factory : SellDeepLinkHandler.Factory { - override fun create(coroutineScope: CoroutineScope, params: Map): DefaultSellDeepLinkHandler + override fun create( + coroutineScope: CoroutineScope, + queryParams: Map, + ): DefaultSellDeepLinkHandler } private companion object { diff --git a/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/deeplink/TokenDetailsDeepLinkHandler.kt b/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/deeplink/TokenDetailsDeepLinkHandler.kt index 5510648e3f..52b739b46c 100644 --- a/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/deeplink/TokenDetailsDeepLinkHandler.kt +++ b/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/deeplink/TokenDetailsDeepLinkHandler.kt @@ -5,6 +5,6 @@ import kotlinx.coroutines.CoroutineScope interface TokenDetailsDeepLinkHandler { interface Factory { - fun create(coroutineScope: CoroutineScope, params: Map): TokenDetailsDeepLinkHandler + fun create(coroutineScope: CoroutineScope, queryParams: Map): TokenDetailsDeepLinkHandler } } \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/DefaultTokenDetailsDeepLinkHandler.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/DefaultTokenDetailsDeepLinkHandler.kt index eaf2d83527..9a11dba923 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/DefaultTokenDetailsDeepLinkHandler.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/DefaultTokenDetailsDeepLinkHandler.kt @@ -16,8 +16,8 @@ import kotlinx.coroutines.launch import timber.log.Timber internal class DefaultTokenDetailsDeepLinkHandler @AssistedInject constructor( - @Assisted private val params: Map, @Assisted private val scope: CoroutineScope, + @Assisted private val queryParams: Map, private val appRouter: AppRouter, private val getSelectedWalletSyncUseCase: GetSelectedWalletSyncUseCase, private val getCryptoCurrenciesUseCase: GetCryptoCurrenciesUseCase, @@ -29,7 +29,7 @@ internal class DefaultTokenDetailsDeepLinkHandler @AssistedInject constructor( private fun handleDeepLink() { // It is okay here, we are navigating from outside, and there is no other way to getting UserWallet - val userWalletId = params[WALLET_ID_KEY]?.let(::UserWalletId) + val userWalletId = queryParams[WALLET_ID_KEY]?.let(::UserWalletId) ?: getSelectedWalletSyncUseCase().getOrNull()?.walletId if (userWalletId == null) { @@ -37,9 +37,9 @@ internal class DefaultTokenDetailsDeepLinkHandler @AssistedInject constructor( return } - val networkId = params[NETWORK_ID_KEY] - val tokenId = params[TOKEN_ID_KEY] - val type = NotificationType.getType(params[TYPE_KEY]) + val networkId = queryParams[NETWORK_ID_KEY] + val tokenId = queryParams[TOKEN_ID_KEY] + val type = NotificationType.getType(queryParams[TYPE_KEY]) if (type == NotificationType.Promo) { scope.launch { @@ -75,7 +75,7 @@ internal class DefaultTokenDetailsDeepLinkHandler @AssistedInject constructor( interface Factory : TokenDetailsDeepLinkHandler.Factory { override fun create( coroutineScope: CoroutineScope, - params: Map, + queryParams: Map, ): DefaultTokenDetailsDeepLinkHandler }