Skip to content

Commit

Permalink
CB-11957 - Update docs for remote/local notifications removed in cord…
Browse files Browse the repository at this point in the history
…ova-ios-4.0
  • Loading branch information
shazron committed Oct 5, 2016
1 parent a47b9d9 commit 636113f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
15 changes: 11 additions & 4 deletions CordovaLib/Classes/Public/CDVPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
extern NSString* const CDVPageDidLoadNotification;
extern NSString* const CDVPluginHandleOpenURLNotification;
extern NSString* const CDVPluginResetNotification;
extern NSString* const CDVLocalNotification;
extern NSString* const CDVRemoteNotification;
extern NSString* const CDVRemoteNotificationError;
extern NSString* const CDVViewWillAppearNotification;
extern NSString* const CDVViewDidAppearNotification;
extern NSString* const CDVViewWillDisappearNotification;
Expand All @@ -44,6 +41,17 @@ extern NSString* const CDVViewWillLayoutSubviewsNotification;
extern NSString* const CDVViewDidLayoutSubviewsNotification;
extern NSString* const CDVViewWillTransitionToSizeNotification;

/*
* The local and remote push notification functionality has been removed from the core in cordova-ios 4.x,
* but these constants have unfortunately have not been removed, but will be removed in 5.x.
*
* To have the same functionality as 3.x, use a third-party plugin or the experimental
* https://github.com/apache/cordova-plugins/tree/master/notification-rebroadcast
*/
extern NSString* const CDVLocalNotification CDV_DEPRECATED(4.0, "Functionality removed in 4.0, constant will be removed in 5.0");
extern NSString* const CDVRemoteNotification CDV_DEPRECATED(4.0, "Functionality removed in 4.0, constant will be removed in 5.0");
extern NSString* const CDVRemoteNotificationError CDV_DEPRECATED(4.0, "Functionality removed in 4.0, constant will be removed in 5.0");

@interface CDVPlugin : NSObject {}

@property (nonatomic, readonly, weak) UIView* webView;
Expand All @@ -68,7 +76,6 @@ extern NSString* const CDVViewWillTransitionToSizeNotification;
- (void) onResume {}
- (void) onOrientationWillChange {}
- (void) onOrientationDidChange {}
- (void)didReceiveLocalNotification:(NSNotification *)notification;
*/

- (id)appDelegate;
Expand Down
11 changes: 1 addition & 10 deletions CordovaLib/Classes/Public/CDVPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ - (void)pluginInitialize
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationWillChange) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationDidChange) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];

// Added in 2.3.0
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:) name:CDVLocalNotification object:nil];

// Added in 2.5.0
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad:) name:CDVPageDidLoadNotification object:self.webView];
//Added in 4.3.0
Expand Down Expand Up @@ -161,18 +158,12 @@ - (void)onReset

- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self]; // this will remove all notification unless added using addObserverForName:object:queue:usingBlock:
[[NSNotificationCenter defaultCenter] removeObserver:self]; // this will remove all notifications unless added using addObserverForName:object:queue:usingBlock:
}

- (id)appDelegate
{
return [[UIApplication sharedApplication] delegate];
}

// default implementation does nothing, ideally, we are not registered for notification if we aren't going to do anything.
// - (void)didReceiveLocalNotification:(NSNotification *)notification
// {
// // UILocalNotification* localNotification = [notification object]; // get the payload as a LocalNotification
// }

@end
8 changes: 8 additions & 0 deletions guides/API changes in 4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ Properties:
@property id<CDVWebViewEngineProtocol> webViewEngine


### Deprecated:

const CDVLocalNotification
const CDVRemoteNotification
const CDVRemoteNotificationError

These constants were unfortunately not removed in 4.0, but will be removed in 5.0. Local and remote push notification functionality was removed in the core in 4.0.

### Modified:

@property UIView* webView
Expand Down

0 comments on commit 636113f

Please sign in to comment.