Revoke notification permission (Android 13+) if user disables session notification.

This commit is contained in:
Benoit Marty 2022-10-07 09:58:50 +02:00
parent 652069d520
commit 238b41ce55
2 changed files with 8 additions and 0 deletions

View file

@ -68,4 +68,11 @@ class NotificationPermissionManager @Inject constructor(
arrayOf(Manifest.permission.POST_NOTIFICATIONS)
)
}
fun eventuallyRevokePermission(
activity: Activity,
) {
if (!sdkIntProvider.isAtLeast(Build.VERSION_CODES.TIRAMISU)) return
activity.revokeSelfPermissionOnKill(Manifest.permission.POST_NOTIFICATIONS)
}
}

View file

@ -142,6 +142,7 @@ class VectorSettingsNotificationPreferenceFragment :
} else {
unifiedPushHelper.unregister(pushersManager)
session.pushersService().refreshPushers()
notificationPermissionManager.eventuallyRevokePermission(requireActivity())
}
}
}