Loading src/windows/LocalNotificationCore.js +6 −8 Changes for src/windows/LocalNotificationCore.js: 6 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -32,14 +32,12 @@ exports.core = { */ deviceready: function () { var plugin = cordova.plugins.notification.local, args; events = this.eventQueue; this.isReady = true; for (var i = 0; i < this.eventQueue.length; i++) { args = this.eventQueue[i]; plugin.fireEvent.apply(plugin, args); for (var i = 0; i < events.length; i++) { plugin.fireEvent.apply(plugin, events[i]); } this.eventQueue = []; Loading Loading @@ -370,7 +368,7 @@ exports.core = { var toasts = this.getScheduledToasts(), notifications = []; if (ids.length === 0) { if (!ids || ids.length === 0) { ids = this.getAllIds(); } Loading @@ -397,7 +395,7 @@ exports.core = { * List of local notification IDs */ getScheduled: function (ids) { if (ids.length === 0) { if (!ids || ids.length === 0) { ids = this.getAllIds(); } Loading @@ -412,7 +410,7 @@ exports.core = { * List of local notification IDs */ getTriggered: function (ids) { if (ids.length === 0) { if (!ids || ids.length === 0) { ids = this.getAllIds(); } Loading src/windows/LocalNotificationUtil.js +38 −12 Changes for src/windows/LocalNotificationUtil.js: 38 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -19,6 +19,9 @@ under the License. */ var channel = require('cordova/channel'); exports = require('de.appplant.cordova.plugin.local-notification.LocalNotification.Proxy.Core').core; Loading Loading @@ -288,6 +291,20 @@ exports.callOnTrigger = function (notification, callback) { }); }; /** * Sets trigger event for all scheduled local notification. * * @param {Function} callback * Callback function */ exports.callOnTriggerForScheduled = function (callback) { var notifications = this.getScheduled(); for (var i = 0; i < notifications.length; i++) { this.callOnTrigger(notifications[i], callback); } }; /** * The application state - background or foreground. * Loading Loading @@ -328,6 +345,27 @@ exports.fireEvent = function (event, notification) { * LIFE CYCLE * **************/ // Called before 'deviceready' event channel.onCordovaReady.subscribe(function () { // Register trigger handler for each scheduled notification exports.callOnTriggerForScheduled(function (notification) { this.updateBadge(notification.badge); this.fireEvent('trigger', notification); }); }); // Handle onclick event WinJS.Application.addEventListener('activated', function (args) { var id = args.detail.arguments, notification = exports.getAll([id])[0]; if (!notification) return; exports.clearLocalNotification(id); exports.fireEvent('click', notification); }, false); // App is running in background document.addEventListener('pause', function () { exports.isInBackground = true; Loading @@ -342,15 +380,3 @@ document.addEventListener('resume', function () { document.addEventListener('deviceready', function () { exports.isInBackground = false; }, false); // Handle onclick event WinJS.Application.addEventListener('activated', function (args) { var id = args.detail.arguments, notification = exports.getAll([id])[0]; if (!notification) return; exports.clearLocalNotification(id); exports.fireEvent('click', notification); }, false); Loading
src/windows/LocalNotificationCore.js +6 −8 Changes for src/windows/LocalNotificationCore.js: 6 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -32,14 +32,12 @@ exports.core = { */ deviceready: function () { var plugin = cordova.plugins.notification.local, args; events = this.eventQueue; this.isReady = true; for (var i = 0; i < this.eventQueue.length; i++) { args = this.eventQueue[i]; plugin.fireEvent.apply(plugin, args); for (var i = 0; i < events.length; i++) { plugin.fireEvent.apply(plugin, events[i]); } this.eventQueue = []; Loading Loading @@ -370,7 +368,7 @@ exports.core = { var toasts = this.getScheduledToasts(), notifications = []; if (ids.length === 0) { if (!ids || ids.length === 0) { ids = this.getAllIds(); } Loading @@ -397,7 +395,7 @@ exports.core = { * List of local notification IDs */ getScheduled: function (ids) { if (ids.length === 0) { if (!ids || ids.length === 0) { ids = this.getAllIds(); } Loading @@ -412,7 +410,7 @@ exports.core = { * List of local notification IDs */ getTriggered: function (ids) { if (ids.length === 0) { if (!ids || ids.length === 0) { ids = this.getAllIds(); } Loading
src/windows/LocalNotificationUtil.js +38 −12 Changes for src/windows/LocalNotificationUtil.js: 38 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -19,6 +19,9 @@ under the License. */ var channel = require('cordova/channel'); exports = require('de.appplant.cordova.plugin.local-notification.LocalNotification.Proxy.Core').core; Loading Loading @@ -288,6 +291,20 @@ exports.callOnTrigger = function (notification, callback) { }); }; /** * Sets trigger event for all scheduled local notification. * * @param {Function} callback * Callback function */ exports.callOnTriggerForScheduled = function (callback) { var notifications = this.getScheduled(); for (var i = 0; i < notifications.length; i++) { this.callOnTrigger(notifications[i], callback); } }; /** * The application state - background or foreground. * Loading Loading @@ -328,6 +345,27 @@ exports.fireEvent = function (event, notification) { * LIFE CYCLE * **************/ // Called before 'deviceready' event channel.onCordovaReady.subscribe(function () { // Register trigger handler for each scheduled notification exports.callOnTriggerForScheduled(function (notification) { this.updateBadge(notification.badge); this.fireEvent('trigger', notification); }); }); // Handle onclick event WinJS.Application.addEventListener('activated', function (args) { var id = args.detail.arguments, notification = exports.getAll([id])[0]; if (!notification) return; exports.clearLocalNotification(id); exports.fireEvent('click', notification); }, false); // App is running in background document.addEventListener('pause', function () { exports.isInBackground = true; Loading @@ -342,15 +380,3 @@ document.addEventListener('resume', function () { document.addEventListener('deviceready', function () { exports.isInBackground = false; }, false); // Handle onclick event WinJS.Application.addEventListener('activated', function (args) { var id = args.detail.arguments, notification = exports.getAll([id])[0]; if (!notification) return; exports.clearLocalNotification(id); exports.fireEvent('click', notification); }, false);