mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-25 18:11:15 +02:00
Only requests notification once.
This commit is contained in:
@@ -93,6 +93,7 @@ fun NotificationScreen(
|
||||
SummaryBar(
|
||||
model = userReactionsStatsModel
|
||||
)
|
||||
|
||||
RefresheableCardView(
|
||||
viewModel = notifFeedViewModel,
|
||||
accountViewModel = accountViewModel,
|
||||
@@ -104,6 +105,9 @@ fun NotificationScreen(
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Turn this into an Account flag
|
||||
var hasAlreadyAskedNotificationPermissions = false
|
||||
|
||||
@OptIn(ExperimentalPermissionsApi::class)
|
||||
@Composable
|
||||
fun CheckifItNeedsToRequestNotificationPermission() {
|
||||
@@ -112,7 +116,10 @@ fun CheckifItNeedsToRequestNotificationPermission() {
|
||||
Manifest.permission.POST_NOTIFICATIONS
|
||||
)
|
||||
|
||||
if (!notificationPermissionState.status.isGranted) {
|
||||
if (!notificationPermissionState.status.isGranted && !hasAlreadyAskedNotificationPermissions) {
|
||||
hasAlreadyAskedNotificationPermissions = true
|
||||
|
||||
// This will pause the APP, including the connection with relays.
|
||||
LaunchedEffect(notificationPermissionState) {
|
||||
notificationPermissionState.launchPermissionRequest()
|
||||
}
|
||||
|
Reference in New Issue
Block a user