Explorar o código

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

Sebastián Katzer %!s(int64=8) %!d(string=hai) anos
pai
achega
8767a0f264
Modificáronse 2 ficheiros con 4 adicións e 2 borrados
  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,