f4dbf37ba8
Summary: **Motivation** Today it's hard to build a good flow around requesting permissions if we don't know when the user rejects the push notification permission. With this PR I wrap `PushNotificationIOS#requestPermission` in a promise. The promise will return with the updated permissions when the user accepts, rejects or has previously rejected the permission. An example flow of how an app should handle push notifications with the change proposed: 1) Show user an explanation of push notification permissions with a button to enable, 2) User presses the enable push notifications button, 3) If the user accepts -> take them into the app, 4) if the user rejects -> explain how to enable permission in the settings app. 5) My app will now store some state about how it has asked permissions for push notifications so that the next time the user is taken through this flow they will go straight to step 4. Without this change we could listen to the `register` event that PushNotificationIOS fires on the success sc Closes https://github.com/facebook/react-native/pull/7900 Differential Revision: D3387424 Pulled By: nicklockwood fbshipit-source-id: e27df41e83216e4e2a14d1e42c6b26e72236f48c |
||
---|---|---|
.. | ||
RCTPushNotification.xcodeproj | ||
PushNotificationIOS.js | ||
RCTPushNotificationManager.h | ||
RCTPushNotificationManager.m |