Commit d74caf68 by Sebastián Katzer

Fix getIds returns none existing notifications

parent 829501a9
......@@ -44,13 +44,13 @@ public class ClickActivity extends de.appplant.cordova.plugin.notification.Click
public void onClick(Notification notification) {
LocalNotification.fireEvent("click", notification);
if (!notification.getOptions().isOngoing()) {
String event = notification.isRepeating() ? "clear" : "cancel";
super.onClick(notification);
LocalNotification.fireEvent(event, notification);
}
if (notification.getOptions().isOngoing())
return;
super.onClick(notification);
String event = notification.isRepeating() ? "clear" : "cancel";
LocalNotification.fireEvent(event, notification);
}
/**
......
......@@ -40,6 +40,12 @@ public class ClickActivity extends AbstractClickActivity {
@Override
public void onClick(Notification notification) {
launchApp();
if (notification.isRepeating()) {
notification.clear();
} else {
notification.cancel();
}
}
/**
......
......@@ -145,7 +145,6 @@ public class Notification {
return false;
long now = new Date().getTime();
long updatedAt = options.getDict().optLong("updatedAt", now);
return (now - updatedAt) < 1000;
......@@ -184,15 +183,15 @@ public class Notification {
/**
* Clear the local notification without canceling repeating alarms.
*
*/
public void clear () {
if (!isRepeating() && wasInThePast()) {
if (!isRepeating() && wasInThePast())
unpersist();
} else {
if (!isRepeating())
getNotMgr().cancel(getId());
}
}
/**
* Cancel the local notification.
......@@ -240,13 +239,6 @@ public class Notification {
}
/**
* Show as modal dialog when in foreground.
*/
private void showDialog () {
// TODO
}
/**
* Count of triggers since schedule.
*/
public int getTriggerCountSinceSchedule() {
......
......@@ -213,10 +213,10 @@ public class Options {
* Trigger date in milliseconds.
*/
public long getTriggerTime() {
return Math.max(
System.currentTimeMillis(),
options.optLong("at", 0) * 1000
);
//return Math.max(
// System.currentTimeMillis(),
return options.optLong("at", 0) * 1000;
//);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment