forked from github/cordova-android
Updated cordova.android.js for CB-1950 - InAppBrowser events
This commit is contained in:
parent
432aec62a9
commit
00e5ff1964
@ -1,6 +1,6 @@
|
|||||||
// commit 54335c8f70223b053f4c039185d13cb95801d043
|
// commit 832eb92dbc908e9544bed202878906fba49667c7
|
||||||
|
|
||||||
// File generated at :: Mon Nov 26 2012 16:05:15 GMT-0500 (EST)
|
// File generated at :: Fri Nov 30 2012 05:23:45 GMT-0800 (PST)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -3323,18 +3323,55 @@ define("cordova/plugin/InAppBrowser", function(require, exports, module) {
|
|||||||
|
|
||||||
var exec = require('cordova/exec');
|
var exec = require('cordova/exec');
|
||||||
|
|
||||||
var InAppBrowser = {
|
function InAppBrowser()
|
||||||
open : function(strUrl, strWindowName, strWindowFeatures) {
|
{
|
||||||
exec(null, null, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
|
var _channel = require('cordova/channel');
|
||||||
return InAppBrowser;
|
this.channels = {
|
||||||
},
|
'loadstart': _channel.create('loadstart'),
|
||||||
close : function() {
|
'loadstop' : _channel.create('loadstop'),
|
||||||
|
'exit' : _channel.create('exit')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
InAppBrowser.prototype._eventHandler = function(event)
|
||||||
|
{
|
||||||
|
if (event.type in this.channels) {
|
||||||
|
this.channels[event.type].fire(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InAppBrowser.open = function(strUrl, strWindowName, strWindowFeatures)
|
||||||
|
{
|
||||||
|
var iab = new InAppBrowser();
|
||||||
|
var cb = function(eventname) {
|
||||||
|
iab._eventHandler(eventname);
|
||||||
|
}
|
||||||
|
exec(cb, null, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
|
||||||
|
return iab;
|
||||||
|
}
|
||||||
|
|
||||||
|
InAppBrowser.prototype.close = function(eventname, f)
|
||||||
|
{
|
||||||
exec(null, null, "InAppBrowser", "close", []);
|
exec(null, null, "InAppBrowser", "close", []);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
InAppBrowser.prototype.addEventListener = function(eventname, f)
|
||||||
|
{
|
||||||
|
if (eventname in this.channels) {
|
||||||
|
this.channels[eventname].subscribe(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InAppBrowser.prototype.removeEventListener = function(eventname, f)
|
||||||
|
{
|
||||||
|
if (eventname in this.channels) {
|
||||||
|
this.channels[eventname].unsubscribe(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = InAppBrowser.open;
|
module.exports = InAppBrowser.open;
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// file: lib/common/plugin/LocalFileSystem.js
|
// file: lib/common/plugin/LocalFileSystem.js
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// commit 02b91c5313ff37d74a58f71775170afd360f4a1f
|
// commit 832eb92dbc908e9544bed202878906fba49667c7
|
||||||
|
|
||||||
// File generated at :: Wed Oct 31 2012 10:40:25 GMT-0700 (PDT)
|
// File generated at :: Fri Nov 30 2012 05:23:45 GMT-0800 (PST)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -314,6 +314,65 @@ channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
|
|||||||
|
|
||||||
module.exports = cordova;
|
module.exports = cordova;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// file: lib/common/argscheck.js
|
||||||
|
define("cordova/argscheck", function(require, exports, module) {
|
||||||
|
|
||||||
|
var exec = require('cordova/exec');
|
||||||
|
var moduleExports = module.exports;
|
||||||
|
|
||||||
|
var typeMap = {
|
||||||
|
'A': 'Array',
|
||||||
|
'D': 'Date',
|
||||||
|
'N': 'Number',
|
||||||
|
'S': 'String',
|
||||||
|
'F': 'Function',
|
||||||
|
'O': 'Object'
|
||||||
|
};
|
||||||
|
|
||||||
|
function extractParamName(callee, argIndex) {
|
||||||
|
return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkArgs(spec, functionName, args, opt_callee) {
|
||||||
|
if (!moduleExports.enableChecks) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var errMsg = null;
|
||||||
|
var type;
|
||||||
|
for (var i = 0; i < spec.length; ++i) {
|
||||||
|
var c = spec.charAt(i),
|
||||||
|
cUpper = c.toUpperCase(),
|
||||||
|
arg = args[i];
|
||||||
|
// Asterix means allow anything.
|
||||||
|
if (c == '*') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
type = Object.prototype.toString.call(arg).slice(8, -1);
|
||||||
|
if ((arg === null || arg === undefined) && c == cUpper) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (type != typeMap[cUpper]) {
|
||||||
|
errMsg = 'Expected ' + typeMap[cUpper];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (errMsg) {
|
||||||
|
errMsg += ', but got ' + type + '.';
|
||||||
|
errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg;
|
||||||
|
// Don't log when running jake test.
|
||||||
|
if (typeof jasmine == 'undefined') {
|
||||||
|
console.error(errMsg);
|
||||||
|
}
|
||||||
|
throw TypeError(errMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
moduleExports.checkArgs = checkArgs;
|
||||||
|
moduleExports.enableChecks = true;
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// file: lib/common/builder.js
|
// file: lib/common/builder.js
|
||||||
@ -329,14 +388,24 @@ function each(objects, func, context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clobber(obj, key, value) {
|
||||||
|
obj[key] = value;
|
||||||
|
// Getters can only be overridden by getters.
|
||||||
|
if (obj[key] !== value) {
|
||||||
|
utils.defineGetter(obj, key, function() {
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function assignOrWrapInDeprecateGetter(obj, key, value, message) {
|
function assignOrWrapInDeprecateGetter(obj, key, value, message) {
|
||||||
if (message) {
|
if (message) {
|
||||||
utils.defineGetter(obj, key, function() {
|
utils.defineGetter(obj, key, function() {
|
||||||
window.console && console.log(message);
|
console.log(message);
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
obj[key] = value;
|
clobber(obj, key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,8 +464,11 @@ function recursiveMerge(target, src) {
|
|||||||
// If the target object is a constructor override off prototype.
|
// If the target object is a constructor override off prototype.
|
||||||
target.prototype[prop] = src[prop];
|
target.prototype[prop] = src[prop];
|
||||||
} else {
|
} else {
|
||||||
target[prop] = typeof src[prop] === 'object' ? recursiveMerge(
|
if (typeof src[prop] === 'object') {
|
||||||
target[prop], src[prop]) : src[prop];
|
target[prop] = recursiveMerge(target[prop], src[prop]);
|
||||||
|
} else {
|
||||||
|
clobber(target, prop, src[prop]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,20 +476,16 @@ function recursiveMerge(target, src) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
build: function (objects) {
|
buildIntoButDoNotClobber: function(objects, target) {
|
||||||
return {
|
|
||||||
intoButDoNotClobber: function (target) {
|
|
||||||
include(target, objects, false, false);
|
include(target, objects, false, false);
|
||||||
},
|
},
|
||||||
intoAndClobber: function(target) {
|
buildIntoAndClobber: function(objects, target) {
|
||||||
include(target, objects, true, false);
|
include(target, objects, true, false);
|
||||||
},
|
},
|
||||||
intoAndMerge: function(target) {
|
buildIntoAndMerge: function(objects, target) {
|
||||||
include(target, objects, true, true);
|
include(target, objects, true, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -701,7 +769,7 @@ module.exports = {
|
|||||||
define("cordova/common", function(require, exports, module) {
|
define("cordova/common", function(require, exports, module) {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
objects: {
|
defaults: {
|
||||||
cordova: {
|
cordova: {
|
||||||
path: 'cordova',
|
path: 'cordova',
|
||||||
children: {
|
children: {
|
||||||
@ -720,6 +788,9 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
open : {
|
||||||
|
path: 'cordova/plugin/InAppBrowser'
|
||||||
|
},
|
||||||
navigator: {
|
navigator: {
|
||||||
children: {
|
children: {
|
||||||
notification: {
|
notification: {
|
||||||
@ -737,9 +808,6 @@ module.exports = {
|
|||||||
compass:{
|
compass:{
|
||||||
path: 'cordova/plugin/compass'
|
path: 'cordova/plugin/compass'
|
||||||
},
|
},
|
||||||
connection: {
|
|
||||||
path: 'cordova/plugin/network'
|
|
||||||
},
|
|
||||||
contacts: {
|
contacts: {
|
||||||
path: 'cordova/plugin/contacts'
|
path: 'cordova/plugin/contacts'
|
||||||
},
|
},
|
||||||
@ -907,6 +975,15 @@ module.exports = {
|
|||||||
resolveLocalFileSystemURI:{
|
resolveLocalFileSystemURI:{
|
||||||
path: 'cordova/plugin/resolveLocalFileSystemURI'
|
path: 'cordova/plugin/resolveLocalFileSystemURI'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
clobbers: {
|
||||||
|
navigator: {
|
||||||
|
children: {
|
||||||
|
connection: {
|
||||||
|
path: 'cordova/plugin/network'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -961,6 +1038,7 @@ var cordova = require('cordova'),
|
|||||||
|
|
||||||
function androidExec(success, fail, service, action, args) {
|
function androidExec(success, fail, service, action, args) {
|
||||||
// Set default bridge modes if they have not already been set.
|
// Set default bridge modes if they have not already been set.
|
||||||
|
// By default, we use the failsafe, since addJavascriptInterface breaks too often
|
||||||
if (jsToNativeBridgeMode === undefined) {
|
if (jsToNativeBridgeMode === undefined) {
|
||||||
androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
|
androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
|
||||||
}
|
}
|
||||||
@ -1199,7 +1277,7 @@ module.exports = {
|
|||||||
exec(null, null, "App", "show", []);
|
exec(null, null, "App", "show", []);
|
||||||
}, [channel.onCordovaReady]);
|
}, [channel.onCordovaReady]);
|
||||||
},
|
},
|
||||||
objects: {
|
clobbers: {
|
||||||
navigator: {
|
navigator: {
|
||||||
children: {
|
children: {
|
||||||
app:{
|
app:{
|
||||||
@ -1218,6 +1296,9 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
MediaError: { // exists natively on Android WebView on Android 4.x
|
MediaError: { // exists natively on Android WebView on Android 4.x
|
||||||
path: "cordova/plugin/MediaError"
|
path: "cordova/plugin/MediaError"
|
||||||
|
},
|
||||||
|
open: {
|
||||||
|
path: "cordova/plugin/InAppBrowser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merges: {
|
merges: {
|
||||||
@ -3235,6 +3316,62 @@ GlobalizationError.PATTERN_ERROR = 3;
|
|||||||
|
|
||||||
module.exports = GlobalizationError;
|
module.exports = GlobalizationError;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// file: lib/common/plugin/InAppBrowser.js
|
||||||
|
define("cordova/plugin/InAppBrowser", function(require, exports, module) {
|
||||||
|
|
||||||
|
var exec = require('cordova/exec');
|
||||||
|
|
||||||
|
function InAppBrowser()
|
||||||
|
{
|
||||||
|
var _channel = require('cordova/channel');
|
||||||
|
this.channels = {
|
||||||
|
'loadstart': _channel.create('loadstart'),
|
||||||
|
'loadstop' : _channel.create('loadstop'),
|
||||||
|
'exit' : _channel.create('exit')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
InAppBrowser.prototype._eventHandler = function(event)
|
||||||
|
{
|
||||||
|
if (event.type in this.channels) {
|
||||||
|
this.channels[event.type].fire(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InAppBrowser.open = function(strUrl, strWindowName, strWindowFeatures)
|
||||||
|
{
|
||||||
|
var iab = new InAppBrowser();
|
||||||
|
var cb = function(eventname) {
|
||||||
|
iab._eventHandler(eventname);
|
||||||
|
}
|
||||||
|
exec(cb, null, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
|
||||||
|
return iab;
|
||||||
|
}
|
||||||
|
|
||||||
|
InAppBrowser.prototype.close = function(eventname, f)
|
||||||
|
{
|
||||||
|
exec(null, null, "InAppBrowser", "close", []);
|
||||||
|
}
|
||||||
|
|
||||||
|
InAppBrowser.prototype.addEventListener = function(eventname, f)
|
||||||
|
{
|
||||||
|
if (eventname in this.channels) {
|
||||||
|
this.channels[eventname].subscribe(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InAppBrowser.prototype.removeEventListener = function(eventname, f)
|
||||||
|
{
|
||||||
|
if (eventname in this.channels) {
|
||||||
|
this.channels[eventname].unsubscribe(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = InAppBrowser.open;
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// file: lib/common/plugin/LocalFileSystem.js
|
// file: lib/common/plugin/LocalFileSystem.js
|
||||||
@ -3673,7 +3810,8 @@ define("cordova/plugin/accelerometer", function(require, exports, module) {
|
|||||||
* This class provides access to device accelerometer data.
|
* This class provides access to device accelerometer data.
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
var utils = require("cordova/utils"),
|
var argscheck = require('cordova/argscheck'),
|
||||||
|
utils = require("cordova/utils"),
|
||||||
exec = require("cordova/exec"),
|
exec = require("cordova/exec"),
|
||||||
Acceleration = require('cordova/plugin/Acceleration');
|
Acceleration = require('cordova/plugin/Acceleration');
|
||||||
|
|
||||||
@ -3737,10 +3875,7 @@ var accelerometer = {
|
|||||||
* @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
|
* @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
|
||||||
*/
|
*/
|
||||||
getCurrentAcceleration: function(successCallback, errorCallback, options) {
|
getCurrentAcceleration: function(successCallback, errorCallback, options) {
|
||||||
// successCallback required
|
argscheck.checkArgs('fFO', 'accelerometer.getCurrentAcceleration', arguments);
|
||||||
if (typeof successCallback !== "function") {
|
|
||||||
throw "getCurrentAcceleration must be called with at least a success callback function as first parameter.";
|
|
||||||
}
|
|
||||||
|
|
||||||
var p;
|
var p;
|
||||||
var win = function(a) {
|
var win = function(a) {
|
||||||
@ -3749,7 +3884,7 @@ var accelerometer = {
|
|||||||
};
|
};
|
||||||
var fail = function(e) {
|
var fail = function(e) {
|
||||||
removeListeners(p);
|
removeListeners(p);
|
||||||
errorCallback(e);
|
errorCallback && errorCallback(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
p = createCallbackPair(win, fail);
|
p = createCallbackPair(win, fail);
|
||||||
@ -3769,20 +3904,16 @@ var accelerometer = {
|
|||||||
* @return String The watch id that must be passed to #clearWatch to stop watching.
|
* @return String The watch id that must be passed to #clearWatch to stop watching.
|
||||||
*/
|
*/
|
||||||
watchAcceleration: function(successCallback, errorCallback, options) {
|
watchAcceleration: function(successCallback, errorCallback, options) {
|
||||||
|
argscheck.checkArgs('fFO', 'accelerometer.watchAcceleration', arguments);
|
||||||
// Default interval (10 sec)
|
// Default interval (10 sec)
|
||||||
var frequency = (options && options.frequency && typeof options.frequency == 'number') ? options.frequency : 10000;
|
var frequency = (options && options.frequency && typeof options.frequency == 'number') ? options.frequency : 10000;
|
||||||
|
|
||||||
// successCallback required
|
|
||||||
if (typeof successCallback !== "function") {
|
|
||||||
throw "watchAcceleration must be called with at least a success callback function as first parameter.";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep reference to watch id, and report accel readings as often as defined in frequency
|
// Keep reference to watch id, and report accel readings as often as defined in frequency
|
||||||
var id = utils.createUUID();
|
var id = utils.createUUID();
|
||||||
|
|
||||||
var p = createCallbackPair(function(){}, function(e) {
|
var p = createCallbackPair(function(){}, function(e) {
|
||||||
removeListeners(p);
|
removeListeners(p);
|
||||||
errorCallback(e);
|
errorCallback && errorCallback(e);
|
||||||
});
|
});
|
||||||
listeners.push(p);
|
listeners.push(p);
|
||||||
|
|
||||||
@ -4592,7 +4723,8 @@ module.exports = new Capture();
|
|||||||
// file: lib/common/plugin/compass.js
|
// file: lib/common/plugin/compass.js
|
||||||
define("cordova/plugin/compass", function(require, exports, module) {
|
define("cordova/plugin/compass", function(require, exports, module) {
|
||||||
|
|
||||||
var exec = require('cordova/exec'),
|
var argscheck = require('cordova/argscheck'),
|
||||||
|
exec = require('cordova/exec'),
|
||||||
utils = require('cordova/utils'),
|
utils = require('cordova/utils'),
|
||||||
CompassHeading = require('cordova/plugin/CompassHeading'),
|
CompassHeading = require('cordova/plugin/CompassHeading'),
|
||||||
CompassError = require('cordova/plugin/CompassError'),
|
CompassError = require('cordova/plugin/CompassError'),
|
||||||
@ -4607,23 +4739,13 @@ var exec = require('cordova/exec'),
|
|||||||
* @param {CompassOptions} options The options for getting the heading data (not used).
|
* @param {CompassOptions} options The options for getting the heading data (not used).
|
||||||
*/
|
*/
|
||||||
getCurrentHeading:function(successCallback, errorCallback, options) {
|
getCurrentHeading:function(successCallback, errorCallback, options) {
|
||||||
// successCallback required
|
argscheck.checkArgs('fFO', 'compass.getCurrentHeading', arguments);
|
||||||
if (typeof successCallback !== "function") {
|
|
||||||
console.log("Compass Error: successCallback is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback optional
|
|
||||||
if (errorCallback && (typeof errorCallback !== "function")) {
|
|
||||||
console.log("Compass Error: errorCallback is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var win = function(result) {
|
var win = function(result) {
|
||||||
var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
|
var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
|
||||||
successCallback(ch);
|
successCallback(ch);
|
||||||
};
|
};
|
||||||
var fail = function(code) {
|
var fail = errorCallback && function(code) {
|
||||||
var ce = new CompassError(code);
|
var ce = new CompassError(code);
|
||||||
errorCallback(ce);
|
errorCallback(ce);
|
||||||
};
|
};
|
||||||
@ -4643,22 +4765,11 @@ var exec = require('cordova/exec'),
|
|||||||
* specifies to watch via a distance filter rather than time.
|
* specifies to watch via a distance filter rather than time.
|
||||||
*/
|
*/
|
||||||
watchHeading:function(successCallback, errorCallback, options) {
|
watchHeading:function(successCallback, errorCallback, options) {
|
||||||
|
argscheck.checkArgs('fFO', 'compass.watchHeading', arguments);
|
||||||
// Default interval (100 msec)
|
// Default interval (100 msec)
|
||||||
var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
|
var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
|
||||||
var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0;
|
var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0;
|
||||||
|
|
||||||
// successCallback required
|
|
||||||
if (typeof successCallback !== "function") {
|
|
||||||
console.log("Compass Error: successCallback is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback optional
|
|
||||||
if (errorCallback && (typeof errorCallback !== "function")) {
|
|
||||||
console.log("Compass Error: errorCallback is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var id = utils.createUUID();
|
var id = utils.createUUID();
|
||||||
if (filter > 0) {
|
if (filter > 0) {
|
||||||
// is an iOS request for watch by filter, no timer needed
|
// is an iOS request for watch by filter, no timer needed
|
||||||
@ -4871,7 +4982,8 @@ for (var key in console) {
|
|||||||
// file: lib/common/plugin/contacts.js
|
// file: lib/common/plugin/contacts.js
|
||||||
define("cordova/plugin/contacts", function(require, exports, module) {
|
define("cordova/plugin/contacts", function(require, exports, module) {
|
||||||
|
|
||||||
var exec = require('cordova/exec'),
|
var argscheck = require('cordova/argscheck'),
|
||||||
|
exec = require('cordova/exec'),
|
||||||
ContactError = require('cordova/plugin/ContactError'),
|
ContactError = require('cordova/plugin/ContactError'),
|
||||||
utils = require('cordova/utils'),
|
utils = require('cordova/utils'),
|
||||||
Contact = require('cordova/plugin/Contact');
|
Contact = require('cordova/plugin/Contact');
|
||||||
@ -4890,13 +5002,9 @@ var contacts = {
|
|||||||
* @return array of Contacts matching search criteria
|
* @return array of Contacts matching search criteria
|
||||||
*/
|
*/
|
||||||
find:function(fields, successCB, errorCB, options) {
|
find:function(fields, successCB, errorCB, options) {
|
||||||
if (!successCB) {
|
argscheck.checkArgs('afFO', 'contacts.find', arguments);
|
||||||
throw new TypeError("You must specify a success callback for the find command.");
|
if (!fields.length) {
|
||||||
}
|
errorCB && errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
|
||||||
if (!fields || (utils.isArray(fields) && fields.length === 0)) {
|
|
||||||
if (typeof errorCB === "function") {
|
|
||||||
errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
var win = function(result) {
|
var win = function(result) {
|
||||||
var cs = [];
|
var cs = [];
|
||||||
@ -4917,9 +5025,9 @@ var contacts = {
|
|||||||
* @returns new Contact object
|
* @returns new Contact object
|
||||||
*/
|
*/
|
||||||
create:function(properties) {
|
create:function(properties) {
|
||||||
var i;
|
argscheck.checkArgs('O', 'contacts.create', arguments);
|
||||||
var contact = new Contact();
|
var contact = new Contact();
|
||||||
for (i in properties) {
|
for (var i in properties) {
|
||||||
if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) {
|
if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) {
|
||||||
contact[i] = properties[i];
|
contact[i] = properties[i];
|
||||||
}
|
}
|
||||||
@ -4935,7 +5043,8 @@ module.exports = contacts;
|
|||||||
// file: lib/common/plugin/device.js
|
// file: lib/common/plugin/device.js
|
||||||
define("cordova/plugin/device", function(require, exports, module) {
|
define("cordova/plugin/device", function(require, exports, module) {
|
||||||
|
|
||||||
var channel = require('cordova/channel'),
|
var argscheck = require('cordova/argscheck'),
|
||||||
|
channel = require('cordova/channel'),
|
||||||
utils = require('cordova/utils'),
|
utils = require('cordova/utils'),
|
||||||
exec = require('cordova/exec');
|
exec = require('cordova/exec');
|
||||||
|
|
||||||
@ -4954,6 +5063,7 @@ function Device() {
|
|||||||
this.name = null;
|
this.name = null;
|
||||||
this.uuid = null;
|
this.uuid = null;
|
||||||
this.cordova = null;
|
this.cordova = null;
|
||||||
|
this.model = null;
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
@ -4965,6 +5075,7 @@ function Device() {
|
|||||||
me.name = info.name;
|
me.name = info.name;
|
||||||
me.uuid = info.uuid;
|
me.uuid = info.uuid;
|
||||||
me.cordova = info.cordova;
|
me.cordova = info.cordova;
|
||||||
|
me.model = info.model;
|
||||||
channel.onCordovaInfoReady.fire();
|
channel.onCordovaInfoReady.fire();
|
||||||
},function(e) {
|
},function(e) {
|
||||||
me.available = false;
|
me.available = false;
|
||||||
@ -4980,20 +5091,7 @@ function Device() {
|
|||||||
* @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL)
|
* @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL)
|
||||||
*/
|
*/
|
||||||
Device.prototype.getInfo = function(successCallback, errorCallback) {
|
Device.prototype.getInfo = function(successCallback, errorCallback) {
|
||||||
|
argscheck.checkArgs('fF', 'Device.getInfo', arguments);
|
||||||
// successCallback required
|
|
||||||
if (typeof successCallback !== "function") {
|
|
||||||
console.log("Device Error: successCallback is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback optional
|
|
||||||
if (errorCallback && (typeof errorCallback !== "function")) {
|
|
||||||
console.log("Device Error: errorCallback is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get info
|
|
||||||
exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
|
exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -5024,7 +5122,8 @@ module.exports = function(successCallback, errorCallback, message, forceAsync) {
|
|||||||
// file: lib/common/plugin/geolocation.js
|
// file: lib/common/plugin/geolocation.js
|
||||||
define("cordova/plugin/geolocation", function(require, exports, module) {
|
define("cordova/plugin/geolocation", function(require, exports, module) {
|
||||||
|
|
||||||
var utils = require('cordova/utils'),
|
var argscheck = require('cordova/argscheck'),
|
||||||
|
utils = require('cordova/utils'),
|
||||||
exec = require('cordova/exec'),
|
exec = require('cordova/exec'),
|
||||||
PositionError = require('cordova/plugin/PositionError'),
|
PositionError = require('cordova/plugin/PositionError'),
|
||||||
Position = require('cordova/plugin/Position');
|
Position = require('cordova/plugin/Position');
|
||||||
@ -5081,9 +5180,7 @@ var geolocation = {
|
|||||||
* @param {PositionOptions} options The options for getting the position data. (OPTIONAL)
|
* @param {PositionOptions} options The options for getting the position data. (OPTIONAL)
|
||||||
*/
|
*/
|
||||||
getCurrentPosition:function(successCallback, errorCallback, options) {
|
getCurrentPosition:function(successCallback, errorCallback, options) {
|
||||||
if (arguments.length === 0) {
|
argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
|
||||||
throw new Error("getCurrentPosition must be called with at least one argument.");
|
|
||||||
}
|
|
||||||
options = parseParameters(options);
|
options = parseParameters(options);
|
||||||
|
|
||||||
// Timer var that will fire an error callback if no position is retrieved from native
|
// Timer var that will fire an error callback if no position is retrieved from native
|
||||||
@ -5159,9 +5256,7 @@ var geolocation = {
|
|||||||
* @return String The watch id that must be passed to #clearWatch to stop watching.
|
* @return String The watch id that must be passed to #clearWatch to stop watching.
|
||||||
*/
|
*/
|
||||||
watchPosition:function(successCallback, errorCallback, options) {
|
watchPosition:function(successCallback, errorCallback, options) {
|
||||||
if (arguments.length === 0) {
|
argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
|
||||||
throw new Error("watchPosition must be called with at least one argument.");
|
|
||||||
}
|
|
||||||
options = parseParameters(options);
|
options = parseParameters(options);
|
||||||
|
|
||||||
var id = utils.createUUID();
|
var id = utils.createUUID();
|
||||||
@ -5223,7 +5318,8 @@ module.exports = geolocation;
|
|||||||
// file: lib/common/plugin/globalization.js
|
// file: lib/common/plugin/globalization.js
|
||||||
define("cordova/plugin/globalization", function(require, exports, module) {
|
define("cordova/plugin/globalization", function(require, exports, module) {
|
||||||
|
|
||||||
var exec = require('cordova/exec'),
|
var argscheck = require('cordova/argscheck'),
|
||||||
|
exec = require('cordova/exec'),
|
||||||
GlobalizationError = require('cordova/plugin/GlobalizationError');
|
GlobalizationError = require('cordova/plugin/GlobalizationError');
|
||||||
|
|
||||||
var globalization = {
|
var globalization = {
|
||||||
@ -5246,18 +5342,7 @@ var globalization = {
|
|||||||
* function () {});
|
* function () {});
|
||||||
*/
|
*/
|
||||||
getPreferredLanguage:function(successCB, failureCB) {
|
getPreferredLanguage:function(successCB, failureCB) {
|
||||||
// successCallback required
|
argscheck.checkArgs('fF', 'Globalization.getPreferredLanguage', arguments);
|
||||||
if (typeof successCB != "function") {
|
|
||||||
console.log("Globalization.getPreferredLanguage Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.getPreferredLanguage Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
exec(successCB, failureCB, "Globalization","getPreferredLanguage", []);
|
exec(successCB, failureCB, "Globalization","getPreferredLanguage", []);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -5279,17 +5364,7 @@ getPreferredLanguage:function(successCB, failureCB) {
|
|||||||
* function () {});
|
* function () {});
|
||||||
*/
|
*/
|
||||||
getLocaleName:function(successCB, failureCB) {
|
getLocaleName:function(successCB, failureCB) {
|
||||||
// successCallback required
|
argscheck.checkArgs('fF', 'Globalization.getLocaleName', arguments);
|
||||||
if (typeof successCB != "function") {
|
|
||||||
console.log("Globalization.getLocaleName Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.getLocaleName Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
exec(successCB, failureCB, "Globalization","getLocaleName", []);
|
exec(successCB, failureCB, "Globalization","getLocaleName", []);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -5320,27 +5395,9 @@ getLocaleName:function(successCB, failureCB) {
|
|||||||
* {formatLength:'short'});
|
* {formatLength:'short'});
|
||||||
*/
|
*/
|
||||||
dateToString:function(date, successCB, failureCB, options) {
|
dateToString:function(date, successCB, failureCB, options) {
|
||||||
// successCallback required
|
argscheck.checkArgs('dfFO', 'Globalization.dateToString', arguments);
|
||||||
if (typeof successCB != "function") {
|
var dateValue = date.valueOf();
|
||||||
console.log("Globalization.dateToString Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.dateToString Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (date instanceof Date){
|
|
||||||
var dateValue;
|
|
||||||
dateValue = date.valueOf();
|
|
||||||
exec(successCB, failureCB, "Globalization", "dateToString", [{"date": dateValue, "options": options}]);
|
exec(successCB, failureCB, "Globalization", "dateToString", [{"date": dateValue, "options": options}]);
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log("Globalization.dateToString Error: date is not a Date object");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@ -5380,23 +5437,8 @@ dateToString:function(date, successCB, failureCB, options) {
|
|||||||
* {selector:'date'});
|
* {selector:'date'});
|
||||||
*/
|
*/
|
||||||
stringToDate:function(dateString, successCB, failureCB, options) {
|
stringToDate:function(dateString, successCB, failureCB, options) {
|
||||||
// successCallback required
|
argscheck.checkArgs('sfFO', 'Globalization.stringToDate', arguments);
|
||||||
if (typeof successCB != "function") {
|
|
||||||
console.log("Globalization.stringToDate Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.stringToDate Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (typeof dateString == "string"){
|
|
||||||
exec(successCB, failureCB, "Globalization", "stringToDate", [{"dateString": dateString, "options": options}]);
|
exec(successCB, failureCB, "Globalization", "stringToDate", [{"dateString": dateString, "options": options}]);
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log("Globalization.stringToDate Error: dateString is not a string");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@ -5433,18 +5475,7 @@ stringToDate:function(dateString, successCB, failureCB, options) {
|
|||||||
* {formatLength:'short'});
|
* {formatLength:'short'});
|
||||||
*/
|
*/
|
||||||
getDatePattern:function(successCB, failureCB, options) {
|
getDatePattern:function(successCB, failureCB, options) {
|
||||||
// successCallback required
|
argscheck.checkArgs('fFO', 'Globalization.getDatePattern', arguments);
|
||||||
if (typeof successCB != "function") {
|
|
||||||
console.log("Globalization.getDatePattern Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.getDatePattern Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
exec(successCB, failureCB, "Globalization", "getDatePattern", [{"options": options}]);
|
exec(successCB, failureCB, "Globalization", "getDatePattern", [{"options": options}]);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -5475,17 +5506,7 @@ getDatePattern:function(successCB, failureCB, options) {
|
|||||||
* function () {});
|
* function () {});
|
||||||
*/
|
*/
|
||||||
getDateNames:function(successCB, failureCB, options) {
|
getDateNames:function(successCB, failureCB, options) {
|
||||||
// successCallback required
|
argscheck.checkArgs('fFO', 'Globalization.getDateNames', arguments);
|
||||||
if (typeof successCB != "function") {
|
|
||||||
console.log("Globalization.getDateNames Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.getDateNames Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
exec(successCB, failureCB, "Globalization", "getDateNames", [{"options": options}]);
|
exec(successCB, failureCB, "Globalization", "getDateNames", [{"options": options}]);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -5510,28 +5531,9 @@ getDateNames:function(successCB, failureCB, options) {
|
|||||||
* function () {});
|
* function () {});
|
||||||
*/
|
*/
|
||||||
isDayLightSavingsTime:function(date, successCB, failureCB) {
|
isDayLightSavingsTime:function(date, successCB, failureCB) {
|
||||||
// successCallback required
|
argscheck.checkArgs('dfF', 'Globalization.isDayLightSavingsTime', arguments);
|
||||||
if (typeof successCB != "function") {
|
var dateValue = date.valueOf();
|
||||||
console.log("Globalization.isDayLightSavingsTime Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.isDayLightSavingsTime Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (date instanceof Date){
|
|
||||||
var dateValue;
|
|
||||||
dateValue = date.valueOf();
|
|
||||||
exec(successCB, failureCB, "Globalization", "isDayLightSavingsTime", [{"date": dateValue}]);
|
exec(successCB, failureCB, "Globalization", "isDayLightSavingsTime", [{"date": dateValue}]);
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log("Globalization.isDayLightSavingsTime Error: date is not a Date object");
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -5553,18 +5555,7 @@ isDayLightSavingsTime:function(date, successCB, failureCB) {
|
|||||||
* function () {});
|
* function () {});
|
||||||
*/
|
*/
|
||||||
getFirstDayOfWeek:function(successCB, failureCB) {
|
getFirstDayOfWeek:function(successCB, failureCB) {
|
||||||
// successCallback required
|
argscheck.checkArgs('fF', 'Globalization.getFirstDayOfWeek', arguments);
|
||||||
if (typeof successCB != "function") {
|
|
||||||
console.log("Globalization.getFirstDayOfWeek Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.getFirstDayOfWeek Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
exec(successCB, failureCB, "Globalization", "getFirstDayOfWeek", []);
|
exec(successCB, failureCB, "Globalization", "getFirstDayOfWeek", []);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -5593,24 +5584,8 @@ getFirstDayOfWeek:function(successCB, failureCB) {
|
|||||||
* {type:'decimal'});
|
* {type:'decimal'});
|
||||||
*/
|
*/
|
||||||
numberToString:function(number, successCB, failureCB, options) {
|
numberToString:function(number, successCB, failureCB, options) {
|
||||||
// successCallback required
|
argscheck.checkArgs('nfFO', 'Globalization.numberToString', arguments);
|
||||||
if (typeof successCB != "function") {
|
|
||||||
console.log("Globalization.numberToString Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.numberToString Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof number == "number") {
|
|
||||||
exec(successCB, failureCB, "Globalization", "numberToString", [{"number": number, "options": options}]);
|
exec(successCB, failureCB, "Globalization", "numberToString", [{"number": number, "options": options}]);
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log("Globalization.numberToString Error: number is not a number");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -5637,24 +5612,8 @@ numberToString:function(number, successCB, failureCB, options) {
|
|||||||
* function () { alert('Error parsing number');});
|
* function () { alert('Error parsing number');});
|
||||||
*/
|
*/
|
||||||
stringToNumber:function(numberString, successCB, failureCB, options) {
|
stringToNumber:function(numberString, successCB, failureCB, options) {
|
||||||
// successCallback required
|
argscheck.checkArgs('sfFO', 'Globalization.stringToNumber', arguments);
|
||||||
if (typeof successCB != "function") {
|
|
||||||
console.log("Globalization.stringToNumber Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.stringToNumber Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof numberString == "string") {
|
|
||||||
exec(successCB, failureCB, "Globalization", "stringToNumber", [{"numberString": numberString, "options": options}]);
|
exec(successCB, failureCB, "Globalization", "stringToNumber", [{"numberString": numberString, "options": options}]);
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log("Globalization.stringToNumber Error: numberString is not a string");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -5690,18 +5649,7 @@ stringToNumber:function(numberString, successCB, failureCB, options) {
|
|||||||
* function () {});
|
* function () {});
|
||||||
*/
|
*/
|
||||||
getNumberPattern:function(successCB, failureCB, options) {
|
getNumberPattern:function(successCB, failureCB, options) {
|
||||||
// successCallback required
|
argscheck.checkArgs('fFO', 'Globalization.getNumberPattern', arguments);
|
||||||
if (typeof successCB != "function") {
|
|
||||||
console.log("Globalization.getNumberPattern Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.getNumberPattern Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
exec(successCB, failureCB, "Globalization", "getNumberPattern", [{"options": options}]);
|
exec(successCB, failureCB, "Globalization", "getNumberPattern", [{"options": options}]);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -5733,25 +5681,9 @@ getNumberPattern:function(successCB, failureCB, options) {
|
|||||||
* function () {});
|
* function () {});
|
||||||
*/
|
*/
|
||||||
getCurrencyPattern:function(currencyCode, successCB, failureCB) {
|
getCurrencyPattern:function(currencyCode, successCB, failureCB) {
|
||||||
// successCallback required
|
argscheck.checkArgs('sfF', 'Globalization.getCurrencyPattern', arguments);
|
||||||
if (typeof successCB != "function") {
|
|
||||||
console.log("Globalization.getCurrencyPattern Error: successCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// errorCallback required
|
|
||||||
if (typeof failureCB != "function") {
|
|
||||||
console.log("Globalization.getCurrencyPattern Error: failureCB is not a function");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof currencyCode == "string") {
|
|
||||||
exec(successCB, failureCB, "Globalization", "getCurrencyPattern", [{"currencyCode": currencyCode}]);
|
exec(successCB, failureCB, "Globalization", "getCurrencyPattern", [{"currencyCode": currencyCode}]);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
console.log("Globalization.getCurrencyPattern Error: currencyCode is not a currency code");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -6004,49 +5936,9 @@ if (typeof navigator != 'undefined') {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var NetworkConnection = function () {
|
function NetworkConnection() {
|
||||||
this.type = null;
|
this.type = 'unknown';
|
||||||
this._firstRun = true;
|
|
||||||
this._timer = null;
|
|
||||||
this.timeout = 500;
|
|
||||||
|
|
||||||
var me = this;
|
|
||||||
|
|
||||||
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
|
|
||||||
me._timer = setTimeout(function(){
|
|
||||||
cordova.fireDocumentEvent("offline");
|
|
||||||
me._timer = null;
|
|
||||||
}, me.timeout);
|
|
||||||
} else {
|
|
||||||
// If there is a current offline event pending clear it
|
|
||||||
if (me._timer !== null) {
|
|
||||||
clearTimeout(me._timer);
|
|
||||||
me._timer = null;
|
|
||||||
}
|
}
|
||||||
cordova.fireDocumentEvent("online");
|
|
||||||
}
|
|
||||||
|
|
||||||
// should only fire this once
|
|
||||||
if (me._firstRun) {
|
|
||||||
me._firstRun = false;
|
|
||||||
channel.onCordovaConnectionReady.fire();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
function (e) {
|
|
||||||
// If we can't get the network info we should still tell Cordova
|
|
||||||
// to fire the deviceready event.
|
|
||||||
if (me._firstRun) {
|
|
||||||
me._firstRun = false;
|
|
||||||
channel.onCordovaConnectionReady.fire();
|
|
||||||
}
|
|
||||||
console.log("Error initializing Network Connection: " + e);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get connection info
|
* Get connection info
|
||||||
@ -6055,11 +5947,47 @@ var NetworkConnection = function () {
|
|||||||
* @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL)
|
* @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL)
|
||||||
*/
|
*/
|
||||||
NetworkConnection.prototype.getInfo = function(successCallback, errorCallback) {
|
NetworkConnection.prototype.getInfo = function(successCallback, errorCallback) {
|
||||||
// Get info
|
|
||||||
exec(successCallback, errorCallback, "NetworkStatus", "getConnectionInfo", []);
|
exec(successCallback, errorCallback, "NetworkStatus", "getConnectionInfo", []);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = new NetworkConnection();
|
var me = new NetworkConnection();
|
||||||
|
var timerId = null;
|
||||||
|
var timeout = 500;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -6128,7 +6056,8 @@ module.exports = {
|
|||||||
// file: lib/common/plugin/requestFileSystem.js
|
// file: lib/common/plugin/requestFileSystem.js
|
||||||
define("cordova/plugin/requestFileSystem", function(require, exports, module) {
|
define("cordova/plugin/requestFileSystem", function(require, exports, module) {
|
||||||
|
|
||||||
var FileError = require('cordova/plugin/FileError'),
|
var argscheck = require('cordova/argscheck'),
|
||||||
|
FileError = require('cordova/plugin/FileError'),
|
||||||
FileSystem = require('cordova/plugin/FileSystem'),
|
FileSystem = require('cordova/plugin/FileSystem'),
|
||||||
exec = require('cordova/exec');
|
exec = require('cordova/exec');
|
||||||
|
|
||||||
@ -6140,10 +6069,9 @@ var FileError = require('cordova/plugin/FileError'),
|
|||||||
* @param errorCallback invoked if error occurs retrieving file system
|
* @param errorCallback invoked if error occurs retrieving file system
|
||||||
*/
|
*/
|
||||||
var requestFileSystem = function(type, size, successCallback, errorCallback) {
|
var requestFileSystem = function(type, size, successCallback, errorCallback) {
|
||||||
|
argscheck.checkArgs('nnFF', 'requestFileSystem', arguments);
|
||||||
var fail = function(code) {
|
var fail = function(code) {
|
||||||
if (typeof errorCallback === 'function') {
|
errorCallback && errorCallback(new FileError(code));
|
||||||
errorCallback(new FileError(code));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (type < 0 || type > 3) {
|
if (type < 0 || type > 3) {
|
||||||
@ -6152,7 +6080,7 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) {
|
|||||||
// if successful, return a FileSystem object
|
// if successful, return a FileSystem object
|
||||||
var success = function(file_system) {
|
var success = function(file_system) {
|
||||||
if (file_system) {
|
if (file_system) {
|
||||||
if (typeof successCallback === 'function') {
|
if (successCallback) {
|
||||||
// grab the name and root from the file system object
|
// grab the name and root from the file system object
|
||||||
var result = new FileSystem(file_system.name, file_system.root);
|
var result = new FileSystem(file_system.name, file_system.root);
|
||||||
successCallback(result);
|
successCallback(result);
|
||||||
@ -6174,7 +6102,8 @@ module.exports = requestFileSystem;
|
|||||||
// file: lib/common/plugin/resolveLocalFileSystemURI.js
|
// file: lib/common/plugin/resolveLocalFileSystemURI.js
|
||||||
define("cordova/plugin/resolveLocalFileSystemURI", function(require, exports, module) {
|
define("cordova/plugin/resolveLocalFileSystemURI", function(require, exports, module) {
|
||||||
|
|
||||||
var DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
|
var argscheck = require('cordova/argscheck'),
|
||||||
|
DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
|
||||||
FileEntry = require('cordova/plugin/FileEntry'),
|
FileEntry = require('cordova/plugin/FileEntry'),
|
||||||
FileError = require('cordova/plugin/FileError'),
|
FileError = require('cordova/plugin/FileError'),
|
||||||
exec = require('cordova/exec');
|
exec = require('cordova/exec');
|
||||||
@ -6186,11 +6115,10 @@ var DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
|
|||||||
* @param errorCallback invoked if error occurs retrieving file system entry
|
* @param errorCallback invoked if error occurs retrieving file system entry
|
||||||
*/
|
*/
|
||||||
module.exports = function(uri, successCallback, errorCallback) {
|
module.exports = function(uri, successCallback, errorCallback) {
|
||||||
|
argscheck.checkArgs('sFF', 'resolveLocalFileSystemURI', arguments);
|
||||||
// error callback
|
// error callback
|
||||||
var fail = function(error) {
|
var fail = function(error) {
|
||||||
if (typeof errorCallback === 'function') {
|
errorCallback && errorCallback(new FileError(error));
|
||||||
errorCallback(new FileError(error));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
// sanity check for 'not:valid:filename'
|
// sanity check for 'not:valid:filename'
|
||||||
if(!uri || uri.split(":").length > 2) {
|
if(!uri || uri.split(":").length > 2) {
|
||||||
@ -6203,16 +6131,11 @@ module.exports = function(uri, successCallback, errorCallback) {
|
|||||||
var success = function(entry) {
|
var success = function(entry) {
|
||||||
var result;
|
var result;
|
||||||
if (entry) {
|
if (entry) {
|
||||||
if (typeof successCallback === 'function') {
|
if (successCallback) {
|
||||||
// create appropriate Entry object
|
// create appropriate Entry object
|
||||||
result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath);
|
result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath);
|
||||||
try {
|
|
||||||
successCallback(result);
|
successCallback(result);
|
||||||
}
|
}
|
||||||
catch (e) {
|
|
||||||
console.log('Error invoking callback: ' + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// no Entry object returned
|
// no Entry object returned
|
||||||
@ -6259,6 +6182,30 @@ utils.defineGetter = function(obj, key, func) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
utils.arrayIndexOf = function(a, item) {
|
||||||
|
if (a.indexOf) {
|
||||||
|
return a.indexOf(item);
|
||||||
|
}
|
||||||
|
var len = a.length;
|
||||||
|
for (var i = 0; i < len; ++i) {
|
||||||
|
if (a[i] == item) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the item was found in the array.
|
||||||
|
*/
|
||||||
|
utils.arrayRemove = function(a, item) {
|
||||||
|
var index = utils.arrayIndexOf(a, item);
|
||||||
|
if (index != -1) {
|
||||||
|
a.splice(index, 1);
|
||||||
|
}
|
||||||
|
return index != -1;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an indication of whether the argument is an array or not
|
* Returns an indication of whether the argument is an array or not
|
||||||
*/
|
*/
|
||||||
@ -6454,10 +6401,10 @@ window.cordova = require('cordova');
|
|||||||
(function (context) {
|
(function (context) {
|
||||||
// Replace navigator before any modules are required(), to ensure it happens as soon as possible.
|
// 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.
|
// We replace it so that properties that can't be clobbered can instead be overridden.
|
||||||
if (typeof navigator != 'undefined') {
|
if (context.navigator) {
|
||||||
var CordovaNavigator = function () {};
|
function CordovaNavigator() {}
|
||||||
CordovaNavigator.prototype = navigator;
|
CordovaNavigator.prototype = context.navigator;
|
||||||
navigator = new CordovaNavigator();
|
context.navigator = new CordovaNavigator();
|
||||||
}
|
}
|
||||||
|
|
||||||
var channel = require("cordova/channel"),
|
var channel = require("cordova/channel"),
|
||||||
@ -6472,17 +6419,13 @@ window.cordova = require('cordova');
|
|||||||
platform = require('cordova/platform');
|
platform = require('cordova/platform');
|
||||||
|
|
||||||
// Drop the common globals into the window object, but be nice and don't overwrite anything.
|
// Drop the common globals into the window object, but be nice and don't overwrite anything.
|
||||||
builder.build(base.objects).intoButDoNotClobber(window);
|
builder.buildIntoButDoNotClobber(base.defaults, context);
|
||||||
|
builder.buildIntoAndMerge(base.merges, context);
|
||||||
|
builder.buildIntoAndClobber(base.clobbers, context);
|
||||||
|
|
||||||
// Drop the platform-specific globals into the window object
|
builder.buildIntoButDoNotClobber(platform.defaults, context);
|
||||||
// and clobber any existing object.
|
builder.buildIntoAndMerge(platform.merges, context);
|
||||||
builder.build(platform.objects).intoAndClobber(window);
|
builder.buildIntoAndClobber(platform.clobbers, context);
|
||||||
|
|
||||||
// Merge the platform-specific overrides/enhancements into
|
|
||||||
// the window object.
|
|
||||||
if (typeof platform.merges !== 'undefined') {
|
|
||||||
builder.build(platform.merges).intoAndMerge(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call the platform-specific initialization
|
// Call the platform-specific initialization
|
||||||
platform.initialize();
|
platform.initialize();
|
||||||
|
Loading…
Reference in New Issue
Block a user