Skip to content

Commit

Permalink
feat: support critical alert permissions (#3852)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zohaad97 authored Jun 30, 2020
1 parent 7c61cfd commit c8f7c31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/messaging/ios/RNFBMessaging/RNFBMessagingModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ - (NSDictionary *)constantsToExport {
options |= UNAuthorizationOptionSound;
}

if ([permissions[@"criticalAlert"] isEqual:@(YES)]) {
if (@available(iOS 12.0, *)) {
options |= UNAuthorizationOptionCriticalAlert;
}
}

if ([permissions[@"provisional"] isEqual:@(YES)]) {
if (@available(iOS 12.0, *)) {
options |= UNAuthorizationOptionProvisional;
Expand Down
7 changes: 7 additions & 0 deletions packages/messaging/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,13 @@ export namespace FirebaseMessagingTypes {
*/
badge?: boolean;

/**
* Request permission for critical alerts.
*
* Defaults to false.
*/
criticalAlert?: boolean;

/**
* Request permission to display notifications in a CarPlay environment.
*
Expand Down
1 change: 1 addition & 0 deletions packages/messaging/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class FirebaseMessagingModule extends FirebaseModule {
carPlay: true,
provisional: false,
sound: true,
criticalAlert: false,
};

if (!permissions) {
Expand Down

0 comments on commit c8f7c31

Please sign in to comment.