Baseflow / Baseflow/flutter-permission-handler

[Feature request]: Expose UNNotificationSettings.alertSetting to check if alerts are enabled

Open
#1,467 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
2.2k
Forks
970
Avg merge
14h 22m
Merged PRs (30d)
2

Description

### Is there already an issue requesting this feature?

- [x] I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues).

### Please select affected platform(s)

- [ ] Android
- [x] iOS
- [ ] Windows

### Use case

We have a feature that relies on silent push notifications but they are not delivered when all notification alert types(e.g. Lock Screen, Banners, Notification Center) are disabled*, even when the app is on the foreground.

We'd like to display a warning to the user if alerts are disabled, to inform them that our feature requires at least one alert type to function.

*: If all alert types are disabled, iOS deems the notification non-deliverable and drops it before it reaches the Notification Service Extension.

> Additionally, please share any alternative solutions you have considered. Have you explored existing packages on pub.dev that might already address this problem?

Alternate solution is to use platform channels to access [UNNotificationSettings.alertSetting](https://developer.apple.com/documentation/usernotifications/unnotificationsettings/alertsetting), and that'll be the approach we'll take in the meantime but, I thought this is better suited to be part of this plugin.

I was unable to find an existing package on pub.dev that exposes this setting.

### Proposal

Expose [UNNotificationSettings.alertSetting](https://developer.apple.com/documentation/usernotifications/unnotificationsettings/alertsetting) to check if alerts are enabled.

### Specific requirements or considerations

We don't have additional requirements as silent push notifications are delivered as long as one alert presentation style is enabled.

Other developers may be interested in learning the status of specific alert presentation settings such as:
- [UNNotificationSettings.locksScreenSetting](https://developer.apple.com/documentation/usernotifications/unnotificationsettings/lockscreensetting)
- [UNNotificationSettings.notificationCenterSetting](https://developer.apple.com/documentation/usernotifications/unnotificationsettings/notificationcentersetting)

### Additional information or context

[UNNotificationSettings.alertSetting](https://developer.apple.com/documentation/usernotifications/unnotificationsettings/alertsetting)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.