diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index 79c00174e1..c0aae1035e 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -1099,6 +1099,7 @@ Use %s or scan a card/ring to have access to your wallet Connection failed: This dApp uses Wallet Connect version 1.0, which is not supported. Please ensure the dApp supports Wallet Connect version 2.0 to connect successfully. Stay up to date with the latest features and news + Get notified of incoming transactions Be the first to know about new promotions Would you like to use\nPush-notifications? Add new wallet diff --git a/core/ui/src/main/res/drawable/ic_notifications_24.xml b/core/ui/src/main/res/drawable/ic_notifications_24.xml new file mode 100644 index 0000000000..d9106f0a89 --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_notifications_24.xml @@ -0,0 +1,31 @@ + + + + + + diff --git a/features/push-notifications/impl/build.gradle.kts b/features/push-notifications/impl/build.gradle.kts index 184fccb455..68fc33bd13 100644 --- a/features/push-notifications/impl/build.gradle.kts +++ b/features/push-notifications/impl/build.gradle.kts @@ -38,6 +38,7 @@ dependencies { /** Domain module */ implementation(projects.domain.settings) + implementation(projects.domain.notifications.toggles) /** Feature modules */ implementation(projects.features.pushNotifications.api) diff --git a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/DefaultPushNotificationsComponent.kt b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/DefaultPushNotificationsComponent.kt index d2ba519029..07278cd29d 100644 --- a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/DefaultPushNotificationsComponent.kt +++ b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/DefaultPushNotificationsComponent.kt @@ -2,6 +2,8 @@ package com.tangem.features.pushnotifications.impl import androidx.activity.compose.BackHandler import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import com.tangem.core.decompose.context.AppComponentContext @@ -25,6 +27,7 @@ internal class DefaultPushNotificationsComponent @AssistedInject constructor( @Composable override fun Content(modifier: Modifier) { val activity = LocalContext.current.findActivity() + val state by model.state.collectAsState() BackHandler(onBack = { activity.finish() }) NavigationBar3ButtonsScrim() PushNotificationsScreen( @@ -32,6 +35,7 @@ internal class DefaultPushNotificationsComponent @AssistedInject constructor( onNeverRequest = model::onNeverRequest, onAllowPermission = model::onAllowPermission, onDenyPermission = model::onDenyPermission, + showNotificationsInfo = state.showInfoAboutNotifications, ) } diff --git a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/model/PushNotificationsModel.kt b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/model/PushNotificationsModel.kt index 29cd04e418..de2d442132 100644 --- a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/model/PushNotificationsModel.kt +++ b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/model/PushNotificationsModel.kt @@ -7,11 +7,15 @@ import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.analytics.models.AnalyticsParam import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model +import com.tangem.domain.notifications.toggles.NotificationsFeatureToggles import com.tangem.domain.settings.NeverRequestPermissionUseCase import com.tangem.domain.settings.NeverToInitiallyAskPermissionUseCase import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnalyticEvents import com.tangem.features.pushnotifications.api.utils.PUSH_PERMISSION +import com.tangem.features.pushnotifications.impl.presentation.state.PushNotificationsUM import com.tangem.utils.coroutines.CoroutineDispatcherProvider +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.launch import javax.inject.Inject @@ -23,8 +27,17 @@ internal class PushNotificationsModel @Inject constructor( private val neverToInitiallyAskPermissionUseCase: NeverToInitiallyAskPermissionUseCase, private val appRouter: AppRouter, private val analyticHandler: AnalyticsEventHandler, + private val notificationsFeatureToggles: NotificationsFeatureToggles, ) : Model(), PushNotificationsClickIntents { + private val _state = MutableStateFlow( + PushNotificationsUM( + showInfoAboutNotifications = notificationsFeatureToggles.isNotificationsEnabled, + ), + ) + + val state = _state.asStateFlow() + override fun onRequest() { analyticHandler.send( PushNotificationAnalyticEvents.ButtonAllow(AnalyticsParam.ScreensSources.Stories), diff --git a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/state/PushNotificationsUM.kt b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/state/PushNotificationsUM.kt new file mode 100644 index 0000000000..a7161b630b --- /dev/null +++ b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/state/PushNotificationsUM.kt @@ -0,0 +1,5 @@ +package com.tangem.features.pushnotifications.impl.presentation.state + +data class PushNotificationsUM( + val showInfoAboutNotifications: Boolean = false, +) \ No newline at end of file diff --git a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/ui/PushNotificationsScreen.kt b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/ui/PushNotificationsScreen.kt index 76d8ea97f8..4d6a0e3406 100644 --- a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/ui/PushNotificationsScreen.kt +++ b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/ui/PushNotificationsScreen.kt @@ -18,6 +18,7 @@ internal fun PushNotificationsScreen( onNeverRequest: () -> Unit, onAllowPermission: () -> Unit, onDenyPermission: () -> Unit, + showNotificationsInfo: Boolean, ) { val requestPushPermission = requestPushPermission( onAllow = onAllowPermission, @@ -37,7 +38,18 @@ internal fun PushNotificationsScreen( R.drawable.ic_storefront_24, resourceReference(R.string.user_push_notification_agreement_argument_two), ), - ), + ).let { baseItems -> + if (showNotificationsInfo) { + baseItems.add( + ShowcaseItemModel( + R.drawable.ic_notifications_24, + resourceReference(R.string.user_push_notification_agreement_argument_three), + ), + ) + } else { + baseItems + } + }, primaryButton = ShowcaseButtonModel( buttonText = resourceReference(R.string.common_allow), onClick = {