react-native/Libraries
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
..
ART Check if either array is null before diffing 2016-04-25 13:28:31 -07:00
ActionSheetIOS Update the documenation of ActionSheetIOS to include all possible options 2016-06-03 02:58:31 -07:00
AdSupport Text highlighting on iOS 2015-07-24 08:41:58 -08:00
Animated Round alpha channel when interpolating colors to the nearest thousandth. 2016-05-17 10:13:29 -07:00
AppRegistry Refactor BugReporing to avoid multiple registers 2016-05-18 14:28:26 -07:00
AppState Updated AppState module to use new emitter system 2016-05-23 09:13:37 -07:00
BatchedBridge Memoize lazy module configs 2016-05-16 03:58:23 -07:00
BugReporting Make BugReporting not pull in native module on require 2016-05-19 12:58:21 -07:00
CameraRoll iOS: Support HTTP headers for source prop on <Image> components 2016-06-01 10:43:28 -07:00
Components Native propTypes RCTDatePickerIOS !== propTypes DatePickerIOS 2016-06-01 08:58:22 -07:00
CustomComponents Fix typo in ListViewDataSource documentation. 2016-06-03 06:28:23 -07:00
DebugComponentHierarchy Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
Devtools Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
EventEmitter Add a removeListener method to DeviceEventEmitter for Framework consi… 2016-05-24 11:45:51 -07:00
Experimental Disable right-swipe from closed position 2016-05-31 16:28:22 -07:00
Fetch Reject promise if network request failed 2016-03-08 16:37:24 -08:00
Geolocation Update RCTNetworking, RCTNetInfo and RCTLocationManager to use new events system 2016-05-25 04:28:36 -07:00
Image iOS: Support HTTP headers for source prop on <Image> components 2016-06-01 10:43:28 -07:00
Inspector Extract getDevServerURL into reusable module 2016-06-01 13:59:16 -07:00
Interaction explicit type args in react-native-github 2016-05-24 18:28:26 -07:00
JavaScriptAppEngine Remove dead SourceMap code 2016-06-01 13:59:16 -07:00
LayoutAnimation Add support for delete animation in LayoutAnimation on iOS 2016-04-25 00:19:25 -07:00
Linking react-native-github: turn on strict type args in Flow, codemod stragglers 2016-06-03 02:43:57 -07:00
LinkingIOS Updated Linking and PushNotificationIOS modules to use NativeEventEmitter 2016-05-27 10:28:23 -07:00
Modal explicit type args in react-native-github 2016-05-24 18:28:26 -07:00
NavigationExperimental Fix typo in NavigationTransitioner 2016-06-03 04:28:23 -07:00
Network Correct semantics for XMLHttpRequest.responseText 2016-06-02 18:13:23 -07:00
PushNotificationIOS PushNotificationIOS requestPermission promisified 2016-06-03 16:28:30 -07:00
QuickPerformanceLogger added QPL for main interactions 2015-09-29 22:25:23 -07:00
RCTTest Updated AppState module to use new emitter system 2016-05-23 09:13:37 -07:00
RKBackendNode Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
ReactIOS Native propTypes RCTDatePickerIOS !== propTypes DatePickerIOS 2016-06-01 08:58:22 -07:00
ReactNative Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
Sample Remove knowledge of fbjs from the packager 2016-03-02 04:28:38 -08:00
Settings Updated AppState module to use new emitter system 2016-05-23 09:13:37 -07:00
Storage change undeclared variable to intended value 2016-05-26 01:43:30 -07:00
StyleSheet Deprecate transformMatrix and decomposedMatrix 2016-04-29 14:19:25 -07:00
Text Changed RCTTextView to check for failed focus 2016-06-03 16:13:19 -07:00
Utilities Reverted commit D3369528 2016-06-03 05:43:26 -07:00
Vibration Add support for vibration patterns 2016-03-29 21:45:20 -07:00
WebSocket Fix the Origin: header used in WebSocket requests. 2016-06-03 15:13:41 -07:00
react-native Cross platform ActivityIndicator 2016-05-26 13:58:17 -07:00
vendor Fixed NativeEventListener deregistration 2016-05-16 04:13:56 -07:00
Promise.js Remove knowledge of fbjs from the packager 2016-03-02 04:28:38 -08:00
promiseRejectionIsError.js Add possibility to `console.error`/redbox on promise rejections 2016-03-15 05:22:22 -07:00