Pārlūkot izejas kodu

Make sure that - if an ID is given - the ID needs to be a string.

The app crashes if a number is passed as an argument.
Sebastián Katzer 12 gadi atpakaļ
vecāks
revīzija
c00e6cdfef
1 mainītis faili ar 6 papildinājumiem un 2 dzēšanām
  1. 6 2
      www/local-notification.js

+ 6 - 2
www/local-notification.js

@@ -40,6 +40,10 @@ LocalNotification.prototype = {
             }
         }
 
+        if (defaults.id) {
+            defaults.id = defaults.id.toString();
+        }
+
         if (typeof defaults.date == 'object') {
             defaults.date = Math.round(defaults.date.getTime()/1000);
         }
@@ -55,7 +59,7 @@ LocalNotification.prototype = {
      * @param {String} id
      */
     cancel: function (id) {
-        cordova.exec(null, null, 'LocalNotification', 'cancel', [id]);
+        cordova.exec(null, null, 'LocalNotification', 'cancel', [id.toString()]);
     },
 
     /**
@@ -68,4 +72,4 @@ LocalNotification.prototype = {
 
 var plugin = new LocalNotification();
 
-module.exports = plugin;
+module.exports = plugin;