Commit 40461306 authored by Sebastián Katzer's avatar Sebastián Katzer
Browse files

`onadd` was called each time after a repeating message was triggered

parent 7c642208
Loading
Loading
Loading
Loading
+4 −1
Changes for README.md: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -46,11 +46,14 @@ or to use this exact version:
More informations can be found [here](https://build.phonegap.com/plugins/413).

## Release Notes
#### Version 0.7.2 (not yet released)
- [enhancement:] Avoid blocking the main thread (on Android) **(dpogue)**.
- [bugfix:] `onadd` was called each time after a repeating message was triggered (Android)

#### Version 0.7.1 (31.01.2014)
- [bugfix:] `ongoing` attribute was ignored.
- [bugfix:] `oncancel` wasnt fired if `autoCancel` was set to true.
- [bugfix:] App throwed an error at restart if a callback was registered.
- [enhancement:] Avoid blocking the main thread (on Android) **(dpogue)**.

#### Version 0.7.0 (22.01.2014)
**Note:** The new way of callback registration will be not compatible with previous versions! See #62
+6 −2
Changes for src/android/LocalNotification.java: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class LocalNotification extends CordovaPlugin {
                    Options options      = new Options(context).parse(arguments);

                    persist(options.getId(), args);
                    add(options);
                    add(options, true);
                }
            });

@@ -116,8 +116,10 @@ public class LocalNotification extends CordovaPlugin {
     *
     * @param options
     *            The options that can be specified per alarm.
     * @param doFireEvent
     *            If the onadd callback shall be called.
     */
    public static void add (Options options) {
    public static void add (Options options, boolean doFireEvent) {
        long triggerTime = options.getDate();

        Intent intent = new Intent(context, Receiver.class)
@@ -127,7 +129,9 @@ public class LocalNotification extends CordovaPlugin {
        AlarmManager am  = getAlarmManager();
        PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);

        if (doFireEvent) {
            fireEvent("add", options.getId(), options.getJSON());
        }

        am.set(AlarmManager.RTC_WAKEUP, triggerTime, pi);
    }
+1 −1
Changes for src/android/Receiver.java: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ public class Receiver extends BroadcastReceiver {
        } else if (isFirstAlarmInFuture()) {
            return;
        } else {
            LocalNotification.add(options.moveDate());
            LocalNotification.add(options.moveDate(), false);
        }

        Builder notification = buildNotification();
+1 −1
Changes for src/android/Restore.java: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ public class Restore extends BroadcastReceiver {
                /*
                 * If the trigger date was in the past, the notification will be displayed immediately.
                 */
                LocalNotification.add(options);
                LocalNotification.add(options, false);

            } catch (JSONException e) {}
        }