From 22721a013bdd10d5eb395ba18453585f5f3f1f7f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 31 Aug 2020 23:07:20 +0200 Subject: rebuild the ios platform and the plugins --- .../ios/platform_www/cordova-js-src/exec.js | 187 +---- .../ios/platform_www/cordova-js-src/platform.js | 8 + .../cordova-js-src/plugin/ios/console.js | 122 +-- .../cordova-js-src/plugin/ios/launchscreen.js | 33 + .../cordova-js-src/plugin/ios/logger.js | 130 ++- .../cordova-js-src/plugin/ios/wkwebkit.js | 42 + StoneIsland/platforms/ios/platform_www/cordova.js | 935 +++++++-------------- .../platforms/ios/platform_www/cordova_plugins.js | 265 +++--- .../cordova-plugin-firebasex/www/firebase.js | 388 +++++++++ .../cordova-plugin-geolocation/www/Coordinates.js | 2 +- .../cordova-plugin-geolocation/www/Position.js | 2 +- .../www/PositionError.js | 2 +- .../cordova-plugin-geolocation/www/geolocation.js | 78 +- .../www/inappbrowser.js | 114 --- .../www/ios/keyboard.js | 105 +++ .../www/Connection.js | 37 - .../www/network.js | 94 --- .../www/splashscreen.js | 36 - .../cordova-plugin-statusbar/www/statusbar.js | 116 --- .../www/SocialSharing.js | 124 --- .../ionic-plugin-keyboard/www/ios/keyboard.js | 43 - .../www/MobileAccessibilityNotifications.js | 53 -- .../www/mobile-accessibility.js | 502 ----------- .../plugins/phonegap-plugin-push/www/push.js | 329 -------- 24 files changed, 1182 insertions(+), 2565 deletions(-) create mode 100644 StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/launchscreen.js create mode 100644 StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/wkwebkit.js create mode 100644 StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-firebasex/www/firebase.js delete mode 100644 StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js create mode 100644 StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-ionic-keyboard/www/ios/keyboard.js delete mode 100644 StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/Connection.js delete mode 100644 StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/network.js delete mode 100644 StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-splashscreen/www/splashscreen.js delete mode 100644 StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-statusbar/www/statusbar.js delete mode 100644 StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js delete mode 100644 StoneIsland/platforms/ios/platform_www/plugins/ionic-plugin-keyboard/www/ios/keyboard.js delete mode 100644 StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-mobile-accessibility/www/MobileAccessibilityNotifications.js delete mode 100644 StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-mobile-accessibility/www/mobile-accessibility.js delete mode 100644 StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-push/www/push.js (limited to 'StoneIsland/platforms/ios/platform_www') diff --git a/StoneIsland/platforms/ios/platform_www/cordova-js-src/exec.js b/StoneIsland/platforms/ios/platform_www/cordova-js-src/exec.js index 3fb7fa19..466220d8 100644 --- a/StoneIsland/platforms/ios/platform_www/cordova-js-src/exec.js +++ b/StoneIsland/platforms/ios/platform_www/cordova-js-src/exec.js @@ -19,30 +19,24 @@ * */ -/*global require, module, atob, document */ - /** - * Creates a gap bridge iframe used to notify the native code about queued + * Creates the exec bridge used to notify the native code of * commands. */ -var cordova = require('cordova'), - utils = require('cordova/utils'), - base64 = require('cordova/base64'), - execIframe, - commandQueue = [], // Contains pending JS->Native messages. - isInContextOfEvalJs = 0, - failSafeTimerId = 0; +var cordova = require('cordova'); +var utils = require('cordova/utils'); +var base64 = require('cordova/base64'); -function massageArgsJsToNative(args) { - if (!args || utils.typeName(args) != 'Array') { +function massageArgsJsToNative (args) { + if (!args || utils.typeName(args) !== 'Array') { return args; } var ret = []; - args.forEach(function(arg, i) { - if (utils.typeName(arg) == 'ArrayBuffer') { + args.forEach(function (arg, i) { + if (utils.typeName(arg) === 'ArrayBuffer') { ret.push({ - 'CDVType': 'ArrayBuffer', - 'data': base64.fromArrayBuffer(arg) + CDVType: 'ArrayBuffer', + data: base64.fromArrayBuffer(arg) }); } else { ret.push(arg); @@ -51,29 +45,29 @@ function massageArgsJsToNative(args) { return ret; } -function massageMessageNativeToJs(message) { - if (message.CDVType == 'ArrayBuffer') { - var stringToArrayBuffer = function(str) { +function massageMessageNativeToJs (message) { + if (message.CDVType === 'ArrayBuffer') { + var stringToArrayBuffer = function (str) { var ret = new Uint8Array(str.length); for (var i = 0; i < str.length; i++) { ret[i] = str.charCodeAt(i); } return ret.buffer; }; - var base64ToArrayBuffer = function(b64) { - return stringToArrayBuffer(atob(b64)); + var base64ToArrayBuffer = function (b64) { + return stringToArrayBuffer(atob(b64)); // eslint-disable-line no-undef }; message = base64ToArrayBuffer(message.data); } return message; } -function convertMessageToArgsNativeToJs(message) { +function convertMessageToArgsNativeToJs (message) { var args = []; - if (!message || !message.hasOwnProperty('CDVType')) { + if (!message || !Object.prototype.hasOwnProperty.call(message, 'CDVType')) { args.push(message); - } else if (message.CDVType == 'MultiPart') { - message.messages.forEach(function(e) { + } else if (message.CDVType === 'MultiPart') { + message.messages.forEach(function (e) { args.push(massageMessageNativeToJs(e)); }); } else { @@ -82,8 +76,7 @@ function convertMessageToArgsNativeToJs(message) { return args; } -function iOSExec() { - +var iOSExec = function () { var successCallback, failCallback, service, action, actionArgs; var callbackId = null; if (typeof arguments[0] !== 'string') { @@ -100,9 +93,8 @@ function iOSExec() { // an invalid callbackId and passes it even if no callbacks were given. callbackId = 'INVALID'; } else { - throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + - 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);' - ); + throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + // eslint-disable-line + 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);'); } // If actionArgs is not provided, default to an empty array @@ -113,149 +105,54 @@ function iOSExec() { if (successCallback || failCallback) { callbackId = service + cordova.callbackId++; cordova.callbacks[callbackId] = - {success:successCallback, fail:failCallback}; + { success: successCallback, fail: failCallback }; } actionArgs = massageArgsJsToNative(actionArgs); - var command = [callbackId, service, action, actionArgs]; - - // Stringify and queue the command. We stringify to command now to - // effectively clone the command arguments in case they are mutated before - // the command is executed. - commandQueue.push(JSON.stringify(command)); - - // If we're in the context of a stringByEvaluatingJavaScriptFromString call, - // then the queue will be flushed when it returns; no need for a poke. - // Also, if there is already a command in the queue, then we've already - // poked the native side, so there is no reason to do so again. - if (!isInContextOfEvalJs && commandQueue.length == 1) { - pokeNative(); - } -} - -// CB-10530 -function proxyChanged() { - var cexec = cordovaExec(); - - return (execProxy !== cexec && // proxy objects are different - iOSExec !== cexec // proxy object is not the current iOSExec - ); -} - -// CB-10106 -function handleBridgeChange() { - if (proxyChanged()) { - var commandString = commandQueue.shift(); - while(commandString) { - var command = JSON.parse(commandString); - var callbackId = command[0]; - var service = command[1]; - var action = command[2]; - var actionArgs = command[3]; - var callbacks = cordova.callbacks[callbackId] || {}; - - execProxy(callbacks.success, callbacks.fail, service, action, actionArgs); - - commandString = commandQueue.shift(); - }; - return true; - } - - return false; -} - -function pokeNative() { - // CB-5488 - Don't attempt to create iframe before document.body is available. - if (!document.body) { - setTimeout(pokeNative); - return; - } - - // Check if they've removed it from the DOM, and put it back if so. - if (execIframe && execIframe.contentWindow) { - execIframe.contentWindow.location = 'gap://ready'; - } else { - execIframe = document.createElement('iframe'); - execIframe.style.display = 'none'; - execIframe.src = 'gap://ready'; - document.body.appendChild(execIframe); - } - // Use a timer to protect against iframe being unloaded during the poke (CB-7735). - // This makes the bridge ~ 7% slower, but works around the poke getting lost - // when the iframe is removed from the DOM. - // An onunload listener could be used in the case where the iframe has just been - // created, but since unload events fire only once, it doesn't work in the normal - // case of iframe reuse (where unload will have already fired due to the attempted - // navigation of the page). - failSafeTimerId = setTimeout(function() { - if (commandQueue.length) { - // CB-10106 - flush the queue on bridge change - if (!handleBridgeChange()) { - pokeNative(); - } - } - }, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire). -} - -iOSExec.nativeFetchMessages = function() { - // Stop listing for window detatch once native side confirms poke. - if (failSafeTimerId) { - clearTimeout(failSafeTimerId); - failSafeTimerId = 0; - } - // Each entry in commandQueue is a JSON string already. - if (!commandQueue.length) { - return ''; - } - var json = '[' + commandQueue.join(',') + ']'; - commandQueue.length = 0; - return json; + // CB-10133 DataClone DOM Exception 25 guard (fast function remover) + var command = [callbackId, service, action, JSON.parse(JSON.stringify(actionArgs))]; + window.webkit.messageHandlers.cordova.postMessage(command); }; -iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) { - return iOSExec.nativeEvalAndFetch(function() { - var success = status === 0 || status === 1; - var args = convertMessageToArgsNativeToJs(message); - function nc2() { - cordova.callbackFromNative(callbackId, success, status, args, keepCallback); - } - setTimeout(nc2, 0); +iOSExec.nativeCallback = function (callbackId, status, message, keepCallback, debug) { + var success = status === 0 || status === 1; + var args = convertMessageToArgsNativeToJs(message); + Promise.resolve().then(function () { + cordova.callbackFromNative(callbackId, success, status, args, keepCallback); // eslint-disable-line }); }; -iOSExec.nativeEvalAndFetch = function(func) { - // This shouldn't be nested, but better to be safe. - isInContextOfEvalJs++; +// for backwards compatibility +iOSExec.nativeEvalAndFetch = function (func) { try { func(); - return iOSExec.nativeFetchMessages(); - } finally { - isInContextOfEvalJs--; + } catch (e) { + console.log(e); } }; // Proxy the exec for bridge changes. See CB-10106 -function cordovaExec() { +function cordovaExec () { var cexec = require('cordova/exec'); var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function'); - return (cexec_valid && execProxy !== cexec)? cexec : iOSExec; + return (cexec_valid && execProxy !== cexec) ? cexec : iOSExec; } -function execProxy() { +function execProxy () { cordovaExec().apply(null, arguments); -}; +} -execProxy.nativeFetchMessages = function() { +execProxy.nativeFetchMessages = function () { return cordovaExec().nativeFetchMessages.apply(null, arguments); }; -execProxy.nativeEvalAndFetch = function() { +execProxy.nativeEvalAndFetch = function () { return cordovaExec().nativeEvalAndFetch.apply(null, arguments); }; -execProxy.nativeCallback = function() { +execProxy.nativeCallback = function () { return cordovaExec().nativeCallback.apply(null, arguments); }; diff --git a/StoneIsland/platforms/ios/platform_www/cordova-js-src/platform.js b/StoneIsland/platforms/ios/platform_www/cordova-js-src/platform.js index 2345fa5b..83868c81 100644 --- a/StoneIsland/platforms/ios/platform_www/cordova-js-src/platform.js +++ b/StoneIsland/platforms/ios/platform_www/cordova-js-src/platform.js @@ -26,6 +26,14 @@ module.exports = { // see the file under plugin/ios/console.js require('cordova/modulemapper').clobbers('cordova/plugin/ios/console', 'window.console'); + // Attach the wkwebkit utility to window.WkWebView + // see the file under plugin/ios/wkwebkit.js + require('cordova/modulemapper').clobbers('cordova/plugin/ios/wkwebkit', 'window.WkWebView'); + + // Attach the splashscreen utility to window.navigator.splashscreen + // see the file under plugin/ios/launchscreen.js + require('cordova/modulemapper').clobbers('cordova/plugin/ios/launchscreen', 'navigator.splashscreen'); + require('cordova/channel').onNativeReady.fire(); } }; diff --git a/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/console.js b/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/console.js index 6224fb44..0a4820ed 100644 --- a/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/console.js +++ b/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/console.js @@ -19,168 +19,168 @@ * */ -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var logger = require('cordova/plugin/ios/logger'); -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // object that we're exporting -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var console = module.exports; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // copy of the original console object -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var WinConsole = window.console; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // whether to use the logger -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var UseLogger = false; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // Timers -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var Timers = {}; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // used for unimplemented methods -//------------------------------------------------------------------------------ -function noop() {} +// ------------------------------------------------------------------------------ +function noop () {} -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // used for unimplemented methods -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.useLogger = function (value) { if (arguments.length) UseLogger = !!value; if (UseLogger) { if (logger.useConsole()) { - throw new Error("console and logger are too intertwingly"); + throw new Error('console and logger are too intertwingly'); } } return UseLogger; }; -//------------------------------------------------------------------------------ -console.log = function() { +// ------------------------------------------------------------------------------ +console.log = function () { if (logger.useConsole()) return; logger.log.apply(logger, [].slice.call(arguments)); }; -//------------------------------------------------------------------------------ -console.error = function() { +// ------------------------------------------------------------------------------ +console.error = function () { if (logger.useConsole()) return; logger.error.apply(logger, [].slice.call(arguments)); }; -//------------------------------------------------------------------------------ -console.warn = function() { +// ------------------------------------------------------------------------------ +console.warn = function () { if (logger.useConsole()) return; logger.warn.apply(logger, [].slice.call(arguments)); }; -//------------------------------------------------------------------------------ -console.info = function() { +// ------------------------------------------------------------------------------ +console.info = function () { if (logger.useConsole()) return; logger.info.apply(logger, [].slice.call(arguments)); }; -//------------------------------------------------------------------------------ -console.debug = function() { +// ------------------------------------------------------------------------------ +console.debug = function () { if (logger.useConsole()) return; logger.debug.apply(logger, [].slice.call(arguments)); }; -//------------------------------------------------------------------------------ -console.assert = function(expression) { +// ------------------------------------------------------------------------------ +console.assert = function (expression) { if (expression) return; var message = logger.format.apply(logger.format, [].slice.call(arguments, 1)); - console.log("ASSERT: " + message); + console.log('ASSERT: ' + message); }; -//------------------------------------------------------------------------------ -console.clear = function() {}; +// ------------------------------------------------------------------------------ +console.clear = function () {}; -//------------------------------------------------------------------------------ -console.dir = function(object) { - console.log("%o", object); +// ------------------------------------------------------------------------------ +console.dir = function (object) { + console.log('%o', object); }; -//------------------------------------------------------------------------------ -console.dirxml = function(node) { +// ------------------------------------------------------------------------------ +console.dirxml = function (node) { console.log(node.innerHTML); }; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.trace = noop; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.group = console.log; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.groupCollapsed = console.log; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.groupEnd = noop; -//------------------------------------------------------------------------------ -console.time = function(name) { +// ------------------------------------------------------------------------------ +console.time = function (name) { Timers[name] = new Date().valueOf(); }; -//------------------------------------------------------------------------------ -console.timeEnd = function(name) { +// ------------------------------------------------------------------------------ +console.timeEnd = function (name) { var timeStart = Timers[name]; if (!timeStart) { - console.warn("unknown timer: " + name); + console.warn('unknown timer: ' + name); return; } var timeElapsed = new Date().valueOf() - timeStart; - console.log(name + ": " + timeElapsed + "ms"); + console.log(name + ': ' + timeElapsed + 'ms'); }; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.timeStamp = noop; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.profile = noop; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.profileEnd = noop; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.count = noop; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.exception = console.log; -//------------------------------------------------------------------------------ -console.table = function(data, columns) { - console.log("%o", data); +// ------------------------------------------------------------------------------ +console.table = function (data, columns) { + console.log('%o', data); }; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // return a new function that calls both functions passed as args -//------------------------------------------------------------------------------ -function wrappedOrigCall(orgFunc, newFunc) { - return function() { +// ------------------------------------------------------------------------------ +function wrappedOrigCall (orgFunc, newFunc) { + return function () { var args = [].slice.call(arguments); try { orgFunc.apply(WinConsole, args); } catch (e) {} - try { newFunc.apply(console, args); } catch (e) {} + try { newFunc.apply(console, args); } catch (e) {} }; } -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // For every function that exists in the original console object, that // also exists in the new console object, wrap the new console method // with one that calls both -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ for (var key in console) { - if (typeof WinConsole[key] == "function") { + if (typeof WinConsole[key] === 'function') { console[key] = wrappedOrigCall(WinConsole[key], console[key]); } } diff --git a/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/launchscreen.js b/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/launchscreen.js new file mode 100644 index 00000000..24606969 --- /dev/null +++ b/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/launchscreen.js @@ -0,0 +1,33 @@ +/* + * + * 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 launchscreen = { + show: function () { + exec(null, null, 'LaunchScreen', 'show', []); + }, + hide: function () { + exec(null, null, 'LaunchScreen', 'hide', []); + } +}; + +module.exports = launchscreen; diff --git a/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/logger.js b/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/logger.js index 430d887d..6f59e1c8 100644 --- a/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/logger.js +++ b/StoneIsland/platforms/ios/platform_www/cordova-js-src/plugin/ios/logger.js @@ -19,7 +19,7 @@ * */ -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // The logger module exports the following properties/functions: // // LOG - constant for the level LOG @@ -38,16 +38,16 @@ // debug(message,...) - logs a message at level DEBUG // logLevel(level,message,...) - logs a message specified level // -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var logger = exports; -var exec = require('cordova/exec'); +var exec = require('cordova/exec'); -var UseConsole = false; -var UseLogger = true; -var Queued = []; -var DeviceReady = false; +var UseConsole = false; +var UseLogger = true; +var Queued = []; +var DeviceReady = false; var CurrentLevel; var originalConsole = console; @@ -57,11 +57,11 @@ var originalConsole = console; */ var Levels = [ - "LOG", - "ERROR", - "WARN", - "INFO", - "DEBUG" + 'LOG', + 'ERROR', + 'WARN', + 'INFO', + 'DEBUG' ]; /* @@ -70,10 +70,10 @@ var Levels = [ */ var LevelsMap = {}; -for (var i=0; i 0){ + if (fmtString.length > 0) { formatArgs.unshift(fmtString); // add formatString } - var message = logger.format.apply(logger.format, formatArgs); + var message = logger.format.apply(logger.format, formatArgs); if (LevelsMap[level] === null) { - throw new Error("invalid logging level: " + level); + throw new Error('invalid logging level: ' + level); } if (LevelsMap[level] > CurrentLevel) return; @@ -229,28 +229,27 @@ logger.logLevel = function(level /* , ... */) { // Log using the native logger if that is enabled if (UseLogger) { - exec(null, null, "Console", "logLevel", [level, message]); + exec(null, null, 'Console', 'logLevel', [level, message]); } // Log using the console if that is enabled if (UseConsole) { // make sure console is not using logger if (console.useLogger()) { - throw new Error("console and logger are too intertwingly"); + throw new Error('console and logger are too intertwingly'); } // log to the console switch (level) { - case logger.LOG: originalConsole.log(message); break; - case logger.ERROR: originalConsole.log("ERROR: " + message); break; - case logger.WARN: originalConsole.log("WARN: " + message); break; - case logger.INFO: originalConsole.log("INFO: " + message); break; - case logger.DEBUG: originalConsole.log("DEBUG: " + message); break; + case logger.LOG: originalConsole.log(message); break; + case logger.ERROR: originalConsole.log('ERROR: ' + message); break; + case logger.WARN: originalConsole.log('WARN: ' + message); break; + case logger.INFO: originalConsole.log('INFO: ' + message); break; + case logger.DEBUG: originalConsole.log('DEBUG: ' + message); break; } } }; - /** * Formats a string and arguments following it ala console.log() * @@ -259,12 +258,11 @@ logger.logLevel = function(level /* , ... */) { * for rationale, see FireBug's Console API: * http://getfirebug.com/wiki/index.php/Console_API */ -logger.format = function(formatString, args) { - return __format(arguments[0], [].slice.call(arguments,1)).join(' '); +logger.format = function (formatString, args) { + return __format(arguments[0], [].slice.call(arguments, 1)).join(' '); }; - -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ /** * Formats a string and arguments following it ala vsprintf() * @@ -279,26 +277,25 @@ logger.format = function(formatString, args) { * Returns an array containing the formatted string and any remaining * arguments. */ -function __format(formatString, args) { - if (formatString === null || formatString === undefined) return [""]; - if (arguments.length == 1) return [formatString.toString()]; +function __format (formatString, args) { + if (formatString === null || formatString === undefined) return ['']; + if (arguments.length === 1) return [formatString.toString()]; - if (typeof formatString != "string") - formatString = formatString.toString(); + if (typeof formatString !== 'string') { formatString = formatString.toString(); } var pattern = /(.*?)%(.)(.*)/; - var rest = formatString; - var result = []; + var rest = formatString; + var result = []; while (args.length) { var match = pattern.exec(rest); if (!match) break; - var arg = args.shift(); + var arg = args.shift(); rest = match[3]; result.push(match[1]); - if (match[2] == '%') { + if (match[2] === '%') { result.push('%'); args.unshift(arg); continue; @@ -314,17 +311,15 @@ function __format(formatString, args) { return remainingArgs; } -function __formatted(object, formatChar) { - +function __formatted (object, formatChar) { try { - switch(formatChar) { - case 'j': - case 'o': return JSON.stringify(object); - case 'c': return ''; + switch (formatChar) { + case 'j': + case 'o': return JSON.stringify(object); + case 'c': return ''; } - } - catch (e) { - return "error JSON.stringify()ing argument: " + e; + } catch (e) { + return 'error JSON.stringify()ing argument: ' + e; } if ((object === null) || (object === undefined)) { @@ -334,15 +329,14 @@ function __formatted(object, formatChar) { return object.toString(); } - -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // when deviceready fires, log queued messages -logger.__onDeviceReady = function() { +logger.__onDeviceReady = function () { if (DeviceReady) return; DeviceReady = true; - for (var i=0; i') + '->' + id; - throw 'Cycle in require graph: ' + cycle; + throw new Error('Cycle in require graph: ' + cycle); } if (modules[id].factory) { try { @@ -73,8 +69,8 @@ var define; }; define = function (id, factory) { - if (modules[id]) { - throw 'module ' + id + ' already defined'; + if (Object.prototype.hasOwnProperty.call(modules, id)) { + throw new Error('module ' + id + ' already defined'); } modules[id] = { @@ -101,7 +97,7 @@ define("cordova", function(require, exports, module) { // Workaround for Windows 10 in hosted environment case // http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object -if (window.cordova && !(window.cordova instanceof HTMLElement)) { // eslint-disable-line no-undef +if (window.cordova && !(window.cordova instanceof HTMLElement)) { throw new Error('cordova already defined'); } @@ -166,7 +162,7 @@ function createEvent (type, data) { event.initEvent(type, false, false); if (data) { for (var i in data) { - if (data.hasOwnProperty(i)) { + if (Object.prototype.hasOwnProperty.call(data, i)) { event[i] = data[i]; } } @@ -174,7 +170,6 @@ function createEvent (type, data) { return event; } -/* eslint-disable no-undef */ var cordova = { define: define, require: require, @@ -182,8 +177,6 @@ var cordova = { platformVersion: PLATFORM_VERSION_BUILD_LABEL, platformId: platform.id, - /* eslint-enable no-undef */ - /** * Methods to add/remove your own addEventListener hijacking on document + window. */ @@ -202,15 +195,25 @@ var cordova = { removeDocumentEventHandler: function (event) { delete documentEventHandlers[event]; }, + /** * Retrieve original event handlers that were replaced by Cordova * * @return object */ getOriginalHandlers: function () { - return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener}, - 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}}; + return { + document: { + addEventListener: m_document_addEventListener, + removeEventListener: m_document_removeEventListener + }, + window: { + addEventListener: m_window_addEventListener, + removeEventListener: m_window_removeEventListener + } + }; }, + /** * Method to fire event from native code * bNoDetach is required for events which cause an exception which needs to be caught in native code @@ -233,6 +236,7 @@ var cordova = { document.dispatchEvent(evt); } }, + fireWindowEvent: function (type, data) { var evt = createEvent(type, data); if (typeof windowEventHandlers[type] !== 'undefined') { @@ -306,11 +310,11 @@ var cordova = { } } catch (err) { var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err; - console && console.log && console.log(msg); - cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg }); + cordova.fireWindowEvent('cordovacallbackerror', { message: msg, error: err }); throw err; } }, + addConstructor: function (func) { channel.onCordovaReady.subscribe(function () { try { @@ -334,18 +338,47 @@ var utils = require('cordova/utils'); var moduleExports = module.exports; var typeMap = { - 'A': 'Array', - 'D': 'Date', - 'N': 'Number', - 'S': 'String', - 'F': 'Function', - 'O': 'Object' + A: 'Array', + D: 'Date', + N: 'Number', + S: 'String', + F: 'Function', + O: 'Object' }; function extractParamName (callee, argIndex) { - return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex]; + return (/\(\s*([^)]*?)\s*\)/).exec(callee)[1].split(/\s*,\s*/)[argIndex]; } +/** + * Checks the given arguments' types and throws if they are not as expected. + * + * `spec` is a string where each character stands for the required type of the + * argument at the same position. In other words: the character at `spec[i]` + * specifies the required type for `args[i]`. The characters in `spec` are the + * first letter of the required type's name. The supported types are: + * + * Array, Date, Number, String, Function, Object + * + * Lowercase characters specify arguments that must not be `null` or `undefined` + * while uppercase characters allow those values to be passed. + * + * Finally, `*` can be used to allow any type at the corresponding position. + * + * @example + * function foo (arr, opts) { + * // require `arr` to be an Array and `opts` an Object, null or undefined + * checkArgs('aO', 'my.package.foo', arguments); + * // ... + * } + * @param {String} spec - the type specification for `args` as described above + * @param {String} functionName - full name of the callee. + * Used in the error message + * @param {Array|arguments} args - the arguments to be checked against `spec` + * @param {Function} [opt_callee=args.callee] - the recipient of `args`. + * Used to extract parameter names for the error message + * @throws {TypeError} if args do not satisfy spec + */ function checkArgs (spec, functionName, args, opt_callee) { if (!moduleExports.enableChecks) { return; @@ -401,7 +434,7 @@ base64.fromArrayBuffer = function (arrayBuffer) { }; base64.toArrayBuffer = function (str) { - var decodedStr = typeof atob !== 'undefined' ? atob(str) : Buffer.from(str, 'base64').toString('binary'); // eslint-disable-line no-undef + var decodedStr = atob(str); var arrayBuffer = new ArrayBuffer(decodedStr.length); var array = new Uint8Array(arrayBuffer); for (var i = 0, len = decodedStr.length; i < len; i++) { @@ -463,14 +496,13 @@ var utils = require('cordova/utils'); function each (objects, func, context) { for (var prop in objects) { - if (objects.hasOwnProperty(prop)) { + if (Object.prototype.hasOwnProperty.call(objects, prop)) { func.apply(context, [objects[prop], prop]); } } } function clobber (obj, key, value) { - exports.replaceHookForTesting(obj, key); var needsProperty = false; try { obj[key] = value; @@ -544,7 +576,7 @@ function include (parent, objects, clobber, merge) { */ function recursiveMerge (target, src) { for (var prop in src) { - if (src.hasOwnProperty(prop)) { + if (Object.prototype.hasOwnProperty.call(src, prop)) { if (target.prototype && target.prototype.constructor === target) { // If the target object is a constructor override off prototype. clobber(target.prototype, prop, src[prop]); @@ -570,7 +602,6 @@ exports.buildIntoAndMerge = function (objects, target) { }; exports.recursiveMerge = recursiveMerge; exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter; -exports.replaceHookForTesting = function () {}; }); @@ -651,14 +682,14 @@ var channel = { } if (!len) h(); }, - /* eslint-disable no-return-assign */ + create: function (type) { - return channel[type] = new Channel(type, false); + return (channel[type] = new Channel(type, false)); }, createSticky: function (type) { - return channel[type] = new Channel(type, true); + return (channel[type] = new Channel(type, true)); }, - /* eslint-enable no-return-assign */ + /** * cordova Channels that must fire before "deviceready" is fired. */ @@ -779,7 +810,6 @@ Channel.prototype.unsubscribe = function (eventListenerOrFunction) { * Calls all functions subscribed to this channel. */ Channel.prototype.fire = function (e) { - var fail = false; // eslint-disable-line no-unused-vars var fireArgs = Array.prototype.slice.call(arguments); // Apply stickiness. if (this.state === 1) { @@ -836,33 +866,27 @@ module.exports = channel; }); -// file: /Users/spindori/Documents/Cordova/cordova-ios/cordova-js-src/exec.js +// file: ../cordova-ios/cordova-js-src/exec.js define("cordova/exec", function(require, exports, module) { -/*global require, module, atob, document */ - /** - * Creates a gap bridge iframe used to notify the native code about queued + * Creates the exec bridge used to notify the native code of * commands. */ -var cordova = require('cordova'), - utils = require('cordova/utils'), - base64 = require('cordova/base64'), - execIframe, - commandQueue = [], // Contains pending JS->Native messages. - isInContextOfEvalJs = 0, - failSafeTimerId = 0; - -function massageArgsJsToNative(args) { - if (!args || utils.typeName(args) != 'Array') { +var cordova = require('cordova'); +var utils = require('cordova/utils'); +var base64 = require('cordova/base64'); + +function massageArgsJsToNative (args) { + if (!args || utils.typeName(args) !== 'Array') { return args; } var ret = []; - args.forEach(function(arg, i) { - if (utils.typeName(arg) == 'ArrayBuffer') { + args.forEach(function (arg, i) { + if (utils.typeName(arg) === 'ArrayBuffer') { ret.push({ - 'CDVType': 'ArrayBuffer', - 'data': base64.fromArrayBuffer(arg) + CDVType: 'ArrayBuffer', + data: base64.fromArrayBuffer(arg) }); } else { ret.push(arg); @@ -871,29 +895,29 @@ function massageArgsJsToNative(args) { return ret; } -function massageMessageNativeToJs(message) { - if (message.CDVType == 'ArrayBuffer') { - var stringToArrayBuffer = function(str) { +function massageMessageNativeToJs (message) { + if (message.CDVType === 'ArrayBuffer') { + var stringToArrayBuffer = function (str) { var ret = new Uint8Array(str.length); for (var i = 0; i < str.length; i++) { ret[i] = str.charCodeAt(i); } return ret.buffer; }; - var base64ToArrayBuffer = function(b64) { - return stringToArrayBuffer(atob(b64)); + var base64ToArrayBuffer = function (b64) { + return stringToArrayBuffer(atob(b64)); // eslint-disable-line no-undef }; message = base64ToArrayBuffer(message.data); } return message; } -function convertMessageToArgsNativeToJs(message) { +function convertMessageToArgsNativeToJs (message) { var args = []; - if (!message || !message.hasOwnProperty('CDVType')) { + if (!message || !Object.prototype.hasOwnProperty.call(message, 'CDVType')) { args.push(message); - } else if (message.CDVType == 'MultiPart') { - message.messages.forEach(function(e) { + } else if (message.CDVType === 'MultiPart') { + message.messages.forEach(function (e) { args.push(massageMessageNativeToJs(e)); }); } else { @@ -902,8 +926,7 @@ function convertMessageToArgsNativeToJs(message) { return args; } -function iOSExec() { - +var iOSExec = function () { var successCallback, failCallback, service, action, actionArgs; var callbackId = null; if (typeof arguments[0] !== 'string') { @@ -920,9 +943,8 @@ function iOSExec() { // an invalid callbackId and passes it even if no callbacks were given. callbackId = 'INVALID'; } else { - throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + - 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);' - ); + throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + // eslint-disable-line + 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);'); } // If actionArgs is not provided, default to an empty array @@ -933,149 +955,54 @@ function iOSExec() { if (successCallback || failCallback) { callbackId = service + cordova.callbackId++; cordova.callbacks[callbackId] = - {success:successCallback, fail:failCallback}; + { success: successCallback, fail: failCallback }; } actionArgs = massageArgsJsToNative(actionArgs); - var command = [callbackId, service, action, actionArgs]; - - // Stringify and queue the command. We stringify to command now to - // effectively clone the command arguments in case they are mutated before - // the command is executed. - commandQueue.push(JSON.stringify(command)); - - // If we're in the context of a stringByEvaluatingJavaScriptFromString call, - // then the queue will be flushed when it returns; no need for a poke. - // Also, if there is already a command in the queue, then we've already - // poked the native side, so there is no reason to do so again. - if (!isInContextOfEvalJs && commandQueue.length == 1) { - pokeNative(); - } -} - -// CB-10530 -function proxyChanged() { - var cexec = cordovaExec(); - - return (execProxy !== cexec && // proxy objects are different - iOSExec !== cexec // proxy object is not the current iOSExec - ); -} - -// CB-10106 -function handleBridgeChange() { - if (proxyChanged()) { - var commandString = commandQueue.shift(); - while(commandString) { - var command = JSON.parse(commandString); - var callbackId = command[0]; - var service = command[1]; - var action = command[2]; - var actionArgs = command[3]; - var callbacks = cordova.callbacks[callbackId] || {}; - - execProxy(callbacks.success, callbacks.fail, service, action, actionArgs); - - commandString = commandQueue.shift(); - }; - return true; - } - - return false; -} - -function pokeNative() { - // CB-5488 - Don't attempt to create iframe before document.body is available. - if (!document.body) { - setTimeout(pokeNative); - return; - } - - // Check if they've removed it from the DOM, and put it back if so. - if (execIframe && execIframe.contentWindow) { - execIframe.contentWindow.location = 'gap://ready'; - } else { - execIframe = document.createElement('iframe'); - execIframe.style.display = 'none'; - execIframe.src = 'gap://ready'; - document.body.appendChild(execIframe); - } - // Use a timer to protect against iframe being unloaded during the poke (CB-7735). - // This makes the bridge ~ 7% slower, but works around the poke getting lost - // when the iframe is removed from the DOM. - // An onunload listener could be used in the case where the iframe has just been - // created, but since unload events fire only once, it doesn't work in the normal - // case of iframe reuse (where unload will have already fired due to the attempted - // navigation of the page). - failSafeTimerId = setTimeout(function() { - if (commandQueue.length) { - // CB-10106 - flush the queue on bridge change - if (!handleBridgeChange()) { - pokeNative(); - } - } - }, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire). -} - -iOSExec.nativeFetchMessages = function() { - // Stop listing for window detatch once native side confirms poke. - if (failSafeTimerId) { - clearTimeout(failSafeTimerId); - failSafeTimerId = 0; - } - // Each entry in commandQueue is a JSON string already. - if (!commandQueue.length) { - return ''; - } - var json = '[' + commandQueue.join(',') + ']'; - commandQueue.length = 0; - return json; + // CB-10133 DataClone DOM Exception 25 guard (fast function remover) + var command = [callbackId, service, action, JSON.parse(JSON.stringify(actionArgs))]; + window.webkit.messageHandlers.cordova.postMessage(command); }; -iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) { - return iOSExec.nativeEvalAndFetch(function() { - var success = status === 0 || status === 1; - var args = convertMessageToArgsNativeToJs(message); - function nc2() { - cordova.callbackFromNative(callbackId, success, status, args, keepCallback); - } - setTimeout(nc2, 0); +iOSExec.nativeCallback = function (callbackId, status, message, keepCallback, debug) { + var success = status === 0 || status === 1; + var args = convertMessageToArgsNativeToJs(message); + Promise.resolve().then(function () { + cordova.callbackFromNative(callbackId, success, status, args, keepCallback); // eslint-disable-line }); }; -iOSExec.nativeEvalAndFetch = function(func) { - // This shouldn't be nested, but better to be safe. - isInContextOfEvalJs++; +// for backwards compatibility +iOSExec.nativeEvalAndFetch = function (func) { try { func(); - return iOSExec.nativeFetchMessages(); - } finally { - isInContextOfEvalJs--; + } catch (e) { + console.log(e); } }; // Proxy the exec for bridge changes. See CB-10106 -function cordovaExec() { +function cordovaExec () { var cexec = require('cordova/exec'); var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function'); - return (cexec_valid && execProxy !== cexec)? cexec : iOSExec; + return (cexec_valid && execProxy !== cexec) ? cexec : iOSExec; } -function execProxy() { +function execProxy () { cordovaExec().apply(null, arguments); -}; +} -execProxy.nativeFetchMessages = function() { +execProxy.nativeFetchMessages = function () { return cordovaExec().nativeFetchMessages.apply(null, arguments); }; -execProxy.nativeEvalAndFetch = function() { +execProxy.nativeEvalAndFetch = function () { return cordovaExec().nativeEvalAndFetch.apply(null, arguments); }; -execProxy.nativeCallback = function() { +execProxy.nativeCallback = function () { return cordovaExec().nativeCallback.apply(null, arguments); }; @@ -1121,7 +1048,6 @@ var cordova = require('cordova'); var modulemapper = require('cordova/modulemapper'); var platform = require('cordova/platform'); var pluginloader = require('cordova/pluginloader'); -var utils = require('cordova/utils'); var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady]; @@ -1141,34 +1067,6 @@ window.setTimeout(function () { } }, 5000); -// Replace navigator before any modules are required(), to ensure it happens as soon as possible. -// We replace it so that properties that can't be clobbered can instead be overridden. -function replaceNavigator (origNavigator) { - var CordovaNavigator = function () {}; - CordovaNavigator.prototype = origNavigator; - var newNavigator = new CordovaNavigator(); - // This work-around really only applies to new APIs that are newer than Function.bind. - // Without it, APIs such as getGamepads() break. - if (CordovaNavigator.bind) { - for (var key in origNavigator) { - if (typeof origNavigator[key] === 'function') { - newNavigator[key] = origNavigator[key].bind(origNavigator); - } else { - (function (k) { - utils.defineGetterSetter(newNavigator, key, function () { - return origNavigator[k]; - }); - })(key); - } - } - } - return newNavigator; -} - -if (window.navigator) { - window.navigator = replaceNavigator(window.navigator); -} - if (!window.console) { window.console = { log: function () {} @@ -1234,131 +1132,6 @@ channel.join(function () { channel.join(function () { require('cordova').fireDocumentEvent('deviceready'); }, channel.deviceReadyChannelsArray); - -}, platformInitChannelsArray); - -}); - -// file: src/common/init_b.js -define("cordova/init_b", function(require, exports, module) { - -var channel = require('cordova/channel'); -var cordova = require('cordova'); -var modulemapper = require('cordova/modulemapper'); -var platform = require('cordova/platform'); -var pluginloader = require('cordova/pluginloader'); -var utils = require('cordova/utils'); - -var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady, channel.onPluginsReady]; - -// setting exec -cordova.exec = require('cordova/exec'); - -function logUnfiredChannels (arr) { - for (var i = 0; i < arr.length; ++i) { - if (arr[i].state !== 2) { - console.log('Channel not fired: ' + arr[i].type); - } - } -} - -window.setTimeout(function () { - if (channel.onDeviceReady.state !== 2) { - console.log('deviceready has not fired after 5 seconds.'); - logUnfiredChannels(platformInitChannelsArray); - logUnfiredChannels(channel.deviceReadyChannelsArray); - } -}, 5000); - -// Replace navigator before any modules are required(), to ensure it happens as soon as possible. -// We replace it so that properties that can't be clobbered can instead be overridden. -function replaceNavigator (origNavigator) { - var CordovaNavigator = function () {}; - CordovaNavigator.prototype = origNavigator; - var newNavigator = new CordovaNavigator(); - // This work-around really only applies to new APIs that are newer than Function.bind. - // Without it, APIs such as getGamepads() break. - if (CordovaNavigator.bind) { - for (var key in origNavigator) { - if (typeof origNavigator[key] === 'function') { - newNavigator[key] = origNavigator[key].bind(origNavigator); - } else { - (function (k) { - utils.defineGetterSetter(newNavigator, key, function () { - return origNavigator[k]; - }); - })(key); - } - } - } - return newNavigator; -} -if (window.navigator) { - window.navigator = replaceNavigator(window.navigator); -} - -if (!window.console) { - window.console = { - log: function () {} - }; -} -if (!window.console.warn) { - window.console.warn = function (msg) { - this.log('warn: ' + msg); - }; -} - -// Register pause, resume and deviceready channels as events on document. -channel.onPause = cordova.addDocumentEventHandler('pause'); -channel.onResume = cordova.addDocumentEventHandler('resume'); -channel.onActivated = cordova.addDocumentEventHandler('activated'); -channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready'); - -// Listen for DOMContentLoaded and notify our channel subscribers. -if (document.readyState === 'complete' || document.readyState === 'interactive') { - channel.onDOMContentLoaded.fire(); -} else { - document.addEventListener('DOMContentLoaded', function () { - channel.onDOMContentLoaded.fire(); - }, false); -} - -// _nativeReady is global variable that the native side can set -// to signify that the native code is ready. It is a global since -// it may be called before any cordova JS is ready. -if (window._nativeReady) { - channel.onNativeReady.fire(); -} - -// Call the platform-specific initialization. -platform.bootstrap && platform.bootstrap(); - -// Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js. -// The delay allows the attached modules to be defined before the plugin loader looks for them. -setTimeout(function () { - pluginloader.load(function () { - channel.onPluginsReady.fire(); - }); -}, 0); - -/** - * Create all cordova objects once native side is ready. - */ -channel.join(function () { - modulemapper.mapModules(window); - - platform.initialize && platform.initialize(); - - // Fire event to notify that all objects are created - channel.onCordovaReady.fire(); - - // Fire onDeviceReady event once page has fully loaded, all - // constructors have run and cordova info has been received from native - // side. - channel.join(function () { - require('cordova').fireDocumentEvent('deviceready'); - }, channel.deviceReadyChannelsArray); - }, platformInitChannelsArray); }); @@ -1367,7 +1140,7 @@ channel.join(function () { define("cordova/modulemapper", function(require, exports, module) { var builder = require('cordova/builder'); -var moduleMap = define.moduleMap; // eslint-disable-line no-undef +var moduleMap = define.moduleMap; var symbolList; var deprecationMap; @@ -1407,12 +1180,9 @@ function prepareNamespace (symbolPath, context) { if (!symbolPath) { return context; } - var parts = symbolPath.split('.'); - var cur = context; - for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign - cur = cur[part] = cur[part] || {}; - } - return cur; + return symbolPath.split('.').reduce(function (cur, part) { + return (cur[part] = cur[part] || {}); + }, context); } exports.mapModules = function (context) { @@ -1463,103 +1233,7 @@ exports.reset(); }); -// file: src/common/modulemapper_b.js -define("cordova/modulemapper_b", function(require, exports, module) { - -var builder = require('cordova/builder'); -var symbolList = []; -var deprecationMap; - -exports.reset = function () { - symbolList = []; - deprecationMap = {}; -}; - -function addEntry (strategy, moduleName, symbolPath, opt_deprecationMessage) { - symbolList.push(strategy, moduleName, symbolPath); - if (opt_deprecationMessage) { - deprecationMap[symbolPath] = opt_deprecationMessage; - } -} - -// Note: Android 2.3 does have Function.bind(). -exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) { - addEntry('c', moduleName, symbolPath, opt_deprecationMessage); -}; - -exports.merges = function (moduleName, symbolPath, opt_deprecationMessage) { - addEntry('m', moduleName, symbolPath, opt_deprecationMessage); -}; - -exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) { - addEntry('d', moduleName, symbolPath, opt_deprecationMessage); -}; - -exports.runs = function (moduleName) { - addEntry('r', moduleName, null); -}; - -function prepareNamespace (symbolPath, context) { - if (!symbolPath) { - return context; - } - var parts = symbolPath.split('.'); - var cur = context; - for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign - cur = cur[part] = cur[part] || {}; - } - return cur; -} - -exports.mapModules = function (context) { - var origSymbols = {}; - context.CDV_origSymbols = origSymbols; - for (var i = 0, len = symbolList.length; i < len; i += 3) { - var strategy = symbolList[i]; - var moduleName = symbolList[i + 1]; - var module = require(moduleName); - // - if (strategy === 'r') { - continue; - } - var symbolPath = symbolList[i + 2]; - var lastDot = symbolPath.lastIndexOf('.'); - var namespace = symbolPath.substr(0, lastDot); - var lastName = symbolPath.substr(lastDot + 1); - - var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null; - var parentObj = prepareNamespace(namespace, context); - var target = parentObj[lastName]; - - if (strategy === 'm' && target) { - builder.recursiveMerge(target, module); - } else if ((strategy === 'd' && !target) || (strategy !== 'd')) { - if (!(symbolPath in origSymbols)) { - origSymbols[symbolPath] = target; - } - builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg); - } - } -}; - -exports.getOriginalSymbol = function (context, symbolPath) { - var origSymbols = context.CDV_origSymbols; - if (origSymbols && (symbolPath in origSymbols)) { - return origSymbols[symbolPath]; - } - var parts = symbolPath.split('.'); - var obj = context; - for (var i = 0; i < parts.length; ++i) { - obj = obj && obj[parts[i]]; - } - return obj; -}; - -exports.reset(); - -}); - -// file: /Users/spindori/Documents/Cordova/cordova-ios/cordova-js-src/platform.js +// file: ../cordova-ios/cordova-js-src/platform.js define("cordova/platform", function(require, exports, module) { module.exports = { @@ -1569,187 +1243,213 @@ module.exports = { // see the file under plugin/ios/console.js require('cordova/modulemapper').clobbers('cordova/plugin/ios/console', 'window.console'); + // Attach the wkwebkit utility to window.WkWebView + // see the file under plugin/ios/wkwebkit.js + require('cordova/modulemapper').clobbers('cordova/plugin/ios/wkwebkit', 'window.WkWebView'); + + // Attach the splashscreen utility to window.navigator.splashscreen + // see the file under plugin/ios/launchscreen.js + require('cordova/modulemapper').clobbers('cordova/plugin/ios/launchscreen', 'navigator.splashscreen'); + require('cordova/channel').onNativeReady.fire(); } }; }); -// file: /Users/spindori/Documents/Cordova/cordova-ios/cordova-js-src/plugin/ios/console.js +// file: ../cordova-ios/cordova-js-src/plugin/ios/console.js define("cordova/plugin/ios/console", function(require, exports, module) { -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var logger = require('cordova/plugin/ios/logger'); -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // object that we're exporting -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var console = module.exports; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // copy of the original console object -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var WinConsole = window.console; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // whether to use the logger -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var UseLogger = false; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // Timers -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var Timers = {}; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // used for unimplemented methods -//------------------------------------------------------------------------------ -function noop() {} +// ------------------------------------------------------------------------------ +function noop () {} -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // used for unimplemented methods -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.useLogger = function (value) { if (arguments.length) UseLogger = !!value; if (UseLogger) { if (logger.useConsole()) { - throw new Error("console and logger are too intertwingly"); + throw new Error('console and logger are too intertwingly'); } } return UseLogger; }; -//------------------------------------------------------------------------------ -console.log = function() { +// ------------------------------------------------------------------------------ +console.log = function () { if (logger.useConsole()) return; logger.log.apply(logger, [].slice.call(arguments)); }; -//------------------------------------------------------------------------------ -console.error = function() { +// ------------------------------------------------------------------------------ +console.error = function () { if (logger.useConsole()) return; logger.error.apply(logger, [].slice.call(arguments)); }; -//------------------------------------------------------------------------------ -console.warn = function() { +// ------------------------------------------------------------------------------ +console.warn = function () { if (logger.useConsole()) return; logger.warn.apply(logger, [].slice.call(arguments)); }; -//------------------------------------------------------------------------------ -console.info = function() { +// ------------------------------------------------------------------------------ +console.info = function () { if (logger.useConsole()) return; logger.info.apply(logger, [].slice.call(arguments)); }; -//------------------------------------------------------------------------------ -console.debug = function() { +// ------------------------------------------------------------------------------ +console.debug = function () { if (logger.useConsole()) return; logger.debug.apply(logger, [].slice.call(arguments)); }; -//------------------------------------------------------------------------------ -console.assert = function(expression) { +// ------------------------------------------------------------------------------ +console.assert = function (expression) { if (expression) return; var message = logger.format.apply(logger.format, [].slice.call(arguments, 1)); - console.log("ASSERT: " + message); + console.log('ASSERT: ' + message); }; -//------------------------------------------------------------------------------ -console.clear = function() {}; +// ------------------------------------------------------------------------------ +console.clear = function () {}; -//------------------------------------------------------------------------------ -console.dir = function(object) { - console.log("%o", object); +// ------------------------------------------------------------------------------ +console.dir = function (object) { + console.log('%o', object); }; -//------------------------------------------------------------------------------ -console.dirxml = function(node) { +// ------------------------------------------------------------------------------ +console.dirxml = function (node) { console.log(node.innerHTML); }; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.trace = noop; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.group = console.log; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.groupCollapsed = console.log; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.groupEnd = noop; -//------------------------------------------------------------------------------ -console.time = function(name) { +// ------------------------------------------------------------------------------ +console.time = function (name) { Timers[name] = new Date().valueOf(); }; -//------------------------------------------------------------------------------ -console.timeEnd = function(name) { +// ------------------------------------------------------------------------------ +console.timeEnd = function (name) { var timeStart = Timers[name]; if (!timeStart) { - console.warn("unknown timer: " + name); + console.warn('unknown timer: ' + name); return; } var timeElapsed = new Date().valueOf() - timeStart; - console.log(name + ": " + timeElapsed + "ms"); + console.log(name + ': ' + timeElapsed + 'ms'); }; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.timeStamp = noop; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.profile = noop; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.profileEnd = noop; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.count = noop; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ console.exception = console.log; -//------------------------------------------------------------------------------ -console.table = function(data, columns) { - console.log("%o", data); +// ------------------------------------------------------------------------------ +console.table = function (data, columns) { + console.log('%o', data); }; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // return a new function that calls both functions passed as args -//------------------------------------------------------------------------------ -function wrappedOrigCall(orgFunc, newFunc) { - return function() { +// ------------------------------------------------------------------------------ +function wrappedOrigCall (orgFunc, newFunc) { + return function () { var args = [].slice.call(arguments); try { orgFunc.apply(WinConsole, args); } catch (e) {} - try { newFunc.apply(console, args); } catch (e) {} + try { newFunc.apply(console, args); } catch (e) {} }; } -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // For every function that exists in the original console object, that // also exists in the new console object, wrap the new console method // with one that calls both -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ for (var key in console) { - if (typeof WinConsole[key] == "function") { + if (typeof WinConsole[key] === 'function') { console[key] = wrappedOrigCall(WinConsole[key], console[key]); } } }); -// file: /Users/spindori/Documents/Cordova/cordova-ios/cordova-js-src/plugin/ios/logger.js +// file: ../cordova-ios/cordova-js-src/plugin/ios/launchscreen.js +define("cordova/plugin/ios/launchscreen", function(require, exports, module) { + +var exec = require('cordova/exec'); + +var launchscreen = { + show: function () { + exec(null, null, 'LaunchScreen', 'show', []); + }, + hide: function () { + exec(null, null, 'LaunchScreen', 'hide', []); + } +}; + +module.exports = launchscreen; + +}); + +// file: ../cordova-ios/cordova-js-src/plugin/ios/logger.js define("cordova/plugin/ios/logger", function(require, exports, module) { -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // The logger module exports the following properties/functions: // // LOG - constant for the level LOG @@ -1768,16 +1468,16 @@ define("cordova/plugin/ios/logger", function(require, exports, module) { // debug(message,...) - logs a message at level DEBUG // logLevel(level,message,...) - logs a message specified level // -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ var logger = exports; -var exec = require('cordova/exec'); +var exec = require('cordova/exec'); -var UseConsole = false; -var UseLogger = true; -var Queued = []; -var DeviceReady = false; +var UseConsole = false; +var UseLogger = true; +var Queued = []; +var DeviceReady = false; var CurrentLevel; var originalConsole = console; @@ -1787,11 +1487,11 @@ var originalConsole = console; */ var Levels = [ - "LOG", - "ERROR", - "WARN", - "INFO", - "DEBUG" + 'LOG', + 'ERROR', + 'WARN', + 'INFO', + 'DEBUG' ]; /* @@ -1800,10 +1500,10 @@ var Levels = [ */ var LevelsMap = {}; -for (var i=0; i 0){ + if (fmtString.length > 0) { formatArgs.unshift(fmtString); // add formatString } - var message = logger.format.apply(logger.format, formatArgs); + var message = logger.format.apply(logger.format, formatArgs); if (LevelsMap[level] === null) { - throw new Error("invalid logging level: " + level); + throw new Error('invalid logging level: ' + level); } if (LevelsMap[level] > CurrentLevel) return; @@ -1959,28 +1659,27 @@ logger.logLevel = function(level /* , ... */) { // Log using the native logger if that is enabled if (UseLogger) { - exec(null, null, "Console", "logLevel", [level, message]); + exec(null, null, 'Console', 'logLevel', [level, message]); } // Log using the console if that is enabled if (UseConsole) { // make sure console is not using logger if (console.useLogger()) { - throw new Error("console and logger are too intertwingly"); + throw new Error('console and logger are too intertwingly'); } // log to the console switch (level) { - case logger.LOG: originalConsole.log(message); break; - case logger.ERROR: originalConsole.log("ERROR: " + message); break; - case logger.WARN: originalConsole.log("WARN: " + message); break; - case logger.INFO: originalConsole.log("INFO: " + message); break; - case logger.DEBUG: originalConsole.log("DEBUG: " + message); break; + case logger.LOG: originalConsole.log(message); break; + case logger.ERROR: originalConsole.log('ERROR: ' + message); break; + case logger.WARN: originalConsole.log('WARN: ' + message); break; + case logger.INFO: originalConsole.log('INFO: ' + message); break; + case logger.DEBUG: originalConsole.log('DEBUG: ' + message); break; } } }; - /** * Formats a string and arguments following it ala console.log() * @@ -1989,12 +1688,11 @@ logger.logLevel = function(level /* , ... */) { * for rationale, see FireBug's Console API: * http://getfirebug.com/wiki/index.php/Console_API */ -logger.format = function(formatString, args) { - return __format(arguments[0], [].slice.call(arguments,1)).join(' '); +logger.format = function (formatString, args) { + return __format(arguments[0], [].slice.call(arguments, 1)).join(' '); }; - -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ /** * Formats a string and arguments following it ala vsprintf() * @@ -2009,26 +1707,25 @@ logger.format = function(formatString, args) { * Returns an array containing the formatted string and any remaining * arguments. */ -function __format(formatString, args) { - if (formatString === null || formatString === undefined) return [""]; - if (arguments.length == 1) return [formatString.toString()]; +function __format (formatString, args) { + if (formatString === null || formatString === undefined) return ['']; + if (arguments.length === 1) return [formatString.toString()]; - if (typeof formatString != "string") - formatString = formatString.toString(); + if (typeof formatString !== 'string') { formatString = formatString.toString(); } var pattern = /(.*?)%(.)(.*)/; - var rest = formatString; - var result = []; + var rest = formatString; + var result = []; while (args.length) { var match = pattern.exec(rest); if (!match) break; - var arg = args.shift(); + var arg = args.shift(); rest = match[3]; result.push(match[1]); - if (match[2] == '%') { + if (match[2] === '%') { result.push('%'); args.unshift(arg); continue; @@ -2044,17 +1741,15 @@ function __format(formatString, args) { return remainingArgs; } -function __formatted(object, formatChar) { - +function __formatted (object, formatChar) { try { - switch(formatChar) { - case 'j': - case 'o': return JSON.stringify(object); - case 'c': return ''; + switch (formatChar) { + case 'j': + case 'o': return JSON.stringify(object); + case 'c': return ''; } - } - catch (e) { - return "error JSON.stringify()ing argument: " + e; + } catch (e) { + return 'error JSON.stringify()ing argument: ' + e; } if ((object === null) || (object === undefined)) { @@ -2064,15 +1759,14 @@ function __formatted(object, formatChar) { return object.toString(); } - -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // when deviceready fires, log queued messages -logger.__onDeviceReady = function() { +logger.__onDeviceReady = function () { if (DeviceReady) return; DeviceReady = true; - for (var i=0; i\n'); +}; + +Keyboard.disableScroll = function (disable) { + exec(null, null, "CDVIonicKeyboard", "disableScroll", [disable]); +}; + +Keyboard.setResizeMode = function (mode) { + exec(null, null, "CDVIonicKeyboard", "setResizeMode", [mode]); +} + +Keyboard.setKeyboardStyle = function(style) { + exec(null, null, "CDVIonicKeyboard", "keyboardStyle", [style]); +}; + +Keyboard.isVisible = false; + +module.exports = Keyboard; +}); diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/Connection.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/Connection.js deleted file mode 100644 index 5f7279c5..00000000 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/Connection.js +++ /dev/null @@ -1,37 +0,0 @@ -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/ios/platform_www/plugins/cordova-plugin-network-information/www/network.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/network.js deleted file mode 100644 index 770e6ba5..00000000 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/network.js +++ /dev/null @@ -1,94 +0,0 @@ -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/ios/platform_www/plugins/cordova-plugin-splashscreen/www/splashscreen.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-splashscreen/www/splashscreen.js deleted file mode 100644 index 5beaa5fd..00000000 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-splashscreen/www/splashscreen.js +++ /dev/null @@ -1,36 +0,0 @@ -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/ios/platform_www/plugins/cordova-plugin-statusbar/www/statusbar.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-statusbar/www/statusbar.js deleted file mode 100644 index 708186f9..00000000 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-statusbar/www/statusbar.js +++ /dev/null @@ -1,116 +0,0 @@ -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/ios/platform_www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js deleted file mode 100644 index fe0e83ad..00000000 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js +++ /dev/null @@ -1,124 +0,0 @@ -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/ios/platform_www/plugins/ionic-plugin-keyboard/www/ios/keyboard.js b/StoneIsland/platforms/ios/platform_www/plugins/ionic-plugin-keyboard/www/ios/keyboard.js deleted file mode 100644 index c74bb4d6..00000000 --- a/StoneIsland/platforms/ios/platform_www/plugins/ionic-plugin-keyboard/www/ios/keyboard.js +++ /dev/null @@ -1,43 +0,0 @@ -cordova.define("ionic-plugin-keyboard.keyboard", function(require, exports, module) { - -var argscheck = require('cordova/argscheck'), - utils = require('cordova/utils'), - exec = require('cordova/exec'); - - -var Keyboard = function() { -}; - -Keyboard.hideKeyboardAccessoryBar = function(hide) { - exec(null, null, "Keyboard", "hideKeyboardAccessoryBar", [hide]); -}; - -Keyboard.close = function() { - exec(null, null, "Keyboard", "close", []); -}; - -Keyboard.show = function() { - console.warn('Showing keyboard not supported in iOS due to platform limitations.') - console.warn('Instead, use input.focus(), and ensure that you have the following setting in your config.xml: \n'); - console.warn(' \n'); - // 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; - -module.exports = Keyboard; - - - - -}); diff --git a/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-mobile-accessibility/www/MobileAccessibilityNotifications.js b/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-mobile-accessibility/www/MobileAccessibilityNotifications.js deleted file mode 100644 index f5d0aaf7..00000000 --- a/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-mobile-accessibility/www/MobileAccessibilityNotifications.js +++ /dev/null @@ -1,53 +0,0 @@ -cordova.define("phonegap-plugin-mobile-accessibility.MobileAccessibilityNotifications", 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. - * -*/ - -/** - * Mobile Accessibility Notification event constants - */ -module.exports = { - /* MobileAccessibility window events */ - SCREEN_READER_STATUS_CHANGED : "screenreaderstatuschanged", - CLOSED_CAPTIONING_STATUS_CHANGED : "closedcaptioningstatuschanged", - GUIDED_ACCESS_STATUS_CHANGED : "guidedaccessstatuschanged", - INVERT_COLORS_STATUS_CHANGED : "invertcolorsstatuschanged", - MONO_AUDIO_STATUS_CHANGED : "monoaudiostatuschanged", - REDUCE_MOTION_STATUS_CHANGED : "reducemotionstatuschanged", - TOUCH_EXPLORATION_STATUS_CHANGED : "touchexplorationstatechanged", - BOLD_TEXT_STATUS_CHANGED : "boldtextstatuschanged", - DARKER_SYSTEM_COLORS_STATUS_CHANGED : "darkersystemcolorsstatuschanged", - GRAYSCALE_STATUS_CHANGED : "grayscalestatuschanged", - REDUCE_TRANSPARENCY_STATUS_CHANGED : "reducetransparencystatuschanged", - SPEAK_SCREEN_STATUS_CHANGED : "speakscreenstatuschanged", - SPEAK_SELECTION_STATUS_CHANGED : "speakselectionstatuschanged", - SWITCH_CONTROL_STATUS_CHANGED : "switchcontrolstatuschanged", - - /* iOS specific UIAccessibilityNotifications */ - SCREEN_CHANGED : 1000, - LAYOUT_CHANGED : 1001, - ANNOUNCEMENT : 1008, - PAGE_SCROLLED : 1009, - - /* Windows specific high contrast event */ - HIGH_CONTRAST_CHANGED : "highcontrastchanged" -}; - -}); diff --git a/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-mobile-accessibility/www/mobile-accessibility.js b/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-mobile-accessibility/www/mobile-accessibility.js deleted file mode 100644 index 852b8d34..00000000 --- a/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-mobile-accessibility/www/mobile-accessibility.js +++ /dev/null @@ -1,502 +0,0 @@ -cordova.define("phonegap-plugin-mobile-accessibility.mobile-accessibility", 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'), - utils = require('cordova/utils'), - exec = require('cordova/exec'), - device = require('cordova-plugin-device.device'), - network = require('cordova-plugin-network-information.network'), - connection = require('cordova-plugin-network-information.Connection'), - MobileAccessibilityNotifications = require('phonegap-plugin-mobile-accessibility.MobileAccessibilityNotifications'); - -var MobileAccessibility = function() { - this._isBoldTextEnabled = false; - this._isClosedCaptioningEnabled = false; - this._isDarkerSystemColorsEnabled = false; - this._isGrayscaleEnabled = false; - this._isGuidedAccessEnabled = false; - this._isInvertColorsEnabled = false; - this._isMonoAudioEnabled = false; - this._isReduceMotionEnabled = false; - this._isReduceTransparencyEnabled = false; - this._isScreenReaderRunning = false; - this._isSpeakScreenEnabled = false; - this._isSpeakSelectionEnabled = false; - this._isSwitchControlRunning = false; - this._isTouchExplorationEnabled = false; - this._usePreferredTextZoom = false; - this._isHighContrastEnabled = false; - this._highContrastScheme = undefined; - - // Create new event handlers on the window (returns a channel instance) - this.channels = { - boldtextstatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.BOLD_TEXT_STATUS_CHANGED), - closedcaptioningstatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.CLOSED_CAPTIONING_STATUS_CHANGED), - darkersystemcolorsstatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.DARKER_SYSTEM_COLORS_STATUS_CHANGED), - grayscalestatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.GRAYSCALE_STATUS_CHANGED), - guidedaccessstatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.GUIDED_ACCESS_STATUS_CHANGED), - invertcolorsstatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.INVERT_COLORS_STATUS_CHANGED), - monoaudiostatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.MONO_AUDIO_STATUS_CHANGED), - reducemotionstatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.REDUCE_MOTION_STATUS_CHANGED), - reducetransparencystatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.REDUCE_TRANSPARENCY_STATUS_CHANGED), - screenreaderstatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.SCREEN_READER_STATUS_CHANGED), - speakscreenstatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.SPEAK_SCREEN_STATUS_CHANGED), - speakselectionstatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.SPEAK_SELECTION_STATUS_CHANGED), - switchcontrolstatuschanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.SWITCH_CONTROL_STATUS_CHANGED), - touchexplorationstatechanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.TOUCH_EXPLORATION_STATUS_CHANGED), - highcontrastchanged : cordova.addWindowEventHandler(MobileAccessibilityNotifications.HIGH_CONTRAST_CHANGED) - }; - for (var key in this.channels) { - this.channels[key].onHasSubscribersChange = MobileAccessibility.onHasSubscribersChange; - } -}; - -/** - * @private - * @ignore - */ -function handlers() { - return mobileAccessibility.channels.boldtextstatuschanged.numHandlers + - mobileAccessibility.channels.closedcaptioningstatuschanged.numHandlers + - mobileAccessibility.channels.darkersystemcolorsstatuschanged.numHandlers + - mobileAccessibility.channels.grayscalestatuschanged.numHandlers + - mobileAccessibility.channels.guidedaccessstatuschanged.numHandlers + - mobileAccessibility.channels.invertcolorsstatuschanged.numHandlers + - mobileAccessibility.channels.monoaudiostatuschanged.numHandlers + - mobileAccessibility.channels.reducemotionstatuschanged.numHandlers + - mobileAccessibility.channels.reducetransparencystatuschanged.numHandlers + - mobileAccessibility.channels.screenreaderstatuschanged.numHandlers + - mobileAccessibility.channels.speakscreenstatuschanged.numHandlers + - mobileAccessibility.channels.speakselectionstatuschanged.numHandlers + - mobileAccessibility.channels.switchcontrolstatuschanged.numHandlers + - mobileAccessibility.channels.touchexplorationstatechanged.numHandlers + - mobileAccessibility.channels.highcontrastchanged.numHandlers; -}; - -/** - * - * Event handlers for when callback methods get registered for mobileAccessibility. - * Keep track of how many handlers we have so we can start and stop the native MobileAccessibility listener - * appropriately. - * @private - * @ignore - */ -MobileAccessibility.onHasSubscribersChange = function() { - // If we just registered the first handler, make sure native listener is started. - if (this.numHandlers === 1 && handlers() === 1) { - exec(mobileAccessibility._status, mobileAccessibility._error, "MobileAccessibility", "start", []); - } else if (handlers() === 0) { - exec(null, null, "MobileAccessibility", "stop", []); - } -}; - -/** - * Asynchronous call to native MobileAccessibility determine if a screen reader is running. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isScreenReaderRunning = function(callback) { - exec(function(bool) { - mobileAccessibility.activateOrDeactivateChromeVox(bool); - callback(Boolean(bool)); - }, null, "MobileAccessibility", "isScreenReaderRunning", []); -}; -MobileAccessibility.prototype.isVoiceOverRunning = function(callback) { - if (device.platform.toLowerCase() === "ios") { - MobileAccessibility.prototype.isScreenReaderRunning(callback); - } else { - callback(false); - } -}; -MobileAccessibility.prototype.isTalkBackRunning = function(callback) { - if (device.platform.toLowerCase() === "android" || device.platform.toLowerCase() === "amazon-fireos") { - MobileAccessibility.prototype.isScreenReaderRunning(callback); - } else { - callback(false); - } -}; -MobileAccessibility.prototype.isChromeVoxActive = function () { - return typeof cvox !== "undefined" && cvox.ChromeVox.host.ttsLoaded() && cvox.Api.isChromeVoxActive(); -}; -MobileAccessibility.prototype.activateOrDeactivateChromeVox = function(bool) { - if (device.platform !== "Android") return; - if (typeof cvox === "undefined") { - if (bool) { - console.warn('A screen reader is running but ChromeVox has failed to initialize.'); - if (navigator.connection.type === Connection.UNKNOWN || navigator.connection.type === Connection.NONE) { - mobileAccessibility.injectLocalAndroidVoxScript(); - } - } - } else { - // activate or deactivate ChromeVox based on whether or not or not the screen reader is running. - try { - cvox.ChromeVox.host.activateOrDeactivateChromeVox(bool); - } catch (err) { - console.error(err); - } - } - - if (bool) { - if (!mobileAccessibility.hasOrientationChangeListener) { - window.addEventListener("orientationchange", mobileAccessibility.onOrientationChange); - mobileAccessibility.hasOrientationChangeListener = true; - } - } else if(mobileAccessibility.hasOrientationChangeListener) { - window.removeEventListener("orientationchange", mobileAccessibility.onOrientationChange); - mobileAccessibility.hasOrientationChangeListener = false; - } -}; - -MobileAccessibility.prototype.hasOrientationChangeListener = false; -MobileAccessibility.prototype.onOrientationChange = function(event) { - if (!mobileAccessibility.isChromeVoxActive()) return; - cvox.ChromeVox.navigationManager.updateIndicator(); -}; - -MobileAccessibility.prototype.scriptInjected = false; -MobileAccessibility.prototype.injectLocalAndroidVoxScript = function() { - var versionsplit = device.version.split('.'); - if (device.platform !== "Android" || - !(versionsplit[0] > 4 || (versionsplit[0] == 4 && versionsplit[1] >= 1)) || - typeof cvox !== "undefined" || mobileAccessibility.scriptInjected) return; - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.async = true; - script.onload = function(){ - // console.log(this.src + ' has loaded'); - if (mobileAccessibility.isChromeVoxActive()) { - cordova.fireWindowEvent("screenreaderstatuschanged", { - isScreenReaderRunning: true - }); - } - }; - - script.src = (versionsplit[0] > 4 || versionsplit[1] > 3) - ? "plugins/com.phonegap.plugin.mobile-accessibility/android/chromeandroidvox.js" - : "plugins/com.phonegap.plugin.mobile-accessibility/android/AndroidVox_v1.js"; - document.getElementsByTagName('head')[0].appendChild(script); - mobileAccessibility.scriptInjected = true; -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Bold Text is enabled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isBoldTextEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isBoldTextEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Closed Captioning is enabled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isClosedCaptioningEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isClosedCaptioningEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Darker System Colors are enabled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isDarkerSystemColorsEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isDarkerSystemColorsEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Grayscale is enabled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isGrayscaleEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isGrayscaleEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Guided Access is enabled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isGuidedAccessEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isGuidedAccessEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if the display colors have been inverted. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isInvertColorsEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isInvertColorsEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Mono Audio is enabled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isMonoAudioEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isMonoAudioEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Reduce Motion is enabled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isReduceMotionEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isReduceMotionEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Reduce Transparency is enabled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isReduceTransparencyEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isReduceTransparencyEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Speak Screen is enabled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isSpeakScreenEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isSpeakScreenEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Speak Selection is enabled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isSpeakSelectionEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isSpeakSelectionEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Switch Control is running. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isSwitchControlRunning = function(callback) { - exec(callback, null, "MobileAccessibility", "isSwitchControlRunning", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if Touch Exploration is enabled on Android. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isTouchExplorationEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isTouchExplorationEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to determine if High Contrast is enabled on Windows. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.isHighContrastEnabled = function(callback) { - exec(callback, null, "MobileAccessibility", "isHighContrastEnabled", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to return the current text zoom percent value for the WebView. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.getTextZoom = function(callback) { - exec(callback, null, "MobileAccessibility", "getTextZoom", []); -}; - -/** - * Asynchronous call to native MobileAccessibility to set the current text zoom percent value for the WebView. - * @param {Number} textZoom A percentage value by which text in the WebView should be scaled. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.setTextZoom = function(textZoom, callback) { - exec(callback, null, "MobileAccessibility", "setTextZoom", [textZoom]); -}; - -/** - * Asynchronous call to native MobileAccessibility to retrieve the user's preferred text zoom from system settings and apply it to the application WebView. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility. - */ -MobileAccessibility.prototype.updateTextZoom = function(callback) { - exec(callback, null, "MobileAccessibility", "updateTextZoom", []); -}; - -MobileAccessibility.prototype.usePreferredTextZoom = function(bool) { - var currentValue = window.localStorage.getItem("MobileAccessibility.usePreferredTextZoom") === "true"; - - if (arguments.length === 0) { - return currentValue; - } - - if (currentValue != bool) { - window.localStorage.setItem("MobileAccessibility.usePreferredTextZoom", bool); - } - - var callback = function(){ - // Wrapping updateTextZoom call in a function to stop - // the event parameter propagation. This fixes an error - // on resume where cordova tried to call apply() on the - // event, expecting a function. - mobileAccessibility.updateTextZoom(); - }; - - document.removeEventListener("resume", callback); - - if (bool) { - // console.log("We should update the text zoom at this point: " + bool) - document.addEventListener("resume", callback, false); - mobileAccessibility.updateTextZoom(); - } else { - mobileAccessibility.setTextZoom(100); - } - - return Boolean(bool); -}; - -MobileAccessibility.prototype.MobileAccessibilityNotifications = MobileAccessibilityNotifications; - -/** - * Posts a notification with a string for a screen reader to announce, if it is running. - * @param {uint} mobileAccessibilityNotification A numeric constant for the type of notification to send. Constants are defined in MobileAccessibility.MobileAccessibilityNotifications. - * @param {string} string A string to be announced by a screen reader. - * @param {function} callback A callback method to receive the asynchronous result from the native MobileAccessibility, when the announcement is finished, the function should expect an object containing the stringValue that was voiced and a boolean indicating that the announcement wasSuccessful. - */ -MobileAccessibility.prototype.postNotification = function(mobileAccessibilityNotification, string, callback) { - exec(callback, null, "MobileAccessibility", "postNotification", [mobileAccessibilityNotification, string]); -}; - -/** - * Speaks the given string, and if ChromeVox is active, it will use the specified queueMode and properties. - * @param {string} string A string to be announced by a screen reader. - * @param {number} [queueMode] Optional number. Valid modes are 0 for flush; 1 for queue. - * @param {Object} [properties] Speech properties to use for this utterance. - */ -MobileAccessibility.prototype.speak = function(string, queueMode, properties) { - if (this.isChromeVoxActive()) { - cvox.ChromeVox.tts.speak(string, queueMode, properties); - } else { - exec(null, null, "MobileAccessibility", "postNotification", [MobileAccessibilityNotifications.ANNOUNCEMENT, string]); - } -} - -/** - * Stops speech. - */ -MobileAccessibility.prototype.stop = function() { - if (this.isChromeVoxActive()) { - cvox.ChromeVox.tts.stop(); - } else { - exec(null, null, "MobileAccessibility", "postNotification", [MobileAccessibilityNotifications.ANNOUNCEMENT, "\u200b"]); - } -} - -/** - * Callback from native MobileAccessibility returning an object which describes the status of MobileAccessibility features. - * - * @param {Object} info - * @config {Boolean} [isBoldTextEnabled] Boolean to indicate bold text status (ios). - * @config {Boolean} [isClosedCaptioningEnabled] Boolean to indicate closed captioning status. - * @config {Boolean} [isDarkerSystemColorsEnabled] Boolean to indicate darker system colors status (ios). - * @config {Boolean} [isGrayscaleEnabled] Boolean to indicate grayscale status (ios). - * @config {Boolean} [isGuidedAccessEnabled] Boolean to indicate guided access status (ios). - * @config {Boolean} [isInvertColorsEnabled] Boolean to indicate invert colors status (ios). - * @config {Boolean} [isMonoAudioEnabled] Boolean to indicate mono audio status (ios). - * @config {Boolean} [isReduceMotionEnabled] Boolean to indicate reduce motion status (ios). - * @config {Boolean} [isReduceTransparencyEnabled] Boolean to indicate reduce transparency status (ios). - * @config {Boolean} [isScreenReaderRunning] Boolean to indicate screen reader status. - * @config {Boolean} [isSpeakScreenEnabled] Boolean to indicate speak screen status (ios). - * @config {Boolean} [isSpeakSelectionEnabled] Boolean to indicate speak selection status (ios). - * @config {Boolean} [isSwitchControlRunning] Boolean to indicate switch control status (ios). - * @config {Boolean} [isTouchExplorationEnabled] Boolean to indicate touch exploration status (android). - */ -MobileAccessibility.prototype._status = function(info) { - if (info) { - mobileAccessibility.activateOrDeactivateChromeVox(info.isScreenReaderRunning); - if (mobileAccessibility._isBoldTextEnabled !== info.isBoldTextEnabled) { - mobileAccessibility._isBoldTextEnabled = info.isBoldTextEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.BOLD_TEXT_STATUS_CHANGED, info); - } - if (mobileAccessibility._isClosedCaptioningEnabled !== info.isClosedCaptioningEnabled) { - mobileAccessibility._isClosedCaptioningEnabled = info.isClosedCaptioningEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.CLOSED_CAPTIONING_STATUS_CHANGED, info); - } - if (mobileAccessibility._isDarkerSystemColorsEnabled !== info.isDarkerSystemColorsEnabled) { - mobileAccessibility._isDarkerSystemColorsEnabled = info.isDarkerSystemColorsEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.DARKER_SYSTEM_COLORS_STATUS_CHANGED, info); - } - if (mobileAccessibility._isGrayscaleEnabled !== info.isGrayscaleEnabled) { - mobileAccessibility._isGrayscaleEnabled = info.isGrayscaleEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.GRAYSCALE_STATUS_CHANGED, info); - } - if (mobileAccessibility._isGuidedAccessEnabled !== info.isGuidedAccessEnabled) { - mobileAccessibility._isGuidedAccessEnabled = info.isGuidedAccessEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.GUIDED_ACCESS_STATUS_CHANGED, info); - } - if (mobileAccessibility._isInvertColorsEnabled !== info.isInvertColorsEnabled) { - mobileAccessibility._isInvertColorsEnabled = info.isInvertColorsEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.INVERT_COLORS_STATUS_CHANGED, info); - } - if (mobileAccessibility._isMonoAudioEnabled !== info.isMonoAudioEnabled) { - mobileAccessibility._isMonoAudioEnabled = info.isMonoAudioEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.MONO_AUDIO_STATUS_CHANGED, info); - } - if (mobileAccessibility._isReduceMotionEnabled !== info.isReduceMotionEnabled) { - mobileAccessibility._isReduceMotionEnabled = info.isReduceMotionEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.REDUCE_MOTION_STATUS_CHANGED, info); - } - if (mobileAccessibility._isReduceTransparencyEnabled !== info.isReduceTransparencyEnabled) { - mobileAccessibility._isReduceTransparencyEnabled = info.isReduceTransparencyEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.REDUCE_TRANSPARENCY_STATUS_CHANGED, info); - } - if (mobileAccessibility._isScreenReaderRunning !== info.isScreenReaderRunning) { - mobileAccessibility._isScreenReaderRunning = info.isScreenReaderRunning; - cordova.fireWindowEvent(MobileAccessibilityNotifications.SCREEN_READER_STATUS_CHANGED, info); - } - if (mobileAccessibility._isSpeakScreenEnabled !== info.isSpeakScreenEnabled) { - mobileAccessibility._isSpeakScreenEnabled = info.isSpeakScreenEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.SPEAK_SCREEN_STATUS_CHANGED, info); - } - if (mobileAccessibility._isSpeakSelectionEnabled !== info.isSpeakSelectionEnabled) { - mobileAccessibility._isSpeakSelectionEnabled = info.isSpeakSelectionEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.SPEAK_SELECTION_STATUS_CHANGED, info); - } - if (mobileAccessibility._isSwitchControlRunning !== info.isSwitchControlRunning) { - mobileAccessibility._isSwitchControlRunning = info.isSwitchControlRunning; - cordova.fireWindowEvent(MobileAccessibilityNotifications.SWITCH_CONTROL_STATUS_CHANGED, info); - } - if (mobileAccessibility._isTouchExplorationEnabled !== info.isTouchExplorationEnabled) { - mobileAccessibility._isTouchExplorationEnabled = info.isTouchExplorationEnabled; - cordova.fireWindowEvent(MobileAccessibilityNotifications.TOUCH_EXPLORATION_STATUS_CHANGED, info); - } - if (mobileAccessibility._isHighContrastEnabled !== info.isHighContrastEnabled) { - mobileAccessibility._isHighContrastEnabled = info.isHighContrastEnabled; - mobileAccessibility._highContrastScheme = info.highContrastScheme; - cordova.fireWindowEvent(MobileAccessibilityNotifications.HIGH_CONTRAST_CHANGED, info); - } - } -}; - -/** - * Error callback for MobileAccessibility start - */ -MobileAccessibility.prototype._error = function(e) { - console.log("Error initializing MobileAccessibility: " + e); -}; - -var mobileAccessibility = new MobileAccessibility(); - -module.exports = mobileAccessibility; - -}); diff --git a/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-push/www/push.js b/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-push/www/push.js deleted file mode 100644 index a5315486..00000000 --- a/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-push/www/push.js +++ /dev/null @@ -1,329 +0,0 @@ -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 -}; - -}); -- cgit v1.2.3-70-g09d2