Skip to content

Commit

Permalink
feat(firebase_messaging): Added 'criticalAlert' to notification setti…
Browse files Browse the repository at this point in the history
…ngs. (#9004)

Co-authored-by: Matthias Schicker <mail@matthiasschicker.de>
Co-authored-by: Russell Wheatley <russellwheatley85@gmail.com>
  • Loading branch information
3 people committed Jul 20, 2022
1 parent 5313826 commit 4c425f2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
Expand Up @@ -18,6 +18,7 @@ class NotificationSettings {
required this.notificationCenter,
required this.showPreviews,
required this.timeSensitive,
required this.criticalAlert,
required this.sound});

/// Whether or not messages containing a notification will alert the user.
Expand All @@ -39,6 +40,12 @@ class NotificationSettings {
/// Apple devices only.
final AppleNotificationSetting timeSensitive;

/// Whether or not "critical alerts" are permitted, i.e., alerts that will be
/// shown as highest priority, overriding the phone's focus and mute settings.
///
/// Apple devices only.
final AppleNotificationSetting criticalAlert;

/// Whether or not messages containing a notification can update the application badge.
///
/// Apple devices only.
Expand Down
Expand Up @@ -133,6 +133,7 @@ NotificationSettings convertToNotificationSettings(Map<String, int> map) {
authorizationStatus:
convertToAuthorizationStatus(map['authorizationStatus']),
timeSensitive: convertToAppleNotificationSetting(map['timeSensitive']),
criticalAlert: convertToAppleNotificationSetting(map['criticalAlert']),
alert: convertToAppleNotificationSetting(map['alert']),
announcement: convertToAppleNotificationSetting(map['announcement']),
badge: convertToAppleNotificationSetting(map['badge']),
Expand All @@ -157,4 +158,5 @@ const NotificationSettings defaultNotificationSettings = NotificationSettings(
showPreviews: AppleShowPreviewSetting.notSupported,
sound: AppleNotificationSetting.notSupported,
timeSensitive: AppleNotificationSetting.notSupported,
criticalAlert: AppleNotificationSetting.notSupported,
);
Expand Up @@ -37,6 +37,7 @@ NotificationSettings getNotificationSettings(String? status) {
showPreviews: AppleShowPreviewSetting.notSupported,
sound: AppleNotificationSetting.notSupported,
timeSensitive: AppleNotificationSetting.notSupported,
criticalAlert: AppleNotificationSetting.notSupported,
);
}

Expand Down
Expand Up @@ -36,6 +36,7 @@ void main() {
expect(notification.carPlay, AppleNotificationSetting.notSupported);
expect(notification.lockScreen, AppleNotificationSetting.notSupported);
expect(notification.timeSensitive, AppleNotificationSetting.notSupported);
expect(notification.criticalAlert, AppleNotificationSetting.notSupported);
expect(
notification.notificationCenter,
AppleNotificationSetting.notSupported,
Expand Down

0 comments on commit 4c425f2

Please sign in to comment.