Loading CHANGELOG.md +2 −1 Changes for CHANGELOG.md: 2 added lines, 1 removed line. Original line number Diff line number Diff line ## ChangeLog #### Version 0.8.0 (not yet released) - [enhancement:] android 2.1 support added (Thanks to **khizarsonu**) - [enhancement:] Android 2.x (SDK >= 7) support (Thanks to **khizarsonu**) - [enhancement:] Scope parameter for `isScheduled` and `getScheduledIds` - [enhancement:] Callbacks for `cancel` & `cancelAll` #### Version 0.7.4 (22.03.2014) - [bugfix:] Platform specific properties were ignored. Loading README.md +8 −3 Changes for README.md: 8 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -70,8 +70,9 @@ More informations can be found [here][PGB_plugin]. ## ChangeLog #### Version 0.8.0 (not yet released) - [enhancement:] android 2.1 support added (Thanks to **khizarsonu**) - [enhancement:] Android 2.x (SDK >= 7) support (Thanks to **khizarsonu**) - [enhancement:] Scope parameter for `isScheduled` and `getScheduledIds` - [enhancement:] Callbacks for `cancel` & `cancelAll` #### Further informations - See [CHANGELOG.md][changelog] to get the full changelog for the plugin. Loading Loading @@ -131,7 +132,9 @@ Note that only local notifications with an ID can be canceled. - See [getScheduledIds][getscheduledids] of how to retrieve a list of IDs of all scheduled local notifications. ```javascript window.plugin.notification.local.cancel(ID); window.plugin.notification.local.cancel(ID, function () { // The notification has been canceled }, scope); ``` ### Cancel all scheduled local notifications Loading @@ -142,7 +145,9 @@ The method cancels all local notifications even if they have no ID. - See the [oncancel][oncancel] event of how a listener can be registered to be notified when a local notification has been canceled. ```javascript window.plugin.notification.local.cancelAll(); window.plugin.notification.local.cancelAll(function () { // All notifications have been canceled }, scope); ``` ### Check wether a notification with an ID is scheduled Loading src/android/LocalNotification.java +13 −21 Changes for src/android/LocalNotification.java: 13 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class LocalNotification extends CordovaPlugin { } @Override public boolean execute (String action, final JSONArray args, CallbackContext callbackContext) throws JSONException { public boolean execute (String action, final JSONArray args, final CallbackContext command) throws JSONException { if (action.equalsIgnoreCase("add")) { cordova.getThreadPool().execute( new Runnable() { public void run() { Loading @@ -78,8 +78,6 @@ public class LocalNotification extends CordovaPlugin { add(options, true); } }); return true; } if (action.equalsIgnoreCase("cancel")) { Loading @@ -89,10 +87,9 @@ public class LocalNotification extends CordovaPlugin { cancel(id); unpersist(id); execCallback(command); } }); return true; } if (action.equalsIgnoreCase("cancelAll")) { Loading @@ -100,24 +97,19 @@ public class LocalNotification extends CordovaPlugin { public void run() { cancelAll(); unpersistAll(); execCallback(command); } }); return true; } if (action.equalsIgnoreCase("isScheduled")) { String id = args.optString(0); isScheduled(id, callbackContext); return true; isScheduled(id, command); } if (action.equalsIgnoreCase("getScheduledIds")) { getScheduledIds(callbackContext); return true; getScheduledIds(command); } if (action.equalsIgnoreCase("deviceready")) { Loading @@ -126,24 +118,17 @@ public class LocalNotification extends CordovaPlugin { deviceready(); } }); return true; } if (action.equalsIgnoreCase("pause")) { isInBackground = true; return true; } if (action.equalsIgnoreCase("resume")) { isInBackground = false; return true; } // Returning false results in a "MethodNotFound" error. return false; return true; } /** Loading Loading @@ -309,6 +294,13 @@ public class LocalNotification extends CordovaPlugin { editor.apply(); } /** * Simply invokes the callback without any parameter. */ private static void execCallback (CallbackContext command) { command.sendPluginResult(new PluginResult(PluginResult.Status.OK)); } /** * Fires the given event. * Loading src/ios/APPLocalNotification.m +18 −0 Changes for src/ios/APPLocalNotification.m: 18 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ - (NSString*) applicationState; // Retrieves all scheduled notifications - (NSArray*) scheduledNotifications; // Simply invokes the callback without any parameter - (void) execCallback:(CDVInvokedUrlCommand*)command; // Fires the given event - (void) fireEvent:(NSString*)event id:(NSString*)id json:(NSString*)json; Loading Loading @@ -133,6 +135,8 @@ if (notification) { [self cancelNotification:notification fireEvent:YES]; } [self execCallback:command]; }]; } Loading @@ -153,6 +157,8 @@ [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; [self execCallback:command]; }]; } Loading Loading @@ -560,6 +566,18 @@ return notificationsWithoutNIL; } /** * Simply invokes the callback without any parameter. */ - (void) execCallback:(CDVInvokedUrlCommand*)command { CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; [self.commandDelegate sendPluginResult:result callbackId:command.callbackId]; } /** * Fires the given event. * Loading src/wp8/LocalNotification.cs +1 −0 Changes for src/wp8/LocalNotification.cs: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ namespace Cordova.Extension.Commands cancelAll(jsonArgs); FireEvent("cancel", notificationID, ""); DispatchCommandResult(); } /// <summary> Loading Loading
CHANGELOG.md +2 −1 Changes for CHANGELOG.md: 2 added lines, 1 removed line. Original line number Diff line number Diff line ## ChangeLog #### Version 0.8.0 (not yet released) - [enhancement:] android 2.1 support added (Thanks to **khizarsonu**) - [enhancement:] Android 2.x (SDK >= 7) support (Thanks to **khizarsonu**) - [enhancement:] Scope parameter for `isScheduled` and `getScheduledIds` - [enhancement:] Callbacks for `cancel` & `cancelAll` #### Version 0.7.4 (22.03.2014) - [bugfix:] Platform specific properties were ignored. Loading
README.md +8 −3 Changes for README.md: 8 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -70,8 +70,9 @@ More informations can be found [here][PGB_plugin]. ## ChangeLog #### Version 0.8.0 (not yet released) - [enhancement:] android 2.1 support added (Thanks to **khizarsonu**) - [enhancement:] Android 2.x (SDK >= 7) support (Thanks to **khizarsonu**) - [enhancement:] Scope parameter for `isScheduled` and `getScheduledIds` - [enhancement:] Callbacks for `cancel` & `cancelAll` #### Further informations - See [CHANGELOG.md][changelog] to get the full changelog for the plugin. Loading Loading @@ -131,7 +132,9 @@ Note that only local notifications with an ID can be canceled. - See [getScheduledIds][getscheduledids] of how to retrieve a list of IDs of all scheduled local notifications. ```javascript window.plugin.notification.local.cancel(ID); window.plugin.notification.local.cancel(ID, function () { // The notification has been canceled }, scope); ``` ### Cancel all scheduled local notifications Loading @@ -142,7 +145,9 @@ The method cancels all local notifications even if they have no ID. - See the [oncancel][oncancel] event of how a listener can be registered to be notified when a local notification has been canceled. ```javascript window.plugin.notification.local.cancelAll(); window.plugin.notification.local.cancelAll(function () { // All notifications have been canceled }, scope); ``` ### Check wether a notification with an ID is scheduled Loading
src/android/LocalNotification.java +13 −21 Changes for src/android/LocalNotification.java: 13 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class LocalNotification extends CordovaPlugin { } @Override public boolean execute (String action, final JSONArray args, CallbackContext callbackContext) throws JSONException { public boolean execute (String action, final JSONArray args, final CallbackContext command) throws JSONException { if (action.equalsIgnoreCase("add")) { cordova.getThreadPool().execute( new Runnable() { public void run() { Loading @@ -78,8 +78,6 @@ public class LocalNotification extends CordovaPlugin { add(options, true); } }); return true; } if (action.equalsIgnoreCase("cancel")) { Loading @@ -89,10 +87,9 @@ public class LocalNotification extends CordovaPlugin { cancel(id); unpersist(id); execCallback(command); } }); return true; } if (action.equalsIgnoreCase("cancelAll")) { Loading @@ -100,24 +97,19 @@ public class LocalNotification extends CordovaPlugin { public void run() { cancelAll(); unpersistAll(); execCallback(command); } }); return true; } if (action.equalsIgnoreCase("isScheduled")) { String id = args.optString(0); isScheduled(id, callbackContext); return true; isScheduled(id, command); } if (action.equalsIgnoreCase("getScheduledIds")) { getScheduledIds(callbackContext); return true; getScheduledIds(command); } if (action.equalsIgnoreCase("deviceready")) { Loading @@ -126,24 +118,17 @@ public class LocalNotification extends CordovaPlugin { deviceready(); } }); return true; } if (action.equalsIgnoreCase("pause")) { isInBackground = true; return true; } if (action.equalsIgnoreCase("resume")) { isInBackground = false; return true; } // Returning false results in a "MethodNotFound" error. return false; return true; } /** Loading Loading @@ -309,6 +294,13 @@ public class LocalNotification extends CordovaPlugin { editor.apply(); } /** * Simply invokes the callback without any parameter. */ private static void execCallback (CallbackContext command) { command.sendPluginResult(new PluginResult(PluginResult.Status.OK)); } /** * Fires the given event. * Loading
src/ios/APPLocalNotification.m +18 −0 Changes for src/ios/APPLocalNotification.m: 18 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ - (NSString*) applicationState; // Retrieves all scheduled notifications - (NSArray*) scheduledNotifications; // Simply invokes the callback without any parameter - (void) execCallback:(CDVInvokedUrlCommand*)command; // Fires the given event - (void) fireEvent:(NSString*)event id:(NSString*)id json:(NSString*)json; Loading Loading @@ -133,6 +135,8 @@ if (notification) { [self cancelNotification:notification fireEvent:YES]; } [self execCallback:command]; }]; } Loading @@ -153,6 +157,8 @@ [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; [self execCallback:command]; }]; } Loading Loading @@ -560,6 +566,18 @@ return notificationsWithoutNIL; } /** * Simply invokes the callback without any parameter. */ - (void) execCallback:(CDVInvokedUrlCommand*)command { CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; [self.commandDelegate sendPluginResult:result callbackId:command.callbackId]; } /** * Fires the given event. * Loading
src/wp8/LocalNotification.cs +1 −0 Changes for src/wp8/LocalNotification.cs: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ namespace Cordova.Extension.Commands cancelAll(jsonArgs); FireEvent("cancel", notificationID, ""); DispatchCommandResult(); } /// <summary> Loading