Skip to content

Commit

Permalink
[PushNotification] Unregister for remote notifications support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuangzuan committed Jun 5, 2015
1 parent 09e7f96 commit d32b769
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Libraries/PushNotificationIOS/PushNotificationIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ class PushNotificationIOS {
RCTPushNotificationManager.requestPermissions();
}

/**
* 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:
Expand Down
5 changes: 5 additions & 0 deletions Libraries/PushNotificationIOS/RCTPushNotificationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ - (void)handleRemoteNotificationReceived:(NSNotification *)notification
}
}

RCT_EXPORT_METHOD(abandonPermissions)
{
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
}

RCT_EXPORT_METHOD(checkPermissions:(RCTResponseSenderBlock)callback)
{

Expand Down

0 comments on commit d32b769

Please sign in to comment.