/* Copyright 2013-2015 appPlant UG Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ exports = require('de.appplant.cordova.plugin.local-notification.LocalNotification.Proxy').core; var channel = require('cordova/channel'); /*********** * MEMBERS * ***********/ // True if App is running, false if suspended exports.isInBackground = true; // Indicates if the device is ready (to receive events) exports.isReady = false; // Queues all events before deviceready exports.eventQueue = []; /******** * UTIL * ********/ /** * The repeating interval in milliseconds. * * @param {String} interval * A number or a placeholder like `minute`. * * @return {Number} * Interval in milliseconds */ exports.getRepeatInterval = function (every) { if (!every) return 0; if (every == 'minute') return 60000; if (every == 'hour') return 360000; if (!NaN(every)) return parseInt(every) * 60000; return 0; }; /** * If the notification is repeating. * * @param {Object} notification * Local notification object * * @return Boolean */ exports.isRepeating = function (notification) { return this.getRepeatInterval(notification.every) !== 0; }; /** * Parses sound file path. * * @param {String} path * Relative path to sound resource * * @return {String} XML Tag for Sound-File */ exports.parseSound = function (path) { if (!path.match(/^file/)) return ''; var uri = this.parseUri(path), audio = "