소스 검색

Do not fire `clear` or `cancel` event when clicked on persistent notifications

Sebastián Katzer 10 년 전
부모
커밋
d01c621b97
2개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 0
      CHANGELOG.md
  2. 4 2
      src/android/ClickActivity.java

+ 1 - 0
CHANGELOG.md

@@ -6,6 +6,7 @@ Please also read the [Upgrade Guide](https://github.com/katzer/cordova-plugin-lo
 #### Version 0.8.1 (not yet released)
 
 - Fire `clear` instead of `cancel` event when clicked on repeating notifications
+- Do not fire `clear` or `cancel` event when clicked on persistent notifications
 
 ### Version 0.8.0 (05.03.2015)
 

+ 4 - 2
src/android/ClickActivity.java

@@ -43,9 +43,11 @@ public class ClickActivity extends de.appplant.cordova.plugin.notification.Click
     public void onClick(Notification notification) {
         LocalNotification.fireEvent("click", notification);
 
-        String event = notification.isRepeating() ? "clear" : "cancel";
+        if (!notification.getOptions().isOngoing()) {
+            String event = notification.isRepeating() ? "clear" : "cancel";
 
-        LocalNotification.fireEvent(event, notification);
+            LocalNotification.fireEvent(event, notification);
+        }
 
         super.onClick(notification);
     }