diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b9e46866c1..21808cc1b9 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -142,6 +142,17 @@
android:scheme="tangem" />
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/tangem/tap/common/pushes/TangemPushNotificationService.kt b/app/src/main/java/com/tangem/tap/common/pushes/TangemPushNotificationService.kt
index 9bdca56b66..c8dc6dda61 100644
--- a/app/src/main/java/com/tangem/tap/common/pushes/TangemPushNotificationService.kt
+++ b/app/src/main/java/com/tangem/tap/common/pushes/TangemPushNotificationService.kt
@@ -5,18 +5,19 @@ import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Intent
+import android.content.Intent.ACTION_VIEW
import android.graphics.Bitmap
import android.net.Uri
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.toBitmap
+import androidx.core.net.toUri
import coil.executeBlocking
import coil.request.ImageRequest
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import com.tangem.domain.common.LogConfig
-import com.tangem.tap.MainActivity
import com.tangem.tap.common.images.createCoilImageLoader
import com.tangem.tap.features.intentHandler.handlers.OnPushClickedIntentHandler
import com.tangem.wallet.R
@@ -36,10 +37,11 @@ internal class TangemPushNotificationService : FirebaseMessagingService() {
val notification = message.notification ?: return
val channelId = notification.channelId ?: TANGEM_CHANNEL_ID
- // TODO refactoring: [REDACTED_JIRA]
- val intent = Intent(applicationContext, MainActivity::class.java)
- intent.putExtra(OnPushClickedIntentHandler.OPENED_FROM_GCM_PUSH, true)
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
+ val intent = Intent(ACTION_VIEW).apply {
+ data = message.data[DEEPLINK_KEY]?.toUri()
+ putExtra(OnPushClickedIntentHandler.OPENED_FROM_GCM_PUSH, true)
+ addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
+ }
val pendingIntent = PendingIntent.getActivity(
/* context = */ this,
/* requestCode = */ PUSH_NOTIFICATION_REQUEST_CODE,
@@ -101,5 +103,7 @@ internal class TangemPushNotificationService : FirebaseMessagingService() {
private companion object {
const val TANGEM_CHANNEL_ID = "Tangem General" // General channel for notifications
const val PUSH_NOTIFICATION_REQUEST_CODE = 123
+
+ const val DEEPLINK_KEY = "deeplink"
}
}
\ No newline at end of file
diff --git a/core/deep-links/global/src/main/kotlin/com/tangem/core/deeplink/global/ReferralDeepLink.kt b/core/deep-links/global/src/main/kotlin/com/tangem/core/deeplink/global/ReferralDeepLink.kt
new file mode 100644
index 0000000000..763a6d80f7
--- /dev/null
+++ b/core/deep-links/global/src/main/kotlin/com/tangem/core/deeplink/global/ReferralDeepLink.kt
@@ -0,0 +1,13 @@
+package com.tangem.core.deeplink.global
+
+import com.tangem.core.deeplink.DeepLink
+
+class ReferralDeepLink(
+ val onReceive: () -> Unit,
+) : DeepLink(shouldHandleDelayed = true) {
+ override val uri: String = "tangem://referral"
+
+ override fun onReceive(params: Map) {
+ onReceive()
+ }
+}
\ No newline at end of file
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 a0b28f06fd..75075d1d24 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
@@ -6,6 +6,7 @@ import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.core.deeplink.DeepLink
import com.tangem.core.deeplink.DeepLinksRegistry
import com.tangem.core.deeplink.global.BuyCurrencyDeepLink
+import com.tangem.core.deeplink.global.ReferralDeepLink
import com.tangem.core.deeplink.global.SellCurrencyDeepLink
import com.tangem.domain.tokens.GetCryptoCurrencyUseCase
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent
@@ -54,6 +55,7 @@ internal class WalletDeepLinksHandler @Inject constructor(
)
return buildList {
+ addReferralDeepLink(userWallet.walletId)
add(sellCurrencyDeepLink)
if (onrampFeatureToggles.isFeatureEnabled || !userWallet.isMultiCurrency) {
add(
@@ -95,4 +97,16 @@ internal class WalletDeepLinksHandler @Inject constructor(
analyticsEventHandler.send(TokenScreenAnalyticsEvent.Bought(cryptoCurrency.symbol))
}
}
+
+ private fun MutableList.addReferralDeepLink(userWalletId: UserWalletId) {
+ add(
+ ReferralDeepLink(
+ onReceive = {
+ router.push(
+ AppRoute.ReferralProgram(userWalletId = userWalletId),
+ )
+ },
+ ),
+ )
+ }
}
\ No newline at end of file