@@ -88,6 +88,7 @@ fun WebSettingsPage(
8888 var permissionList by remember { mutableStateOf(Permissions .getWebList(context)) }
8989 var shouldIgnoreOptimize by remember { mutableStateOf(! powerManager.isIgnoringBatteryOptimizations(BuildConfig .APPLICATION_ID )) }
9090 var systemAlertWindow by remember { mutableStateOf(Permission .SYSTEM_ALERT_WINDOW .can(context)) }
91+ var notificationListenerGranted by remember { mutableStateOf(Permission .NOTIFICATION_LISTENER .can(context)) }
9192 val sharedFlow = Channel .sharedFlow
9293
9394 val learnMore = stringResource(id = R .string.learn_more)
@@ -99,6 +100,7 @@ fun WebSettingsPage(
99100 is PermissionsResultEvent -> {
100101 permissionList = Permissions .getWebList(context)
101102 systemAlertWindow = Permission .SYSTEM_ALERT_WINDOW .can(context)
103+ notificationListenerGranted = Permission .NOTIFICATION_LISTENER .can(context)
102104 if (event.map[Permission .NOTIFICATION_LISTENER .toSysPermission()] == true ) {
103105 // Only enable listener if web is enabled
104106 PNotificationListenerService .toggle(context, WebPreference .getAsync(context))
@@ -107,6 +109,7 @@ fun WebSettingsPage(
107109
108110 is WindowFocusChangedEvent -> {
109111 shouldIgnoreOptimize = ! powerManager.isIgnoringBatteryOptimizations(BuildConfig .APPLICATION_ID )
112+ notificationListenerGranted = Permission .NOTIFICATION_LISTENER .can(context)
110113 }
111114
112115 is IgnoreBatteryOptimizationResultEvent -> {
@@ -230,7 +233,7 @@ fun WebSettingsPage(
230233 title = permission.getText(),
231234 subtitle =
232235 stringResource(
233- if (m.granted ) R .string.system_permission_granted else R .string.system_permission_not_granted,
236+ if (notificationListenerGranted ) R .string.system_permission_granted else R .string.system_permission_not_granted,
234237 ),
235238 ) {
236239 PSwitch (activated = enabledPermissions.contains(permission.name)) { enable ->
0 commit comments