react-native/Libraries/PushNotificationIOS
Peter Pistorius d03f9b7442 PushNotificationIOS.requestPermissions won't resolve if no event listeners are attached
Summary:
Resolves #13012

RCTPushNotificationManager uses startObserving to register for RCTRegisterUserNotificationSettings. According to the docs, the startObserving method won't be called until somebody subscribes to NotificationManagerIOS.

This means there is a scenario when the developer can call requestPermissions without subscribing to notifications first, but since RCTPushNotificationManager relies on NSNotificationCenter subscribtion, the result will never be returned.

When requesting permissions  the promise will resolve:
`PushNotificationIOS.requestPermissions().then(console.log);` without the need for calling `PushNotificationIOS.addEventListener()` first.
Closes https://github.com/facebook/react-native/pull/13263

Differential Revision: D4851767

Pulled By: javache

fbshipit-source-id: 2be8621e072ae1086014594bc986ca5590b5eb61
2017-04-07 11:17:00 -07:00
..
RCTPushNotification.xcodeproj Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
PushNotificationIOS.js Integrare UNUserNotification 2017-03-23 12:02:25 -07:00
RCTPushNotificationManager.h Handle push notifications on iOS 2017-02-03 11:58:30 -08:00
RCTPushNotificationManager.m PushNotificationIOS.requestPermissions won't resolve if no event listeners are attached 2017-04-07 11:17:00 -07:00