Parcourir la source

Prevent clearing the badge if no value had been assigned by user

Sebastián Katzer il y a 8 ans
Parent
commit
8767a0f264
2 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 3 1
      src/ios/APPNotificationOptions.m
  2. 1 1
      www/local-notification-util.js

+ 3 - 1
src/ios/APPNotificationOptions.m

@@ -119,7 +119,9 @@
  */
 - (NSNumber*) badge
 {
-    return [NSNumber numberWithInt:[[dict objectForKey:@"badge"] intValue]];
+    id value = [dict objectForKey:@"badge"];
+    
+    return (value == NULL) ? NULL : [NSNumber numberWithInt:[value intValue]];
 }
 
 /**

+ 1 - 1
www/local-notification-util.js

@@ -23,7 +23,7 @@ exports._defaults = {
     text:  '',
     title: '',
     sound: 'res://platform_default',
-    badge: 0,
+    badge: undefined,
     id:    0,
     data:  undefined,
     every: undefined,