summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/android/assets/www/plugins
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-05-10 17:15:14 +0200
committerJules Laplace <julescarbon@gmail.com>2018-05-10 17:15:14 +0200
commit2fb2e09bb24340a7cc33ae30037f45125791131c (patch)
tree45afccf7b9455ab48f7725a24bae5c28ad02ca9e /StoneIsland/platforms/android/assets/www/plugins
parent6196541cf993d5a1a4b8b7f511bf7daf8f849608 (diff)
androidz
Diffstat (limited to 'StoneIsland/platforms/android/assets/www/plugins')
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-customurlscheme/www/android/LaunchMyApp.js48
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-device/www/device.js85
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-dialogs/www/android/notification.js76
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-dialogs/www/notification.js132
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-geolocation/www/PositionError.js40
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-geolocation/www/android/geolocation.js73
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js113
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-network-information/www/Connection.js36
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-network-information/www/network.js93
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-splashscreen/www/splashscreen.js36
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-statusbar/www/statusbar.js116
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js123
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/ionic-plugin-keyboard/www/android/keyboard.js62
-rw-r--r--StoneIsland/platforms/android/assets/www/plugins/phonegap-plugin-push/www/push.js329
14 files changed, 1362 insertions, 0 deletions
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-customurlscheme/www/android/LaunchMyApp.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-customurlscheme/www/android/LaunchMyApp.js
new file mode 100644
index 00000000..091a8297
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-customurlscheme/www/android/LaunchMyApp.js
@@ -0,0 +1,48 @@
+cordova.define("cordova-plugin-customurlscheme.LaunchMyApp", function(require, exports, module) { (function () {
+ "use strict";
+
+ var remainingAttempts = 10;
+
+ function waitForAndCallHandlerFunction(url) {
+ if (typeof window.handleOpenURL === "function") {
+ // Clear the intent when we have a handler (note that this is only done when the preference 'CustomURLSchemePluginClearsAndroidIntent' is 'true' in config.xml
+ cordova.exec(
+ null,
+ null,
+ "LaunchMyApp",
+ "clearIntent",
+ []);
+
+ window.handleOpenURL(url);
+ } else if (remainingAttempts-- > 0) {
+ setTimeout(function(){waitForAndCallHandlerFunction(url);}, 500);
+ }
+ }
+
+ function triggerOpenURL() {
+ cordova.exec(
+ waitForAndCallHandlerFunction,
+ null,
+ "LaunchMyApp",
+ "checkIntent",
+ []);
+ }
+
+ document.addEventListener("deviceready", triggerOpenURL, false);
+
+ var launchmyapp = {
+ getLastIntent: function(success, failure) {
+ cordova.exec(
+ success,
+ failure,
+ "LaunchMyApp",
+ "getLastIntent",
+ []);
+ }
+ }
+
+ module.exports = launchmyapp;
+
+}());
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-device/www/device.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-device/www/device.js
new file mode 100644
index 00000000..ff0c5b48
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-device/www/device.js
@@ -0,0 +1,85 @@
+cordova.define("cordova-plugin-device.device", function(require, exports, module) { /*
+ *
+ * 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.
+ *
+*/
+
+var argscheck = require('cordova/argscheck'),
+ channel = require('cordova/channel'),
+ utils = require('cordova/utils'),
+ exec = require('cordova/exec'),
+ cordova = require('cordova');
+
+channel.createSticky('onCordovaInfoReady');
+// Tell cordova channel to wait on the CordovaInfoReady event
+channel.waitForInitialization('onCordovaInfoReady');
+
+/**
+ * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the
+ * phone, etc.
+ * @constructor
+ */
+function Device() {
+ this.available = false;
+ this.platform = null;
+ this.version = null;
+ this.uuid = null;
+ this.cordova = null;
+ this.model = null;
+ this.manufacturer = null;
+ this.isVirtual = null;
+ this.serial = null;
+
+ var me = this;
+
+ channel.onCordovaReady.subscribe(function() {
+ me.getInfo(function(info) {
+ //ignoring info.cordova returning from native, we should use value from cordova.version defined in cordova.js
+ //TODO: CB-5105 native implementations should not return info.cordova
+ var buildLabel = cordova.version;
+ me.available = true;
+ me.platform = info.platform;
+ me.version = info.version;
+ me.uuid = info.uuid;
+ me.cordova = buildLabel;
+ me.model = info.model;
+ me.isVirtual = info.isVirtual;
+ me.manufacturer = info.manufacturer || 'unknown';
+ me.serial = info.serial || 'unknown';
+ channel.onCordovaInfoReady.fire();
+ },function(e) {
+ me.available = false;
+ utils.alert("[ERROR] Error initializing Cordova: " + e);
+ });
+ });
+}
+
+/**
+ * Get device info
+ *
+ * @param {Function} successCallback The function to call when the heading data is available
+ * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL)
+ */
+Device.prototype.getInfo = function(successCallback, errorCallback) {
+ argscheck.checkArgs('fF', 'Device.getInfo', arguments);
+ exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
+};
+
+module.exports = new Device();
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-dialogs/www/android/notification.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-dialogs/www/android/notification.js
new file mode 100644
index 00000000..07b92378
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-dialogs/www/android/notification.js
@@ -0,0 +1,76 @@
+cordova.define("cordova-plugin-dialogs.notification_android", function(require, exports, module) { /*
+ *
+ * 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.
+ *
+*/
+
+var exec = require('cordova/exec');
+
+/**
+ * Provides Android enhanced notification API.
+ */
+module.exports = {
+ activityStart : function(title, message) {
+ // If title and message not specified then mimic Android behavior of
+ // using default strings.
+ if (typeof title === "undefined" && typeof message == "undefined") {
+ title = "Busy";
+ message = 'Please wait...';
+ }
+
+ exec(null, null, 'Notification', 'activityStart', [ title, message ]);
+ },
+
+ /**
+ * Close an activity dialog
+ */
+ activityStop : function() {
+ exec(null, null, 'Notification', 'activityStop', []);
+ },
+
+ /**
+ * Display a progress dialog with progress bar that goes from 0 to 100.
+ *
+ * @param {String}
+ * title Title of the progress dialog.
+ * @param {String}
+ * message Message to display in the dialog.
+ */
+ progressStart : function(title, message) {
+ exec(null, null, 'Notification', 'progressStart', [ title, message ]);
+ },
+
+ /**
+ * Close the progress dialog.
+ */
+ progressStop : function() {
+ exec(null, null, 'Notification', 'progressStop', []);
+ },
+
+ /**
+ * Set the progress dialog value.
+ *
+ * @param {Number}
+ * value 0-100
+ */
+ progressValue : function(value) {
+ exec(null, null, 'Notification', 'progressValue', [ value ]);
+ }
+};
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-dialogs/www/notification.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-dialogs/www/notification.js
new file mode 100644
index 00000000..d08d34a6
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-dialogs/www/notification.js
@@ -0,0 +1,132 @@
+cordova.define("cordova-plugin-dialogs.notification", function(require, exports, module) { /*
+ *
+ * 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.
+ *
+*/
+
+var exec = require('cordova/exec');
+var platform = require('cordova/platform');
+
+/**
+ * Provides access to notifications on the device.
+ */
+
+module.exports = {
+
+ /**
+ * Open a native alert dialog, with a customizable title and button text.
+ *
+ * @param {String} message Message to print in the body of the alert
+ * @param {Function} completeCallback The callback that is called when user clicks on a button.
+ * @param {String} title Title of the alert dialog (default: Alert)
+ * @param {String} buttonLabel Label of the close button (default: OK)
+ */
+ alert: function(message, completeCallback, title, buttonLabel) {
+ var _message = (typeof message === "string" ? message : JSON.stringify(message));
+ var _title = (typeof title === "string" ? title : "Alert");
+ var _buttonLabel = (buttonLabel || "OK");
+ exec(completeCallback, null, "Notification", "alert", [_message, _title, _buttonLabel]);
+ },
+
+ /**
+ * Open a native confirm dialog, with a customizable title and button text.
+ * The result that the user selects is returned to the result callback.
+ *
+ * @param {String} message Message to print in the body of the alert
+ * @param {Function} resultCallback The callback that is called when user clicks on a button.
+ * @param {String} title Title of the alert dialog (default: Confirm)
+ * @param {Array} buttonLabels Array of the labels of the buttons (default: ['OK', 'Cancel'])
+ */
+ confirm: function(message, resultCallback, title, buttonLabels) {
+ var _message = (typeof message === "string" ? message : JSON.stringify(message));
+ var _title = (typeof title === "string" ? title : "Confirm");
+ var _buttonLabels = (buttonLabels || ["OK", "Cancel"]);
+
+ // Strings are deprecated!
+ if (typeof _buttonLabels === 'string') {
+ console.log("Notification.confirm(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array).");
+ }
+
+ _buttonLabels = convertButtonLabels(_buttonLabels);
+
+ exec(resultCallback, null, "Notification", "confirm", [_message, _title, _buttonLabels]);
+ },
+
+ /**
+ * Open a native prompt dialog, with a customizable title and button text.
+ * The following results are returned to the result callback:
+ * buttonIndex Index number of the button selected.
+ * input1 The text entered in the prompt dialog box.
+ *
+ * @param {String} message Dialog message to display (default: "Prompt message")
+ * @param {Function} resultCallback The callback that is called when user clicks on a button.
+ * @param {String} title Title of the dialog (default: "Prompt")
+ * @param {Array} buttonLabels Array of strings for the button labels (default: ["OK","Cancel"])
+ * @param {String} defaultText Textbox input value (default: empty string)
+ */
+ prompt: function(message, resultCallback, title, buttonLabels, defaultText) {
+ var _message = (typeof message === "string" ? message : JSON.stringify(message));
+ var _title = (typeof title === "string" ? title : "Prompt");
+ var _buttonLabels = (buttonLabels || ["OK","Cancel"]);
+
+ // Strings are deprecated!
+ if (typeof _buttonLabels === 'string') {
+ console.log("Notification.prompt(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array).");
+ }
+
+ _buttonLabels = convertButtonLabels(_buttonLabels);
+
+ var _defaultText = (defaultText || "");
+ exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]);
+ },
+
+ /**
+ * Causes the device to beep.
+ * On Android, the default notification ringtone is played "count" times.
+ *
+ * @param {Integer} count The number of beeps.
+ */
+ beep: function(count) {
+ var defaultedCount = count || 1;
+ exec(null, null, "Notification", "beep", [ defaultedCount ]);
+ }
+};
+
+function convertButtonLabels(buttonLabels) {
+
+ // Some platforms take an array of button label names.
+ // Other platforms take a comma separated list.
+ // For compatibility, we convert to the desired type based on the platform.
+ if (platform.id == "amazon-fireos" || platform.id == "android" || platform.id == "ios" ||
+ platform.id == "windowsphone" || platform.id == "firefoxos" || platform.id == "ubuntu" ||
+ platform.id == "windows8" || platform.id == "windows") {
+
+ if (typeof buttonLabels === 'string') {
+ buttonLabels = buttonLabels.split(","); // not crazy about changing the var type here
+ }
+ } else {
+ if (Array.isArray(buttonLabels)) {
+ var buttonLabelArray = buttonLabels;
+ buttonLabels = buttonLabelArray.toString();
+ }
+ }
+
+ return buttonLabels;
+}
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-geolocation/www/PositionError.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-geolocation/www/PositionError.js
new file mode 100644
index 00000000..45439b70
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-geolocation/www/PositionError.js
@@ -0,0 +1,40 @@
+cordova.define("cordova-plugin-geolocation.PositionError", function(require, exports, module) { /*
+ *
+ * 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.
+ *
+*/
+
+/**
+ * Position error object
+ *
+ * @constructor
+ * @param code
+ * @param message
+ */
+var PositionError = function(code, message) {
+ this.code = code || null;
+ this.message = message || '';
+};
+
+PositionError.prototype.PERMISSION_DENIED = PositionError.PERMISSION_DENIED = 1;
+PositionError.prototype.POSITION_UNAVAILABLE = PositionError.POSITION_UNAVAILABLE = 2;
+PositionError.prototype.TIMEOUT = PositionError.TIMEOUT = 3;
+
+module.exports = PositionError;
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-geolocation/www/android/geolocation.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-geolocation/www/android/geolocation.js
new file mode 100644
index 00000000..c90d3c2a
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-geolocation/www/android/geolocation.js
@@ -0,0 +1,73 @@
+cordova.define("cordova-plugin-geolocation.geolocation", function(require, exports, module) { /*
+ *
+ * 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.
+ *
+*/
+
+var exec = cordova.require('cordova/exec');
+var utils = require('cordova/utils');
+var PositionError = require('./PositionError');
+
+// Native watchPosition method is called async after permissions prompt.
+// So we use additional map and own ids to return watch id synchronously.
+var pluginToNativeWatchMap = {};
+
+module.exports = {
+ getCurrentPosition: function(success, error, args) {
+ var win = function() {
+ var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation');
+ geo.getCurrentPosition(success, error, args);
+ };
+ var fail = function() {
+ if (error) {
+ error(new PositionError (PositionError.PERMISSION_DENIED, 'Illegal Access'));
+ }
+ };
+ exec(win, fail, "Geolocation", "getPermission", []);
+ },
+
+ watchPosition: function(success, error, args) {
+ var pluginWatchId = utils.createUUID();
+
+ var win = function() {
+ var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation');
+ pluginToNativeWatchMap[pluginWatchId] = geo.watchPosition(success, error, args);
+ };
+
+ var fail = function() {
+ if (error) {
+ error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
+ }
+ };
+ exec(win, fail, "Geolocation", "getPermission", []);
+
+ return pluginWatchId;
+ },
+
+ clearWatch: function(pluginWatchId) {
+ var win = function() {
+ var nativeWatchId = pluginToNativeWatchMap[pluginWatchId];
+ var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation');
+ geo.clearWatch(nativeWatchId);
+ };
+
+ exec(win, null, "Geolocation", "getPermission", []);
+ }
+};
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js
new file mode 100644
index 00000000..20bcd65a
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js
@@ -0,0 +1,113 @@
+cordova.define("cordova-plugin-inappbrowser.inappbrowser", function(require, exports, module) { /*
+ *
+ * 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.
+ *
+*/
+
+(function() {
+ // special patch to correctly work on Ripple emulator (CB-9760)
+ if (window.parent && !!window.parent.ripple) { // https://gist.github.com/triceam/4658021
+ module.exports = window.open.bind(window); // fallback to default window.open behaviour
+ return;
+ }
+
+ var exec = require('cordova/exec');
+ var channel = require('cordova/channel');
+ var modulemapper = require('cordova/modulemapper');
+ var urlutil = require('cordova/urlutil');
+
+ function InAppBrowser() {
+ this.channels = {
+ 'loadstart': channel.create('loadstart'),
+ 'loadstop' : channel.create('loadstop'),
+ 'loaderror' : channel.create('loaderror'),
+ 'exit' : channel.create('exit')
+ };
+ }
+
+ InAppBrowser.prototype = {
+ _eventHandler: function (event) {
+ if (event && (event.type in this.channels)) {
+ this.channels[event.type].fire(event);
+ }
+ },
+ close: function (eventname) {
+ exec(null, null, "InAppBrowser", "close", []);
+ },
+ show: function (eventname) {
+ exec(null, null, "InAppBrowser", "show", []);
+ },
+ addEventListener: function (eventname,f) {
+ if (eventname in this.channels) {
+ this.channels[eventname].subscribe(f);
+ }
+ },
+ removeEventListener: function(eventname, f) {
+ if (eventname in this.channels) {
+ this.channels[eventname].unsubscribe(f);
+ }
+ },
+
+ executeScript: function(injectDetails, cb) {
+ if (injectDetails.code) {
+ exec(cb, null, "InAppBrowser", "injectScriptCode", [injectDetails.code, !!cb]);
+ } else if (injectDetails.file) {
+ exec(cb, null, "InAppBrowser", "injectScriptFile", [injectDetails.file, !!cb]);
+ } else {
+ throw new Error('executeScript requires exactly one of code or file to be specified');
+ }
+ },
+
+ insertCSS: function(injectDetails, cb) {
+ if (injectDetails.code) {
+ exec(cb, null, "InAppBrowser", "injectStyleCode", [injectDetails.code, !!cb]);
+ } else if (injectDetails.file) {
+ exec(cb, null, "InAppBrowser", "injectStyleFile", [injectDetails.file, !!cb]);
+ } else {
+ throw new Error('insertCSS requires exactly one of code or file to be specified');
+ }
+ }
+ };
+
+ module.exports = function(strUrl, strWindowName, strWindowFeatures, callbacks) {
+ // Don't catch calls that write to existing frames (e.g. named iframes).
+ if (window.frames && window.frames[strWindowName]) {
+ var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open');
+ return origOpenFunc.apply(window, arguments);
+ }
+
+ strUrl = urlutil.makeAbsolute(strUrl);
+ var iab = new InAppBrowser();
+
+ callbacks = callbacks || {};
+ for (var callbackName in callbacks) {
+ iab.addEventListener(callbackName, callbacks[callbackName]);
+ }
+
+ var cb = function(eventname) {
+ iab._eventHandler(eventname);
+ };
+
+ strWindowFeatures = strWindowFeatures || "";
+
+ exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
+ return iab;
+ };
+})();
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-network-information/www/Connection.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-network-information/www/Connection.js
new file mode 100644
index 00000000..1450e953
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-network-information/www/Connection.js
@@ -0,0 +1,36 @@
+cordova.define("cordova-plugin-network-information.Connection", function(require, exports, module) { /*
+ *
+ * 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.
+ *
+*/
+
+/**
+ * Network status
+ */
+module.exports = {
+ UNKNOWN: "unknown",
+ ETHERNET: "ethernet",
+ WIFI: "wifi",
+ CELL_2G: "2g",
+ CELL_3G: "3g",
+ CELL_4G: "4g",
+ CELL:"cellular",
+ NONE: "none"
+};
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-network-information/www/network.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-network-information/www/network.js
new file mode 100644
index 00000000..bfac2e3f
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-network-information/www/network.js
@@ -0,0 +1,93 @@
+cordova.define("cordova-plugin-network-information.network", function(require, exports, module) { /*
+ * 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.
+ *
+*/
+
+var exec = require('cordova/exec'),
+ cordova = require('cordova'),
+ channel = require('cordova/channel'),
+ utils = require('cordova/utils');
+
+// Link the onLine property with the Cordova-supplied network info.
+// This works because we clobber the navigator object with our own
+// object in bootstrap.js.
+// Browser platform do not need to define this property, because
+// it is already supported by modern browsers
+if (cordova.platformId !== 'browser' && typeof navigator != 'undefined') {
+ utils.defineGetter(navigator, 'onLine', function() {
+ return this.connection.type != 'none';
+ });
+}
+
+function NetworkConnection() {
+ this.type = 'unknown';
+}
+
+/**
+ * Get connection info
+ *
+ * @param {Function} successCallback The function to call when the Connection data is available
+ * @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL)
+ */
+NetworkConnection.prototype.getInfo = function(successCallback, errorCallback) {
+ exec(successCallback, errorCallback, "NetworkStatus", "getConnectionInfo", []);
+};
+
+var me = new NetworkConnection();
+var timerId = null;
+var timeout = 500;
+
+channel.createSticky('onCordovaConnectionReady');
+channel.waitForInitialization('onCordovaConnectionReady');
+
+channel.onCordovaReady.subscribe(function() {
+ me.getInfo(function(info) {
+ me.type = info;
+ if (info === "none") {
+ // set a timer if still offline at the end of timer send the offline event
+ timerId = setTimeout(function(){
+ cordova.fireDocumentEvent("offline");
+ timerId = null;
+ }, timeout);
+ } else {
+ // If there is a current offline event pending clear it
+ if (timerId !== null) {
+ clearTimeout(timerId);
+ timerId = null;
+ }
+ cordova.fireDocumentEvent("online");
+ }
+
+ // should only fire this once
+ if (channel.onCordovaConnectionReady.state !== 2) {
+ channel.onCordovaConnectionReady.fire();
+ }
+ },
+ function (e) {
+ // If we can't get the network info we should still tell Cordova
+ // to fire the deviceready event.
+ if (channel.onCordovaConnectionReady.state !== 2) {
+ channel.onCordovaConnectionReady.fire();
+ }
+ console.log("Error initializing Network Connection: " + e);
+ });
+});
+
+module.exports = me;
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-splashscreen/www/splashscreen.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-splashscreen/www/splashscreen.js
new file mode 100644
index 00000000..5beaa5fd
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-splashscreen/www/splashscreen.js
@@ -0,0 +1,36 @@
+cordova.define("cordova-plugin-splashscreen.SplashScreen", function(require, exports, module) {
+/*
+ *
+ * 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.
+ *
+*/
+
+var exec = require('cordova/exec');
+
+var splashscreen = {
+ show:function() {
+ exec(null, null, "SplashScreen", "show", []);
+ },
+ hide:function() {
+ exec(null, null, "SplashScreen", "hide", []);
+ }
+};
+
+module.exports = splashscreen;
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-statusbar/www/statusbar.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-statusbar/www/statusbar.js
new file mode 100644
index 00000000..708186f9
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-statusbar/www/statusbar.js
@@ -0,0 +1,116 @@
+cordova.define("cordova-plugin-statusbar.statusbar", function(require, exports, module) {
+/*
+ *
+ * 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.
+ *
+*/
+
+/* global cordova */
+
+var exec = require('cordova/exec');
+
+var namedColors = {
+ "black": "#000000",
+ "darkGray": "#A9A9A9",
+ "lightGray": "#D3D3D3",
+ "white": "#FFFFFF",
+ "gray": "#808080",
+ "red": "#FF0000",
+ "green": "#00FF00",
+ "blue": "#0000FF",
+ "cyan": "#00FFFF",
+ "yellow": "#FFFF00",
+ "magenta": "#FF00FF",
+ "orange": "#FFA500",
+ "purple": "#800080",
+ "brown": "#A52A2A"
+};
+
+var StatusBar = {
+
+ isVisible: true,
+
+ overlaysWebView: function (doOverlay) {
+ exec(null, null, "StatusBar", "overlaysWebView", [doOverlay]);
+ },
+
+ styleDefault: function () {
+ // dark text ( to be used on a light background )
+ exec(null, null, "StatusBar", "styleDefault", []);
+ },
+
+ styleLightContent: function () {
+ // light text ( to be used on a dark background )
+ exec(null, null, "StatusBar", "styleLightContent", []);
+ },
+
+ styleBlackTranslucent: function () {
+ // #88000000 ? Apple says to use lightContent instead
+ exec(null, null, "StatusBar", "styleBlackTranslucent", []);
+ },
+
+ styleBlackOpaque: function () {
+ // #FF000000 ? Apple says to use lightContent instead
+ exec(null, null, "StatusBar", "styleBlackOpaque", []);
+ },
+
+ backgroundColorByName: function (colorname) {
+ return StatusBar.backgroundColorByHexString(namedColors[colorname]);
+ },
+
+ backgroundColorByHexString: function (hexString) {
+ if (hexString.charAt(0) !== "#") {
+ hexString = "#" + hexString;
+ }
+
+ if (hexString.length === 4) {
+ var split = hexString.split("");
+ hexString = "#" + split[1] + split[1] + split[2] + split[2] + split[3] + split[3];
+ }
+
+ exec(null, null, "StatusBar", "backgroundColorByHexString", [hexString]);
+ },
+
+ hide: function () {
+ exec(null, null, "StatusBar", "hide", []);
+ StatusBar.isVisible = false;
+ },
+
+ show: function () {
+ exec(null, null, "StatusBar", "show", []);
+ StatusBar.isVisible = true;
+ }
+
+};
+
+// prime it. setTimeout so that proxy gets time to init
+window.setTimeout(function () {
+ exec(function (res) {
+ if (typeof res == 'object') {
+ if (res.type == 'tap') {
+ cordova.fireWindowEvent('statusTap');
+ }
+ } else {
+ StatusBar.isVisible = res;
+ }
+ }, null, "StatusBar", "_ready", []);
+}, 0);
+
+module.exports = StatusBar;
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js
new file mode 100644
index 00000000..dbfd4d63
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js
@@ -0,0 +1,123 @@
+cordova.define("cordova-plugin-x-socialsharing.SocialSharing", function(require, exports, module) { function SocialSharing() {
+}
+
+// Override this method (after deviceready) to set the location where you want the iPad popup arrow to appear.
+// If not overridden with different values, the popup is not used. Example:
+//
+// window.plugins.socialsharing.iPadPopupCoordinates = function() {
+// return "100,100,200,300";
+// };
+SocialSharing.prototype.iPadPopupCoordinates = function () {
+ // left,top,width,height
+ return "-1,-1,-1,-1";
+};
+
+SocialSharing.prototype.setIPadPopupCoordinates = function (coords) {
+ // left,top,width,height
+ cordova.exec(function() {}, this._getErrorCallback(function() {}, "setIPadPopupCoordinates"), "SocialSharing", "setIPadPopupCoordinates", [coords]);
+};
+
+SocialSharing.prototype.available = function (callback) {
+ cordova.exec(function (avail) {
+ callback(avail ? true : false);
+ }, null, "SocialSharing", "available", []);
+};
+
+// this is the recommended way to share as it is the most feature-rich with respect to what you pass in and get back
+SocialSharing.prototype.shareWithOptions = function (options, successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareWithOptions"), "SocialSharing", "shareWithOptions", [options]);
+};
+
+SocialSharing.prototype.share = function (message, subject, fileOrFileArray, url, successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "share"), "SocialSharing", "share", [message, subject, this._asArray(fileOrFileArray), url]);
+};
+
+SocialSharing.prototype.shareViaTwitter = function (message, file /* multiple not allowed by twitter */, url, successCallback, errorCallback) {
+ var fileArray = this._asArray(file);
+ var ecb = this._getErrorCallback(errorCallback, "shareViaTwitter");
+ if (fileArray.length > 1) {
+ ecb("shareViaTwitter supports max one file");
+ } else {
+ cordova.exec(successCallback, ecb, "SocialSharing", "shareViaTwitter", [message, null, fileArray, url]);
+ }
+};
+
+SocialSharing.prototype.shareViaFacebook = function (message, fileOrFileArray, url, successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaFacebook"), "SocialSharing", "shareViaFacebook", [message, null, this._asArray(fileOrFileArray), url]);
+};
+
+SocialSharing.prototype.shareViaFacebookWithPasteMessageHint = function (message, fileOrFileArray, url, pasteMessageHint, successCallback, errorCallback) {
+ pasteMessageHint = pasteMessageHint || "If you like you can paste a message from your clipboard";
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaFacebookWithPasteMessageHint"), "SocialSharing", "shareViaFacebookWithPasteMessageHint", [message, null, this._asArray(fileOrFileArray), url, pasteMessageHint]);
+};
+
+SocialSharing.prototype.shareViaWhatsApp = function (message, fileOrFileArray, url, successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaWhatsApp"), "SocialSharing", "shareViaWhatsApp", [message, null, this._asArray(fileOrFileArray), url, null]);
+};
+
+SocialSharing.prototype.shareViaWhatsAppToReceiver = function (receiver, message, fileOrFileArray, url, successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaWhatsAppToReceiver"), "SocialSharing", "shareViaWhatsApp", [message, null, this._asArray(fileOrFileArray), url, receiver]);
+};
+
+SocialSharing.prototype.shareViaSMS = function (options, phonenumbers, successCallback, errorCallback) {
+ var opts = options;
+ if (typeof options == "string") {
+ opts = {"message":options}; // for backward compatibility as the options param used to be the message
+ }
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaSMS"), "SocialSharing", "shareViaSMS", [opts, phonenumbers]);
+};
+
+SocialSharing.prototype.shareViaEmail = function (message, subject, toArray, ccArray, bccArray, fileOrFileArray, successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaEmail"), "SocialSharing", "shareViaEmail", [message, subject, this._asArray(toArray), this._asArray(ccArray), this._asArray(bccArray), this._asArray(fileOrFileArray)]);
+};
+
+SocialSharing.prototype.canShareVia = function (via, message, subject, fileOrFileArray, url, successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "canShareVia"), "SocialSharing", "canShareVia", [message, subject, this._asArray(fileOrFileArray), url, via]);
+};
+
+SocialSharing.prototype.canShareViaEmail = function (successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "canShareViaEmail"), "SocialSharing", "canShareViaEmail", []);
+};
+
+SocialSharing.prototype.shareViaInstagram = function (message, fileOrFileArray, successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaInstagram"), "SocialSharing", "shareViaInstagram", [message, null, this._asArray(fileOrFileArray), null]);
+};
+
+SocialSharing.prototype.shareVia = function (via, message, subject, fileOrFileArray, url, successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareVia"), "SocialSharing", "shareVia", [message, subject, this._asArray(fileOrFileArray), url, via]);
+};
+
+SocialSharing.prototype.saveToPhotoAlbum = function (fileOrFileArray, successCallback, errorCallback) {
+ cordova.exec(successCallback, this._getErrorCallback(errorCallback, "saveToPhotoAlbum"), "SocialSharing", "saveToPhotoAlbum", [this._asArray(fileOrFileArray)]);
+};
+
+SocialSharing.prototype._asArray = function (param) {
+ if (param == null) {
+ param = [];
+ } else if (typeof param === 'string') {
+ param = new Array(param);
+ }
+ return param;
+};
+
+SocialSharing.prototype._getErrorCallback = function (ecb, functionName) {
+ if (typeof ecb === 'function') {
+ return ecb;
+ } else {
+ return function (result) {
+ console.log("The injected error callback of '" + functionName + "' received: " + JSON.stringify(result));
+ }
+ }
+};
+
+SocialSharing.install = function () {
+ if (!window.plugins) {
+ window.plugins = {};
+ }
+
+ window.plugins.socialsharing = new SocialSharing();
+ return window.plugins.socialsharing;
+};
+
+cordova.addConstructor(SocialSharing.install);
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/ionic-plugin-keyboard/www/android/keyboard.js b/StoneIsland/platforms/android/assets/www/plugins/ionic-plugin-keyboard/www/android/keyboard.js
new file mode 100644
index 00000000..cce2e5be
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/ionic-plugin-keyboard/www/android/keyboard.js
@@ -0,0 +1,62 @@
+cordova.define("ionic-plugin-keyboard.keyboard", function(require, exports, module) {
+var argscheck = require('cordova/argscheck'),
+ utils = require('cordova/utils'),
+ exec = require('cordova/exec'),
+ channel = require('cordova/channel');
+
+
+var Keyboard = function() {
+};
+
+Keyboard.hideKeyboardAccessoryBar = function(hide) {
+ exec(null, null, "Keyboard", "hideKeyboardAccessoryBar", [hide]);
+};
+
+Keyboard.close = function() {
+ exec(null, null, "Keyboard", "close", []);
+};
+
+Keyboard.show = function() {
+ exec(null, null, "Keyboard", "show", []);
+};
+
+Keyboard.disableScroll = function(disable) {
+ exec(null, null, "Keyboard", "disableScroll", [disable]);
+};
+
+/*
+Keyboard.styleDark = function(dark) {
+ exec(null, null, "Keyboard", "styleDark", [dark]);
+};
+*/
+
+Keyboard.isVisible = false;
+
+channel.onCordovaReady.subscribe(function() {
+ exec(success, null, 'Keyboard', 'init', []);
+
+ function success(msg) {
+ var action = msg.charAt(0);
+ if ( action === 'S' ) {
+ var keyboardHeight = msg.substr(1);
+ cordova.plugins.Keyboard.isVisible = true;
+ cordova.fireWindowEvent('native.keyboardshow', { 'keyboardHeight': + keyboardHeight });
+
+ //deprecated
+ cordova.fireWindowEvent('native.showkeyboard', { 'keyboardHeight': + keyboardHeight });
+ } else if ( action === 'H' ) {
+ cordova.plugins.Keyboard.isVisible = false;
+ cordova.fireWindowEvent('native.keyboardhide');
+
+ //deprecated
+ cordova.fireWindowEvent('native.hidekeyboard');
+ }
+ }
+});
+
+module.exports = Keyboard;
+
+
+
+
+});
diff --git a/StoneIsland/platforms/android/assets/www/plugins/phonegap-plugin-push/www/push.js b/StoneIsland/platforms/android/assets/www/plugins/phonegap-plugin-push/www/push.js
new file mode 100644
index 00000000..a5315486
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/plugins/phonegap-plugin-push/www/push.js
@@ -0,0 +1,329 @@
+cordova.define("phonegap-plugin-push.PushNotification", function(require, exports, module) {
+/* global cordova:false */
+/* globals window */
+
+/*!
+ * Module dependencies.
+ */
+
+var exec = cordova.require('cordova/exec');
+
+/**
+ * PushNotification constructor.
+ *
+ * @param {Object} options to initiate Push Notifications.
+ * @return {PushNotification} instance that can be monitored and cancelled.
+ */
+
+var PushNotification = function(options) {
+ this._handlers = {
+ 'registration': [],
+ 'notification': [],
+ 'error': []
+ };
+
+ // require options parameter
+ if (typeof options === 'undefined') {
+ throw new Error('The options argument is required.');
+ }
+
+ // store the options to this object instance
+ this.options = options;
+
+ // triggered on registration and notification
+ var that = this;
+ var success = function(result) {
+ if (result && typeof result.registrationId !== 'undefined') {
+ that.emit('registration', result);
+ } else if (result && result.additionalData && typeof result.additionalData.actionCallback !== 'undefined') {
+ var executeFuctionOrEmitEventByName = function(callbackName, context, arg) {
+ var namespaces = callbackName.split('.');
+ var func = namespaces.pop();
+ for (var i = 0; i < namespaces.length; i++) {
+ context = context[namespaces[i]];
+ }
+
+ if (typeof context[func] === 'function') {
+ context[func].call(context, arg);
+ } else {
+ that.emit(callbackName, arg);
+ }
+ };
+
+ executeFuctionOrEmitEventByName(result.additionalData.actionCallback, window, result);
+ } else if (result) {
+ that.emit('notification', result);
+ }
+ };
+
+ // triggered on error
+ var fail = function(msg) {
+ var e = (typeof msg === 'string') ? new Error(msg) : msg;
+ that.emit('error', e);
+ };
+
+ // wait at least one process tick to allow event subscriptions
+ setTimeout(function() {
+ exec(success, fail, 'PushNotification', 'init', [options]);
+ }, 10);
+};
+
+/**
+ * Unregister from push notifications
+ */
+
+PushNotification.prototype.unregister = function(successCallback, errorCallback, options) {
+ if (!errorCallback) { errorCallback = function() {}; }
+
+ if (typeof errorCallback !== 'function') {
+ console.log('PushNotification.unregister failure: failure parameter not a function');
+ return;
+ }
+
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.unregister failure: success callback parameter must be a function');
+ return;
+ }
+
+ var that = this;
+ var cleanHandlersAndPassThrough = function() {
+ if (!options) {
+ that._handlers = {
+ 'registration': [],
+ 'notification': [],
+ 'error': []
+ };
+ }
+ successCallback();
+ };
+
+ exec(cleanHandlersAndPassThrough, errorCallback, 'PushNotification', 'unregister', [options]);
+};
+
+/**
+ * subscribe to a topic
+ * @param {String} topic topic to subscribe
+ * @param {Function} successCallback success callback
+ * @param {Function} errorCallback error callback
+ * @return {void}
+ */
+PushNotification.prototype.subscribe = function(topic, successCallback, errorCallback) {
+ if (!errorCallback) { errorCallback = function() {}; }
+
+ if (typeof errorCallback !== 'function') {
+ console.log('PushNotification.subscribe failure: failure parameter not a function');
+ return;
+ }
+
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.subscribe failure: success callback parameter must be a function');
+ return;
+ }
+
+ exec(successCallback, errorCallback, 'PushNotification', 'subscribe', [topic]);
+};
+
+/**
+ * unsubscribe to a topic
+ * @param {String} topic topic to unsubscribe
+ * @param {Function} successCallback success callback
+ * @param {Function} errorCallback error callback
+ * @return {void}
+ */
+PushNotification.prototype.unsubscribe = function(topic, successCallback, errorCallback) {
+ if (!errorCallback) { errorCallback = function() {}; }
+
+ if (typeof errorCallback !== 'function') {
+ console.log('PushNotification.unsubscribe failure: failure parameter not a function');
+ return;
+ }
+
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.unsubscribe failure: success callback parameter must be a function');
+ return;
+ }
+
+ exec(successCallback, errorCallback, 'PushNotification', 'unsubscribe', [topic]);
+};
+
+/**
+ * Call this to set the application icon badge
+ */
+
+PushNotification.prototype.setApplicationIconBadgeNumber = function(successCallback, errorCallback, badge) {
+ if (!errorCallback) { errorCallback = function() {}; }
+
+ if (typeof errorCallback !== 'function') {
+ console.log('PushNotification.setApplicationIconBadgeNumber failure: failure parameter not a function');
+ return;
+ }
+
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.setApplicationIconBadgeNumber failure: success callback parameter must be a function');
+ return;
+ }
+
+ exec(successCallback, errorCallback, 'PushNotification', 'setApplicationIconBadgeNumber', [{badge: badge}]);
+};
+
+/**
+ * Get the application icon badge
+ */
+
+PushNotification.prototype.getApplicationIconBadgeNumber = function(successCallback, errorCallback) {
+ if (!errorCallback) { errorCallback = function() {}; }
+
+ if (typeof errorCallback !== 'function') {
+ console.log('PushNotification.getApplicationIconBadgeNumber failure: failure parameter not a function');
+ return;
+ }
+
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.getApplicationIconBadgeNumber failure: success callback parameter must be a function');
+ return;
+ }
+
+ exec(successCallback, errorCallback, 'PushNotification', 'getApplicationIconBadgeNumber', []);
+};
+
+/**
+ * Get the application icon badge
+ */
+
+PushNotification.prototype.clearAllNotifications = function(successCallback, errorCallback) {
+ if (!successCallback) { successCallback = function() {}; }
+ if (!errorCallback) { errorCallback = function() {}; }
+
+ if (typeof errorCallback !== 'function') {
+ console.log('PushNotification.clearAllNotifications failure: failure parameter not a function');
+ return;
+ }
+
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.clearAllNotifications failure: success callback parameter must be a function');
+ return;
+ }
+
+ exec(successCallback, errorCallback, 'PushNotification', 'clearAllNotifications', []);
+};
+
+/**
+ * Listen for an event.
+ *
+ * Any event is supported, but the following are built-in:
+ *
+ * - registration
+ * - notification
+ * - error
+ *
+ * @param {String} eventName to subscribe to.
+ * @param {Function} callback triggered on the event.
+ */
+
+PushNotification.prototype.on = function(eventName, callback) {
+ if (!this._handlers.hasOwnProperty(eventName)) {
+ this._handlers[eventName] = [];
+ }
+ this._handlers[eventName].push(callback);
+};
+
+/**
+ * Remove event listener.
+ *
+ * @param {String} eventName to match subscription.
+ * @param {Function} handle function associated with event.
+ */
+
+PushNotification.prototype.off = function (eventName, handle) {
+ if (this._handlers.hasOwnProperty(eventName)) {
+ var handleIndex = this._handlers[eventName].indexOf(handle);
+ if (handleIndex >= 0) {
+ this._handlers[eventName].splice(handleIndex, 1);
+ }
+ }
+};
+
+/**
+ * Emit an event.
+ *
+ * This is intended for internal use only.
+ *
+ * @param {String} eventName is the event to trigger.
+ * @param {*} all arguments are passed to the event listeners.
+ *
+ * @return {Boolean} is true when the event is triggered otherwise false.
+ */
+
+PushNotification.prototype.emit = function() {
+ var args = Array.prototype.slice.call(arguments);
+ var eventName = args.shift();
+
+ if (!this._handlers.hasOwnProperty(eventName)) {
+ return false;
+ }
+
+ for (var i = 0, length = this._handlers[eventName].length; i < length; i++) {
+ var callback = this._handlers[eventName][i];
+ if (typeof callback === 'function') {
+ callback.apply(undefined,args);
+ } else {
+ console.log('event handler: ' + eventName + ' must be a function');
+ }
+ }
+
+ return true;
+};
+
+PushNotification.prototype.finish = function(successCallback, errorCallback, id) {
+ if (!successCallback) { successCallback = function() {}; }
+ if (!errorCallback) { errorCallback = function() {}; }
+ if (!id) { id = 'handler'; }
+
+ if (typeof successCallback !== 'function') {
+ console.log('finish failure: success callback parameter must be a function');
+ return;
+ }
+
+ if (typeof errorCallback !== 'function') {
+ console.log('finish failure: failure parameter not a function');
+ return;
+ }
+
+ exec(successCallback, errorCallback, 'PushNotification', 'finish', [id]);
+};
+
+/*!
+ * Push Notification Plugin.
+ */
+
+module.exports = {
+ /**
+ * Register for Push Notifications.
+ *
+ * This method will instantiate a new copy of the PushNotification object
+ * and start the registration process.
+ *
+ * @param {Object} options
+ * @return {PushNotification} instance
+ */
+
+ init: function(options) {
+ return new PushNotification(options);
+ },
+
+ hasPermission: function(successCallback, errorCallback) {
+ exec(successCallback, errorCallback, 'PushNotification', 'hasPermission', []);
+ },
+
+ /**
+ * PushNotification Object.
+ *
+ * Expose the PushNotification object for direct use
+ * and testing. Typically, you should use the
+ * .init helper method.
+ */
+
+ PushNotification: PushNotification
+};
+
+});