Updated on 2026-08-14

This commit is contained in:
Tangem 2025-06-06 15:32:48 +04:00
parent 60c861b9e7
commit af04a09095
4 changed files with 30 additions and 1 deletions

View file

@ -43,4 +43,22 @@ sealed class PushNotificationAnalyticEvents(
AnalyticsParam.STATE to if (isAllowed) "Allow" else "Cancel",
),
)
data class NotificationOpened(
val type: String,
) : PushNotificationAnalyticEvents(
event = "Push Notification Opened",
params = mapOf(
AnalyticsParam.TYPE to type,
),
)
data class NotificationsEnabled(
val isEnabled: Boolean,
) : PushNotificationAnalyticEvents(
event = "Push Toggle Clicked",
params = mapOf(
AnalyticsParam.STATE to if (isEnabled) "On" else "Off",
),
)
}

View file

@ -99,6 +99,7 @@ dependencies {
implementation(projects.features.staking.api)
implementation(projects.features.markets.api)
implementation(projects.features.onramp.api)
implementation(projects.features.pushNotifications.api)
implementation(projects.features.swap.api)
implementation(projects.features.txhistory.api)

View file

@ -3,6 +3,7 @@ package com.tangem.feature.tokendetails.deeplink
import arrow.core.getOrElse
import com.tangem.common.routing.AppRoute
import com.tangem.common.routing.AppRouter
import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.core.deeplink.DeeplinkConst.NETWORK_ID_KEY
import com.tangem.core.deeplink.DeeplinkConst.TOKEN_ID_KEY
import com.tangem.core.deeplink.DeeplinkConst.TYPE_KEY
@ -12,6 +13,7 @@ import com.tangem.domain.tokens.FetchCurrencyStatusUseCase
import com.tangem.domain.tokens.GetCryptoCurrenciesUseCase
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.domain.wallets.usecase.GetSelectedWalletSyncUseCase
import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnalyticEvents
import com.tangem.features.tokendetails.deeplink.TokenDetailsDeepLinkHandler
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
@ -29,6 +31,7 @@ internal class DefaultTokenDetailsDeepLinkHandler @AssistedInject constructor(
private val getSelectedWalletSyncUseCase: GetSelectedWalletSyncUseCase,
private val getCryptoCurrenciesUseCase: GetCryptoCurrenciesUseCase,
private val fetchCurrencyStatusUseCase: FetchCurrencyStatusUseCase,
private val analyticsEventHandler: AnalyticsEventHandler,
) : TokenDetailsDeepLinkHandler {
init {
@ -70,6 +73,8 @@ internal class DefaultTokenDetailsDeepLinkHandler @AssistedInject constructor(
return@launch
}
analyticsEventHandler.send(PushNotificationAnalyticEvents.NotificationOpened(type.name))
appRouter.push(
AppRoute.CurrencyDetails(
userWalletId = userWalletId,

View file

@ -37,6 +37,7 @@ import com.tangem.feature.walletsettings.entity.WalletSettingsUM
import com.tangem.feature.walletsettings.impl.R
import com.tangem.feature.walletsettings.utils.ItemsBuilder
import com.tangem.features.nft.NFTFeatureToggles
import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnalyticEvents
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf
@ -226,6 +227,7 @@ internal class WalletSettingsModel @Inject constructor(
}
} else {
setNotificationsEnabledUseCase(params.userWalletId, false)
analyticsEventHandler.send(PushNotificationAnalyticEvents.NotificationsEnabled(false))
}
}
}
@ -239,6 +241,7 @@ internal class WalletSettingsModel @Inject constructor(
}
private fun onPushNotificationPermissionGranted(isGranted: Boolean) {
analyticsEventHandler.send(PushNotificationAnalyticEvents.PermissionStatus(isGranted))
state.update { value ->
value.copy(
requestPushNotificationsPermission = false,
@ -246,7 +249,9 @@ internal class WalletSettingsModel @Inject constructor(
}
if (isGranted) {
modelScope.launch {
setNotificationsEnabledUseCase(params.userWalletId, true)
setNotificationsEnabledUseCase(params.userWalletId, true).onRight {
analyticsEventHandler.send(PushNotificationAnalyticEvents.NotificationsEnabled(true))
}
}
} else {
val message = DialogMessage(