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

Fire `clear` instead of `cancel` when clicked on repeating notifications

parent 1ee8a5e5
Loading
Loading
Loading
Loading
+4 −0
Changes for CHANGELOG.md: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,10 @@ ChangeLog

Please also read the [Upgrade Guide](https://github.com/katzer/cordova-plugin-local-notifications/wiki/Upgrade-Guide) for more information.

#### Version 0.8.1 (not yet released)

- Fire `clear` instead of `cancel` event when clicked on repeating notifications

### Version 0.8.0 (05.03.2015)

- Support for iOS 8, Android 2 (SDK >= 7) and Android 5
+3 −3
Changes for src/android/ClickActivity.java: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -43,9 +43,9 @@ public class ClickActivity extends de.appplant.cordova.plugin.notification.Click
    public void onClick(Notification notification) {
        LocalNotification.fireEvent("click", notification);

        if (!notification.isRepeating()) {
            LocalNotification.fireEvent("cancel", notification);
        }
        String event = notification.isRepeating() ? "clear" : "cancel";

        LocalNotification.fireEvent(event, notification);

        super.onClick(notification);
    }
+6 −3
Changes for src/ios/APPLocalNotification.m: 6 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -501,7 +501,6 @@
            && notification.timeIntervalSinceFireDate > seconds)
        {
            [self.app cancelLocalNotification:notification];

            [self fireEvent:@"cancel" notification:notification];
        }
    }
@@ -527,8 +526,12 @@

    [self fireEvent:event notification:notification];

    if ([event isEqualToString:@"click"] && ![notification isRepeating])
    {
    if (![event isEqualToString:@"click"])
        return;

    if ([notification isRepeating]) {
        [self fireEvent:@"clear" notification:notification];
    } else {
        [self.app cancelLocalNotification:notification];
        [self fireEvent:@"cancel" notification:notification];
    }