Skip to content

Commit 636113f

Browse files
committed
CB-11957 - Update docs for remote/local notifications removed in cordova-ios-4.0
1 parent a47b9d9 commit 636113f

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

CordovaLib/Classes/Public/CDVPlugin.h

+11-4
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
extern NSString* const CDVPageDidLoadNotification;
3434
extern NSString* const CDVPluginHandleOpenURLNotification;
3535
extern NSString* const CDVPluginResetNotification;
36-
extern NSString* const CDVLocalNotification;
37-
extern NSString* const CDVRemoteNotification;
38-
extern NSString* const CDVRemoteNotificationError;
3936
extern NSString* const CDVViewWillAppearNotification;
4037
extern NSString* const CDVViewDidAppearNotification;
4138
extern NSString* const CDVViewWillDisappearNotification;
@@ -44,6 +41,17 @@ extern NSString* const CDVViewWillLayoutSubviewsNotification;
4441
extern NSString* const CDVViewDidLayoutSubviewsNotification;
4542
extern NSString* const CDVViewWillTransitionToSizeNotification;
4643

44+
/*
45+
* The local and remote push notification functionality has been removed from the core in cordova-ios 4.x,
46+
* but these constants have unfortunately have not been removed, but will be removed in 5.x.
47+
*
48+
* To have the same functionality as 3.x, use a third-party plugin or the experimental
49+
* https://github.com/apache/cordova-plugins/tree/master/notification-rebroadcast
50+
*/
51+
extern NSString* const CDVLocalNotification CDV_DEPRECATED(4.0, "Functionality removed in 4.0, constant will be removed in 5.0");
52+
extern NSString* const CDVRemoteNotification CDV_DEPRECATED(4.0, "Functionality removed in 4.0, constant will be removed in 5.0");
53+
extern NSString* const CDVRemoteNotificationError CDV_DEPRECATED(4.0, "Functionality removed in 4.0, constant will be removed in 5.0");
54+
4755
@interface CDVPlugin : NSObject {}
4856

4957
@property (nonatomic, readonly, weak) UIView* webView;
@@ -68,7 +76,6 @@ extern NSString* const CDVViewWillTransitionToSizeNotification;
6876
- (void) onResume {}
6977
- (void) onOrientationWillChange {}
7078
- (void) onOrientationDidChange {}
71-
- (void)didReceiveLocalNotification:(NSNotification *)notification;
7279
*/
7380

7481
- (id)appDelegate;

CordovaLib/Classes/Public/CDVPlugin.m

+1-10
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ - (void)pluginInitialize
9292
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationWillChange) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
9393
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationDidChange) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
9494

95-
// Added in 2.3.0
96-
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:) name:CDVLocalNotification object:nil];
97-
9895
// Added in 2.5.0
9996
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad:) name:CDVPageDidLoadNotification object:self.webView];
10097
//Added in 4.3.0
@@ -161,18 +158,12 @@ - (void)onReset
161158

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

167164
- (id)appDelegate
168165
{
169166
return [[UIApplication sharedApplication] delegate];
170167
}
171168

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

guides/API changes in 4.0.md

+8
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ Properties:
118118
@property id<CDVWebViewEngineProtocol> webViewEngine
119119

120120

121+
### Deprecated:
122+
123+
const CDVLocalNotification
124+
const CDVRemoteNotification
125+
const CDVRemoteNotificationError
126+
127+
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.
128+
121129
### Modified:
122130

123131
@property UIView* webView

0 commit comments

Comments
 (0)