Updated on 2026-08-14
This commit is contained in:
parent
189ffd9927
commit
d327640e9f
10 changed files with 64 additions and 10 deletions
|
|
@ -365,7 +365,7 @@ internal class ChildFactory @Inject constructor(
|
||||||
is AppRoute.PushNotification -> {
|
is AppRoute.PushNotification -> {
|
||||||
createComponentChild(
|
createComponentChild(
|
||||||
context = context,
|
context = context,
|
||||||
params = Unit,
|
params = PushNotificationsComponent.Params.Route(AppRoute.Home),
|
||||||
componentFactory = pushNotificationsComponentFactory,
|
componentFactory = pushNotificationsComponentFactory,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ sealed class AnalyticsParam {
|
||||||
data object Onboarding : ScreensSources("Onboarding")
|
data object Onboarding : ScreensSources("Onboarding")
|
||||||
data object LongTap : ScreensSources("Long Tap")
|
data object LongTap : ScreensSources("Long Tap")
|
||||||
data object Markets : ScreensSources("Markets")
|
data object Markets : ScreensSources("Markets")
|
||||||
|
data object HotWallet : ScreensSources("Hot Wallet")
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class TxSentFrom(val value: String) {
|
sealed class TxSentFrom(val value: String) {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ android {
|
||||||
dependencies {
|
dependencies {
|
||||||
/** Api */
|
/** Api */
|
||||||
implementation(projects.features.hotWallet.api)
|
implementation(projects.features.hotWallet.api)
|
||||||
|
implementation(projects.features.pushNotifications.api)
|
||||||
|
|
||||||
/** Core modules */
|
/** Core modules */
|
||||||
implementation(projects.core.configToggles)
|
implementation(projects.core.configToggles)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.tangem.core.decompose.navigation.Router
|
||||||
import com.tangem.features.hotwallet.addexistingwallet.start.AddExistingWalletStartComponent
|
import com.tangem.features.hotwallet.addexistingwallet.start.AddExistingWalletStartComponent
|
||||||
import com.tangem.features.hotwallet.addexistingwallet.im.port.AddExistingWalletImportComponent
|
import com.tangem.features.hotwallet.addexistingwallet.im.port.AddExistingWalletImportComponent
|
||||||
import com.tangem.features.hotwallet.addexistingwallet.root.routing.AddExistingWalletRoute
|
import com.tangem.features.hotwallet.addexistingwallet.root.routing.AddExistingWalletRoute
|
||||||
|
import com.tangem.features.pushnotifications.api.PushNotificationsComponent
|
||||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
@ -20,6 +21,7 @@ internal class AddExistingWalletModel @Inject constructor(
|
||||||
|
|
||||||
val addExistingWalletStartModelCallbacks = AddExistingWalletStartModelCallbacks()
|
val addExistingWalletStartModelCallbacks = AddExistingWalletStartModelCallbacks()
|
||||||
val addExistingWalletImportModelCallbacks = AddExistingWalletImportModelCallbacks()
|
val addExistingWalletImportModelCallbacks = AddExistingWalletImportModelCallbacks()
|
||||||
|
val pushNotificationsComponentModelCallbacks = PushNotificationsComponentModelCallbacks()
|
||||||
|
|
||||||
val stackNavigation = StackNavigation<AddExistingWalletRoute>()
|
val stackNavigation = StackNavigation<AddExistingWalletRoute>()
|
||||||
|
|
||||||
|
|
@ -38,4 +40,10 @@ internal class AddExistingWalletModel @Inject constructor(
|
||||||
stackNavigation.pop()
|
stackNavigation.pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inner class PushNotificationsComponentModelCallbacks : PushNotificationsComponent.ModelCallbacks {
|
||||||
|
override fun onResult() {
|
||||||
|
// TODO [REDACTED_TASK_KEY]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,9 +5,12 @@ import com.tangem.core.ui.decompose.ComposableContentComponent
|
||||||
import com.tangem.features.hotwallet.addexistingwallet.root.AddExistingWalletModel
|
import com.tangem.features.hotwallet.addexistingwallet.root.AddExistingWalletModel
|
||||||
import com.tangem.features.hotwallet.addexistingwallet.start.AddExistingWalletStartComponent
|
import com.tangem.features.hotwallet.addexistingwallet.start.AddExistingWalletStartComponent
|
||||||
import com.tangem.features.hotwallet.addexistingwallet.im.port.AddExistingWalletImportComponent
|
import com.tangem.features.hotwallet.addexistingwallet.im.port.AddExistingWalletImportComponent
|
||||||
|
import com.tangem.features.pushnotifications.api.PushNotificationsComponent
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class AddExistingWalletChildFactory @Inject constructor() {
|
internal class AddExistingWalletChildFactory @Inject constructor(
|
||||||
|
private val pushNotificationsComponent: PushNotificationsComponent.Factory,
|
||||||
|
) {
|
||||||
|
|
||||||
fun createChild(
|
fun createChild(
|
||||||
route: AddExistingWalletRoute,
|
route: AddExistingWalletRoute,
|
||||||
|
|
@ -27,6 +30,12 @@ internal class AddExistingWalletChildFactory @Inject constructor() {
|
||||||
callbacks = model.addExistingWalletImportModelCallbacks,
|
callbacks = model.addExistingWalletImportModelCallbacks,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
is AddExistingWalletRoute.PushNotifications -> pushNotificationsComponent.create(
|
||||||
|
context = childContext,
|
||||||
|
params = PushNotificationsComponent.Params.Callbacks(
|
||||||
|
callbacks = model.pushNotificationsComponentModelCallbacks,
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,4 +10,7 @@ internal sealed class AddExistingWalletRoute : Route {
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object Import : AddExistingWalletRoute()
|
object Import : AddExistingWalletRoute()
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
object PushNotifications : AddExistingWalletRoute()
|
||||||
}
|
}
|
||||||
|
|
@ -16,4 +16,7 @@ dependencies {
|
||||||
implementation(projects.core.decompose)
|
implementation(projects.core.decompose)
|
||||||
implementation(projects.core.ui)
|
implementation(projects.core.ui)
|
||||||
implementation(projects.core.analytics.models)
|
implementation(projects.core.analytics.models)
|
||||||
|
|
||||||
|
/** Common */
|
||||||
|
implementation(projects.common.routing)
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,19 @@
|
||||||
package com.tangem.features.pushnotifications.api
|
package com.tangem.features.pushnotifications.api
|
||||||
|
|
||||||
|
import com.tangem.common.routing.AppRoute
|
||||||
import com.tangem.core.decompose.factory.ComponentFactory
|
import com.tangem.core.decompose.factory.ComponentFactory
|
||||||
import com.tangem.core.ui.decompose.ComposableContentComponent
|
import com.tangem.core.ui.decompose.ComposableContentComponent
|
||||||
|
|
||||||
interface PushNotificationsComponent : ComposableContentComponent {
|
interface PushNotificationsComponent : ComposableContentComponent {
|
||||||
|
|
||||||
interface Factory : ComponentFactory<Unit, PushNotificationsComponent>
|
interface Factory : ComponentFactory<Params, PushNotificationsComponent>
|
||||||
|
|
||||||
|
interface ModelCallbacks {
|
||||||
|
fun onResult()
|
||||||
|
}
|
||||||
|
|
||||||
|
sealed class Params {
|
||||||
|
data class Callbacks(val callbacks: ModelCallbacks) : Params()
|
||||||
|
data class Route(val route: AppRoute) : Params()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ import dagger.assisted.AssistedInject
|
||||||
|
|
||||||
internal class DefaultPushNotificationsComponent @AssistedInject constructor(
|
internal class DefaultPushNotificationsComponent @AssistedInject constructor(
|
||||||
@Assisted appComponentContext: AppComponentContext,
|
@Assisted appComponentContext: AppComponentContext,
|
||||||
@Assisted params: Unit,
|
@Assisted params: PushNotificationsComponent.Params,
|
||||||
) : PushNotificationsComponent, AppComponentContext by appComponentContext {
|
) : PushNotificationsComponent, AppComponentContext by appComponentContext {
|
||||||
|
|
||||||
private val model: PushNotificationsModel = getOrCreateModel(params)
|
private val model: PushNotificationsModel = getOrCreateModel(params)
|
||||||
|
|
@ -41,6 +41,9 @@ internal class DefaultPushNotificationsComponent @AssistedInject constructor(
|
||||||
|
|
||||||
@AssistedFactory
|
@AssistedFactory
|
||||||
interface Factory : PushNotificationsComponent.Factory {
|
interface Factory : PushNotificationsComponent.Factory {
|
||||||
override fun create(context: AppComponentContext, params: Unit): DefaultPushNotificationsComponent
|
override fun create(
|
||||||
|
context: AppComponentContext,
|
||||||
|
params: PushNotificationsComponent.Params,
|
||||||
|
): DefaultPushNotificationsComponent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
package com.tangem.features.pushnotifications.impl.model
|
package com.tangem.features.pushnotifications.impl.model
|
||||||
|
|
||||||
import androidx.compose.runtime.Stable
|
import androidx.compose.runtime.Stable
|
||||||
import com.tangem.common.routing.AppRoute
|
|
||||||
import com.tangem.common.routing.AppRouter
|
import com.tangem.common.routing.AppRouter
|
||||||
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||||
import com.tangem.core.analytics.models.AnalyticsParam
|
import com.tangem.core.analytics.models.AnalyticsParam
|
||||||
import com.tangem.core.decompose.di.ModelScoped
|
import com.tangem.core.decompose.di.ModelScoped
|
||||||
import com.tangem.core.decompose.model.Model
|
import com.tangem.core.decompose.model.Model
|
||||||
|
import com.tangem.core.decompose.model.ParamsContainer
|
||||||
import com.tangem.domain.notifications.toggles.NotificationsFeatureToggles
|
import com.tangem.domain.notifications.toggles.NotificationsFeatureToggles
|
||||||
import com.tangem.domain.settings.NeverRequestPermissionUseCase
|
import com.tangem.domain.settings.NeverRequestPermissionUseCase
|
||||||
import com.tangem.domain.settings.NeverToInitiallyAskPermissionUseCase
|
import com.tangem.domain.settings.NeverToInitiallyAskPermissionUseCase
|
||||||
|
import com.tangem.features.pushnotifications.api.PushNotificationsComponent
|
||||||
import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnalyticEvents
|
import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnalyticEvents
|
||||||
import com.tangem.features.pushnotifications.api.utils.PUSH_PERMISSION
|
import com.tangem.features.pushnotifications.api.utils.PUSH_PERMISSION
|
||||||
import com.tangem.features.pushnotifications.impl.presentation.state.PushNotificationsUM
|
import com.tangem.features.pushnotifications.impl.presentation.state.PushNotificationsUM
|
||||||
|
|
@ -21,15 +22,19 @@ import javax.inject.Inject
|
||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
@ModelScoped
|
@ModelScoped
|
||||||
|
@Suppress("LongParameterList")
|
||||||
internal class PushNotificationsModel @Inject constructor(
|
internal class PushNotificationsModel @Inject constructor(
|
||||||
|
paramsContainer: ParamsContainer,
|
||||||
override val dispatchers: CoroutineDispatcherProvider,
|
override val dispatchers: CoroutineDispatcherProvider,
|
||||||
private val neverRequestPermissionUseCase: NeverRequestPermissionUseCase,
|
private val neverRequestPermissionUseCase: NeverRequestPermissionUseCase,
|
||||||
private val neverToInitiallyAskPermissionUseCase: NeverToInitiallyAskPermissionUseCase,
|
private val neverToInitiallyAskPermissionUseCase: NeverToInitiallyAskPermissionUseCase,
|
||||||
private val appRouter: AppRouter,
|
private val appRouter: AppRouter,
|
||||||
private val analyticHandler: AnalyticsEventHandler,
|
private val analyticHandler: AnalyticsEventHandler,
|
||||||
private val notificationsFeatureToggles: NotificationsFeatureToggles,
|
notificationsFeatureToggles: NotificationsFeatureToggles,
|
||||||
) : Model(), PushNotificationsClickIntents {
|
) : Model(), PushNotificationsClickIntents {
|
||||||
|
|
||||||
|
private val params: PushNotificationsComponent.Params = paramsContainer.require()
|
||||||
|
|
||||||
private val _state = MutableStateFlow(
|
private val _state = MutableStateFlow(
|
||||||
PushNotificationsUM(
|
PushNotificationsUM(
|
||||||
showInfoAboutNotifications = notificationsFeatureToggles.isNotificationsEnabled,
|
showInfoAboutNotifications = notificationsFeatureToggles.isNotificationsEnabled,
|
||||||
|
|
@ -51,7 +56,7 @@ internal class PushNotificationsModel @Inject constructor(
|
||||||
modelScope.launch {
|
modelScope.launch {
|
||||||
neverRequestPermissionUseCase(PUSH_PERMISSION)
|
neverRequestPermissionUseCase(PUSH_PERMISSION)
|
||||||
neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)
|
neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)
|
||||||
appRouter.push(AppRoute.Home)
|
onResult()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,7 +67,7 @@ internal class PushNotificationsModel @Inject constructor(
|
||||||
modelScope.launch {
|
modelScope.launch {
|
||||||
neverRequestPermissionUseCase(PUSH_PERMISSION)
|
neverRequestPermissionUseCase(PUSH_PERMISSION)
|
||||||
neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)
|
neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)
|
||||||
appRouter.push(AppRoute.Home)
|
onResult()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,7 +78,18 @@ internal class PushNotificationsModel @Inject constructor(
|
||||||
modelScope.launch {
|
modelScope.launch {
|
||||||
neverRequestPermissionUseCase(PUSH_PERMISSION)
|
neverRequestPermissionUseCase(PUSH_PERMISSION)
|
||||||
neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)
|
neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)
|
||||||
appRouter.push(AppRoute.Home)
|
onResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun onResult() {
|
||||||
|
when (params) {
|
||||||
|
is PushNotificationsComponent.Params.Callbacks -> {
|
||||||
|
params.callbacks.onResult()
|
||||||
|
}
|
||||||
|
is PushNotificationsComponent.Params.Route -> {
|
||||||
|
appRouter.push(params.route)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue