Skip to content

Commit

Permalink
Merge 2d89f5b into 630142f
Browse files Browse the repository at this point in the history
  • Loading branch information
navro authored Aug 26, 2022
2 parents 630142f + 2d89f5b commit d2225a6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/messaging/ios-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ The value returned is a number value, which can be mapped to one of the followin
- `0` = `messaging.AuthorizationStatus.DENIED`: The user has denied notification permissions.
- `1` = `messaging.AuthorizationStatus.AUTHORIZED`: The user has accept the permission & it is enabled.
- `2` = `messaging.AuthorizationStatus.PROVISIONAL`: [Provisional authorization](#provisional-authorization) has been granted.
- `3` = `messaging.AuthorizationStatus.EPHEMERAL`: The app is authorized to create notifications for a limited amount of time. Used for app clips.

To help improve the chances of the user granting your app permission, it is recommended that permission is requested at a time which makes
sense during the flow of your application (e.g. starting a new chat), where the user would expect to receive such notifications.
Expand Down
6 changes: 6 additions & 0 deletions packages/messaging/ios/RNFBMessaging/RNFBMessagingModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ - (NSDictionary *)constantsToExport {
}
}

if (@available(iOS 14.0, macCatalyst 14.0, *)) {
if (settings.authorizationStatus == UNAuthorizationStatusEphemeral) {
authorizedStatus = @3;
}
}

resolve(authorizedStatus);
}];
} else {
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 @@ -501,6 +501,13 @@ export namespace FirebaseMessagingTypes {
* @platform ios iOS >= 12
*/
PROVISIONAL = 2,

/**
* The app is authorized to create notifications for a limited amount of time.
* Used in App Clips.
* @platform ios iOS >= 14
*/
EPHEMERAL = 3,
}

/**
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 @@ -40,6 +40,7 @@ const statics = {
DENIED: 0,
AUTHORIZED: 1,
PROVISIONAL: 2,
EPHEMERAL: 3,
},
NotificationAndroidPriority: {
PRIORITY_MIN: -2,
Expand Down

0 comments on commit d2225a6

Please sign in to comment.