Updated on 2026-08-14
This commit is contained in:
parent
ef36fbf13e
commit
e4fc013173
10 changed files with 72 additions and 31 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 = {},
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue