Updated on 2026-08-14

This commit is contained in:
Tangem 2025-08-19 13:33:32 +05:00
parent ad19b86697
commit 7d0121c40c
7 changed files with 38 additions and 7 deletions

View file

@ -384,6 +384,7 @@ internal class ChildFactory @Inject constructor(
context = context,
params = PushNotificationsParams(
modelCallbacks = PushNotificationsModelCallbacksStub(),
source = route.source,
),
componentFactory = pushNotificationsComponentFactory,
)

View file

@ -1,6 +1,7 @@
package com.tangem.common.routing
import android.os.Bundle
import com.tangem.common.routing.AppRoute.ManageTokens.Source
import com.tangem.common.routing.bundle.RouteBundleParams
import com.tangem.common.routing.bundle.bundle
import com.tangem.common.routing.entity.SerializableIntent
@ -185,7 +186,15 @@ sealed class AppRoute(val path: String) : Route {
) : AppRoute(path = "/staking/${userWalletId.stringValue}/${cryptoCurrencyId.value}/$yieldId")
@Serializable
data object PushNotification : AppRoute(path = "/push_notification")
data class PushNotification(
val source: Source,
) : AppRoute(path = "/push_notification") {
enum class Source {
Stories,
Main,
Onboarding,
}
}
@Serializable
data class WalletSettings(

View file

@ -1,5 +1,6 @@
package com.tangem.features.hotwallet.addexistingwallet.root.routing
import com.tangem.common.routing.AppRoute
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.ui.decompose.ComposableContentComponent
import com.tangem.features.hotwallet.addexistingwallet.im.port.AddExistingWalletImportComponent
@ -51,6 +52,7 @@ internal class AddExistingWalletChildFactory @Inject constructor(
context = childContext,
params = PushNotificationsParams(
modelCallbacks = PushNotificationsModelCallbacksStub(),
source = AppRoute.PushNotification.Source.Onboarding,
),
)
AddExistingWalletRoute.SetupFinished -> MobileWalletSetupFinishedComponent(

View file

@ -1,6 +1,9 @@
package com.tangem.features.pushnotifications.api
import com.tangem.common.routing.AppRoute
data class PushNotificationsParams(
val isBottomSheet: Boolean = false,
val modelCallbacks: PushNotificationsModelCallbacks,
val source: AppRoute.PushNotification.Source,
)

View file

@ -53,6 +53,15 @@ sealed class PushNotificationAnalyticEvents(
),
)
data class NotificationsScreenOpened(
val source: AnalyticsParam.ScreensSources,
) : PushNotificationAnalyticEvents(
event = "Push Notification Screen Opened",
params = mapOf(
AnalyticsParam.SOURCE to source.value,
),
)
data class NotificationsEnabled(
val isEnabled: Boolean,
) : PushNotificationAnalyticEvents(

View file

@ -37,6 +37,11 @@ internal class PushNotificationsModel @Inject constructor(
) : Model(), PushNotificationsClickIntents {
val params: PushNotificationsParams = paramsContainer.require()
val source = when (params.source) {
AppRoute.PushNotification.Source.Stories -> AnalyticsParam.ScreensSources.Stories
AppRoute.PushNotification.Source.Main -> AnalyticsParam.ScreensSources.Main
AppRoute.PushNotification.Source.Onboarding -> AnalyticsParam.ScreensSources.Onboarding
}
private val _state = MutableStateFlow(
PushNotificationsUM(
@ -44,6 +49,10 @@ internal class PushNotificationsModel @Inject constructor(
),
)
init {
analyticHandler.send(PushNotificationAnalyticEvents.NotificationsScreenOpened(source))
}
val state = _state.asStateFlow()
override fun onAllowClick() {
@ -52,9 +61,7 @@ internal class PushNotificationsModel @Inject constructor(
notificationsRepository.setUserAllowToSubscribeOnPushNotifications(true)
}
}
analyticHandler.send(
PushNotificationAnalyticEvents.ButtonAllow(AnalyticsParam.ScreensSources.Stories),
)
analyticHandler.send(PushNotificationAnalyticEvents.ButtonAllow(source))
}
override fun onLaterClick() {
@ -63,9 +70,7 @@ internal class PushNotificationsModel @Inject constructor(
notificationsRepository.setUserAllowToSubscribeOnPushNotifications(false)
}
}
analyticHandler.send(
PushNotificationAnalyticEvents.ButtonLater(AnalyticsParam.ScreensSources.Stories),
)
analyticHandler.send(PushNotificationAnalyticEvents.ButtonLater(source))
modelScope.launch {
neverRequestPermissionUseCase(PUSH_PERMISSION)
neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)

View file

@ -7,6 +7,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.arkivanov.decompose.extensions.compose.subscribeAsState
import com.arkivanov.decompose.router.slot.childSlot
import com.arkivanov.decompose.router.slot.dismiss
import com.tangem.common.routing.AppRoute
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.decompose.context.child
import com.tangem.core.decompose.context.childByContext
@ -74,6 +75,7 @@ internal class WalletComponent @AssistedInject constructor(
params = PushNotificationsParams(
isBottomSheet = true,
modelCallbacks = model.askForPushNotificationsModelCallbacks,
source = AppRoute.PushNotification.Source.Main,
),
)
}