Skip to content

Commit

Permalink
canRequestPermission is iOS only
Browse files Browse the repository at this point in the history
  • Loading branch information
nan-li committed Sep 26, 2023
1 parent 4189a99 commit c503c99
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ The Notifications namespace is accessible via `OneSignal.Notifications` and prov
| **React Native** | **Description** |
|--------------------------------------- | --------------- |
| `OneSignal.Notifications.hasPermission()` | _Whether this app has push notification permission._ |
| `await OneSignal.Notifications.canRequestPermission()` | _Whether attempting to request notification permission will show a prompt. Returns `true` if the device has not been prompted for push notification permission already._ |
| `await OneSignal.Notifications.canRequestPermission()` | _(ios only) Whether attempting to request notification permission will show a prompt. Returns `true` if the device has not been prompted for push notification permission already._ |
| `await OneSignal.Notifications.permissionNative()` | _(ios only) Returns the enum for the native permission of the device. It will be one of: NotDetermined, Denied, Authorized, Provisional (only available in iOS 12), Ephemeral (only available in iOS 14)_ |
| `OneSignal.Notifications.clearAll();` | _Removes all OneSignal notifications._ |
| `OneSignal.Notifications.removeNotification(32432)` | _(Android only) Cancels a single OneSignal notification based on its Android notification integer ID. Use instead of Android's [android.app.NotificationManager.cancel], otherwise the notification will be restored when your app is restarted._ |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ public void hasNotificationPermission(Promise promise) {

@ReactMethod
public void canRequestNotificationPermission(Promise promise) {
// iOS only method
promise.resolve(true);
}

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ export namespace OneSignal {
}

/**
* iOS only.
* Whether attempting to request notification permission will show a prompt. Returns true if the device has not been prompted for push
* notification permission already.
*/
Expand Down

0 comments on commit c503c99

Please sign in to comment.