|
@@ -36,6 +36,7 @@ import org.json.JSONObject;
|
|
|
|
|
|
|
|
import java.lang.reflect.Method;
|
|
import java.lang.reflect.Method;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import de.appplant.cordova.plugin.notification.Manager;
|
|
import de.appplant.cordova.plugin.notification.Manager;
|
|
@@ -234,6 +235,9 @@ public class LocalNotification extends CordovaPlugin {
|
|
|
Notification notification =
|
|
Notification notification =
|
|
|
getNotificationMgr().update(id, update, TriggerReceiver.class);
|
|
getNotificationMgr().update(id, update, TriggerReceiver.class);
|
|
|
|
|
|
|
|
|
|
+ if (notification == null)
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
fireEvent("update", notification);
|
|
fireEvent("update", notification);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -251,9 +255,10 @@ public class LocalNotification extends CordovaPlugin {
|
|
|
Notification notification =
|
|
Notification notification =
|
|
|
getNotificationMgr().cancel(id);
|
|
getNotificationMgr().cancel(id);
|
|
|
|
|
|
|
|
- if (notification != null) {
|
|
|
|
|
- fireEvent("cancel", notification);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (notification == null)
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
|
|
+ fireEvent("cancel", notification);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -278,9 +283,10 @@ public class LocalNotification extends CordovaPlugin {
|
|
|
Notification notification =
|
|
Notification notification =
|
|
|
getNotificationMgr().clear(id);
|
|
getNotificationMgr().clear(id);
|
|
|
|
|
|
|
|
- if (notification != null) {
|
|
|
|
|
- fireEvent("clear", notification);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (notification == null)
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
|
|
+ fireEvent("clear", notification);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -469,11 +475,20 @@ public class LocalNotification extends CordovaPlugin {
|
|
|
CallbackContext command) {
|
|
CallbackContext command) {
|
|
|
|
|
|
|
|
JSONArray ids = new JSONArray().put(id);
|
|
JSONArray ids = new JSONArray().put(id);
|
|
|
|
|
+ PluginResult result;
|
|
|
|
|
|
|
|
- JSONObject options =
|
|
|
|
|
- getNotificationMgr().getOptionsBy(type, toList(ids)).get(0);
|
|
|
|
|
|
|
+ List<JSONObject> options =
|
|
|
|
|
+ getNotificationMgr().getOptionsBy(type, toList(ids));
|
|
|
|
|
|
|
|
- command.success(options);
|
|
|
|
|
|
|
+ if (options.isEmpty()) {
|
|
|
|
|
+ // Status.NO_RESULT led to no callback invocation :(
|
|
|
|
|
+ // Status.OK led to no NPE and crash
|
|
|
|
|
+ result = new PluginResult(PluginResult.Status.NO_RESULT);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result = new PluginResult(PluginResult.Status.OK, options.get(0));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ command.sendPluginResult(result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|