react-native/Libraries/PushNotificationIOS
Jonathan Stanton f4dbf37ba8 PushNotificationIOS requestPermission promisified
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
2016-06-03 16:28:30 -07:00
..
RCTPushNotification.xcodeproj Text highlighting on iOS 2015-07-24 08:41:58 -08:00
PushNotificationIOS.js PushNotificationIOS requestPermission promisified 2016-06-03 16:28:30 -07:00
RCTPushNotificationManager.h Updated Linking and PushNotificationIOS modules to use NativeEventEmitter 2016-05-27 10:28:23 -07:00
RCTPushNotificationManager.m PushNotificationIOS requestPermission promisified 2016-06-03 16:28:30 -07:00