Updated on 2026-08-14
This commit is contained in:
parent
b77fdb2e3a
commit
3e9f54f2db
13 changed files with 76 additions and 8 deletions
|
|
@ -44,6 +44,7 @@ dependencies {
|
|||
|
||||
/** Feature modules */
|
||||
implementation(projects.features.pushNotifications.api)
|
||||
implementation(projects.features.pushNotificationSettings.api)
|
||||
|
||||
/** DI */
|
||||
implementation(deps.hilt.android)
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ internal class DefaultPushNotificationsBottomSheetComponent @AssistedInject cons
|
|||
config = bottomSheetConfig,
|
||||
) {
|
||||
PushNotificationsContent(
|
||||
isPushNotificationSettingsEnabled = model.isPushNotificationSettingsEnabled,
|
||||
onAllowClick = model::onAllowClick,
|
||||
onLaterClick = model::onLaterClick,
|
||||
onAllowPermission = model::onAllowPermission,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ internal class DefaultPushNotificationsComponent @AssistedInject constructor(
|
|||
NavigationBar3ButtonsScrim()
|
||||
|
||||
PushNotificationsScreen(
|
||||
isPushNotificationSettingsEnabled = model.isPushNotificationSettingsEnabled,
|
||||
onAllowClick = model::onAllowClick,
|
||||
onLaterClick = model::onLaterClick,
|
||||
onAllowPermission = model::onAllowPermission,
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.tangem.domain.settings.NeverToInitiallyAskPermissionUseCase
|
|||
import com.tangem.features.pushnotifications.api.PushNotificationsParams
|
||||
import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnalyticEvents
|
||||
import com.tangem.features.pushnotifications.api.utils.PUSH_PERMISSION
|
||||
import com.tangem.features.pushnotificationsettings.PushNotificationSettingsFeatureToggles
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
|
@ -29,9 +30,13 @@ internal class PushNotificationsModel @Inject constructor(
|
|||
private val appRouter: AppRouter,
|
||||
private val analyticHandler: AnalyticsEventHandler,
|
||||
private val notificationsRepository: NotificationsRepository,
|
||||
private val pushNotificationSettingsFeatureToggles: PushNotificationSettingsFeatureToggles,
|
||||
) : Model(), PushNotificationsClickIntents {
|
||||
|
||||
val params: PushNotificationsParams = paramsContainer.require()
|
||||
|
||||
val isPushNotificationSettingsEnabled: Boolean
|
||||
get() = pushNotificationSettingsFeatureToggles.isPushNotificationSettingsEnabled
|
||||
val source = when (params.source) {
|
||||
AppRoute.PushNotification.Source.Stories -> AnalyticsParam.ScreensSources.Stories
|
||||
AppRoute.PushNotification.Source.Main -> AnalyticsParam.ScreensSources.Main
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ internal fun PushNotificationsBottomSheet(config: TangemBottomSheetConfig, conte
|
|||
|
||||
@Composable
|
||||
internal fun PushNotificationsContent(
|
||||
isPushNotificationSettingsEnabled: Boolean,
|
||||
onAllowClick: () -> Unit,
|
||||
onLaterClick: () -> Unit,
|
||||
onAllowPermission: () -> Unit,
|
||||
|
|
@ -51,6 +52,17 @@ internal fun PushNotificationsContent(
|
|||
permission = PUSH_PERMISSION,
|
||||
)
|
||||
|
||||
val argumentTwoTitleRes = if (isPushNotificationSettingsEnabled) {
|
||||
R.string.user_push_notification_agreement_argument_two_title_v2
|
||||
} else {
|
||||
R.string.user_push_notification_agreement_argument_two_title
|
||||
}
|
||||
val argumentTwoSubtitleRes = if (isPushNotificationSettingsEnabled) {
|
||||
R.string.user_push_notification_agreement_argument_two_subtitle_v2
|
||||
} else {
|
||||
R.string.user_push_notification_agreement_argument_two_subtitle
|
||||
}
|
||||
|
||||
Column(modifier = Modifier.background(TangemTheme.colors.background.primary)) {
|
||||
ShowcaseContent(
|
||||
headerIconRes = R.drawable.ic_notification_56,
|
||||
|
|
@ -63,8 +75,8 @@ internal fun PushNotificationsContent(
|
|||
),
|
||||
ShowcaseItemModel(
|
||||
iconRes = R.drawable.ic_stars_24,
|
||||
title = resourceReference(R.string.user_push_notification_agreement_argument_two_title),
|
||||
subTitle = resourceReference(R.string.user_push_notification_agreement_argument_two_subtitle),
|
||||
title = resourceReference(argumentTwoTitleRes),
|
||||
subTitle = resourceReference(argumentTwoSubtitleRes),
|
||||
),
|
||||
),
|
||||
modifier = Modifier.padding(top = TangemTheme.dimens.spacing40),
|
||||
|
|
@ -95,6 +107,7 @@ private fun Preview_PushNotificationsBottomSheet() {
|
|||
),
|
||||
) {
|
||||
PushNotificationsContent(
|
||||
isPushNotificationSettingsEnabled = false,
|
||||
onAllowClick = {},
|
||||
onLaterClick = {},
|
||||
onAllowPermission = {},
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import kotlinx.collections.immutable.persistentListOf
|
|||
|
||||
@Composable
|
||||
internal fun PushNotificationsScreen(
|
||||
isPushNotificationSettingsEnabled: Boolean,
|
||||
onAllowClick: () -> Unit,
|
||||
onLaterClick: () -> Unit,
|
||||
onAllowPermission: () -> Unit,
|
||||
|
|
@ -25,6 +26,17 @@ internal fun PushNotificationsScreen(
|
|||
permission = PUSH_PERMISSION,
|
||||
)
|
||||
|
||||
val argumentTwoTitleRes = if (isPushNotificationSettingsEnabled) {
|
||||
R.string.user_push_notification_agreement_argument_two_title_v2
|
||||
} else {
|
||||
R.string.user_push_notification_agreement_argument_two_title
|
||||
}
|
||||
val argumentTwoSubtitleRes = if (isPushNotificationSettingsEnabled) {
|
||||
R.string.user_push_notification_agreement_argument_two_subtitle_v2
|
||||
} else {
|
||||
R.string.user_push_notification_agreement_argument_two_subtitle
|
||||
}
|
||||
|
||||
Showcase(
|
||||
headerIconRes = R.drawable.ic_notification_56,
|
||||
headerText = resourceReference(R.string.user_push_notification_agreement_header),
|
||||
|
|
@ -36,8 +48,8 @@ internal fun PushNotificationsScreen(
|
|||
),
|
||||
ShowcaseItemModel(
|
||||
iconRes = R.drawable.ic_stars_24,
|
||||
title = resourceReference(R.string.user_push_notification_agreement_argument_two_title),
|
||||
subTitle = resourceReference(R.string.user_push_notification_agreement_argument_two_subtitle),
|
||||
title = resourceReference(argumentTwoTitleRes),
|
||||
subTitle = resourceReference(argumentTwoSubtitleRes),
|
||||
),
|
||||
),
|
||||
primaryButton = ShowcaseButtonModel(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue