Commit b8d9e142 by Sebastián Katzer

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

parent 1ee8a5e5
...@@ -3,6 +3,10 @@ ChangeLog ...@@ -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. 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) ### Version 0.8.0 (05.03.2015)
- Support for iOS 8, Android 2 (SDK >= 7) and Android 5 - Support for iOS 8, Android 2 (SDK >= 7) and Android 5
......
...@@ -43,9 +43,9 @@ public class ClickActivity extends de.appplant.cordova.plugin.notification.Click ...@@ -43,9 +43,9 @@ public class ClickActivity extends de.appplant.cordova.plugin.notification.Click
public void onClick(Notification notification) { public void onClick(Notification notification) {
LocalNotification.fireEvent("click", notification); LocalNotification.fireEvent("click", notification);
if (!notification.isRepeating()) { String event = notification.isRepeating() ? "clear" : "cancel";
LocalNotification.fireEvent("cancel", notification);
} LocalNotification.fireEvent(event, notification);
super.onClick(notification); super.onClick(notification);
} }
......
...@@ -501,7 +501,6 @@ ...@@ -501,7 +501,6 @@
&& notification.timeIntervalSinceFireDate > seconds) && notification.timeIntervalSinceFireDate > seconds)
{ {
[self.app cancelLocalNotification:notification]; [self.app cancelLocalNotification:notification];
[self fireEvent:@"cancel" notification:notification]; [self fireEvent:@"cancel" notification:notification];
} }
} }
...@@ -527,8 +526,12 @@ ...@@ -527,8 +526,12 @@
[self fireEvent:event notification:notification]; [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.app cancelLocalNotification:notification];
[self fireEvent:@"cancel" notification:notification]; [self fireEvent:@"cancel" notification:notification];
} }
......
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