Loading src/android/DeleteIntentReceiver.java +26 −0 Changes for src/android/DeleteIntentReceiver.java: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ package de.appplant.cordova.plugin.localnotification; import java.util.Date; import org.json.JSONException; import org.json.JSONObject; Loading Loading @@ -49,8 +51,32 @@ public class DeleteIntentReceiver extends BroadcastReceiver { // The context may got lost if the app was not running before LocalNotification.setContext(context); Date now = new Date(); if ((options.getInterval()!=0)){ LocalNotification.persist(options.getId(), setInitDate(args)); } else if((new Date(options.getDate()).before(now))){ LocalNotification.unpersist(options.getId()); } fireClearEvent(options); } private JSONObject setInitDate(JSONObject arguments){ long initialDate = arguments.optLong("date", 0) * 1000; try { arguments.put("initialDate", initialDate); } catch (JSONException e) { e.printStackTrace(); } return arguments; } /** * Fires onclear event. */ private void fireClearEvent (Options options) { LocalNotification.fireEvent("clear", options.getId(), options.getJSON()); } } Loading
src/android/DeleteIntentReceiver.java +26 −0 Changes for src/android/DeleteIntentReceiver.java: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ package de.appplant.cordova.plugin.localnotification; import java.util.Date; import org.json.JSONException; import org.json.JSONObject; Loading Loading @@ -49,8 +51,32 @@ public class DeleteIntentReceiver extends BroadcastReceiver { // The context may got lost if the app was not running before LocalNotification.setContext(context); Date now = new Date(); if ((options.getInterval()!=0)){ LocalNotification.persist(options.getId(), setInitDate(args)); } else if((new Date(options.getDate()).before(now))){ LocalNotification.unpersist(options.getId()); } fireClearEvent(options); } private JSONObject setInitDate(JSONObject arguments){ long initialDate = arguments.optLong("date", 0) * 1000; try { arguments.put("initialDate", initialDate); } catch (JSONException e) { e.printStackTrace(); } return arguments; } /** * Fires onclear event. */ private void fireClearEvent (Options options) { LocalNotification.fireEvent("clear", options.getId(), options.getJSON()); } }