[PushNotification] Unregister for remote notifications support.

Summary:
See iOS Developer Library: [- unregisterForRemoteNotifications](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/occ/instm/UIApplication/unregisterForRemoteNotifications).

Unregister for all remote notifications received via Apple Push Notification service.

**Discussion**
You should call this method in rare circumstances only, such as when a new version of the app removes support for all types of remote notifications. Users can temporarily prevent apps from receiving remote notifications through the Notifications section of the Settings app. Apps unregistered through this method can always re-register.
Closes https://github.com/facebook/react-native/pull/1520
Github Author: Shuangzuan <shuangzuan.he@icloud.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
Shuangzuan 2015-06-15 12:14:23 -07:00
parent 3ce8b1a1c8
commit df8287d8ee
2 changed files with 17 additions and 0 deletions

View File

@ -121,6 +121,18 @@ class PushNotificationIOS {
RCTPushNotificationManager.requestPermissions(requestedPermissions);
}
/**
* Unregister for all remote notifications received via Apple Push Notification service.
*
* You should call this method in rare circumstances only, such as when a new version of
* the app removes support for all types of remote notifications. Users can temporarily
* prevent apps from receiving remote notifications through the Notifications section of
* the Settings app. Apps unregistered through this method can always re-register.
*/
static abandonPermissions() {
RCTPushNotificationManager.abandonPermissions();
}
/**
* See what push permissions are currently enabled. `callback` will be
* invoked with a `permissions` object:

View File

@ -148,6 +148,11 @@ RCT_EXPORT_METHOD(requestPermissions:(NSDictionary *)permissions)
}
RCT_EXPORT_METHOD(abandonPermissions)
{
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
}
RCT_EXPORT_METHOD(checkPermissions:(RCTResponseSenderBlock)callback)
{
NSUInteger types = 0;