feat: show notification dialogue outside of debug
This commit is contained in:
parent
51c6dc7fc0
commit
d3d802df12
|
|
@ -186,8 +186,8 @@ class ChatRouterViewModel(
|
||||||
|
|
||||||
val hasNotificationPermission =
|
val hasNotificationPermission =
|
||||||
NotificationManagerCompat.from(context).areNotificationsEnabled()
|
NotificationManagerCompat.from(context).areNotificationsEnabled()
|
||||||
// right now we only show this in debug builds so Chucker can show its notification
|
val rejectedPush = kvStorage.getBoolean("pushNotificationsRejected") == true
|
||||||
if (!hasNotificationPermission && BuildConfig.DEBUG) {
|
if (!hasNotificationPermission && !rejectedPush) {
|
||||||
showNotificationRationale = true
|
showNotificationRationale = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -761,13 +761,13 @@ fun ChatRouterScreen(
|
||||||
if (isGranted) {
|
if (isGranted) {
|
||||||
viewModel.setRegisterForNotifications()
|
viewModel.setRegisterForNotifications()
|
||||||
} else {
|
} else {
|
||||||
viewModel.showNotificationRationale = false
|
viewModel.markNotificationsRejected()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (viewModel.showNotificationRationale) {
|
if (viewModel.showNotificationRationale) {
|
||||||
NotificationRationaleDialog(
|
NotificationRationaleDialog(
|
||||||
onDismiss = {
|
onDismiss = {
|
||||||
viewModel.showNotificationRationale = false
|
viewModel.markNotificationsRejected()
|
||||||
},
|
},
|
||||||
onSelected = { accepted ->
|
onSelected = { accepted ->
|
||||||
if (accepted) {
|
if (accepted) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue