Skip to content

Commit 4c425f2

Browse files
komaxxMatthias Schickerrussellwheatley
authored
feat(firebase_messaging): Added 'criticalAlert' to notification settings. (#9004)
Co-authored-by: Matthias Schicker <[email protected]> Co-authored-by: Russell Wheatley <[email protected]>
1 parent 5313826 commit 4c425f2

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

packages/firebase_messaging/firebase_messaging_platform_interface/lib/src/notification_settings.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class NotificationSettings {
1818
required this.notificationCenter,
1919
required this.showPreviews,
2020
required this.timeSensitive,
21+
required this.criticalAlert,
2122
required this.sound});
2223

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

43+
/// Whether or not "critical alerts" are permitted, i.e., alerts that will be
44+
/// shown as highest priority, overriding the phone's focus and mute settings.
45+
///
46+
/// Apple devices only.
47+
final AppleNotificationSetting criticalAlert;
48+
4249
/// Whether or not messages containing a notification can update the application badge.
4350
///
4451
/// Apple devices only.

packages/firebase_messaging/firebase_messaging_platform_interface/lib/src/utils.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ NotificationSettings convertToNotificationSettings(Map<String, int> map) {
133133
authorizationStatus:
134134
convertToAuthorizationStatus(map['authorizationStatus']),
135135
timeSensitive: convertToAppleNotificationSetting(map['timeSensitive']),
136+
criticalAlert: convertToAppleNotificationSetting(map['criticalAlert']),
136137
alert: convertToAppleNotificationSetting(map['alert']),
137138
announcement: convertToAppleNotificationSetting(map['announcement']),
138139
badge: convertToAppleNotificationSetting(map['badge']),
@@ -157,4 +158,5 @@ const NotificationSettings defaultNotificationSettings = NotificationSettings(
157158
showPreviews: AppleShowPreviewSetting.notSupported,
158159
sound: AppleNotificationSetting.notSupported,
159160
timeSensitive: AppleNotificationSetting.notSupported,
161+
criticalAlert: AppleNotificationSetting.notSupported,
160162
);

packages/firebase_messaging/firebase_messaging_web/lib/src/utils.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ NotificationSettings getNotificationSettings(String? status) {
3737
showPreviews: AppleShowPreviewSetting.notSupported,
3838
sound: AppleNotificationSetting.notSupported,
3939
timeSensitive: AppleNotificationSetting.notSupported,
40+
criticalAlert: AppleNotificationSetting.notSupported,
4041
);
4142
}
4243

packages/firebase_messaging/firebase_messaging_web/test/firebase_messaging_web_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ void main() {
3636
expect(notification.carPlay, AppleNotificationSetting.notSupported);
3737
expect(notification.lockScreen, AppleNotificationSetting.notSupported);
3838
expect(notification.timeSensitive, AppleNotificationSetting.notSupported);
39+
expect(notification.criticalAlert, AppleNotificationSetting.notSupported);
3940
expect(
4041
notification.notificationCenter,
4142
AppleNotificationSetting.notSupported,

0 commit comments

Comments
 (0)