aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xAndroid/libs/cordova-2.5.0.jarbin0 -> 240800 bytes
-rwxr-xr-xAndroid/res/xml/config.xml2
-rwxr-xr-xwww/cordova-android-2.5.0.js (renamed from www/cordova-android-2.2.0.js)2073
-rw-r--r--www/cordova-independent.js2
4 files changed, 1012 insertions, 1065 deletions
diff --git a/Android/libs/cordova-2.5.0.jar b/Android/libs/cordova-2.5.0.jar
new file mode 100755
index 0000000..1c3b9f0
--- /dev/null
+++ b/Android/libs/cordova-2.5.0.jar
Binary files differ
diff --git a/Android/res/xml/config.xml b/Android/res/xml/config.xml
index da9c1f4..8cfd376 100755
--- a/Android/res/xml/config.xml
+++ b/Android/res/xml/config.xml
@@ -29,6 +29,8 @@
<!-- <access origin="https://example.com" subdomains="true" /> such as above, but including subdomains, such as www -->
<access origin=".*"/>
+ <content src="index.html"/>
+
<log level="DEBUG"/>
<preference name="useBrowserHistory" value="true" />
<preference name="exit-on-suspend" value="false" />
diff --git a/www/cordova-android-2.2.0.js b/www/cordova-android-2.5.0.js
index 9f8f783..e4b9ea2 100755
--- a/www/cordova-android-2.2.0.js
+++ b/www/cordova-android-2.5.0.js
@@ -1,6 +1,8 @@
-// commit 02b91c5313ff37d74a58f71775170afd360f4a1f
+// Platform: android
-// File generated at :: Wed Oct 31 2012 10:40:25 GMT-0700 (PDT)
+// commit f50d20a87431c79a54572263729461883f611a53
+
+// File generated at :: Tue Feb 26 2013 13:37:51 GMT-0800 (PST)
/*
Licensed to the Apache Software Foundation (ASF) under one
@@ -78,6 +80,7 @@ var require,
delete modules[id];
};
+ define.moduleMap = modules;
})();
//Export for use in node
@@ -316,6 +319,72 @@ module.exports = cordova;
});
+// file: lib/common/argscheck.js
+define("cordova/argscheck", function(require, exports, module) {
+
+var exec = require('cordova/exec');
+var utils = require('cordova/utils');
+
+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 typeName;
+ 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;
+ }
+ typeName = utils.typeName(arg);
+ if ((arg === null || arg === undefined) && c == cUpper) {
+ continue;
+ }
+ if (typeName != typeMap[cUpper]) {
+ errMsg = 'Expected ' + typeMap[cUpper];
+ break;
+ }
+ }
+ if (errMsg) {
+ errMsg += ', but got ' + typeName + '.';
+ 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);
+ }
+}
+
+function getValue(value, defaultValue) {
+ return value === undefined ? defaultValue : value;
+}
+
+moduleExports.checkArgs = checkArgs;
+moduleExports.getValue = getValue;
+moduleExports.enableChecks = true;
+
+
+});
+
// file: lib/common/builder.js
define("cordova/builder", function(require, exports, module) {
@@ -329,14 +398,27 @@ function each(objects, func, context) {
}
}
+function clobber(obj, key, value) {
+ exports.replaceHookForTesting(obj, key);
+ 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) {
if (message) {
utils.defineGetter(obj, key, function() {
- window.console && console.log(message);
+ console.log(message);
+ delete obj[key];
+ clobber(obj, key, value);
return value;
});
} else {
- obj[key] = value;
+ clobber(obj, key, value);
}
}
@@ -362,10 +444,6 @@ function include(parent, objects, clobber, merge) {
// Overwrite if not currently defined.
if (typeof parent[key] == 'undefined') {
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
- } else if (merge && typeof obj.path !== 'undefined') {
- // If merging, merge parent onto result
- recursiveMerge(result, parent[key]);
- parent[key] = result;
} else {
// Set result to what already exists, so we can build children into it if they exist.
result = parent[key];
@@ -391,33 +469,32 @@ function include(parent, objects, clobber, merge) {
function recursiveMerge(target, src) {
for (var prop in src) {
if (src.hasOwnProperty(prop)) {
- if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) {
+ if (target.prototype && target.prototype.constructor === target) {
// If the target object is a constructor override off prototype.
- target.prototype[prop] = src[prop];
+ clobber(target.prototype, prop, src[prop]);
} else {
- target[prop] = typeof src[prop] === 'object' ? recursiveMerge(
- target[prop], src[prop]) : src[prop];
+ if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
+ recursiveMerge(target[prop], src[prop]);
+ } else {
+ clobber(target, prop, src[prop]);
+ }
}
}
}
- return target;
}
-module.exports = {
- build: function (objects) {
- return {
- intoButDoNotClobber: function (target) {
- include(target, objects, false, false);
- },
- intoAndClobber: function(target) {
- include(target, objects, true, false);
- },
- intoAndMerge: function(target) {
- include(target, objects, true, true);
- }
- };
- }
+exports.buildIntoButDoNotClobber = function(objects, target) {
+ include(target, objects, false, false);
+};
+exports.buildIntoAndClobber = function(objects, target) {
+ include(target, objects, true, false);
+};
+exports.buildIntoAndMerge = function(objects, target) {
+ include(target, objects, true, true);
};
+exports.recursiveMerge = recursiveMerge;
+exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter;
+exports.replaceHookForTesting = function() {};
});
@@ -697,221 +774,6 @@ module.exports = {
};
});
-// file: lib/common/common.js
-define("cordova/common", function(require, exports, module) {
-
-module.exports = {
- objects: {
- cordova: {
- path: 'cordova',
- children: {
- exec: {
- path: 'cordova/exec'
- },
- logger: {
- path: 'cordova/plugin/logger'
- }
- }
- },
- Cordova: {
- children: {
- exec: {
- path: 'cordova/exec'
- }
- }
- },
- navigator: {
- children: {
- notification: {
- path: 'cordova/plugin/notification'
- },
- accelerometer: {
- path: 'cordova/plugin/accelerometer'
- },
- battery: {
- path: 'cordova/plugin/battery'
- },
- camera:{
- path: 'cordova/plugin/Camera'
- },
- compass:{
- path: 'cordova/plugin/compass'
- },
- connection: {
- path: 'cordova/plugin/network'
- },
- contacts: {
- path: 'cordova/plugin/contacts'
- },
- device:{
- children:{
- capture: {
- path: 'cordova/plugin/capture'
- }
- }
- },
- geolocation: {
- path: 'cordova/plugin/geolocation'
- },
- globalization: {
- path: 'cordova/plugin/globalization'
- },
- network: {
- children: {
- connection: {
- path: 'cordova/plugin/network',
- deprecated: 'navigator.network.connection is deprecated. Use navigator.connection instead.'
- }
- }
- },
- splashscreen: {
- path: 'cordova/plugin/splashscreen'
- }
- }
- },
- Acceleration: {
- path: 'cordova/plugin/Acceleration'
- },
- Camera:{
- path: 'cordova/plugin/CameraConstants'
- },
- CameraPopoverOptions: {
- path: 'cordova/plugin/CameraPopoverOptions'
- },
- CaptureError: {
- path: 'cordova/plugin/CaptureError'
- },
- CaptureAudioOptions:{
- path: 'cordova/plugin/CaptureAudioOptions'
- },
- CaptureImageOptions: {
- path: 'cordova/plugin/CaptureImageOptions'
- },
- CaptureVideoOptions: {
- path: 'cordova/plugin/CaptureVideoOptions'
- },
- CompassHeading:{
- path: 'cordova/plugin/CompassHeading'
- },
- CompassError:{
- path: 'cordova/plugin/CompassError'
- },
- ConfigurationData: {
- path: 'cordova/plugin/ConfigurationData'
- },
- Connection: {
- path: 'cordova/plugin/Connection'
- },
- Contact: {
- path: 'cordova/plugin/Contact'
- },
- ContactAddress: {
- path: 'cordova/plugin/ContactAddress'
- },
- ContactError: {
- path: 'cordova/plugin/ContactError'
- },
- ContactField: {
- path: 'cordova/plugin/ContactField'
- },
- ContactFindOptions: {
- path: 'cordova/plugin/ContactFindOptions'
- },
- ContactName: {
- path: 'cordova/plugin/ContactName'
- },
- ContactOrganization: {
- path: 'cordova/plugin/ContactOrganization'
- },
- Coordinates: {
- path: 'cordova/plugin/Coordinates'
- },
- device: {
- path: 'cordova/plugin/device'
- },
- DirectoryEntry: {
- path: 'cordova/plugin/DirectoryEntry'
- },
- DirectoryReader: {
- path: 'cordova/plugin/DirectoryReader'
- },
- Entry: {
- path: 'cordova/plugin/Entry'
- },
- File: {
- path: 'cordova/plugin/File'
- },
- FileEntry: {
- path: 'cordova/plugin/FileEntry'
- },
- FileError: {
- path: 'cordova/plugin/FileError'
- },
- FileReader: {
- path: 'cordova/plugin/FileReader'
- },
- FileSystem: {
- path: 'cordova/plugin/FileSystem'
- },
- FileTransfer: {
- path: 'cordova/plugin/FileTransfer'
- },
- FileTransferError: {
- path: 'cordova/plugin/FileTransferError'
- },
- FileUploadOptions: {
- path: 'cordova/plugin/FileUploadOptions'
- },
- FileUploadResult: {
- path: 'cordova/plugin/FileUploadResult'
- },
- FileWriter: {
- path: 'cordova/plugin/FileWriter'
- },
- Flags: {
- path: 'cordova/plugin/Flags'
- },
- GlobalizationError: {
- path: 'cordova/plugin/GlobalizationError'
- },
- LocalFileSystem: {
- path: 'cordova/plugin/LocalFileSystem'
- },
- Media: {
- path: 'cordova/plugin/Media'
- },
- MediaError: {
- path: 'cordova/plugin/MediaError'
- },
- MediaFile: {
- path: 'cordova/plugin/MediaFile'
- },
- MediaFileData:{
- path: 'cordova/plugin/MediaFileData'
- },
- Metadata:{
- path: 'cordova/plugin/Metadata'
- },
- Position: {
- path: 'cordova/plugin/Position'
- },
- PositionError: {
- path: 'cordova/plugin/PositionError'
- },
- ProgressEvent: {
- path: 'cordova/plugin/ProgressEvent'
- },
- requestFileSystem:{
- path: 'cordova/plugin/requestFileSystem'
- },
- resolveLocalFileSystemURI:{
- path: 'cordova/plugin/resolveLocalFileSystemURI'
- }
- }
-};
-
-});
-
// file: lib/android/exec.js
define("cordova/exec", function(require, exports, module) {
@@ -931,6 +793,7 @@ define("cordova/exec", function(require, exports, module) {
*/
var cordova = require('cordova'),
nativeApiProvider = require('cordova/plugin/android/nativeapiprovider'),
+ utils = require('cordova/utils'),
jsToNativeModes = {
PROMPT: 0,
JS_OBJECT: 1,
@@ -961,10 +824,18 @@ var cordova = require('cordova'),
function androidExec(success, fail, service, action, args) {
// 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) {
androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
}
+ // Process any ArrayBuffers in the args into a string.
+ for (var i = 0; i < args.length; i++) {
+ if (utils.typeName(args[i]) == 'ArrayBuffer') {
+ args[i] = window.btoa(String.fromCharCode.apply(null, new Uint8Array(args[i])));
+ }
+ }
+
var callbackId = service + cordova.callbackId++,
argsJson = JSON.stringify(args),
returnValue;
@@ -1079,6 +950,14 @@ function processMessage(message) {
payload = null;
} else if (payloadKind == 'n') {
payload = +message.slice(nextSpaceIdx + 2);
+ } else if (payloadKind == 'A') {
+ var data = message.slice(nextSpaceIdx + 2);
+ var bytes = window.atob(data);
+ var arraybuffer = new Uint8Array(bytes.length);
+ for (var i = 0; i < bytes.length; i++) {
+ arraybuffer[i] = bytes.charCodeAt(i);
+ }
+ payload = arraybuffer.buffer;
} else {
payload = JSON.parse(message.slice(nextSpaceIdx + 1));
}
@@ -1130,6 +1009,107 @@ module.exports = androidExec;
});
+// file: lib/common/modulemapper.js
+define("cordova/modulemapper", function(require, exports, module) {
+
+var builder = require('cordova/builder'),
+ moduleMap = define.moduleMap,
+ symbolList,
+ deprecationMap;
+
+exports.reset = function() {
+ symbolList = [];
+ deprecationMap = {};
+};
+
+function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) {
+ if (!(moduleName in moduleMap)) {
+ throw new Error('Module ' + moduleName + ' does not exist.');
+ }
+ 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);
+};
+
+function prepareNamespace(symbolPath, context) {
+ if (!symbolPath) {
+ return context;
+ }
+ var parts = symbolPath.split('.');
+ var cur = context;
+ for (var i = 0, part; part = parts[i]; ++i) {
+ 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 symbolPath = symbolList[i + 2];
+ var lastDot = symbolPath.lastIndexOf('.');
+ var namespace = symbolPath.substr(0, lastDot);
+ var lastName = symbolPath.substr(lastDot + 1);
+
+ var module = require(moduleName);
+ 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.loadMatchingModules = function(matchingRegExp) {
+ for (var k in moduleMap) {
+ if (matchingRegExp.exec(k)) {
+ require(k);
+ }
+ }
+};
+
+exports.reset();
+
+
+});
+
// file: lib/android/platform.js
define("cordova/platform", function(require, exports, module) {
@@ -1138,7 +1118,13 @@ module.exports = {
initialize:function() {
var channel = require("cordova/channel"),
cordova = require('cordova'),
- exec = require('cordova/exec');
+ exec = require('cordova/exec'),
+ modulemapper = require('cordova/modulemapper');
+
+ modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
+ modulemapper.clobbers('cordova/plugin/android/app', 'navigator.app');
+
+ modulemapper.mapModules(window);
// Inject a listener for the backbutton on the document.
var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
@@ -1152,85 +1138,11 @@ module.exports = {
cordova.addDocumentEventHandler('menubutton');
cordova.addDocumentEventHandler('searchbutton');
- // Figure out if we need to shim-in localStorage and WebSQL
- // support from the native side.
- var storage = require('cordova/plugin/android/storage');
-
- // First patch WebSQL if necessary
- if (typeof window.openDatabase == 'undefined') {
- // Not defined, create an openDatabase function for all to use!
- window.openDatabase = storage.openDatabase;
- } else {
- // Defined, but some Android devices will throw a SECURITY_ERR -
- // so we wrap the whole thing in a try-catch and shim in our own
- // if the device has Android bug 16175.
- var originalOpenDatabase = window.openDatabase;
- window.openDatabase = function(name, version, desc, size) {
- var db = null;
- try {
- db = originalOpenDatabase(name, version, desc, size);
- }
- catch (ex) {
- if (ex.code === 18) {
- db = null;
- } else {
- throw ex;
- }
- }
-
- if (db === null) {
- return storage.openDatabase(name, version, desc, size);
- }
- else {
- return db;
- }
-
- };
- }
-
- // Patch localStorage if necessary
- if (typeof window.localStorage == 'undefined' || window.localStorage === null) {
- window.localStorage = new storage.CupcakeLocalStorage();
- }
-
// Let native code know we are all done on the JS side.
// Native code will then un-hide the WebView.
channel.join(function() {
exec(null, null, "App", "show", []);
}, [channel.onCordovaReady]);
- },
- objects: {
- navigator: {
- children: {
- app:{
- path: "cordova/plugin/android/app"
- }
- }
- },
- File: { // exists natively on Android WebView, override
- path: "cordova/plugin/File"
- },
- FileReader: { // exists natively on Android WebView, override
- path: "cordova/plugin/FileReader"
- },
- FileError: { //exists natively on Android WebView on Android 4.x
- path: "cordova/plugin/FileError"
- },
- MediaError: { // exists natively on Android WebView on Android 4.x
- path: "cordova/plugin/MediaError"
- }
- },
- merges: {
- device: {
- path: 'cordova/plugin/android/device'
- },
- navigator: {
- children: {
- notification: {
- path: 'cordova/plugin/android/notification'
- }
- }
- }
}
};
@@ -1253,8 +1165,10 @@ module.exports = Acceleration;
// file: lib/common/plugin/Camera.js
define("cordova/plugin/Camera", function(require, exports, module) {
-var exec = require('cordova/exec'),
- Camera = require('cordova/plugin/CameraConstants');
+var argscheck = require('cordova/argscheck'),
+ exec = require('cordova/exec'),
+ Camera = require('cordova/plugin/CameraConstants'),
+ CameraPopoverHandle = require('cordova/plugin/CameraPopoverHandle');
var cameraExport = {};
@@ -1274,95 +1188,27 @@ for (var key in Camera) {
* @param {Object} options
*/
cameraExport.getPicture = function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'Camera.getPicture', arguments);
options = options || {};
- // successCallback required
- if (typeof successCallback != "function") {
- console.log("Camera Error: successCallback is not a function");
- return;
- }
-
- // errorCallback optional
- if (errorCallback && (typeof errorCallback != "function")) {
- console.log("Camera Error: errorCallback is not a function");
- return;
- }
-
- var quality = 50;
- if (typeof options.quality == "number") {
- quality = options.quality;
- } else if (typeof options.quality == "string") {
- var qlity = parseInt(options.quality, 10);
- if (isNaN(qlity) === false) {
- quality = qlity.valueOf();
- }
- }
-
- var destinationType = Camera.DestinationType.FILE_URI;
- if (typeof options.destinationType == "number") {
- destinationType = options.destinationType;
- }
-
- var sourceType = Camera.PictureSourceType.CAMERA;
- if (typeof options.sourceType == "number") {
- sourceType = options.sourceType;
- }
-
- var targetWidth = -1;
- if (typeof options.targetWidth == "number") {
- targetWidth = options.targetWidth;
- } else if (typeof options.targetWidth == "string") {
- var width = parseInt(options.targetWidth, 10);
- if (isNaN(width) === false) {
- targetWidth = width.valueOf();
- }
- }
-
- var targetHeight = -1;
- if (typeof options.targetHeight == "number") {
- targetHeight = options.targetHeight;
- } else if (typeof options.targetHeight == "string") {
- var height = parseInt(options.targetHeight, 10);
- if (isNaN(height) === false) {
- targetHeight = height.valueOf();
- }
- }
-
- var encodingType = Camera.EncodingType.JPEG;
- if (typeof options.encodingType == "number") {
- encodingType = options.encodingType;
- }
-
- var mediaType = Camera.MediaType.PICTURE;
- if (typeof options.mediaType == "number") {
- mediaType = options.mediaType;
- }
- var allowEdit = false;
- if (typeof options.allowEdit == "boolean") {
- allowEdit = options.allowEdit;
- } else if (typeof options.allowEdit == "number") {
- allowEdit = options.allowEdit <= 0 ? false : true;
- }
- var correctOrientation = false;
- if (typeof options.correctOrientation == "boolean") {
- correctOrientation = options.correctOrientation;
- } else if (typeof options.correctOrientation == "number") {
- correctOrientation = options.correctOrientation <=0 ? false : true;
- }
- var saveToPhotoAlbum = false;
- if (typeof options.saveToPhotoAlbum == "boolean") {
- saveToPhotoAlbum = options.saveToPhotoAlbum;
- } else if (typeof options.saveToPhotoAlbum == "number") {
- saveToPhotoAlbum = options.saveToPhotoAlbum <=0 ? false : true;
- }
- var popoverOptions = null;
- if (typeof options.popoverOptions == "object") {
- popoverOptions = options.popoverOptions;
- }
+ var getValue = argscheck.getValue;
+
+ var quality = getValue(options.quality, 50);
+ var destinationType = getValue(options.destinationType, Camera.DestinationType.FILE_URI);
+ var sourceType = getValue(options.sourceType, Camera.PictureSourceType.CAMERA);
+ var targetWidth = getValue(options.targetWidth, -1);
+ var targetHeight = getValue(options.targetHeight, -1);
+ var encodingType = getValue(options.encodingType, Camera.EncodingType.JPEG);
+ var mediaType = getValue(options.mediaType, Camera.MediaType.PICTURE);
+ var allowEdit = !!options.allowEdit;
+ var correctOrientation = !!options.correctOrientation;
+ var saveToPhotoAlbum = !!options.saveToPhotoAlbum;
+ var popoverOptions = getValue(options.popoverOptions, null);
var args = [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType,
mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions];
exec(successCallback, errorCallback, "Camera", "takePicture", args);
+ return new CameraPopoverHandle();
};
cameraExport.cleanup = function(successCallback, errorCallback) {
@@ -1379,7 +1225,8 @@ define("cordova/plugin/CameraConstants", function(require, exports, module) {
module.exports = {
DestinationType:{
DATA_URL: 0, // Return base64 encoded string
- FILE_URI: 1 // Return file uri (content://media/external/images/media/2 for Android)
+ FILE_URI: 1, // Return file uri (content://media/external/images/media/2 for Android)
+ NATIVE_URI: 2 // Return native uri (eg. asset-library://... for iOS)
},
EncodingType:{
JPEG: 0, // Return JPEG encoded image
@@ -1406,6 +1253,24 @@ module.exports = {
});
+// file: lib/common/plugin/CameraPopoverHandle.js
+define("cordova/plugin/CameraPopoverHandle", function(require, exports, module) {
+
+var exec = require('cordova/exec');
+
+/**
+ * A handle to an image picker popover.
+ */
+var CameraPopoverHandle = function() {
+ this.setPosition = function(popoverOptions) {
+ console.log('CameraPopoverHandle.setPosition is only supported on iOS.');
+ };
+};
+
+module.exports = CameraPopoverHandle;
+
+});
+
// file: lib/common/plugin/CameraPopoverOptions.js
define("cordova/plugin/CameraPopoverOptions", function(require, exports, module) {
@@ -1531,10 +1396,10 @@ module.exports = CompassError;
define("cordova/plugin/CompassHeading", function(require, exports, module) {
var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, timestamp) {
- this.magneticHeading = (magneticHeading !== undefined ? magneticHeading : null);
- this.trueHeading = (trueHeading !== undefined ? trueHeading : null);
- this.headingAccuracy = (headingAccuracy !== undefined ? headingAccuracy : null);
- this.timestamp = (timestamp !== undefined ? timestamp : new Date().getTime());
+ this.magneticHeading = magneticHeading;
+ this.trueHeading = trueHeading;
+ this.headingAccuracy = headingAccuracy;
+ this.timestamp = timestamp || new Date().getTime();
};
module.exports = CompassHeading;
@@ -1575,6 +1440,7 @@ module.exports = {
CELL_2G: "2g",
CELL_3G: "3g",
CELL_4G: "4g",
+ CELL:"cellular",
NONE: "none"
};
@@ -1583,7 +1449,8 @@ module.exports = {
// file: lib/common/plugin/Contact.js
define("cordova/plugin/Contact", function(require, exports, module) {
-var exec = require('cordova/exec'),
+var argscheck = require('cordova/argscheck'),
+ exec = require('cordova/exec'),
ContactError = require('cordova/plugin/ContactError'),
utils = require('cordova/utils');
@@ -1668,7 +1535,8 @@ var Contact = function (id, displayName, name, nickname, phoneNumbers, emails, a
* @param errorCB error callback
*/
Contact.prototype.remove = function(successCB, errorCB) {
- var fail = function(code) {
+ argscheck.checkArgs('FF', 'Contact.remove', arguments);
+ var fail = errorCB && function(code) {
errorCB(new ContactError(code));
};
if (this.id === null) {
@@ -1686,50 +1554,26 @@ Contact.prototype.remove = function(successCB, errorCB) {
*/
Contact.prototype.clone = function() {
var clonedContact = utils.clone(this);
- var i;
clonedContact.id = null;
clonedContact.rawId = null;
- // Loop through and clear out any id's in phones, emails, etc.
- if (clonedContact.phoneNumbers) {
- for (i = 0; i < clonedContact.phoneNumbers.length; i++) {
- clonedContact.phoneNumbers[i].id = null;
- }
- }
- if (clonedContact.emails) {
- for (i = 0; i < clonedContact.emails.length; i++) {
- clonedContact.emails[i].id = null;
- }
- }
- if (clonedContact.addresses) {
- for (i = 0; i < clonedContact.addresses.length; i++) {
- clonedContact.addresses[i].id = null;
- }
- }
- if (clonedContact.ims) {
- for (i = 0; i < clonedContact.ims.length; i++) {
- clonedContact.ims[i].id = null;
- }
- }
- if (clonedContact.organizations) {
- for (i = 0; i < clonedContact.organizations.length; i++) {
- clonedContact.organizations[i].id = null;
- }
- }
- if (clonedContact.categories) {
- for (i = 0; i < clonedContact.categories.length; i++) {
- clonedContact.categories[i].id = null;
- }
- }
- if (clonedContact.photos) {
- for (i = 0; i < clonedContact.photos.length; i++) {
- clonedContact.photos[i].id = null;
- }
- }
- if (clonedContact.urls) {
- for (i = 0; i < clonedContact.urls.length; i++) {
- clonedContact.urls[i].id = null;
+
+ function nullIds(arr) {
+ if (arr) {
+ for (var i = 0; i < arr.length; ++i) {
+ arr[i].id = null;
+ }
}
}
+
+ // Loop through and clear out any id's in phones, emails, etc.
+ nullIds(clonedContact.phoneNumbers);
+ nullIds(clonedContact.emails);
+ nullIds(clonedContact.addresses);
+ nullIds(clonedContact.ims);
+ nullIds(clonedContact.organizations);
+ nullIds(clonedContact.categories);
+ nullIds(clonedContact.photos);
+ nullIds(clonedContact.urls);
return clonedContact;
};
@@ -1739,21 +1583,22 @@ Contact.prototype.clone = function() {
* @param errorCB error callback
*/
Contact.prototype.save = function(successCB, errorCB) {
- var fail = function(code) {
- errorCB(new ContactError(code));
- };
+ argscheck.checkArgs('FFO', 'Contact.save', arguments);
+ var fail = errorCB && function(code) {
+ errorCB(new ContactError(code));
+ };
var success = function(result) {
- if (result) {
- if (typeof successCB === 'function') {
- var fullContact = require('cordova/plugin/contacts').create(result);
- successCB(convertIn(fullContact));
- }
- }
- else {
- // no Entry object returned
- fail(ContactError.UNKNOWN_ERROR);
- }
- };
+ if (result) {
+ if (successCB) {
+ var fullContact = require('cordova/plugin/contacts').create(result);
+ successCB(convertIn(fullContact));
+ }
+ }
+ else {
+ // no Entry object returned
+ fail(ContactError.UNKNOWN_ERROR);
+ }
+ };
var dupContact = convertOut(utils.clone(this));
exec(success, fail, "Contacts", "save", [dupContact]);
};
@@ -1974,7 +1819,8 @@ module.exports = Coordinates;
// file: lib/common/plugin/DirectoryEntry.js
define("cordova/plugin/DirectoryEntry", function(require, exports, module) {
-var utils = require('cordova/utils'),
+var argscheck = require('cordova/argscheck'),
+ utils = require('cordova/utils'),
exec = require('cordova/exec'),
Entry = require('cordova/plugin/Entry'),
FileError = require('cordova/plugin/FileError'),
@@ -1990,7 +1836,7 @@ var utils = require('cordova/utils'),
* TODO: implement this!!! {FileSystem} filesystem on which the directory resides (readonly)
*/
var DirectoryEntry = function(name, fullPath) {
- DirectoryEntry.__super__.constructor.apply(this, [false, true, name, fullPath]);
+ DirectoryEntry.__super__.constructor.call(this, false, true, name, fullPath);
};
utils.extend(DirectoryEntry, Entry);
@@ -2011,11 +1857,12 @@ DirectoryEntry.prototype.createReader = function() {
* @param {Function} errorCallback is called with a FileError
*/
DirectoryEntry.prototype.getDirectory = function(path, options, successCallback, errorCallback) {
- var win = typeof successCallback !== 'function' ? null : function(result) {
+ argscheck.checkArgs('sOFF', 'DirectoryEntry.getDirectory', arguments);
+ var win = successCallback && function(result) {
var entry = new DirectoryEntry(result.name, result.fullPath);
successCallback(entry);
};
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ var fail = errorCallback && function(code) {
errorCallback(new FileError(code));
};
exec(win, fail, "File", "getDirectory", [this.fullPath, path, options]);
@@ -2028,7 +1875,8 @@ DirectoryEntry.prototype.getDirectory = function(path, options, successCallback,
* @param {Function} errorCallback is called with a FileError
*/
DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCallback) {
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ argscheck.checkArgs('FF', 'DirectoryEntry.removeRecursively', arguments);
+ var fail = errorCallback && function(code) {
errorCallback(new FileError(code));
};
exec(successCallback, fail, "File", "removeRecursively", [this.fullPath]);
@@ -2043,12 +1891,13 @@ DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCall
* @param {Function} errorCallback is called with a FileError
*/
DirectoryEntry.prototype.getFile = function(path, options, successCallback, errorCallback) {
- var win = typeof successCallback !== 'function' ? null : function(result) {
+ argscheck.checkArgs('sOFF', 'DirectoryEntry.getFile', arguments);
+ var win = successCallback && function(result) {
var FileEntry = require('cordova/plugin/FileEntry');
var entry = new FileEntry(result.name, result.fullPath);
successCallback(entry);
};
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ var fail = errorCallback && function(code) {
errorCallback(new FileError(code));
};
exec(win, fail, "File", "getFile", [this.fullPath, path, options]);
@@ -2109,7 +1958,8 @@ module.exports = DirectoryReader;
// file: lib/common/plugin/Entry.js
define("cordova/plugin/Entry", function(require, exports, module) {
-var exec = require('cordova/exec'),
+var argscheck = require('cordova/argscheck'),
+ exec = require('cordova/exec'),
FileError = require('cordova/plugin/FileError'),
Metadata = require('cordova/plugin/Metadata');
@@ -2128,8 +1978,8 @@ var exec = require('cordova/exec'),
* (readonly)
*/
function Entry(isFile, isDirectory, name, fullPath, fileSystem) {
- this.isFile = (typeof isFile != 'undefined'?isFile:false);
- this.isDirectory = (typeof isDirectory != 'undefined'?isDirectory:false);
+ this.isFile = !!isFile;
+ this.isDirectory = !!isDirectory;
this.name = name || '';
this.fullPath = fullPath || '';
this.filesystem = fileSystem || null;
@@ -2144,15 +1994,16 @@ function Entry(isFile, isDirectory, name, fullPath, fileSystem) {
* {Function} is called with a FileError
*/
Entry.prototype.getMetadata = function(successCallback, errorCallback) {
- var success = typeof successCallback !== 'function' ? null : function(lastModified) {
- var metadata = new Metadata(lastModified);
- successCallback(metadata);
- };
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
- errorCallback(new FileError(code));
- };
+ argscheck.checkArgs('FF', 'Entry.getMetadata', arguments);
+ var success = successCallback && function(lastModified) {
+ var metadata = new Metadata(lastModified);
+ successCallback(metadata);
+ };
+ var fail = errorCallback && function(code) {
+ errorCallback(new FileError(code));
+ };
- exec(success, fail, "File", "getMetadata", [this.fullPath]);
+ exec(success, fail, "File", "getMetadata", [this.fullPath]);
};
/**
@@ -2166,8 +2017,8 @@ Entry.prototype.getMetadata = function(successCallback, errorCallback) {
* {Object} keys and values to set
*/
Entry.prototype.setMetadata = function(successCallback, errorCallback, metadataObject) {
-
- exec(successCallback, errorCallback, "File", "setMetadata", [this.fullPath, metadataObject]);
+ argscheck.checkArgs('FFO', 'Entry.setMetadata', arguments);
+ exec(successCallback, errorCallback, "File", "setMetadata", [this.fullPath, metadataObject]);
};
/**
@@ -2183,36 +2034,25 @@ Entry.prototype.setMetadata = function(successCallback, errorCallback, metadataO
* {Function} called with a FileError
*/
Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallback) {
- var fail = function(code) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(code));
- }
+ argscheck.checkArgs('oSFF', 'Entry.moveTo', arguments);
+ var fail = errorCallback && function(code) {
+ errorCallback(new FileError(code));
};
- // user must specify parent Entry
- if (!parent) {
- fail(FileError.NOT_FOUND_ERR);
- return;
- }
// source path
var srcPath = this.fullPath,
// entry name
name = newName || this.name,
success = function(entry) {
if (entry) {
- if (typeof successCallback === 'function') {
+ if (successCallback) {
// create appropriate Entry object
var result = (entry.isDirectory) ? new (require('cordova/plugin/DirectoryEntry'))(entry.name, entry.fullPath) : new (require('cordova/plugin/FileEntry'))(entry.name, entry.fullPath);
- try {
- successCallback(result);
- }
- catch (e) {
- console.log('Error invoking callback: ' + e);
- }
+ successCallback(result);
}
}
else {
// no Entry object returned
- fail(FileError.NOT_FOUND_ERR);
+ fail && fail(FileError.NOT_FOUND_ERR);
}
};
@@ -2233,18 +2073,11 @@ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallbac
* {Function} called with a FileError
*/
Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallback) {
- var fail = function(code) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(code));
- }
+ argscheck.checkArgs('oSFF', 'Entry.copyTo', arguments);
+ var fail = errorCallback && function(code) {
+ errorCallback(new FileError(code));
};
- // user must specify parent Entry
- if (!parent) {
- fail(FileError.NOT_FOUND_ERR);
- return;
- }
-
// source path
var srcPath = this.fullPath,
// entry name
@@ -2252,20 +2085,15 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
// success callback
success = function(entry) {
if (entry) {
- if (typeof successCallback === 'function') {
+ if (successCallback) {
// create appropriate Entry object
var result = (entry.isDirectory) ? new (require('cordova/plugin/DirectoryEntry'))(entry.name, entry.fullPath) : new (require('cordova/plugin/FileEntry'))(entry.name, entry.fullPath);
- try {
- successCallback(result);
- }
- catch (e) {
- console.log('Error invoking callback: ' + e);
- }
+ successCallback(result);
}
}
else {
// no Entry object returned
- fail(FileError.NOT_FOUND_ERR);
+ fail && fail(FileError.NOT_FOUND_ERR);
}
};
@@ -2302,7 +2130,8 @@ Entry.prototype.toURI = function(mimeType) {
* @param errorCallback {Function} called with a FileError
*/
Entry.prototype.remove = function(successCallback, errorCallback) {
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ argscheck.checkArgs('FF', 'Entry.remove', arguments);
+ var fail = errorCallback && function(code) {
errorCallback(new FileError(code));
};
exec(successCallback, fail, "File", "remove", [this.fullPath]);
@@ -2315,12 +2144,13 @@ Entry.prototype.remove = function(successCallback, errorCallback) {
* @param errorCallback {Function} called with a FileError
*/
Entry.prototype.getParent = function(successCallback, errorCallback) {
- var win = typeof successCallback !== 'function' ? null : function(result) {
+ argscheck.checkArgs('FF', 'Entry.getParent', arguments);
+ var win = successCallback && function(result) {
var DirectoryEntry = require('cordova/plugin/DirectoryEntry');
var entry = new DirectoryEntry(result.name, result.fullPath);
successCallback(entry);
};
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ var fail = errorCallback && function(code) {
errorCallback(new FileError(code));
};
exec(win, fail, "File", "getParent", [this.fullPath]);
@@ -2348,8 +2178,46 @@ var File = function(name, fullPath, type, lastModifiedDate, size){
this.type = type || null;
this.lastModifiedDate = lastModifiedDate || null;
this.size = size || 0;
+
+ // These store the absolute start and end for slicing the file.
+ this.start = 0;
+ this.end = this.size;
+};
+
+/**
+ * Returns a "slice" of the file. Since Cordova Files don't contain the actual
+ * content, this really returns a File with adjusted start and end.
+ * Slices of slices are supported.
+ * start {Number} The index at which to start the slice (inclusive).
+ * end {Number} The index at which to end the slice (exclusive).
+ */
+File.prototype.slice = function(start, end) {
+ var size = this.end - this.start;
+ var newStart = 0;
+ var newEnd = size;
+ if (arguments.length) {
+ if (start < 0) {
+ newStart = Math.max(size + start, 0);
+ } else {
+ newStart = Math.min(size, start);
+ }
+ }
+
+ if (arguments.length >= 2) {
+ if (end < 0) {
+ newEnd = Math.max(size + end, 0);
+ } else {
+ newEnd = Math.min(end, size);
+ }
+ }
+
+ var newFile = new File(this.name, this.fullPath, this.type, this.lastModifiedData, this.size);
+ newFile.start = this.start + newStart;
+ newFile.end = this.start + newEnd;
+ return newFile;
};
+
module.exports = File;
});
@@ -2390,13 +2258,9 @@ FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
var writer = new FileWriter(filePointer);
if (writer.fileName === null || writer.fileName === "") {
- if (typeof errorCallback === "function") {
- errorCallback(new FileError(FileError.INVALID_STATE_ERR));
- }
+ errorCallback && errorCallback(new FileError(FileError.INVALID_STATE_ERR));
} else {
- if (typeof successCallback === "function") {
- successCallback(writer);
- }
+ successCallback && successCallback(writer);
}
}, errorCallback);
};
@@ -2408,11 +2272,11 @@ FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
* @param {Function} errorCallback is called with a FileError
*/
FileEntry.prototype.file = function(successCallback, errorCallback) {
- var win = typeof successCallback !== 'function' ? null : function(f) {
+ var win = successCallback && function(f) {
var file = new File(f.name, f.fullPath, f.type, f.lastModifiedDate, f.size);
successCallback(file);
};
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ var fail = errorCallback && function(code) {
errorCallback(new FileError(code));
};
exec(win, fail, "File", "getFileMetadata", [this.fullPath]);
@@ -2458,8 +2322,12 @@ module.exports = FileError;
define("cordova/plugin/FileReader", function(require, exports, module) {
var exec = require('cordova/exec'),
+ modulemapper = require('cordova/modulemapper'),
+ utils = require('cordova/utils'),
+ File = require('cordova/plugin/File'),
FileError = require('cordova/plugin/FileError'),
- ProgressEvent = require('cordova/plugin/ProgressEvent');
+ ProgressEvent = require('cordova/plugin/ProgressEvent'),
+ origFileReader = modulemapper.getOriginalSymbol(this, 'FileReader');
/**
* This class reads the mobile device file system.
@@ -2470,23 +2338,11 @@ var exec = require('cordova/exec'),
* @constructor
*/
var FileReader = function() {
- this.fileName = "";
-
- this.readyState = 0; // FileReader.EMPTY
-
- // File data
- this.result = null;
-
- // Error
- this.error = null;
-
- // Event handlers
- this.onloadstart = null; // When the read starts.
- this.onprogress = null; // While reading (and decoding) file or fileBlob data, and reporting partial file data (progress.loaded/progress.total)
- this.onload = null; // When the read has successfully completed.
- this.onerror = null; // When the read has failed (see errors).
- this.onloadend = null; // When the request has completed (either in success or failure).
- this.onabort = null; // When the read has been aborted. For instance, by invoking the abort() method.
+ this._readyState = 0;
+ this._error = null;
+ this._result = null;
+ this._fileName = '';
+ this._realReader = origFileReader ? new origFileReader() : {};
};
// States
@@ -2494,17 +2350,70 @@ FileReader.EMPTY = 0;
FileReader.LOADING = 1;
FileReader.DONE = 2;
+utils.defineGetter(FileReader.prototype, 'readyState', function() {
+ return this._fileName ? this._readyState : this._realReader.readyState;
+});
+
+utils.defineGetter(FileReader.prototype, 'error', function() {
+ return this._fileName ? this._error: this._realReader.error;
+});
+
+utils.defineGetter(FileReader.prototype, 'result', function() {
+ return this._fileName ? this._result: this._realReader.result;
+});
+
+function defineEvent(eventName) {
+ utils.defineGetterSetter(FileReader.prototype, eventName, function() {
+ return this._realReader[eventName] || null;
+ }, function(value) {
+ this._realReader[eventName] = value;
+ });
+}
+defineEvent('onloadstart'); // When the read starts.
+defineEvent('onprogress'); // While reading (and decoding) file or fileBlob data, and reporting partial file data (progress.loaded/progress.total)
+defineEvent('onload'); // When the read has successfully completed.
+defineEvent('onerror'); // When the read has failed (see errors).
+defineEvent('onloadend'); // When the request has completed (either in success or failure).
+defineEvent('onabort'); // When the read has been aborted. For instance, by invoking the abort() method.
+
+function initRead(reader, file) {
+ // Already loading something
+ if (reader.readyState == FileReader.LOADING) {
+ throw new FileError(FileError.INVALID_STATE_ERR);
+ }
+
+ reader._result = null;
+ reader._error = null;
+ reader._readyState = FileReader.LOADING;
+
+ if (typeof file == 'string') {
+ // Deprecated in Cordova 2.4.
+ console.warning('Using a string argument with FileReader.readAs functions is deprecated.');
+ reader._fileName = file;
+ } else if (typeof file.fullPath == 'string') {
+ reader._fileName = file.fullPath;
+ } else {
+ reader._fileName = '';
+ return true;
+ }
+
+ reader.onloadstart && reader.onloadstart(new ProgressEvent("loadstart", {target:reader}));
+}
+
/**
* Abort reading file.
*/
FileReader.prototype.abort = function() {
- this.result = null;
+ if (origFileReader && !this._fileName) {
+ return this._realReader.abort();
+ }
+ this._result = null;
- if (this.readyState == FileReader.DONE || this.readyState == FileReader.EMPTY) {
+ if (this._readyState == FileReader.DONE || this._readyState == FileReader.EMPTY) {
return;
}
- this.readyState = FileReader.DONE;
+ this._readyState = FileReader.DONE;
// If abort callback
if (typeof this.onabort === 'function') {
@@ -2523,43 +2432,33 @@ FileReader.prototype.abort = function() {
* @param encoding [Optional] (see http://www.iana.org/assignments/character-sets)
*/
FileReader.prototype.readAsText = function(file, encoding) {
- // Figure out pathing
- this.fileName = '';
- if (typeof file.fullPath === 'undefined') {
- this.fileName = file;
- } else {
- this.fileName = file.fullPath;
- }
-
- // Already loading something
- if (this.readyState == FileReader.LOADING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // LOADING state
- this.readyState = FileReader.LOADING;
-
- // If loadstart callback
- if (typeof this.onloadstart === "function") {
- this.onloadstart(new ProgressEvent("loadstart", {target:this}));
+ if (initRead(this, file)) {
+ return this._realReader.readAsText(file, encoding);
}
// Default encoding is UTF-8
var enc = encoding ? encoding : "UTF-8";
-
var me = this;
+ var execArgs = [this._fileName, enc];
+
+ // Maybe add slice parameters.
+ if (file.end < file.size) {
+ execArgs.push(file.start, file.end);
+ } else if (file.start > 0) {
+ execArgs.push(file.start);
+ }
// Read file
exec(
// Success callback
function(r) {
// If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
+ if (me._readyState === FileReader.DONE) {
return;
}
// Save result
- me.result = r;
+ me._result = r;
// If onload callback
if (typeof me.onload === "function") {
@@ -2567,7 +2466,7 @@ FileReader.prototype.readAsText = function(file, encoding) {
}
// DONE state
- me.readyState = FileReader.DONE;
+ me._readyState = FileReader.DONE;
// If onloadend callback
if (typeof me.onloadend === "function") {
@@ -2577,18 +2476,18 @@ FileReader.prototype.readAsText = function(file, encoding) {
// Error callback
function(e) {
// If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
+ if (me._readyState === FileReader.DONE) {
return;
}
// DONE state
- me.readyState = FileReader.DONE;
+ me._readyState = FileReader.DONE;
// null result
- me.result = null;
+ me._result = null;
// Save error
- me.error = new FileError(e);
+ me._error = new FileError(e);
// If onerror callback
if (typeof me.onerror === "function") {
@@ -2599,7 +2498,7 @@ FileReader.prototype.readAsText = function(file, encoding) {
if (typeof me.onloadend === "function") {
me.onloadend(new ProgressEvent("loadend", {target:me}));
}
- }, "File", "readAsText", [this.fileName, enc]);
+ }, "File", "readAsText", execArgs);
};
@@ -2611,42 +2510,34 @@ FileReader.prototype.readAsText = function(file, encoding) {
* @param file {File} File object containing file properties
*/
FileReader.prototype.readAsDataURL = function(file) {
- this.fileName = "";
- if (typeof file.fullPath === "undefined") {
- this.fileName = file;
- } else {
- this.fileName = file.fullPath;
+ if (initRead(this, file)) {
+ return this._realReader.readAsDataURL(file);
}
- // Already loading something
- if (this.readyState == FileReader.LOADING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // LOADING state
- this.readyState = FileReader.LOADING;
+ var me = this;
+ var execArgs = [this._fileName];
- // If loadstart callback
- if (typeof this.onloadstart === "function") {
- this.onloadstart(new ProgressEvent("loadstart", {target:this}));
+ // Maybe add slice parameters.
+ if (file.end < file.size) {
+ execArgs.push(file.start, file.end);
+ } else if (file.start > 0) {
+ execArgs.push(file.start);
}
- var me = this;
-
// Read file
exec(
// Success callback
function(r) {
// If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
+ if (me._readyState === FileReader.DONE) {
return;
}
// DONE state
- me.readyState = FileReader.DONE;
+ me._readyState = FileReader.DONE;
// Save result
- me.result = r;
+ me._result = r;
// If onload callback
if (typeof me.onload === "function") {
@@ -2661,17 +2552,17 @@ FileReader.prototype.readAsDataURL = function(file) {
// Error callback
function(e) {
// If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
+ if (me._readyState === FileReader.DONE) {
return;
}
// DONE state
- me.readyState = FileReader.DONE;
+ me._readyState = FileReader.DONE;
- me.result = null;
+ me._result = null;
// Save error
- me.error = new FileError(e);
+ me._error = new FileError(e);
// If onerror callback
if (typeof me.onerror === "function") {
@@ -2682,7 +2573,7 @@ FileReader.prototype.readAsDataURL = function(file) {
if (typeof me.onloadend === "function") {
me.onloadend(new ProgressEvent("loadend", {target:me}));
}
- }, "File", "readAsDataURL", [this.fileName]);
+ }, "File", "readAsDataURL", execArgs);
};
/**
@@ -2691,8 +2582,12 @@ FileReader.prototype.readAsDataURL = function(file) {
* @param file {File} File object containing file properties
*/
FileReader.prototype.readAsBinaryString = function(file) {
+ if (initRead(this, file)) {
+ return this._realReader.readAsBinaryString(file);
+ }
// TODO - Can't return binary data to browser.
console.log('method "readAsBinaryString" is not supported at this time.');
+ this.abort();
};
/**
@@ -2701,8 +2596,12 @@ FileReader.prototype.readAsBinaryString = function(file) {
* @param file {File} File object containing file properties
*/
FileReader.prototype.readAsArrayBuffer = function(file) {
+ if (initRead(this, file)) {
+ return this._realReader.readAsArrayBuffer(file);
+ }
// TODO - Can't return binary data to browser.
console.log('This method is not supported at this time.');
+ this.abort();
};
module.exports = FileReader;
@@ -2735,7 +2634,8 @@ module.exports = FileSystem;
// file: lib/common/plugin/FileTransfer.js
define("cordova/plugin/FileTransfer", function(require, exports, module) {
-var exec = require('cordova/exec'),
+var argscheck = require('cordova/argscheck'),
+ exec = require('cordova/exec'),
FileTransferError = require('cordova/plugin/FileTransferError'),
ProgressEvent = require('cordova/plugin/ProgressEvent');
@@ -2769,8 +2669,7 @@ var FileTransfer = function() {
* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false
*/
FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, trustAllHosts) {
- // sanity parameter checking
- if (!filePath || !server) throw new Error("FileTransfer.upload requires filePath and server URL parameters at the minimum.");
+ argscheck.checkArgs('ssFFO*', 'FileTransfer.upload', arguments);
// check for options
var fileKey = null;
var fileName = null;
@@ -2794,7 +2693,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
}
}
- var fail = function(e) {
+ var fail = errorCallback && function(e) {
var error = new FileTransferError(e.code, e.source, e.target, e.http_status);
errorCallback(error);
};
@@ -2803,10 +2702,10 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
var win = function(result) {
if (typeof result.lengthComputable != "undefined") {
if (self.onprogress) {
- return self.onprogress(newProgressEvent(result));
+ self.onprogress(newProgressEvent(result));
}
} else {
- return successCallback(result);
+ successCallback && successCallback(result);
}
};
exec(win, fail, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode, headers, this._id]);
@@ -2821,15 +2720,14 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false
*/
FileTransfer.prototype.download = function(source, target, successCallback, errorCallback, trustAllHosts) {
- // sanity parameter checking
- if (!source || !target) throw new Error("FileTransfer.download requires source URI and target URI parameters at the minimum.");
+ argscheck.checkArgs('ssFF*', 'FileTransfer.download', arguments);
var self = this;
var win = function(result) {
if (typeof result.lengthComputable != "undefined") {
if (self.onprogress) {
return self.onprogress(newProgressEvent(result));
}
- } else {
+ } else if (successCallback) {
var entry = null;
if (result.isDirectory) {
entry = new (require('cordova/plugin/DirectoryEntry'))();
@@ -2845,7 +2743,7 @@ FileTransfer.prototype.download = function(source, target, successCallback, erro
}
};
- var fail = function(e) {
+ var fail = errorCallback && function(e) {
var error = new FileTransferError(e.code, e.source, e.target, e.http_status);
errorCallback(error);
};
@@ -2873,11 +2771,12 @@ define("cordova/plugin/FileTransferError", function(require, exports, module) {
* FileTransferError
* @constructor
*/
-var FileTransferError = function(code, source, target, status) {
+var FileTransferError = function(code, source, target, status, body) {
this.code = code || null;
this.source = source || null;
this.target = target || null;
this.http_status = status || null;
+ this.body = body || null;
};
FileTransferError.FILE_NOT_FOUND_ERR = 1;
@@ -3237,6 +3136,53 @@ module.exports = GlobalizationError;
});
+// file: lib/common/plugin/InAppBrowser.js
+define("cordova/plugin/InAppBrowser", function(require, exports, module) {
+
+var exec = require('cordova/exec');
+var channel = require('cordova/channel');
+
+function InAppBrowser() {
+ 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);
+ }
+ },
+ close: function (eventname) {
+ exec(null, null, "InAppBrowser", "close", []);
+ },
+ addEventListener: function (eventname,f) {
+ if (eventname in this.channels) {
+ this.channels[eventname].subscribe(f);
+ }
+ },
+ removeEventListener: function(eventname, f) {
+ if (eventname in this.channels) {
+ this.channels[eventname].unsubscribe(f);
+ }
+ }
+};
+
+module.exports = 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;
+};
+
+
+});
+
// file: lib/common/plugin/LocalFileSystem.js
define("cordova/plugin/LocalFileSystem", function(require, exports, module) {
@@ -3259,7 +3205,8 @@ module.exports = LocalFileSystem;
// file: lib/common/plugin/Media.js
define("cordova/plugin/Media", function(require, exports, module) {
-var utils = require('cordova/utils'),
+var argscheck = require('cordova/argscheck'),
+ utils = require('cordova/utils'),
exec = require('cordova/exec');
var mediaObjects = {};
@@ -3277,25 +3224,7 @@ var mediaObjects = {};
* statusCallback(int statusCode) - OPTIONAL
*/
var Media = function(src, successCallback, errorCallback, statusCallback) {
-
- // successCallback optional
- if (successCallback && (typeof successCallback !== "function")) {
- console.log("Media Error: successCallback is not a function");
- return;
- }
-
- // errorCallback optional
- if (errorCallback && (typeof errorCallback !== "function")) {
- console.log("Media Error: errorCallback is not a function");
- return;
- }
-
- // statusCallback optional
- if (statusCallback && (typeof statusCallback !== "function")) {
- console.log("Media Error: statusCallback is not a function");
- return;
- }
-
+ argscheck.checkArgs('SFFF', 'Media', arguments);
this.id = utils.createUUID();
mediaObjects[this.id] = this;
this.src = src;
@@ -3439,12 +3368,12 @@ Media.onStatus = function(id, msgType, value) {
media._position = Number(value);
break;
default :
- console && console.error && console.error("Unhandled Media.onStatus :: " + msgType);
+ console.error && console.error("Unhandled Media.onStatus :: " + msgType);
break;
}
}
else {
- console && console.error && console.error("Received Media.onStatus callback for unknown media :: " + id);
+ console.error && console.error("Received Media.onStatus callback for unknown media :: " + id);
}
};
@@ -3673,7 +3602,8 @@ define("cordova/plugin/accelerometer", function(require, exports, module) {
* This class provides access to device accelerometer data.
* @constructor
*/
-var utils = require("cordova/utils"),
+var argscheck = require('cordova/argscheck'),
+ utils = require("cordova/utils"),
exec = require("cordova/exec"),
Acceleration = require('cordova/plugin/Acceleration');
@@ -3737,10 +3667,7 @@ var accelerometer = {
* @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
*/
getCurrentAcceleration: function(successCallback, errorCallback, options) {
- // successCallback required
- if (typeof successCallback !== "function") {
- throw "getCurrentAcceleration must be called with at least a success callback function as first parameter.";
- }
+ argscheck.checkArgs('fFO', 'accelerometer.getCurrentAcceleration', arguments);
var p;
var win = function(a) {
@@ -3749,7 +3676,7 @@ var accelerometer = {
};
var fail = function(e) {
removeListeners(p);
- errorCallback(e);
+ errorCallback && errorCallback(e);
};
p = createCallbackPair(win, fail);
@@ -3769,20 +3696,16 @@ var accelerometer = {
* @return String The watch id that must be passed to #clearWatch to stop watching.
*/
watchAcceleration: function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'accelerometer.watchAcceleration', arguments);
// Default interval (10 sec)
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
var id = utils.createUUID();
var p = createCallbackPair(function(){}, function(e) {
removeListeners(p);
- errorCallback(e);
+ errorCallback && errorCallback(e);
});
listeners.push(p);
@@ -3798,7 +3721,7 @@ var accelerometer = {
if (running) {
// If we're already running then immediately invoke the success callback
// but only if we have retrieved a value, sample code does not check for null ...
- if(accel) {
+ if (accel) {
successCallback(accel);
}
} else {
@@ -3827,6 +3750,17 @@ module.exports = accelerometer;
});
+// file: lib/common/plugin/accelerometer/symbols.js
+define("cordova/plugin/accelerometer/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.defaults('cordova/plugin/Acceleration', 'Acceleration');
+modulemapper.defaults('cordova/plugin/accelerometer', 'navigator.accelerometer');
+
+});
+
// file: lib/android/plugin/android/app.js
define("cordova/plugin/android/app", function(require, exports, module) {
@@ -4331,100 +4265,57 @@ var DroidDB_openDatabase = function(name, version, display_name, size) {
return db;
};
-/**
- * For browsers with no localStorage we emulate it with SQLite. Follows the w3c api.
- * TODO: Do similar for sessionStorage.
- * @constructor
- */
-var CupcakeLocalStorage = function() {
- channel.waitForInitialization("cupcakeStorage");
- try {
+module.exports = {
+ openDatabase:DroidDB_openDatabase,
+ failQuery:failQuery,
+ completeQuery:completeQuery
+};
- this.db = openDatabase('localStorage', '1.0', 'localStorage', 2621440);
- var storage = {};
- this.length = 0;
- function setLength (length) {
- this.length = length;
- localStorage.length = length;
- }
- this.db.transaction(
- function (transaction) {
- var i;
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('SELECT * FROM storage', [], function(tx, result) {
- for(var i = 0; i < result.rows.length; i++) {
- storage[result.rows.item(i).id] = result.rows.item(i).body;
- }
- setLength(result.rows.length);
- channel.initializationComplete("cupcakeStorage");
- });
+});
- },
- function (err) {
- utils.alert(err.message);
- }
- );
- this.setItem = function(key, val) {
- if (typeof(storage[key])=='undefined') {
- this.length++;
- }
- storage[key] = val;
- this.db.transaction(
- function (transaction) {
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('REPLACE INTO storage (id, body) values(?,?)', [key,val]);
- }
- );
- };
- this.getItem = function(key) {
- return storage[key];
- };
- this.removeItem = function(key) {
- delete storage[key];
- this.length--;
- this.db.transaction(
- function (transaction) {
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('DELETE FROM storage where id=?', [key]);
- }
- );
- };
- this.clear = function() {
- storage = {};
- this.length = 0;
- this.db.transaction(
- function (transaction) {
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('DELETE FROM storage', []);
- }
- );
- };
- this.key = function(index) {
- var i = 0;
- for (var j in storage) {
- if (i==index) {
- return j;
- } else {
- i++;
- }
- }
- return null;
- };
+// file: lib/android/plugin/android/storage/openDatabase.js
+define("cordova/plugin/android/storage/openDatabase", function(require, exports, module) {
- } catch(e) {
- utils.alert("Database error "+e+".");
- return;
+
+var modulemapper = require('cordova/modulemapper'),
+ storage = require('cordova/plugin/android/storage');
+
+var originalOpenDatabase = modulemapper.getOriginalSymbol(window, 'openDatabase');
+
+module.exports = function(name, version, desc, size) {
+ // First patch WebSQL if necessary
+ if (!originalOpenDatabase) {
+ // Not defined, create an openDatabase function for all to use!
+ return storage.openDatabase.apply(this, arguments);
}
-};
-module.exports = {
- openDatabase:DroidDB_openDatabase,
- CupcakeLocalStorage:CupcakeLocalStorage,
- failQuery:failQuery,
- completeQuery:completeQuery
+ // Defined, but some Android devices will throw a SECURITY_ERR -
+ // so we wrap the whole thing in a try-catch and shim in our own
+ // if the device has Android bug 16175.
+ try {
+ return originalOpenDatabase(name, version, desc, size);
+ } catch (ex) {
+ if (ex.code !== 18) {
+ throw ex;
+ }
+ }
+ return storage.openDatabase(name, version, desc, size);
};
+
+
+});
+
+// file: lib/android/plugin/android/storage/symbols.js
+define("cordova/plugin/android/storage/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/android/storage/openDatabase', 'openDatabase');
+
+
});
// file: lib/common/plugin/battery.js
@@ -4511,6 +4402,28 @@ module.exports = battery;
});
+// file: lib/common/plugin/battery/symbols.js
+define("cordova/plugin/battery/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.defaults('cordova/plugin/battery', 'navigator.battery');
+
+});
+
+// file: lib/common/plugin/camera/symbols.js
+define("cordova/plugin/camera/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.defaults('cordova/plugin/Camera', 'navigator.camera');
+modulemapper.defaults('cordova/plugin/CameraConstants', 'Camera');
+modulemapper.defaults('cordova/plugin/CameraPopoverOptions', 'CameraPopoverOptions');
+
+});
+
// file: lib/common/plugin/capture.js
define("cordova/plugin/capture", function(require, exports, module) {
@@ -4589,10 +4502,27 @@ module.exports = new Capture();
});
+// file: lib/common/plugin/capture/symbols.js
+define("cordova/plugin/capture/symbols", function(require, exports, module) {
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/CaptureError', 'CaptureError');
+modulemapper.clobbers('cordova/plugin/CaptureAudioOptions', 'CaptureAudioOptions');
+modulemapper.clobbers('cordova/plugin/CaptureImageOptions', 'CaptureImageOptions');
+modulemapper.clobbers('cordova/plugin/CaptureVideoOptions', 'CaptureVideoOptions');
+modulemapper.clobbers('cordova/plugin/ConfigurationData', 'ConfigurationData');
+modulemapper.clobbers('cordova/plugin/MediaFile', 'MediaFile');
+modulemapper.clobbers('cordova/plugin/MediaFileData', 'MediaFileData');
+modulemapper.clobbers('cordova/plugin/capture', 'navigator.device.capture');
+
+});
+
// file: lib/common/plugin/compass.js
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'),
CompassHeading = require('cordova/plugin/CompassHeading'),
CompassError = require('cordova/plugin/CompassError'),
@@ -4607,23 +4537,13 @@ var exec = require('cordova/exec'),
* @param {CompassOptions} options The options for getting the heading data (not used).
*/
getCurrentHeading:function(successCallback, errorCallback, options) {
- // 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;
- }
+ argscheck.checkArgs('fFO', 'compass.getCurrentHeading', arguments);
var win = function(result) {
var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
successCallback(ch);
};
- var fail = function(code) {
+ var fail = errorCallback && function(code) {
var ce = new CompassError(code);
errorCallback(ce);
};
@@ -4643,22 +4563,11 @@ var exec = require('cordova/exec'),
* specifies to watch via a distance filter rather than time.
*/
watchHeading:function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'compass.watchHeading', arguments);
// Default interval (100 msec)
var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
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();
if (filter > 0) {
// is an iOS request for watch by filter, no timer needed
@@ -4682,8 +4591,8 @@ var exec = require('cordova/exec'),
// Stop javascript timer & remove from timer list
if (id && timers[id]) {
if (timers[id] != "iOS") {
- clearInterval(timers[id]);
- } else {
+ clearInterval(timers[id]);
+ } else {
// is iOS watch by filter so call into device to stop
exec(null, null, "Compass", "stopHeading", []);
}
@@ -4696,6 +4605,18 @@ module.exports = compass;
});
+// file: lib/common/plugin/compass/symbols.js
+define("cordova/plugin/compass/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/CompassHeading', 'CompassHeading');
+modulemapper.clobbers('cordova/plugin/CompassError', 'CompassError');
+modulemapper.clobbers('cordova/plugin/compass', 'navigator.compass');
+
+});
+
// file: lib/common/plugin/console-via-logger.js
define("cordova/plugin/console-via-logger", function(require, exports, module) {
@@ -4871,7 +4792,8 @@ for (var key in console) {
// file: lib/common/plugin/contacts.js
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'),
utils = require('cordova/utils'),
Contact = require('cordova/plugin/Contact');
@@ -4890,13 +4812,9 @@ var contacts = {
* @return array of Contacts matching search criteria
*/
find:function(fields, successCB, errorCB, options) {
- if (!successCB) {
- throw new TypeError("You must specify a success callback for the find command.");
- }
- if (!fields || (utils.isArray(fields) && fields.length === 0)) {
- if (typeof errorCB === "function") {
- errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
- }
+ argscheck.checkArgs('afFO', 'contacts.find', arguments);
+ if (!fields.length) {
+ errorCB && errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
} else {
var win = function(result) {
var cs = [];
@@ -4917,9 +4835,9 @@ var contacts = {
* @returns new Contact object
*/
create:function(properties) {
- var i;
+ argscheck.checkArgs('O', 'contacts.create', arguments);
var contact = new Contact();
- for (i in properties) {
+ for (var i in properties) {
if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) {
contact[i] = properties[i];
}
@@ -4932,10 +4850,28 @@ module.exports = contacts;
});
+// file: lib/common/plugin/contacts/symbols.js
+define("cordova/plugin/contacts/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/contacts', 'navigator.contacts');
+modulemapper.clobbers('cordova/plugin/Contact', 'Contact');
+modulemapper.clobbers('cordova/plugin/ContactAddress', 'ContactAddress');
+modulemapper.clobbers('cordova/plugin/ContactError', 'ContactError');
+modulemapper.clobbers('cordova/plugin/ContactField', 'ContactField');
+modulemapper.clobbers('cordova/plugin/ContactFindOptions', 'ContactFindOptions');
+modulemapper.clobbers('cordova/plugin/ContactName', 'ContactName');
+modulemapper.clobbers('cordova/plugin/ContactOrganization', 'ContactOrganization');
+
+});
+
// file: lib/common/plugin/device.js
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'),
exec = require('cordova/exec');
@@ -4954,6 +4890,7 @@ function Device() {
this.name = null;
this.uuid = null;
this.cordova = null;
+ this.model = null;
var me = this;
@@ -4965,6 +4902,7 @@ function Device() {
me.name = info.name;
me.uuid = info.uuid;
me.cordova = info.cordova;
+ me.model = info.model;
channel.onCordovaInfoReady.fire();
},function(e) {
me.available = false;
@@ -4980,20 +4918,7 @@ function Device() {
* @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL)
*/
Device.prototype.getInfo = function(successCallback, errorCallback) {
-
- // 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
+ argscheck.checkArgs('fF', 'Device.getInfo', arguments);
exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
};
@@ -5001,6 +4926,17 @@ module.exports = new Device();
});
+// file: lib/android/plugin/device/symbols.js
+define("cordova/plugin/device/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/device', 'device');
+modulemapper.merges('cordova/plugin/android/device', 'device');
+
+});
+
// file: lib/common/plugin/echo.js
define("cordova/plugin/echo", function(require, exports, module) {
@@ -5015,16 +4951,67 @@ var exec = require('cordova/exec');
*/
module.exports = function(successCallback, errorCallback, message, forceAsync) {
var action = forceAsync ? 'echoAsync' : 'echo';
+ if (!forceAsync && message.constructor == ArrayBuffer) {
+ action = 'echoArrayBuffer';
+ }
exec(successCallback, errorCallback, "Echo", action, [message]);
};
});
+// file: lib/android/plugin/file/symbols.js
+define("cordova/plugin/file/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper'),
+ symbolshelper = require('cordova/plugin/file/symbolshelper');
+
+symbolshelper(modulemapper.clobbers);
+
+});
+
+// file: lib/common/plugin/file/symbolshelper.js
+define("cordova/plugin/file/symbolshelper", function(require, exports, module) {
+
+module.exports = function(exportFunc) {
+ exportFunc('cordova/plugin/DirectoryEntry', 'DirectoryEntry');
+ exportFunc('cordova/plugin/DirectoryReader', 'DirectoryReader');
+ exportFunc('cordova/plugin/Entry', 'Entry');
+ exportFunc('cordova/plugin/File', 'File');
+ exportFunc('cordova/plugin/FileEntry', 'FileEntry');
+ exportFunc('cordova/plugin/FileError', 'FileError');
+ exportFunc('cordova/plugin/FileReader', 'FileReader');
+ exportFunc('cordova/plugin/FileSystem', 'FileSystem');
+ exportFunc('cordova/plugin/FileUploadOptions', 'FileUploadOptions');
+ exportFunc('cordova/plugin/FileUploadResult', 'FileUploadResult');
+ exportFunc('cordova/plugin/FileWriter', 'FileWriter');
+ exportFunc('cordova/plugin/Flags', 'Flags');
+ exportFunc('cordova/plugin/LocalFileSystem', 'LocalFileSystem');
+ exportFunc('cordova/plugin/Metadata', 'Metadata');
+ exportFunc('cordova/plugin/ProgressEvent', 'ProgressEvent');
+ exportFunc('cordova/plugin/requestFileSystem', 'requestFileSystem');
+ exportFunc('cordova/plugin/resolveLocalFileSystemURI', 'resolveLocalFileSystemURI');
+};
+
+});
+
+// file: lib/common/plugin/filetransfer/symbols.js
+define("cordova/plugin/filetransfer/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/FileTransfer', 'FileTransfer');
+modulemapper.clobbers('cordova/plugin/FileTransferError', 'FileTransferError');
+
+});
+
// file: lib/common/plugin/geolocation.js
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'),
PositionError = require('cordova/plugin/PositionError'),
Position = require('cordova/plugin/Position');
@@ -5081,9 +5068,7 @@ var geolocation = {
* @param {PositionOptions} options The options for getting the position data. (OPTIONAL)
*/
getCurrentPosition:function(successCallback, errorCallback, options) {
- if (arguments.length === 0) {
- throw new Error("getCurrentPosition must be called with at least one argument.");
- }
+ argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
options = parseParameters(options);
// Timer var that will fire an error callback if no position is retrieved from native
@@ -5159,9 +5144,7 @@ var geolocation = {
* @return String The watch id that must be passed to #clearWatch to stop watching.
*/
watchPosition:function(successCallback, errorCallback, options) {
- if (arguments.length === 0) {
- throw new Error("watchPosition must be called with at least one argument.");
- }
+ argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
options = parseParameters(options);
var id = utils.createUUID();
@@ -5220,10 +5203,24 @@ module.exports = geolocation;
});
+// file: lib/common/plugin/geolocation/symbols.js
+define("cordova/plugin/geolocation/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.defaults('cordova/plugin/geolocation', 'navigator.geolocation');
+modulemapper.clobbers('cordova/plugin/PositionError', 'PositionError');
+modulemapper.clobbers('cordova/plugin/Position', 'Position');
+modulemapper.clobbers('cordova/plugin/Coordinates', 'Coordinates');
+
+});
+
// file: lib/common/plugin/globalization.js
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');
var globalization = {
@@ -5246,18 +5243,7 @@ var globalization = {
* function () {});
*/
getPreferredLanguage:function(successCB, failureCB) {
- // successCallback required
- 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;
- }
-
+ argscheck.checkArgs('fF', 'Globalization.getPreferredLanguage', arguments);
exec(successCB, failureCB, "Globalization","getPreferredLanguage", []);
},
@@ -5279,17 +5265,7 @@ getPreferredLanguage:function(successCB, failureCB) {
* function () {});
*/
getLocaleName:function(successCB, failureCB) {
- // successCallback required
- 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;
- }
+ argscheck.checkArgs('fF', 'Globalization.getLocaleName', arguments);
exec(successCB, failureCB, "Globalization","getLocaleName", []);
},
@@ -5320,27 +5296,9 @@ getLocaleName:function(successCB, failureCB) {
* {formatLength:'short'});
*/
dateToString:function(date, successCB, failureCB, options) {
- // successCallback required
- if (typeof successCB != "function") {
- 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}]);
- }
- else {
- console.log("Globalization.dateToString Error: date is not a Date object");
- }
+ argscheck.checkArgs('dfFO', 'Globalization.dateToString', arguments);
+ var dateValue = date.valueOf();
+ exec(successCB, failureCB, "Globalization", "dateToString", [{"date": dateValue, "options": options}]);
},
@@ -5380,23 +5338,8 @@ dateToString:function(date, successCB, failureCB, options) {
* {selector:'date'});
*/
stringToDate:function(dateString, successCB, failureCB, options) {
- // successCallback required
- 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}]);
- }
- else {
- console.log("Globalization.stringToDate Error: dateString is not a string");
- }
+ argscheck.checkArgs('sfFO', 'Globalization.stringToDate', arguments);
+ exec(successCB, failureCB, "Globalization", "stringToDate", [{"dateString": dateString, "options": options}]);
},
@@ -5433,18 +5376,7 @@ stringToDate:function(dateString, successCB, failureCB, options) {
* {formatLength:'short'});
*/
getDatePattern:function(successCB, failureCB, options) {
- // successCallback required
- 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;
- }
-
+ argscheck.checkArgs('fFO', 'Globalization.getDatePattern', arguments);
exec(successCB, failureCB, "Globalization", "getDatePattern", [{"options": options}]);
},
@@ -5475,17 +5407,7 @@ getDatePattern:function(successCB, failureCB, options) {
* function () {});
*/
getDateNames:function(successCB, failureCB, options) {
- // successCallback required
- 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;
- }
+ argscheck.checkArgs('fFO', 'Globalization.getDateNames', arguments);
exec(successCB, failureCB, "Globalization", "getDateNames", [{"options": options}]);
},
@@ -5510,28 +5432,9 @@ getDateNames:function(successCB, failureCB, options) {
* function () {});
*/
isDayLightSavingsTime:function(date, successCB, failureCB) {
- // successCallback required
- if (typeof successCB != "function") {
- 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}]);
- }
- else {
- console.log("Globalization.isDayLightSavingsTime Error: date is not a Date object");
- }
-
+ argscheck.checkArgs('dfF', 'Globalization.isDayLightSavingsTime', arguments);
+ var dateValue = date.valueOf();
+ exec(successCB, failureCB, "Globalization", "isDayLightSavingsTime", [{"date": dateValue}]);
},
/**
@@ -5553,18 +5456,7 @@ isDayLightSavingsTime:function(date, successCB, failureCB) {
* function () {});
*/
getFirstDayOfWeek:function(successCB, failureCB) {
- // successCallback required
- 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;
- }
-
+ argscheck.checkArgs('fF', 'Globalization.getFirstDayOfWeek', arguments);
exec(successCB, failureCB, "Globalization", "getFirstDayOfWeek", []);
},
@@ -5593,24 +5485,8 @@ getFirstDayOfWeek:function(successCB, failureCB) {
* {type:'decimal'});
*/
numberToString:function(number, successCB, failureCB, options) {
- // successCallback required
- 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}]);
- }
- else {
- console.log("Globalization.numberToString Error: number is not a number");
- }
+ argscheck.checkArgs('nfFO', 'Globalization.numberToString', arguments);
+ exec(successCB, failureCB, "Globalization", "numberToString", [{"number": number, "options": options}]);
},
/**
@@ -5637,24 +5513,8 @@ numberToString:function(number, successCB, failureCB, options) {
* function () { alert('Error parsing number');});
*/
stringToNumber:function(numberString, successCB, failureCB, options) {
- // successCallback required
- 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}]);
- }
- else {
- console.log("Globalization.stringToNumber Error: numberString is not a string");
- }
+ argscheck.checkArgs('sfFO', 'Globalization.stringToNumber', arguments);
+ exec(successCB, failureCB, "Globalization", "stringToNumber", [{"numberString": numberString, "options": options}]);
},
/**
@@ -5690,18 +5550,7 @@ stringToNumber:function(numberString, successCB, failureCB, options) {
* function () {});
*/
getNumberPattern:function(successCB, failureCB, options) {
- // successCallback required
- 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;
- }
-
+ argscheck.checkArgs('fFO', 'Globalization.getNumberPattern', arguments);
exec(successCB, failureCB, "Globalization", "getNumberPattern", [{"options": options}]);
},
@@ -5733,24 +5582,8 @@ getNumberPattern:function(successCB, failureCB, options) {
* function () {});
*/
getCurrencyPattern:function(currencyCode, successCB, failureCB) {
- // successCallback required
- 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}]);
- }
- else {
- console.log("Globalization.getCurrencyPattern Error: currencyCode is not a currency code");
- }
+ argscheck.checkArgs('sfF', 'Globalization.getCurrencyPattern', arguments);
+ exec(successCB, failureCB, "Globalization", "getCurrencyPattern", [{"currencyCode": currencyCode}]);
}
};
@@ -5759,6 +5592,27 @@ module.exports = globalization;
});
+// file: lib/common/plugin/globalization/symbols.js
+define("cordova/plugin/globalization/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/globalization', 'navigator.globalization');
+modulemapper.clobbers('cordova/plugin/GlobalizationError', 'GlobalizationError');
+
+});
+
+// file: lib/android/plugin/inappbrowser/symbols.js
+define("cordova/plugin/inappbrowser/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/InAppBrowser', 'open');
+
+});
+
// file: lib/common/plugin/logger.js
define("cordova/plugin/logger", function(require, exports, module) {
@@ -5987,6 +5841,27 @@ document.addEventListener("deviceready", logger.__onDeviceReady, false);
});
+// file: lib/common/plugin/logger/symbols.js
+define("cordova/plugin/logger/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/logger', 'cordova.logger');
+
+});
+
+// file: lib/android/plugin/media/symbols.js
+define("cordova/plugin/media/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.defaults('cordova/plugin/Media', 'Media');
+modulemapper.clobbers('cordova/plugin/MediaError', 'MediaError');
+
+});
+
// file: lib/common/plugin/network.js
define("cordova/plugin/network", function(require, exports, module) {
@@ -6004,49 +5879,9 @@ if (typeof navigator != 'undefined') {
});
}
-var NetworkConnection = function () {
- this.type = null;
- 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);
- });
- });
-};
+function NetworkConnection() {
+ this.type = 'unknown';
+}
/**
* Get connection info
@@ -6054,12 +5889,60 @@ var NetworkConnection = function () {
* @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) {
- // Get info
+NetworkConnection.prototype.getInfo = function(successCallback, errorCallback) {
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;
+
+});
+
+// file: lib/common/plugin/networkstatus/symbols.js
+define("cordova/plugin/networkstatus/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/network', 'navigator.network.connection', 'navigator.network.connection is deprecated. Use navigator.connection instead.');
+modulemapper.clobbers('cordova/plugin/network', 'navigator.connection');
+modulemapper.defaults('cordova/plugin/Connection', 'Connection');
});
@@ -6125,10 +6008,22 @@ module.exports = {
});
+// file: lib/android/plugin/notification/symbols.js
+define("cordova/plugin/notification/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/notification', 'navigator.notification');
+modulemapper.merges('cordova/plugin/android/notification', 'navigator.notification');
+
+});
+
// file: lib/common/plugin/requestFileSystem.js
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'),
exec = require('cordova/exec');
@@ -6140,10 +6035,9 @@ var FileError = require('cordova/plugin/FileError'),
* @param errorCallback invoked if error occurs retrieving file system
*/
var requestFileSystem = function(type, size, successCallback, errorCallback) {
+ argscheck.checkArgs('nnFF', 'requestFileSystem', arguments);
var fail = function(code) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(code));
- }
+ errorCallback && errorCallback(new FileError(code));
};
if (type < 0 || type > 3) {
@@ -6152,7 +6046,7 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) {
// if successful, return a FileSystem object
var success = function(file_system) {
if (file_system) {
- if (typeof successCallback === 'function') {
+ if (successCallback) {
// grab the name and root from the file system object
var result = new FileSystem(file_system.name, file_system.root);
successCallback(result);
@@ -6174,7 +6068,8 @@ module.exports = requestFileSystem;
// file: lib/common/plugin/resolveLocalFileSystemURI.js
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'),
FileError = require('cordova/plugin/FileError'),
exec = require('cordova/exec');
@@ -6186,11 +6081,10 @@ var DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
* @param errorCallback invoked if error occurs retrieving file system entry
*/
module.exports = function(uri, successCallback, errorCallback) {
+ argscheck.checkArgs('sFF', 'resolveLocalFileSystemURI', arguments);
// error callback
var fail = function(error) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(error));
- }
+ errorCallback && errorCallback(new FileError(error));
};
// sanity check for 'not:valid:filename'
if(!uri || uri.split(":").length > 2) {
@@ -6203,15 +6097,10 @@ module.exports = function(uri, successCallback, errorCallback) {
var success = function(entry) {
var result;
if (entry) {
- if (typeof successCallback === 'function') {
+ if (successCallback) {
// create appropriate Entry object
result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath);
- try {
- successCallback(result);
- }
- catch (e) {
- console.log('Error invoking callback: ' + e);
- }
+ successCallback(result);
}
}
else {
@@ -6243,34 +6132,100 @@ module.exports = splashscreen;
});
+// file: lib/common/plugin/splashscreen/symbols.js
+define("cordova/plugin/splashscreen/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/splashscreen', 'navigator.splashscreen');
+
+});
+
+// file: lib/common/symbols.js
+define("cordova/symbols", function(require, exports, module) {
+
+var modulemapper = require('cordova/modulemapper');
+
+// Use merges here in case others symbols files depend on this running first,
+// but fail to declare the dependency with a require().
+modulemapper.merges('cordova', 'cordova');
+modulemapper.clobbers('cordova/exec', 'cordova.exec');
+modulemapper.clobbers('cordova/exec', 'Cordova.exec');
+
+});
+
// file: lib/common/utils.js
define("cordova/utils", function(require, exports, module) {
var utils = exports;
/**
- * Defines a property getter for obj[key].
+ * Defines a property getter / setter for obj[key].
*/
-utils.defineGetter = function(obj, key, func) {
+utils.defineGetterSetter = function(obj, key, getFunc, opt_setFunc) {
if (Object.defineProperty) {
- Object.defineProperty(obj, key, { get: func });
+ var desc = {
+ get: getFunc,
+ configurable: true
+ };
+ if (opt_setFunc) {
+ desc.set = opt_setFunc;
+ }
+ Object.defineProperty(obj, key, desc);
} else {
- obj.__defineGetter__(key, func);
+ obj.__defineGetter__(key, getFunc);
+ if (opt_setFunc) {
+ obj.__defineSetter__(key, opt_setFunc);
+ }
+ }
+};
+
+/**
+ * Defines a property getter for obj[key].
+ */
+utils.defineGetter = utils.defineGetterSetter;
+
+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;
+};
+
+utils.typeName = function(val) {
+ return Object.prototype.toString.call(val).slice(8, -1);
};
/**
* Returns an indication of whether the argument is an array or not
*/
utils.isArray = function(a) {
- return Object.prototype.toString.call(a) == '[object Array]';
+ return utils.typeName(a) == 'Array';
};
/**
* Returns an indication of whether the argument is a Date or not
*/
utils.isDate = function(d) {
- return Object.prototype.toString.call(d) == '[object Date]';
+ return utils.typeName(d) == 'Date';
};
/**
@@ -6454,10 +6409,10 @@ window.cordova = require('cordova');
(function (context) {
// 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.
- if (typeof navigator != 'undefined') {
- var CordovaNavigator = function () {};
- CordovaNavigator.prototype = navigator;
- navigator = new CordovaNavigator();
+ if (context.navigator) {
+ var CordovaNavigator = function() {};
+ CordovaNavigator.prototype = context.navigator;
+ context.navigator = new CordovaNavigator();
}
var channel = require("cordova/channel"),
@@ -6468,21 +6423,11 @@ window.cordova = require('cordova');
*/
channel.join(function() {
var builder = require('cordova/builder'),
- base = require('cordova/common'),
platform = require('cordova/platform');
- // Drop the common globals into the window object, but be nice and don't overwrite anything.
- builder.build(base.objects).intoButDoNotClobber(window);
-
- // Drop the platform-specific globals into the window object
- // and clobber any existing object.
- builder.build(platform.objects).intoAndClobber(window);
-
- // Merge the platform-specific overrides/enhancements into
- // the window object.
- if (typeof platform.merges !== 'undefined') {
- builder.build(platform.merges).intoAndMerge(window);
- }
+ builder.buildIntoButDoNotClobber(platform.defaults, context);
+ builder.buildIntoAndClobber(platform.clobbers, context);
+ builder.buildIntoAndMerge(platform.merges, context);
// Call the platform-specific initialization
platform.initialize();
diff --git a/www/cordova-independent.js b/www/cordova-independent.js
index 6590173..016a233 100644
--- a/www/cordova-independent.js
+++ b/www/cordova-independent.js
@@ -4,7 +4,7 @@
if (navigator.userAgent.match(/(iPhone|iPod|iPad)/)) {
scriptElement.src = 'cordova-ios-2.5.0.js';
} else if (navigator.userAgent.match(/Android/)) {
- scriptElement.src = 'cordova-android-2.2.0.js';
+ scriptElement.src = 'cordova-android-2.5.0.js';
} else {
alert("Unknown platform - userAgent is: " + navigator.userAgent);
}