Updated on 2026-08-14
This commit is contained in:
parent
135a8a22f0
commit
142e57868d
3 changed files with 18 additions and 8 deletions
|
|
@ -31,9 +31,9 @@ import com.tangem.common.routing.entity.SerializableIntent
|
|||
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||
import com.tangem.core.decompose.context.AppComponentContext
|
||||
import com.tangem.core.decompose.di.RootAppComponentContext
|
||||
import com.tangem.core.deeplink.DEEPLINK_KEY
|
||||
import com.tangem.core.deeplink.DeepLinksRegistry
|
||||
import com.tangem.core.deeplink.WEBLINK_KEY
|
||||
import com.tangem.core.deeplink.converter.PayloadToDeeplinkConverter
|
||||
import com.tangem.core.navigation.email.EmailSender
|
||||
import com.tangem.core.navigation.url.UrlOpener
|
||||
import com.tangem.core.ui.UiDependencies
|
||||
|
|
@ -490,7 +490,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder {
|
|||
|
||||
private fun handleDeepLink(intent: Intent, isFromOnNewIntent: Boolean) {
|
||||
if (routingFeatureToggle.isDeepLinkNavigationEnabled) {
|
||||
val deepLinkExtras = intent.getStringExtra(DEEPLINK_KEY)?.toUri()
|
||||
val deepLinkExtras = PayloadToDeeplinkConverter.convertBundle(intent.extras)?.toUri()
|
||||
val webLink = intent.getStringExtra(WEBLINK_KEY)
|
||||
|
||||
val receivedDeepLink = intent.data ?: deepLinkExtras
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ import coil.executeBlocking
|
|||
import coil.request.ImageRequest
|
||||
import com.google.firebase.messaging.FirebaseMessagingService
|
||||
import com.google.firebase.messaging.RemoteMessage
|
||||
import com.tangem.core.deeplink.DEEPLINK_KEY
|
||||
import com.tangem.core.deeplink.WEBLINK_KEY
|
||||
import com.tangem.core.deeplink.converter.PayloadToDeeplinkConverter
|
||||
import com.tangem.domain.common.LogConfig
|
||||
import com.tangem.tap.MainActivity
|
||||
import com.tangem.tap.common.images.createCoilImageLoader
|
||||
|
|
@ -38,11 +35,11 @@ internal class TangemPushNotificationService : FirebaseMessagingService() {
|
|||
|
||||
val notification = message.notification ?: return
|
||||
val channelId = notification.channelId ?: TANGEM_CHANNEL_ID
|
||||
val deeplink = PayloadToDeeplinkConverter.convert(message.data)
|
||||
|
||||
val intent = Intent(applicationContext, MainActivity::class.java).apply {
|
||||
putExtra(DEEPLINK_KEY, deeplink)
|
||||
putExtra(WEBLINK_KEY, message.data[WEBLINK_KEY])
|
||||
message.data.forEach {
|
||||
putExtra(it.key, it.value)
|
||||
}
|
||||
putExtra(OnPushClickedIntentHandler.OPENED_FROM_GCM_PUSH, true)
|
||||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.deeplink.converter
|
||||
|
||||
import android.os.Bundle
|
||||
import com.tangem.common.routing.DeepLinkRoute
|
||||
import com.tangem.common.routing.DeepLinkScheme
|
||||
import com.tangem.core.deeplink.DEEPLINK_KEY
|
||||
|
|
@ -22,6 +23,18 @@ object PayloadToDeeplinkConverter : Converter<Map<String, String>, String?> {
|
|||
}
|
||||
}
|
||||
|
||||
fun convertBundle(bundle: Bundle?): String? {
|
||||
if (bundle == null) return null
|
||||
val bundleDataMap = mutableMapOf<String, String>()
|
||||
for (key in bundle.keySet()) {
|
||||
val value = bundle.getString(key)
|
||||
if (value != null) {
|
||||
bundleDataMap[key] = value
|
||||
}
|
||||
}
|
||||
return convert(bundleDataMap)
|
||||
}
|
||||
|
||||
@Suppress("ReturnCount")
|
||||
private fun buildNotificationDeeplink(payload: Map<String, String>): String? {
|
||||
val type = payload[TYPE_KEY] ?: return null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue