diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml
index 14c45c2681..fba85fe955 100644
--- a/core/res/src/main/res/values-ru/strings.xml
+++ b/core/res/src/main/res/values-ru/strings.xml
@@ -68,6 +68,7 @@
Недостаточно ADA
Принять
Доступ запрещен
+ Разрешить
Применить
Одобрение
Подтвердить
diff --git a/features/push-notifications/api/src/main/java/com/tangem/features/pushnotifications/api/analytics/PushNotificationAnalyticEvents.kt b/features/push-notifications/api/src/main/java/com/tangem/features/pushnotifications/api/analytics/PushNotificationAnalyticEvents.kt
index d3c8a94ed5..c35b196ec8 100644
--- a/features/push-notifications/api/src/main/java/com/tangem/features/pushnotifications/api/analytics/PushNotificationAnalyticEvents.kt
+++ b/features/push-notifications/api/src/main/java/com/tangem/features/pushnotifications/api/analytics/PushNotificationAnalyticEvents.kt
@@ -29,4 +29,13 @@ sealed class PushNotificationAnalyticEvents(
data object ButtonCancel : PushNotificationAnalyticEvents(
event = "Button - Cancel",
)
+
+ data class PermissionStatus(
+ val isAllowed: Boolean,
+ ) : PushNotificationAnalyticEvents(
+ event = "Permission Status",
+ params = mapOf(
+ AnalyticsParam.STATE to if (isAllowed) "Allow" else "Cancel",
+ ),
+ )
}
\ No newline at end of file
diff --git a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/PushNotificationsFragment.kt b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/PushNotificationsFragment.kt
index 0b8fedc562..1d6fb08e71 100644
--- a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/PushNotificationsFragment.kt
+++ b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/PushNotificationsFragment.kt
@@ -25,9 +25,10 @@ internal class PushNotificationsFragment : ComposeFragment() {
BackHandler(onBack = requireActivity()::finish)
NavigationBar3ButtonsScrim()
PushNotificationsScreen(
- onShowAllow = viewModel::onAllowPermission,
- onAllow = viewModel::onAllowedPermission,
- onLater = viewModel::onAskLater,
+ onRequest = viewModel::onRequest,
+ onRequestLater = viewModel::onRequestLater,
+ onAllowPermission = viewModel::onAllowPermission,
+ onDenyPermission = viewModel::onDenyPermission,
onOpenSettings = viewModel::openSettings,
)
}
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 9fe0f81030..c039d9109d 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
@@ -16,17 +16,18 @@ import kotlinx.collections.immutable.persistentListOf
@Composable
internal fun PushNotificationsScreen(
- onShowAllow: () -> Unit,
- onAllow: () -> Unit,
- onLater: () -> Unit,
+ onRequest: () -> Unit,
+ onRequestLater: () -> Unit,
+ onAllowPermission: () -> Unit,
+ onDenyPermission: () -> Unit,
onOpenSettings: () -> Unit,
) {
val isClicked = remember { mutableStateOf(false) }
val requestPushPermission = requestPushPermission(
isFirstTimeAsking = true,
isClicked = isClicked,
- onAllow = onAllow,
- onDeny = onLater,
+ onAllow = onAllowPermission,
+ onDeny = onDenyPermission,
onOpenSettings = onOpenSettings,
pushPermission = getPushPermissionOrNull(),
)
@@ -48,13 +49,13 @@ internal fun PushNotificationsScreen(
buttonText = resourceReference(R.string.common_allow),
onClick = {
isClicked.value = true
- onShowAllow()
+ onRequest()
requestPushPermission()
},
),
secondaryButton = ShowcaseButtonModel(
buttonText = resourceReference(R.string.common_later),
- onClick = onLater,
+ onClick = onRequestLater,
),
modifier = Modifier.systemBarsPadding(),
)
diff --git a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/viewmodel/PushNotificationViewModel.kt b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/viewmodel/PushNotificationViewModel.kt
index fcba5aa01c..b87d3f4f88 100644
--- a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/viewmodel/PushNotificationViewModel.kt
+++ b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/viewmodel/PushNotificationViewModel.kt
@@ -28,7 +28,16 @@ internal class PushNotificationViewModel @Inject constructor(
private val analyticHandler: AnalyticsEventHandler,
) : ViewModel(), PushNotificationsClickIntents {
- override fun onAskLater() {
+ override fun onRequest() {
+ analyticHandler.send(
+ PushNotificationAnalyticEvents.ButtonAllow(AnalyticsParam.ScreensSources.Stories),
+ )
+ viewModelScope.launch {
+ setFirstTimeAskingPermissionUseCase(PUSH_PERMISSION)
+ }
+ }
+
+ override fun onRequestLater() {
analyticHandler.send(
PushNotificationAnalyticEvents.ButtonLater(AnalyticsParam.ScreensSources.Stories),
)
@@ -36,25 +45,30 @@ internal class PushNotificationViewModel @Inject constructor(
delayPermissionRequestUseCase(PUSH_PERMISSION)
setFirstTimeAskingPermissionUseCase(PUSH_PERMISSION)
neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)
+ router.openHome()
}
- router.openHome()
}
override fun onAllowPermission() {
- viewModelScope.launch {
- setFirstTimeAskingPermissionUseCase(PUSH_PERMISSION)
- }
- }
-
- override fun onAllowedPermission() {
analyticHandler.send(
- PushNotificationAnalyticEvents.ButtonAllow(AnalyticsParam.ScreensSources.Stories),
+ PushNotificationAnalyticEvents.PermissionStatus(isAllowed = true),
)
viewModelScope.launch {
neverRequestPermissionUseCase(PUSH_PERMISSION)
neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)
+ router.openHome()
+ }
+ }
+
+ override fun onDenyPermission() {
+ analyticHandler.send(
+ PushNotificationAnalyticEvents.PermissionStatus(isAllowed = false),
+ )
+ viewModelScope.launch {
+ delayPermissionRequestUseCase(PUSH_PERMISSION)
+ neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)
+ router.openHome()
}
- router.openHome()
}
override fun openSettings() = settingsManager.openSettings()
diff --git a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/viewmodel/PushNotificationsClickIntents.kt b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/viewmodel/PushNotificationsClickIntents.kt
index f101e15e7a..2d4fe34217 100644
--- a/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/viewmodel/PushNotificationsClickIntents.kt
+++ b/features/push-notifications/impl/src/main/java/com/tangem/features/pushnotifications/impl/presentation/viewmodel/PushNotificationsClickIntents.kt
@@ -1,11 +1,13 @@
package com.tangem.features.pushnotifications.impl.presentation.viewmodel
internal interface PushNotificationsClickIntents {
- fun onAskLater()
+ fun onRequest()
+
+ fun onRequestLater()
fun onAllowPermission()
- fun onAllowedPermission()
+ fun onDenyPermission()
fun openSettings()
}
\ No newline at end of file
diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/PushNotificationsBottomSheetConfig.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/PushNotificationsBottomSheetConfig.kt
index fa0fa3cd6e..c659d29d7c 100644
--- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/PushNotificationsBottomSheetConfig.kt
+++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/PushNotificationsBottomSheetConfig.kt
@@ -6,6 +6,7 @@ data class PushNotificationsBottomSheetConfig(
val isFirstTimeRequested: Boolean,
val wasInitiallyAsk: Boolean,
val onRequest: () -> Unit,
+ val onRequestLater: () -> Unit,
val onAllow: () -> Unit,
val onDeny: () -> Unit,
val openSettings: () -> Unit,
diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/PushNotificationsBottomSheet.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/PushNotificationsBottomSheet.kt
index 6a37a22f0c..dcc56be741 100644
--- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/PushNotificationsBottomSheet.kt
+++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/PushNotificationsBottomSheet.kt
@@ -84,7 +84,7 @@ private fun PushNotificationsSheetContent(content: PushNotificationsBottomSheetC
stringResource(R.string.common_cancel)
},
onClick = {
- content.onDeny()
+ content.onRequestLater()
onDismiss()
},
modifier = Modifier.weight(1f),
@@ -113,6 +113,7 @@ private fun PushNotificationsSheetContent_Preview() {
isFirstTimeRequested = false,
wasInitiallyAsk = false,
onRequest = {},
+ onRequestLater = {},
onAllow = {},
onDeny = {},
openSettings = {},
diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt
index 585bfc901e..a15817a145 100644
--- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt
+++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt
@@ -159,21 +159,22 @@ internal class WalletViewModel @Inject constructor(
val isFirstTimeRequested = isFirstTimeAskingPermissionUseCase(PUSH_PERMISSION).getOrElse { true }
val wasInitiallyAsk = shouldInitiallyAskPermissionUseCase(PUSH_PERMISSION).getOrElse { true }
- val onDenyClick: () -> Unit = if (wasInitiallyAsk) {
+ val onRequestLater: () -> Unit = if (wasInitiallyAsk) {
clickIntents::onDelayAskPushPermission
} else {
- clickIntents::onDenyPushPermission
+ clickIntents::onNeverAskPushPermission
}
stateHolder.showBottomSheet(
content = PushNotificationsBottomSheetConfig(
isFirstTimeRequested = isFirstTimeRequested,
wasInitiallyAsk = wasInitiallyAsk,
onRequest = clickIntents::onRequestPushPermission,
+ onRequestLater = onRequestLater,
onAllow = clickIntents::onAllowPushPermission,
- onDeny = onDenyClick,
+ onDeny = clickIntents::onDenyPushPermission,
openSettings = settingsManager::openSettings,
),
- onDismiss = onDenyClick,
+ onDismiss = onRequestLater,
)
}
}
diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletPushPermissionClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletPushPermissionClickIntents.kt
index 16994a8a7a..fe8848daf5 100644
--- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletPushPermissionClickIntents.kt
+++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletPushPermissionClickIntents.kt
@@ -17,6 +17,8 @@ internal interface WalletPushPermissionClickIntents {
fun onDelayAskPushPermission()
+ fun onNeverAskPushPermission()
+
fun onDenyPushPermission()
fun onAllowPushPermission()
@@ -31,6 +33,9 @@ internal class WalletPushPermissionClickIntentsImplementor @Inject constructor(
) : BaseWalletClickIntents(), WalletPushPermissionClickIntents {
override fun onRequestPushPermission() {
+ analyticsEventHandler.send(
+ PushNotificationAnalyticEvents.ButtonAllow(AnalyticsParam.ScreensSources.Main),
+ )
viewModelScope.launch {
setFirstTimeAskingPermissionUseCase(PUSH_PERMISSION)
}
@@ -45,17 +50,22 @@ internal class WalletPushPermissionClickIntentsImplementor @Inject constructor(
}
}
+ override fun onNeverAskPushPermission() {
+ viewModelScope.launch {
+ analyticsEventHandler.send(PushNotificationAnalyticEvents.ButtonCancel)
+ neverRequestPermissionUseCase(PUSH_PERMISSION)
+ }
+ }
+
override fun onDenyPushPermission() {
- analyticsEventHandler.send(PushNotificationAnalyticEvents.ButtonCancel)
+ analyticsEventHandler.send(PushNotificationAnalyticEvents.PermissionStatus(isAllowed = false))
viewModelScope.launch {
neverRequestPermissionUseCase(PUSH_PERMISSION)
}
}
override fun onAllowPushPermission() {
- analyticsEventHandler.send(
- PushNotificationAnalyticEvents.ButtonAllow(AnalyticsParam.ScreensSources.Main),
- )
+ analyticsEventHandler.send(PushNotificationAnalyticEvents.PermissionStatus(isAllowed = true))
viewModelScope.launch {
neverRequestPermissionUseCase(PUSH_PERMISSION)
}