forked from github/cordova-android
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e5b0157971 | ||
![]() |
847b6fe7c9 | ||
![]() |
133c2dc902 | ||
![]() |
5592765f04 | ||
![]() |
4441215e4c | ||
![]() |
734d4d3147 | ||
![]() |
d269b54aad | ||
![]() |
495ca45f76 | ||
![]() |
42a6e7972a | ||
![]() |
52d0a4fa78 |
54
RELEASENOTES.md
Normal file
54
RELEASENOTES.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<!--
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
-->
|
||||||
|
## Release Notes for Cordova (Android) ##
|
||||||
|
|
||||||
|
### 3.1.0 (Sept 2013) ###
|
||||||
|
|
||||||
|
55 commits from 9 authors. Highlights include:
|
||||||
|
|
||||||
|
* [CB-4817] Remove unused assets in project template.
|
||||||
|
* Fail fast in create script if package name is not com.foo.bar.
|
||||||
|
* [CB-4782] Convert ApplicationInfo.java -> appinfo.js
|
||||||
|
* [CB-4766] Deprecated JSONUtils.java (moved into plugins)
|
||||||
|
* [CB-4765] Deprecated ExifHelper.java (moved into plugins)
|
||||||
|
* [CB-4764] Deprecated DirectoryManager.java (moved into plugins)
|
||||||
|
* [CB-4763] Deprecated FileHelper.java (moved into plugins), Move getMimeType() into CordovaResourceApi.
|
||||||
|
* [CB-4725] Add CordovaWebView.CORDOVA_VERSION constant
|
||||||
|
* Incremeting version check for Android 4.3 API Level 18
|
||||||
|
* [CB-3542] rewrote cli tooling scripts in node
|
||||||
|
* Allow CordovaChromeClient subclasses access to CordovaInterface and CordovaWebView members
|
||||||
|
* Refactor CordovaActivity.init so that subclasses can easily override factory methods for webview objects
|
||||||
|
* [CB-4652] Allow default project template to be overridden on create
|
||||||
|
* Tweak the online bridge to not send excess online events.
|
||||||
|
* [CB-4495] Modify start-emulator script to exit immediately on a fatal emulator error.
|
||||||
|
* Log WebView IOExceptions only when they are not 404s
|
||||||
|
* Use a higher threshold for slow exec() warnings when debugger is attached.
|
||||||
|
* Fix data URI decoding in CordovaResourceApi
|
||||||
|
* [CB-3819] Made it easier to set SplashScreen delay.
|
||||||
|
* [CB-4013] Fixed loadUrlTimeoutValue preference.
|
||||||
|
* Upgrading project to Android 4.3
|
||||||
|
* [CB-4198] bin/create script should be better at handling non-word characters in activity name. Patched windows script as well.
|
||||||
|
* [CB-4198] bin/create should handle spaces in activity better.
|
||||||
|
* [CB-4096] Implemented new unified whitelist for android
|
||||||
|
* [CB-3384] Fix thread assertion when plugins remap URIs
|
||||||
|
* [CB-4133] Add main thread warning for plugins that run too long
|
||||||
|
* [CB-3384] Use the ExposedJsApi to detect webCore thread instead of IceCreamCordovaWebViewClient.
|
||||||
|
|
@ -65,14 +65,15 @@ function ensureJarIsBuilt(version, target_api) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function copyJsAndJar(projectPath, version) {
|
function copyJsAndJar(projectPath, version) {
|
||||||
shell.cp(path.join(ROOT, 'framework', 'assets', 'www', 'cordova.js'), path.join(projectPath, 'assets', 'www', 'cordova.js'));
|
shell.cp('-f', path.join(ROOT, 'framework', 'assets', 'www', 'cordova.js'), path.join(projectPath, 'assets', 'www', 'cordova.js'));
|
||||||
// Don't fail if there are no old jars.
|
// Don't fail if there are no old jars.
|
||||||
setShellFatal(false, function() {
|
setShellFatal(false, function() {
|
||||||
shell.ls(path.join(projectPath, 'libs', 'cordova-*.jar')).forEach(function(oldJar) {
|
shell.ls(path.join(projectPath, 'libs', 'cordova-*.jar')).forEach(function(oldJar) {
|
||||||
shell.rm('-f', path.join(projectPath, 'libs', oldJar));
|
console.log("Deleting " + oldJar);
|
||||||
|
shell.rm('-f', path.join(oldJar));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
shell.cp(path.join(ROOT, 'framework', 'cordova-' + version + '.jar'), path.join(projectPath, 'libs', 'cordova-' + version + '.jar'));
|
shell.cp('-f', path.join(ROOT, 'framework', 'cordova-' + version + '.jar'), path.join(projectPath, 'libs', 'cordova-' + version + '.jar'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyScripts(projectPath) {
|
function copyScripts(projectPath) {
|
||||||
@ -123,7 +124,7 @@ exports.createProject = function(project_path, package_name, project_name, proje
|
|||||||
project_template_dir :
|
project_template_dir :
|
||||||
path.join(ROOT, 'bin', 'templates', 'project');
|
path.join(ROOT, 'bin', 'templates', 'project');
|
||||||
|
|
||||||
var safe_activity_name = project_name.replace(/\W/, '');
|
var safe_activity_name = project_name.replace(/\W/g, '');
|
||||||
var package_as_path = package_name.replace(/\./g, path.sep);
|
var package_as_path = package_name.replace(/\./g, path.sep);
|
||||||
var activity_dir = path.join(project_path, 'src', package_as_path);
|
var activity_dir = path.join(project_path, 'src', package_as_path);
|
||||||
var activity_path = path.join(activity_dir, safe_activity_name + '.java');
|
var activity_path = path.join(activity_dir, safe_activity_name + '.java');
|
||||||
|
@ -20,6 +20,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Coho updates this line:
|
// Coho updates this line:
|
||||||
var VERSION = '3.1.0-dev';
|
var VERSION = "3.1.0";
|
||||||
|
|
||||||
console.log(VERSION);
|
console.log(VERSION);
|
||||||
|
822
framework/assets/www/cordova.js
vendored
822
framework/assets/www/cordova.js
vendored
@ -1,5 +1,5 @@
|
|||||||
// Platform: android
|
// Platform: android
|
||||||
// 3.0.0rc1-1-g1965a39
|
// 3.1.0
|
||||||
/*
|
/*
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
@ -19,7 +19,7 @@
|
|||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
;(function() {
|
;(function() {
|
||||||
var CORDOVA_JS_BUILD_LABEL = '3.0.0rc1-1-g1965a39';
|
var CORDOVA_JS_BUILD_LABEL = '3.1.0';
|
||||||
// file: lib/scripts/require.js
|
// file: lib/scripts/require.js
|
||||||
|
|
||||||
var require,
|
var require,
|
||||||
@ -100,16 +100,7 @@ define("cordova", function(require, exports, module) {
|
|||||||
|
|
||||||
|
|
||||||
var channel = require('cordova/channel');
|
var channel = require('cordova/channel');
|
||||||
|
var platform = require('cordova/platform');
|
||||||
/**
|
|
||||||
* Listen for DOMContentLoaded and notify our channel subscribers.
|
|
||||||
*/
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
channel.onDOMContentLoaded.fire();
|
|
||||||
}, false);
|
|
||||||
if (document.readyState == 'complete' || document.readyState == 'interactive') {
|
|
||||||
channel.onDOMContentLoaded.fire();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intercept calls to addEventListener + removeEventListener and handle deviceready,
|
* Intercept calls to addEventListener + removeEventListener and handle deviceready,
|
||||||
@ -177,21 +168,12 @@ function createEvent(type, data) {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof window.console === "undefined") {
|
|
||||||
window.console = {
|
|
||||||
log:function(){}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// there are places in the framework where we call `warn` also, so we should make sure it exists
|
|
||||||
if(typeof window.console.warn === "undefined") {
|
|
||||||
window.console.warn = function(msg) {
|
|
||||||
this.log("warn: " + msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var cordova = {
|
var cordova = {
|
||||||
define:define,
|
define:define,
|
||||||
require:require,
|
require:require,
|
||||||
|
version:CORDOVA_JS_BUILD_LABEL,
|
||||||
|
platformId:platform.id,
|
||||||
/**
|
/**
|
||||||
* Methods to add/remove your own addEventListener hijacking on document + window.
|
* Methods to add/remove your own addEventListener hijacking on document + window.
|
||||||
*/
|
*/
|
||||||
@ -326,15 +308,56 @@ var cordova = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Register pause, resume and deviceready channels as events on document.
|
|
||||||
channel.onPause = cordova.addDocumentEventHandler('pause');
|
|
||||||
channel.onResume = cordova.addDocumentEventHandler('resume');
|
|
||||||
channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
|
|
||||||
|
|
||||||
module.exports = cordova;
|
module.exports = cordova;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// file: lib/android/android/nativeapiprovider.js
|
||||||
|
define("cordova/android/nativeapiprovider", function(require, exports, module) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports the ExposedJsApi.java object if available, otherwise exports the PromptBasedNativeApi.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var nativeApi = this._cordovaNative || require('cordova/android/promptbasednativeapi');
|
||||||
|
var currentApi = nativeApi;
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
get: function() { return currentApi; },
|
||||||
|
setPreferPrompt: function(value) {
|
||||||
|
currentApi = value ? require('cordova/android/promptbasednativeapi') : nativeApi;
|
||||||
|
},
|
||||||
|
// Used only by tests.
|
||||||
|
set: function(value) {
|
||||||
|
currentApi = value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// file: lib/android/android/promptbasednativeapi.js
|
||||||
|
define("cordova/android/promptbasednativeapi", function(require, exports, module) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the API of ExposedJsApi.java, but uses prompt() to communicate.
|
||||||
|
* This is used only on the 2.3 simulator, where addJavascriptInterface() is broken.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
exec: function(service, action, callbackId, argsJson) {
|
||||||
|
return prompt(argsJson, 'gap:'+JSON.stringify([service, action, callbackId]));
|
||||||
|
},
|
||||||
|
setNativeToJsBridgeMode: function(value) {
|
||||||
|
prompt(value, 'gap_bridge_mode:');
|
||||||
|
},
|
||||||
|
retrieveJsMessages: function(fromOnlineEvent) {
|
||||||
|
return prompt(+fromOnlineEvent, 'gap_poll:');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// file: lib/common/argscheck.js
|
// file: lib/common/argscheck.js
|
||||||
define("cordova/argscheck", function(require, exports, module) {
|
define("cordova/argscheck", function(require, exports, module) {
|
||||||
|
|
||||||
@ -430,7 +453,7 @@ var b64_12bitTable = function() {
|
|||||||
}
|
}
|
||||||
b64_12bitTable = function() { return b64_12bit; };
|
b64_12bitTable = function() { return b64_12bit; };
|
||||||
return b64_12bit;
|
return b64_12bit;
|
||||||
}
|
};
|
||||||
|
|
||||||
function uint8ToBase64(rawData) {
|
function uint8ToBase64(rawData) {
|
||||||
var numBytes = rawData.byteLength;
|
var numBytes = rawData.byteLength;
|
||||||
@ -811,36 +834,6 @@ module.exports = channel;
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// file: lib/common/commandProxy.js
|
|
||||||
define("cordova/commandProxy", function(require, exports, module) {
|
|
||||||
|
|
||||||
|
|
||||||
// internal map of proxy function
|
|
||||||
var CommandProxyMap = {};
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
|
|
||||||
// example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
|
|
||||||
add:function(id,proxyObj) {
|
|
||||||
console.log("adding proxy for " + id);
|
|
||||||
CommandProxyMap[id] = proxyObj;
|
|
||||||
return proxyObj;
|
|
||||||
},
|
|
||||||
|
|
||||||
// cordova.commandProxy.remove("Accelerometer");
|
|
||||||
remove:function(id) {
|
|
||||||
var proxy = CommandProxyMap[id];
|
|
||||||
delete CommandProxyMap[id];
|
|
||||||
CommandProxyMap[id] = null;
|
|
||||||
return proxy;
|
|
||||||
},
|
|
||||||
|
|
||||||
get:function(service,action) {
|
|
||||||
return ( CommandProxyMap[service] ? CommandProxyMap[service][action] : null );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// file: lib/android/exec.js
|
// file: lib/android/exec.js
|
||||||
define("cordova/exec", function(require, exports, module) {
|
define("cordova/exec", function(require, exports, module) {
|
||||||
|
|
||||||
@ -859,7 +852,7 @@ define("cordova/exec", function(require, exports, module) {
|
|||||||
* @param {String[]} [args] Zero or more arguments to pass to the method
|
* @param {String[]} [args] Zero or more arguments to pass to the method
|
||||||
*/
|
*/
|
||||||
var cordova = require('cordova'),
|
var cordova = require('cordova'),
|
||||||
nativeApiProvider = require('cordova/plugin/android/nativeapiprovider'),
|
nativeApiProvider = require('cordova/android/nativeapiprovider'),
|
||||||
utils = require('cordova/utils'),
|
utils = require('cordova/utils'),
|
||||||
base64 = require('cordova/base64'),
|
base64 = require('cordova/base64'),
|
||||||
jsToNativeModes = {
|
jsToNativeModes = {
|
||||||
@ -928,8 +921,12 @@ function androidExec(success, fail, service, action, args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pollOnce() {
|
function pollOnceFromOnlineEvent() {
|
||||||
var msg = nativeApiProvider.get().retrieveJsMessages();
|
pollOnce(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pollOnce(opt_fromOnlineEvent) {
|
||||||
|
var msg = nativeApiProvider.get().retrieveJsMessages(!!opt_fromOnlineEvent);
|
||||||
androidExec.processMessages(msg);
|
androidExec.processMessages(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -948,8 +945,8 @@ function hookOnlineApis() {
|
|||||||
// It currently fires them only on document though, so we bridge them
|
// It currently fires them only on document though, so we bridge them
|
||||||
// to window here (while first listening for exec()-releated online/offline
|
// to window here (while first listening for exec()-releated online/offline
|
||||||
// events).
|
// events).
|
||||||
window.addEventListener('online', pollOnce, false);
|
window.addEventListener('online', pollOnceFromOnlineEvent, false);
|
||||||
window.addEventListener('offline', pollOnce, false);
|
window.addEventListener('offline', pollOnceFromOnlineEvent, false);
|
||||||
cordova.addWindowEventHandler('online');
|
cordova.addWindowEventHandler('online');
|
||||||
cordova.addWindowEventHandler('offline');
|
cordova.addWindowEventHandler('offline');
|
||||||
document.addEventListener('online', proxyEvent, false);
|
document.addEventListener('online', proxyEvent, false);
|
||||||
@ -1072,6 +1069,120 @@ androidExec.processMessages = function(messages) {
|
|||||||
|
|
||||||
module.exports = androidExec;
|
module.exports = androidExec;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// file: lib/common/init.js
|
||||||
|
define("cordova/init", function(require, exports, module) {
|
||||||
|
|
||||||
|
var channel = require('cordova/channel');
|
||||||
|
var cordova = require('cordova');
|
||||||
|
var modulemapper = require('cordova/modulemapper');
|
||||||
|
var platform = require('cordova/platform');
|
||||||
|
var pluginloader = require('cordova/pluginloader');
|
||||||
|
|
||||||
|
var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
|
||||||
|
|
||||||
|
function logUnfiredChannels(arr) {
|
||||||
|
for (var i = 0; i < arr.length; ++i) {
|
||||||
|
if (arr[i].state != 2) {
|
||||||
|
console.log('Channel not fired: ' + arr[i].type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.setTimeout(function() {
|
||||||
|
if (channel.onDeviceReady.state != 2) {
|
||||||
|
console.log('deviceready has not fired after 5 seconds.');
|
||||||
|
logUnfiredChannels(platformInitChannelsArray);
|
||||||
|
logUnfiredChannels(channel.deviceReadyChannelsArray);
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
|
// Replace navigator before any modules are required(), to ensure it happens as soon as possible.
|
||||||
|
// We replace it so that properties that can't be clobbered can instead be overridden.
|
||||||
|
function replaceNavigator(origNavigator) {
|
||||||
|
var CordovaNavigator = function() {};
|
||||||
|
CordovaNavigator.prototype = origNavigator;
|
||||||
|
var newNavigator = new CordovaNavigator();
|
||||||
|
// This work-around really only applies to new APIs that are newer than Function.bind.
|
||||||
|
// Without it, APIs such as getGamepads() break.
|
||||||
|
if (CordovaNavigator.bind) {
|
||||||
|
for (var key in origNavigator) {
|
||||||
|
if (typeof origNavigator[key] == 'function') {
|
||||||
|
newNavigator[key] = origNavigator[key].bind(origNavigator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newNavigator;
|
||||||
|
}
|
||||||
|
if (window.navigator) {
|
||||||
|
window.navigator = replaceNavigator(window.navigator);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!window.console) {
|
||||||
|
window.console = {
|
||||||
|
log: function(){}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (!window.console.warn) {
|
||||||
|
window.console.warn = function(msg) {
|
||||||
|
this.log("warn: " + msg);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register pause, resume and deviceready channels as events on document.
|
||||||
|
channel.onPause = cordova.addDocumentEventHandler('pause');
|
||||||
|
channel.onResume = cordova.addDocumentEventHandler('resume');
|
||||||
|
channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
|
||||||
|
|
||||||
|
// Listen for DOMContentLoaded and notify our channel subscribers.
|
||||||
|
if (document.readyState == 'complete' || document.readyState == 'interactive') {
|
||||||
|
channel.onDOMContentLoaded.fire();
|
||||||
|
} else {
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
channel.onDOMContentLoaded.fire();
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// _nativeReady is global variable that the native side can set
|
||||||
|
// to signify that the native code is ready. It is a global since
|
||||||
|
// it may be called before any cordova JS is ready.
|
||||||
|
if (window._nativeReady) {
|
||||||
|
channel.onNativeReady.fire();
|
||||||
|
}
|
||||||
|
|
||||||
|
modulemapper.clobbers('cordova', 'cordova');
|
||||||
|
modulemapper.clobbers('cordova/exec', 'cordova.exec');
|
||||||
|
modulemapper.clobbers('cordova/exec', 'Cordova.exec');
|
||||||
|
|
||||||
|
// Call the platform-specific initialization.
|
||||||
|
platform.bootstrap && platform.bootstrap();
|
||||||
|
|
||||||
|
pluginloader.load(function() {
|
||||||
|
channel.onPluginsReady.fire();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create all cordova objects once native side is ready.
|
||||||
|
*/
|
||||||
|
channel.join(function() {
|
||||||
|
modulemapper.mapModules(window);
|
||||||
|
|
||||||
|
platform.initialize && platform.initialize();
|
||||||
|
|
||||||
|
// Fire event to notify that all objects are created
|
||||||
|
channel.onCordovaReady.fire();
|
||||||
|
|
||||||
|
// Fire onDeviceReady event once page has fully loaded, all
|
||||||
|
// constructors have run and cordova info has been received from native
|
||||||
|
// side.
|
||||||
|
channel.join(function() {
|
||||||
|
require('cordova').fireDocumentEvent('deviceready');
|
||||||
|
}, channel.deviceReadyChannelsArray);
|
||||||
|
|
||||||
|
}, platformInitChannelsArray);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// file: lib/common/modulemapper.js
|
// file: lib/common/modulemapper.js
|
||||||
@ -1170,14 +1281,6 @@ exports.getOriginalSymbol = function(context, symbolPath) {
|
|||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.loadMatchingModules = function(matchingRegExp) {
|
|
||||||
for (var k in moduleMap) {
|
|
||||||
if (matchingRegExp.exec(k)) {
|
|
||||||
require(k);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.reset();
|
exports.reset();
|
||||||
|
|
||||||
|
|
||||||
@ -1187,17 +1290,20 @@ exports.reset();
|
|||||||
define("cordova/platform", function(require, exports, module) {
|
define("cordova/platform", function(require, exports, module) {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
id: "android",
|
id: 'android',
|
||||||
initialize:function() {
|
bootstrap: function() {
|
||||||
var channel = require("cordova/channel"),
|
var channel = require('cordova/channel'),
|
||||||
cordova = require('cordova'),
|
cordova = require('cordova'),
|
||||||
exec = require('cordova/exec'),
|
exec = require('cordova/exec'),
|
||||||
modulemapper = require('cordova/modulemapper');
|
modulemapper = require('cordova/modulemapper');
|
||||||
|
|
||||||
modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
|
// Tell the native code that a page change has occurred.
|
||||||
modulemapper.clobbers('cordova/plugin/android/app', 'navigator.app');
|
exec(null, null, 'PluginManager', 'startup', []);
|
||||||
|
// Tell the JS that the native side is ready.
|
||||||
|
channel.onNativeReady.fire();
|
||||||
|
|
||||||
modulemapper.mapModules(window);
|
// TODO: Extract this as a proper plugin.
|
||||||
|
modulemapper.clobbers('cordova/plugin/android/app', 'navigator.app');
|
||||||
|
|
||||||
// Inject a listener for the backbutton on the document.
|
// Inject a listener for the backbutton on the document.
|
||||||
var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
|
var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
|
||||||
@ -1213,9 +1319,9 @@ module.exports = {
|
|||||||
|
|
||||||
// Let native code know we are all done on the JS side.
|
// Let native code know we are all done on the JS side.
|
||||||
// Native code will then un-hide the WebView.
|
// Native code will then un-hide the WebView.
|
||||||
channel.join(function() {
|
channel.onCordovaReady.subscribe(function() {
|
||||||
exec(null, null, "App", "show", []);
|
exec(null, null, "App", "show", []);
|
||||||
}, [channel.onCordovaReady]);
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1296,435 +1402,11 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// file: lib/android/plugin/android/nativeapiprovider.js
|
|
||||||
define("cordova/plugin/android/nativeapiprovider", function(require, exports, module) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exports the ExposedJsApi.java object if available, otherwise exports the PromptBasedNativeApi.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var nativeApi = this._cordovaNative || require('cordova/plugin/android/promptbasednativeapi');
|
|
||||||
var currentApi = nativeApi;
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
get: function() { return currentApi; },
|
|
||||||
setPreferPrompt: function(value) {
|
|
||||||
currentApi = value ? require('cordova/plugin/android/promptbasednativeapi') : nativeApi;
|
|
||||||
},
|
|
||||||
// Used only by tests.
|
|
||||||
set: function(value) {
|
|
||||||
currentApi = value;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// file: lib/android/plugin/android/promptbasednativeapi.js
|
|
||||||
define("cordova/plugin/android/promptbasednativeapi", function(require, exports, module) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements the API of ExposedJsApi.java, but uses prompt() to communicate.
|
|
||||||
* This is used only on the 2.3 simulator, where addJavascriptInterface() is broken.
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
exec: function(service, action, callbackId, argsJson) {
|
|
||||||
return prompt(argsJson, 'gap:'+JSON.stringify([service, action, callbackId]));
|
|
||||||
},
|
|
||||||
setNativeToJsBridgeMode: function(value) {
|
|
||||||
prompt(value, 'gap_bridge_mode:');
|
|
||||||
},
|
|
||||||
retrieveJsMessages: function() {
|
|
||||||
return prompt('', 'gap_poll:');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// file: lib/android/plugin/android/storage.js
|
|
||||||
define("cordova/plugin/android/storage", function(require, exports, module) {
|
|
||||||
|
|
||||||
var utils = require('cordova/utils'),
|
|
||||||
exec = require('cordova/exec'),
|
|
||||||
channel = require('cordova/channel');
|
|
||||||
|
|
||||||
var queryQueue = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL result set object
|
|
||||||
* PRIVATE METHOD
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
var DroidDB_Rows = function() {
|
|
||||||
this.resultSet = []; // results array
|
|
||||||
this.length = 0; // number of rows
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get item from SQL result set
|
|
||||||
*
|
|
||||||
* @param row The row number to return
|
|
||||||
* @return The row object
|
|
||||||
*/
|
|
||||||
DroidDB_Rows.prototype.item = function(row) {
|
|
||||||
return this.resultSet[row];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL result set that is returned to user.
|
|
||||||
* PRIVATE METHOD
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
var DroidDB_Result = function() {
|
|
||||||
this.rows = new DroidDB_Rows();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback from native code when query is complete.
|
|
||||||
* PRIVATE METHOD
|
|
||||||
*
|
|
||||||
* @param id Query id
|
|
||||||
*/
|
|
||||||
function completeQuery(id, data) {
|
|
||||||
var query = queryQueue[id];
|
|
||||||
if (query) {
|
|
||||||
try {
|
|
||||||
delete queryQueue[id];
|
|
||||||
|
|
||||||
// Get transaction
|
|
||||||
var tx = query.tx;
|
|
||||||
|
|
||||||
// If transaction hasn't failed
|
|
||||||
// Note: We ignore all query results if previous query
|
|
||||||
// in the same transaction failed.
|
|
||||||
if (tx && tx.queryList[id]) {
|
|
||||||
|
|
||||||
// Save query results
|
|
||||||
var r = new DroidDB_Result();
|
|
||||||
r.rows.resultSet = data;
|
|
||||||
r.rows.length = data.length;
|
|
||||||
try {
|
|
||||||
if (typeof query.successCallback === 'function') {
|
|
||||||
query.successCallback(query.tx, r);
|
|
||||||
}
|
|
||||||
} catch (ex) {
|
|
||||||
console.log("executeSql error calling user success callback: "+ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
tx.queryComplete(id);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log("executeSql error: "+e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback from native code when query fails
|
|
||||||
* PRIVATE METHOD
|
|
||||||
*
|
|
||||||
* @param reason Error message
|
|
||||||
* @param id Query id
|
|
||||||
*/
|
|
||||||
function failQuery(reason, id) {
|
|
||||||
var query = queryQueue[id];
|
|
||||||
if (query) {
|
|
||||||
try {
|
|
||||||
delete queryQueue[id];
|
|
||||||
|
|
||||||
// Get transaction
|
|
||||||
var tx = query.tx;
|
|
||||||
|
|
||||||
// If transaction hasn't failed
|
|
||||||
// Note: We ignore all query results if previous query
|
|
||||||
// in the same transaction failed.
|
|
||||||
if (tx && tx.queryList[id]) {
|
|
||||||
tx.queryList = {};
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (typeof query.errorCallback === 'function') {
|
|
||||||
query.errorCallback(query.tx, reason);
|
|
||||||
}
|
|
||||||
} catch (ex) {
|
|
||||||
console.log("executeSql error calling user error callback: "+ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
tx.queryFailed(id, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
console.log("executeSql error: "+e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL query object
|
|
||||||
* PRIVATE METHOD
|
|
||||||
*
|
|
||||||
* @constructor
|
|
||||||
* @param tx The transaction object that this query belongs to
|
|
||||||
*/
|
|
||||||
var DroidDB_Query = function(tx) {
|
|
||||||
|
|
||||||
// Set the id of the query
|
|
||||||
this.id = utils.createUUID();
|
|
||||||
|
|
||||||
// Add this query to the queue
|
|
||||||
queryQueue[this.id] = this;
|
|
||||||
|
|
||||||
// Init result
|
|
||||||
this.resultSet = [];
|
|
||||||
|
|
||||||
// Set transaction that this query belongs to
|
|
||||||
this.tx = tx;
|
|
||||||
|
|
||||||
// Add this query to transaction list
|
|
||||||
this.tx.queryList[this.id] = this;
|
|
||||||
|
|
||||||
// Callbacks
|
|
||||||
this.successCallback = null;
|
|
||||||
this.errorCallback = null;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transaction object
|
|
||||||
* PRIVATE METHOD
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
var DroidDB_Tx = function() {
|
|
||||||
|
|
||||||
// Set the id of the transaction
|
|
||||||
this.id = utils.createUUID();
|
|
||||||
|
|
||||||
// Callbacks
|
|
||||||
this.successCallback = null;
|
|
||||||
this.errorCallback = null;
|
|
||||||
|
|
||||||
// Query list
|
|
||||||
this.queryList = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mark query in transaction as complete.
|
|
||||||
* If all queries are complete, call the user's transaction success callback.
|
|
||||||
*
|
|
||||||
* @param id Query id
|
|
||||||
*/
|
|
||||||
DroidDB_Tx.prototype.queryComplete = function(id) {
|
|
||||||
delete this.queryList[id];
|
|
||||||
|
|
||||||
// If no more outstanding queries, then fire transaction success
|
|
||||||
if (this.successCallback) {
|
|
||||||
var count = 0;
|
|
||||||
var i;
|
|
||||||
for (i in this.queryList) {
|
|
||||||
if (this.queryList.hasOwnProperty(i)) {
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (count === 0) {
|
|
||||||
try {
|
|
||||||
this.successCallback();
|
|
||||||
} catch(e) {
|
|
||||||
console.log("Transaction error calling user success callback: " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mark query in transaction as failed.
|
|
||||||
*
|
|
||||||
* @param id Query id
|
|
||||||
* @param reason Error message
|
|
||||||
*/
|
|
||||||
DroidDB_Tx.prototype.queryFailed = function(id, reason) {
|
|
||||||
|
|
||||||
// The sql queries in this transaction have already been run, since
|
|
||||||
// we really don't have a real transaction implemented in native code.
|
|
||||||
// However, the user callbacks for the remaining sql queries in transaction
|
|
||||||
// will not be called.
|
|
||||||
this.queryList = {};
|
|
||||||
|
|
||||||
if (this.errorCallback) {
|
|
||||||
try {
|
|
||||||
this.errorCallback(reason);
|
|
||||||
} catch(e) {
|
|
||||||
console.log("Transaction error calling user error callback: " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute SQL statement
|
|
||||||
*
|
|
||||||
* @param sql SQL statement to execute
|
|
||||||
* @param params Statement parameters
|
|
||||||
* @param successCallback Success callback
|
|
||||||
* @param errorCallback Error callback
|
|
||||||
*/
|
|
||||||
DroidDB_Tx.prototype.executeSql = function(sql, params, successCallback, errorCallback) {
|
|
||||||
|
|
||||||
// Init params array
|
|
||||||
if (typeof params === 'undefined') {
|
|
||||||
params = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create query and add to queue
|
|
||||||
var query = new DroidDB_Query(this);
|
|
||||||
queryQueue[query.id] = query;
|
|
||||||
|
|
||||||
// Save callbacks
|
|
||||||
query.successCallback = successCallback;
|
|
||||||
query.errorCallback = errorCallback;
|
|
||||||
|
|
||||||
// Call native code
|
|
||||||
exec(null, null, "Storage", "executeSql", [sql, params, query.id]);
|
|
||||||
};
|
|
||||||
|
|
||||||
var DatabaseShell = function() {
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start a transaction.
|
|
||||||
* Does not support rollback in event of failure.
|
|
||||||
*
|
|
||||||
* @param process {Function} The transaction function
|
|
||||||
* @param successCallback {Function}
|
|
||||||
* @param errorCallback {Function}
|
|
||||||
*/
|
|
||||||
DatabaseShell.prototype.transaction = function(process, errorCallback, successCallback) {
|
|
||||||
var tx = new DroidDB_Tx();
|
|
||||||
tx.successCallback = successCallback;
|
|
||||||
tx.errorCallback = errorCallback;
|
|
||||||
try {
|
|
||||||
process(tx);
|
|
||||||
} catch (e) {
|
|
||||||
console.log("Transaction error: "+e);
|
|
||||||
if (tx.errorCallback) {
|
|
||||||
try {
|
|
||||||
tx.errorCallback(e);
|
|
||||||
} catch (ex) {
|
|
||||||
console.log("Transaction error calling user error callback: "+e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open database
|
|
||||||
*
|
|
||||||
* @param name Database name
|
|
||||||
* @param version Database version
|
|
||||||
* @param display_name Database display name
|
|
||||||
* @param size Database size in bytes
|
|
||||||
* @return Database object
|
|
||||||
*/
|
|
||||||
var DroidDB_openDatabase = function(name, version, display_name, size) {
|
|
||||||
exec(null, null, "Storage", "openDatabase", [name, version, display_name, size]);
|
|
||||||
var db = new DatabaseShell();
|
|
||||||
return db;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
openDatabase:DroidDB_openDatabase,
|
|
||||||
failQuery:failQuery,
|
|
||||||
completeQuery:completeQuery
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// file: lib/android/plugin/android/storage/openDatabase.js
|
|
||||||
define("cordova/plugin/android/storage/openDatabase", function(require, exports, module) {
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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/echo.js
|
|
||||||
define("cordova/plugin/echo", function(require, exports, module) {
|
|
||||||
|
|
||||||
var exec = require('cordova/exec'),
|
|
||||||
utils = require('cordova/utils');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends the given message through exec() to the Echo plugin, which sends it back to the successCallback.
|
|
||||||
* @param successCallback invoked with a FileSystem object
|
|
||||||
* @param errorCallback invoked if error occurs retrieving file system
|
|
||||||
* @param message The string to be echoed.
|
|
||||||
* @param forceAsync Whether to force an async return value (for testing native->js bridge).
|
|
||||||
*/
|
|
||||||
module.exports = function(successCallback, errorCallback, message, forceAsync) {
|
|
||||||
var action = 'echo';
|
|
||||||
var messageIsMultipart = (utils.typeName(message) == "Array");
|
|
||||||
var args = messageIsMultipart ? message : [message];
|
|
||||||
|
|
||||||
if (utils.typeName(message) == 'ArrayBuffer') {
|
|
||||||
if (forceAsync) {
|
|
||||||
console.warn('Cannot echo ArrayBuffer with forced async, falling back to sync.');
|
|
||||||
}
|
|
||||||
action += 'ArrayBuffer';
|
|
||||||
} else if (messageIsMultipart) {
|
|
||||||
if (forceAsync) {
|
|
||||||
console.warn('Cannot echo MultiPart Array with forced async, falling back to sync.');
|
|
||||||
}
|
|
||||||
action += 'MultiPart';
|
|
||||||
} else if (forceAsync) {
|
|
||||||
action += 'Async';
|
|
||||||
}
|
|
||||||
|
|
||||||
exec(successCallback, errorCallback, "Echo", action, args);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// file: lib/common/pluginloader.js
|
// file: lib/common/pluginloader.js
|
||||||
define("cordova/pluginloader", function(require, exports, module) {
|
define("cordova/pluginloader", function(require, exports, module) {
|
||||||
|
|
||||||
var channel = require('cordova/channel');
|
|
||||||
var modulemapper = require('cordova/modulemapper');
|
var modulemapper = require('cordova/modulemapper');
|
||||||
|
|
||||||
// Helper function to inject a <script> tag.
|
// Helper function to inject a <script> tag.
|
||||||
@ -1737,7 +1419,7 @@ function injectScript(url, onload, onerror) {
|
|||||||
document.head.appendChild(script);
|
document.head.appendChild(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScriptLoadingComplete(moduleList) {
|
function onScriptLoadingComplete(moduleList, finishPluginLoading) {
|
||||||
// Loop through all the plugins and then through their clobbers and merges.
|
// Loop through all the plugins and then through their clobbers and merges.
|
||||||
for (var i = 0, module; module = moduleList[i]; i++) {
|
for (var i = 0, module; module = moduleList[i]; i++) {
|
||||||
if (module) {
|
if (module) {
|
||||||
@ -1770,28 +1452,21 @@ function onScriptLoadingComplete(moduleList) {
|
|||||||
finishPluginLoading();
|
finishPluginLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when:
|
|
||||||
// * There are plugins defined and all plugins are finished loading.
|
|
||||||
// * There are no plugins to load.
|
|
||||||
function finishPluginLoading() {
|
|
||||||
channel.onPluginsReady.fire();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for the cordova_plugins.js content.
|
// Handler for the cordova_plugins.js content.
|
||||||
// See plugman's plugin_loader.js for the details of this object.
|
// See plugman's plugin_loader.js for the details of this object.
|
||||||
// This function is only called if the really is a plugins array that isn't empty.
|
// This function is only called if the really is a plugins array that isn't empty.
|
||||||
// Otherwise the onerror response handler will just call finishPluginLoading().
|
// Otherwise the onerror response handler will just call finishPluginLoading().
|
||||||
function handlePluginsObject(path, moduleList) {
|
function handlePluginsObject(path, moduleList, finishPluginLoading) {
|
||||||
// Now inject the scripts.
|
// Now inject the scripts.
|
||||||
var scriptCounter = moduleList.length;
|
var scriptCounter = moduleList.length;
|
||||||
|
|
||||||
if (!scriptCounter) {
|
if (!scriptCounter) {
|
||||||
onScriptLoadingComplete();
|
finishPluginLoading();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
function scriptLoadedCallback() {
|
function scriptLoadedCallback() {
|
||||||
if (!--scriptCounter) {
|
if (!--scriptCounter) {
|
||||||
onScriptLoadingComplete(moduleList);
|
onScriptLoadingComplete(moduleList, finishPluginLoading);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1800,17 +1475,17 @@ function handlePluginsObject(path, moduleList) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function injectPluginScript(pathPrefix) {
|
function injectPluginScript(pathPrefix, finishPluginLoading) {
|
||||||
injectScript(pathPrefix + 'cordova_plugins.js', function(){
|
injectScript(pathPrefix + 'cordova_plugins.js', function(){
|
||||||
try {
|
try {
|
||||||
var moduleList = require("cordova/plugin_list");
|
var moduleList = require("cordova/plugin_list");
|
||||||
handlePluginsObject(pathPrefix, moduleList);
|
handlePluginsObject(pathPrefix, moduleList, finishPluginLoading);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Error loading cordova_plugins.js, file not found or something
|
// Error loading cordova_plugins.js, file not found or something
|
||||||
// this is an acceptable error, pre-3.0.0, so we just move on.
|
// this is an acceptable error, pre-3.0.0, so we just move on.
|
||||||
finishPluginLoading();
|
finishPluginLoading();
|
||||||
}
|
}
|
||||||
},finishPluginLoading); // also, add script load error handler for file not found
|
}, finishPluginLoading); // also, add script load error handler for file not found
|
||||||
}
|
}
|
||||||
|
|
||||||
function findCordovaPath() {
|
function findCordovaPath() {
|
||||||
@ -1830,28 +1505,32 @@ function findCordovaPath() {
|
|||||||
// Tries to load all plugins' js-modules.
|
// Tries to load all plugins' js-modules.
|
||||||
// This is an async process, but onDeviceReady is blocked on onPluginsReady.
|
// This is an async process, but onDeviceReady is blocked on onPluginsReady.
|
||||||
// onPluginsReady is fired when there are no plugins to load, or they are all done.
|
// onPluginsReady is fired when there are no plugins to load, or they are all done.
|
||||||
exports.load = function() {
|
exports.load = function(callback) {
|
||||||
var pathPrefix = findCordovaPath();
|
var pathPrefix = findCordovaPath();
|
||||||
if (pathPrefix === null) {
|
if (pathPrefix === null) {
|
||||||
console.log('Could not find cordova.js script tag. Plugin loading may fail.');
|
console.log('Could not find cordova.js script tag. Plugin loading may fail.');
|
||||||
pathPrefix = '';
|
pathPrefix = '';
|
||||||
}
|
}
|
||||||
injectPluginScript(pathPrefix);
|
injectPluginScript(pathPrefix, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// file: lib/common/symbols.js
|
// file: lib/common/urlutil.js
|
||||||
define("cordova/symbols", function(require, exports, module) {
|
define("cordova/urlutil", function(require, exports, module) {
|
||||||
|
|
||||||
var modulemapper = require('cordova/modulemapper');
|
var urlutil = exports;
|
||||||
|
var anchorEl = document.createElement('a');
|
||||||
|
|
||||||
// Use merges here in case others symbols files depend on this running first,
|
/**
|
||||||
// but fail to declare the dependency with a require().
|
* For already absolute URLs, returns what is passed in.
|
||||||
modulemapper.merges('cordova', 'cordova');
|
* For relative URLs, converts them to absolute ones.
|
||||||
modulemapper.clobbers('cordova/exec', 'cordova.exec');
|
*/
|
||||||
modulemapper.clobbers('cordova/exec', 'Cordova.exec');
|
urlutil.makeAbsolute = function(url) {
|
||||||
|
anchorEl.href = url;
|
||||||
|
return anchorEl.href;
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2028,93 +1707,6 @@ function UUIDcreatePart(length) {
|
|||||||
window.cordova = require('cordova');
|
window.cordova = require('cordova');
|
||||||
// file: lib/scripts/bootstrap.js
|
// file: lib/scripts/bootstrap.js
|
||||||
|
|
||||||
(function (context) {
|
require('cordova/init');
|
||||||
if (context._cordovaJsLoaded) {
|
|
||||||
throw new Error('cordova.js included multiple times.');
|
|
||||||
}
|
|
||||||
context._cordovaJsLoaded = true;
|
|
||||||
|
|
||||||
var channel = require('cordova/channel');
|
|
||||||
var pluginloader = require('cordova/pluginloader');
|
|
||||||
|
|
||||||
var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
|
|
||||||
|
|
||||||
function logUnfiredChannels(arr) {
|
|
||||||
for (var i = 0; i < arr.length; ++i) {
|
|
||||||
if (arr[i].state != 2) {
|
|
||||||
console.log('Channel not fired: ' + arr[i].type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.setTimeout(function() {
|
|
||||||
if (channel.onDeviceReady.state != 2) {
|
|
||||||
console.log('deviceready has not fired after 5 seconds.');
|
|
||||||
logUnfiredChannels(platformInitChannelsArray);
|
|
||||||
logUnfiredChannels(channel.deviceReadyChannelsArray);
|
|
||||||
}
|
|
||||||
}, 5000);
|
|
||||||
|
|
||||||
// Replace navigator before any modules are required(), to ensure it happens as soon as possible.
|
|
||||||
// We replace it so that properties that can't be clobbered can instead be overridden.
|
|
||||||
function replaceNavigator(origNavigator) {
|
|
||||||
var CordovaNavigator = function() {};
|
|
||||||
CordovaNavigator.prototype = origNavigator;
|
|
||||||
var newNavigator = new CordovaNavigator();
|
|
||||||
// This work-around really only applies to new APIs that are newer than Function.bind.
|
|
||||||
// Without it, APIs such as getGamepads() break.
|
|
||||||
if (CordovaNavigator.bind) {
|
|
||||||
for (var key in origNavigator) {
|
|
||||||
if (typeof origNavigator[key] == 'function') {
|
|
||||||
newNavigator[key] = origNavigator[key].bind(origNavigator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return newNavigator;
|
|
||||||
}
|
|
||||||
if (context.navigator) {
|
|
||||||
context.navigator = replaceNavigator(context.navigator);
|
|
||||||
}
|
|
||||||
|
|
||||||
// _nativeReady is global variable that the native side can set
|
|
||||||
// to signify that the native code is ready. It is a global since
|
|
||||||
// it may be called before any cordova JS is ready.
|
|
||||||
if (window._nativeReady) {
|
|
||||||
channel.onNativeReady.fire();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create all cordova objects once native side is ready.
|
|
||||||
*/
|
|
||||||
channel.join(function() {
|
|
||||||
// Call the platform-specific initialization
|
|
||||||
require('cordova/platform').initialize();
|
|
||||||
|
|
||||||
// Fire event to notify that all objects are created
|
|
||||||
channel.onCordovaReady.fire();
|
|
||||||
|
|
||||||
// Fire onDeviceReady event once page has fully loaded, all
|
|
||||||
// constructors have run and cordova info has been received from native
|
|
||||||
// side.
|
|
||||||
// This join call is deliberately made after platform.initialize() in
|
|
||||||
// order that plugins may manipulate channel.deviceReadyChannelsArray
|
|
||||||
// if necessary.
|
|
||||||
channel.join(function() {
|
|
||||||
require('cordova').fireDocumentEvent('deviceready');
|
|
||||||
}, channel.deviceReadyChannelsArray);
|
|
||||||
|
|
||||||
}, platformInitChannelsArray);
|
|
||||||
|
|
||||||
// Don't attempt to load when running unit tests.
|
|
||||||
if (typeof XMLHttpRequest != 'undefined') {
|
|
||||||
pluginloader.load();
|
|
||||||
}
|
|
||||||
}(window));
|
|
||||||
|
|
||||||
// file: lib/scripts/bootstrap-android.js
|
|
||||||
|
|
||||||
// Tell the native code that a page change has occurred.
|
|
||||||
require('cordova/exec')(null, null, 'PluginManager', 'startup', []);
|
|
||||||
require('cordova/channel').onNativeReady.fire();
|
|
||||||
|
|
||||||
})();
|
})();
|
@ -61,7 +61,7 @@ public class CordovaWebView extends WebView {
|
|||||||
|
|
||||||
public static final String TAG = "CordovaWebView";
|
public static final String TAG = "CordovaWebView";
|
||||||
|
|
||||||
public static final String CORDOVA_VERSION = "3.1.0-dev";
|
public static final String CORDOVA_VERSION = "3.1.0";
|
||||||
|
|
||||||
private ArrayList<Integer> keyDownCodes = new ArrayList<Integer>();
|
private ArrayList<Integer> keyDownCodes = new ArrayList<Integer>();
|
||||||
private ArrayList<Integer> keyUpCodes = new ArrayList<Integer>();
|
private ArrayList<Integer> keyUpCodes = new ArrayList<Integer>();
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
*/
|
||||||
package org.apache.cordova;
|
package org.apache.cordova;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
Loading…
Reference in New Issue
Block a user