Loading CHANGELOG.md +1 −1 Changes for CHANGELOG.md: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ - [enhancement:] Scope parameter for `isScheduled` and `getScheduledIds` - [enhancement:] Callbacks for `add`, `cancel` & `cancelAll` - [enhancement:] `image:` accepts remote URLs and local URIs (Android) - [enhancement:] Schedule multiple notifications at once (Android) - [enhancement:] Schedule multiple notifications at once - [enhancement:] Cancel multiple notifications at once - [enhancement:] Clear multiple notifications at once (Android) - [enhancement:] `clear` & `clearAll` methods (Android) Loading src/ios/APPLocalNotification.m +9 −12 Changes for src/ios/APPLocalNotification.m: 9 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -62,17 +62,15 @@ } /** * Schedule a new local notification. * Schedule a set of notifications. * * @param properties * A dict of properties * A dict of properties for each notification */ - (void) add:(CDVInvokedUrlCommand*)command { [self.commandDelegate runInBackground:^{ NSDictionary* options = [[command arguments] objectAtIndex:0]; for (NSDictionary* options in command.arguments) { UILocalNotification* notification; notification = [[UILocalNotification alloc] Loading @@ -80,23 +78,22 @@ [self scheduleLocalNotification:notification]; [self fireEvent:@"add" localNotification:notification]; } [self execCallback:command]; }]; } /** * Cancels a given local notification. * Cancel a set of notifications. * * @param id * The ID of the local notification * @param ids * The IDs of the notifications */ - (void) cancel:(CDVInvokedUrlCommand*)command { [self.commandDelegate runInBackground:^{ NSArray* ids = [[command arguments] objectAtIndex:0]; for (NSString* id in ids) { for (NSString* id in command.arguments) { UILocalNotification* notification; notification = [[UIApplication sharedApplication] Loading www/local-notification.js +22 −17 Changes for www/local-notification.js: 22 added lines, 17 removed lines. Original line number Diff line number Diff line Loading @@ -104,29 +104,28 @@ exports.setDefaults = function (newDefaults) { * A function to be called after the notification has been canceled * @param {Object} scope * The scope for the callback function * * @return {Number} * The notification's ID */ exports.add = function (props, callback, scope) { var options = this.mergeWithDefaults(props), fn = this.createCallbackFn(callback, scope); this.registerPermission(function(granted) { this.convertOptions(options); if (!granted) return; if (['WinCE', 'Win32NT'].indexOf(device.platform) > -1) { fn = function (cmd) { eval(cmd); }; var notifications = Array.isArray(props) ? props : [props]; for (var i = 0; i < notifications.length; i++) { var properties = notifications[i]; this.mergeWithDefaults(properties); this.convertProperties(properties); } this.registerPermission(function(granted) { if (granted) { this.exec('add', options, callback, scope); if (device.platform != 'iOS') { notifications = notifications[0]; } }, this); return options.id; this.exec('add', notifications, callback, scope); }, this); }; /** Loading Loading @@ -519,7 +518,7 @@ exports.mergeWithDefaults = function (options) { * @retrun {Object} * The converted property list */ exports.convertOptions = function (options) { exports.convertProperties = function (options) { if (options.id) { options.id = options.id.toString(); } Loading Loading @@ -618,7 +617,13 @@ exports.createCallbackFn = function (callbackFn, scope) { */ exports.exec = function (action, args, callback, scope) { var fn = this.createCallbackFn(callback, scope), params = args ? [args] : []; params = []; if (Array.isArray(args)) { params = args; } else if (args) { params.push(args); } exec(fn, null, 'LocalNotification', action, params); }; Loading
CHANGELOG.md +1 −1 Changes for CHANGELOG.md: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ - [enhancement:] Scope parameter for `isScheduled` and `getScheduledIds` - [enhancement:] Callbacks for `add`, `cancel` & `cancelAll` - [enhancement:] `image:` accepts remote URLs and local URIs (Android) - [enhancement:] Schedule multiple notifications at once (Android) - [enhancement:] Schedule multiple notifications at once - [enhancement:] Cancel multiple notifications at once - [enhancement:] Clear multiple notifications at once (Android) - [enhancement:] `clear` & `clearAll` methods (Android) Loading
src/ios/APPLocalNotification.m +9 −12 Changes for src/ios/APPLocalNotification.m: 9 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -62,17 +62,15 @@ } /** * Schedule a new local notification. * Schedule a set of notifications. * * @param properties * A dict of properties * A dict of properties for each notification */ - (void) add:(CDVInvokedUrlCommand*)command { [self.commandDelegate runInBackground:^{ NSDictionary* options = [[command arguments] objectAtIndex:0]; for (NSDictionary* options in command.arguments) { UILocalNotification* notification; notification = [[UILocalNotification alloc] Loading @@ -80,23 +78,22 @@ [self scheduleLocalNotification:notification]; [self fireEvent:@"add" localNotification:notification]; } [self execCallback:command]; }]; } /** * Cancels a given local notification. * Cancel a set of notifications. * * @param id * The ID of the local notification * @param ids * The IDs of the notifications */ - (void) cancel:(CDVInvokedUrlCommand*)command { [self.commandDelegate runInBackground:^{ NSArray* ids = [[command arguments] objectAtIndex:0]; for (NSString* id in ids) { for (NSString* id in command.arguments) { UILocalNotification* notification; notification = [[UIApplication sharedApplication] Loading
www/local-notification.js +22 −17 Changes for www/local-notification.js: 22 added lines, 17 removed lines. Original line number Diff line number Diff line Loading @@ -104,29 +104,28 @@ exports.setDefaults = function (newDefaults) { * A function to be called after the notification has been canceled * @param {Object} scope * The scope for the callback function * * @return {Number} * The notification's ID */ exports.add = function (props, callback, scope) { var options = this.mergeWithDefaults(props), fn = this.createCallbackFn(callback, scope); this.registerPermission(function(granted) { this.convertOptions(options); if (!granted) return; if (['WinCE', 'Win32NT'].indexOf(device.platform) > -1) { fn = function (cmd) { eval(cmd); }; var notifications = Array.isArray(props) ? props : [props]; for (var i = 0; i < notifications.length; i++) { var properties = notifications[i]; this.mergeWithDefaults(properties); this.convertProperties(properties); } this.registerPermission(function(granted) { if (granted) { this.exec('add', options, callback, scope); if (device.platform != 'iOS') { notifications = notifications[0]; } }, this); return options.id; this.exec('add', notifications, callback, scope); }, this); }; /** Loading Loading @@ -519,7 +518,7 @@ exports.mergeWithDefaults = function (options) { * @retrun {Object} * The converted property list */ exports.convertOptions = function (options) { exports.convertProperties = function (options) { if (options.id) { options.id = options.id.toString(); } Loading Loading @@ -618,7 +617,13 @@ exports.createCallbackFn = function (callbackFn, scope) { */ exports.exec = function (action, args, callback, scope) { var fn = this.createCallbackFn(callback, scope), params = args ? [args] : []; params = []; if (Array.isArray(args)) { params = args; } else if (args) { params.push(args); } exec(fn, null, 'LocalNotification', action, params); };