This commit is contained in:
Joe Bowser 2013-05-26 16:13:50 -07:00
commit d36b1cc89d
3 changed files with 99 additions and 65 deletions

View File

@ -1 +1 @@
dev 2.8.0rc1

View File

@ -1,9 +1,5 @@
// Platform: android // Platform: android
// 2.8.0rc1-0-g22bc4d8
// commit d0ffb852378ff018bac2f3b12c38098a19b8ce00
// File generated at :: Thu Apr 18 2013 15:10:54 GMT-0400 (EDT)
/* /*
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
@ -22,26 +18,36 @@
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
*/ */
;(function() { ;(function() {
var CORDOVA_JS_BUILD_LABEL = '2.8.0rc1-0-g22bc4d8';
// file: lib/scripts/require.js // file: lib/scripts/require.js
var require, var require,
define; define;
(function () { (function () {
var modules = {}; var modules = {},
// Stack of moduleIds currently being built. // Stack of moduleIds currently being built.
var requireStack = []; requireStack = [],
// Map of module ID -> index into requireStack of modules currently being built. // Map of module ID -> index into requireStack of modules currently being built.
var inProgressModules = {}; inProgressModules = {},
SEPERATOR = ".";
function build(module) { function build(module) {
var factory = module.factory; var factory = module.factory,
localRequire = function (id) {
var resultantId = id;
//Its a relative path, so lop off the last portion and add the id (minus "./")
if (id.charAt(0) === ".") {
resultantId = module.id.slice(0, module.id.lastIndexOf(SEPERATOR)) + SEPERATOR + id.slice(2);
}
return require(resultantId);
};
module.exports = {}; module.exports = {};
delete module.factory; delete module.factory;
factory(require, module.exports, module); factory(localRequire, module.exports, module);
return module.exports; return module.exports;
} }
@ -1314,8 +1320,6 @@ var CaptureAudioOptions = function(){
this.limit = 1; this.limit = 1;
// Maximum duration of a single sound clip in seconds. // Maximum duration of a single sound clip in seconds.
this.duration = 0; this.duration = 0;
// The selected audio mode. Must match with one of the elements in supportedAudioModes array.
this.mode = null;
}; };
module.exports = CaptureAudioOptions; module.exports = CaptureAudioOptions;
@ -1356,8 +1360,6 @@ define("cordova/plugin/CaptureImageOptions", function(require, exports, module)
var CaptureImageOptions = function(){ var CaptureImageOptions = function(){
// Upper limit of images user can take. Value must be equal or greater than 1. // Upper limit of images user can take. Value must be equal or greater than 1.
this.limit = 1; this.limit = 1;
// The selected image mode. Must match with one of the elements in supportedImageModes array.
this.mode = null;
}; };
module.exports = CaptureImageOptions; module.exports = CaptureImageOptions;
@ -1375,8 +1377,6 @@ var CaptureVideoOptions = function(){
this.limit = 1; this.limit = 1;
// Maximum duration of a single video clip in seconds. // Maximum duration of a single video clip in seconds.
this.duration = 0; this.duration = 0;
// The selected video mode. Must match with one of the elements in supportedVideoModes array.
this.mode = null;
}; };
module.exports = CaptureVideoOptions; module.exports = CaptureVideoOptions;
@ -5081,12 +5081,16 @@ function Device() {
channel.onCordovaReady.subscribe(function() { channel.onCordovaReady.subscribe(function() {
me.getInfo(function(info) { me.getInfo(function(info) {
var buildLabel = info.cordova;
if (buildLabel != CORDOVA_JS_BUILD_LABEL) {
buildLabel += ' JS=' + CORDOVA_JS_BUILD_LABEL;
}
me.available = true; me.available = true;
me.platform = info.platform; me.platform = info.platform;
me.version = info.version; me.version = info.version;
me.name = info.name; me.name = info.name;
me.uuid = info.uuid; me.uuid = info.uuid;
me.cordova = info.cordova; me.cordova = buildLabel;
me.model = info.model; me.model = info.model;
channel.onCordovaInfoReady.fire(); channel.onCordovaInfoReady.fire();
},function(e) { },function(e) {
@ -5843,10 +5847,13 @@ var exec = require('cordova/exec');
var utils = require('cordova/utils'); var utils = require('cordova/utils');
var UseConsole = true; var UseConsole = true;
var UseLogger = true;
var Queued = []; var Queued = [];
var DeviceReady = false; var DeviceReady = false;
var CurrentLevel; var CurrentLevel;
var originalConsole = console;
/** /**
* Logging levels * Logging levels
*/ */
@ -5907,8 +5914,7 @@ logger.level = function (value) {
* Getter/Setter for the useConsole functionality * Getter/Setter for the useConsole functionality
* *
* When useConsole is true, the logger will log via the * When useConsole is true, the logger will log via the
* browser 'console' object. Otherwise, it will use the * browser 'console' object.
* native Logger plugin.
*/ */
logger.useConsole = function (value) { logger.useConsole = function (value) {
if (arguments.length) UseConsole = !!value; if (arguments.length) UseConsole = !!value;
@ -5932,6 +5938,18 @@ logger.useConsole = function (value) {
return UseConsole; return UseConsole;
}; };
/**
* Getter/Setter for the useLogger functionality
*
* When useLogger is true, the logger will log via the
* native Logger plugin.
*/
logger.useLogger = function (value) {
// Enforce boolean
if (arguments.length) UseLogger = !!value;
return UseLogger;
};
/** /**
* Logs a message at the LOG level. * Logs a message at the LOG level.
* *
@ -6001,24 +6019,26 @@ logger.logLevel = function(level /* , ... */) {
return; return;
} }
// if not using the console, use the native logger // Log using the native logger if that is enabled
if (!UseConsole) { if (UseLogger) {
exec(null, null, "Logger", "logLevel", [level, message]); exec(null, null, "Logger", "logLevel", [level, message]);
return;
} }
// make sure console is not using logger // Log using the console if that is enabled
if (console.__usingCordovaLogger) { if (UseConsole) {
throw new Error("console and logger are too intertwingly"); // make sure console is not using logger
} if (console.__usingCordovaLogger) {
throw new Error("console and logger are too intertwingly");
}
// log to the console // log to the console
switch (level) { switch (level) {
case logger.LOG: console.log(message); break; case logger.LOG: originalConsole.log(message); break;
case logger.ERROR: console.log("ERROR: " + message); break; case logger.ERROR: originalConsole.log("ERROR: " + message); break;
case logger.WARN: console.log("WARN: " + message); break; case logger.WARN: originalConsole.log("WARN: " + message); break;
case logger.INFO: console.log("INFO: " + message); break; case logger.INFO: originalConsole.log("INFO: " + message); break;
case logger.DEBUG: console.log("DEBUG: " + message); break; case logger.DEBUG: originalConsole.log("DEBUG: " + message); break;
}
} }
}; };
@ -6279,7 +6299,7 @@ module.exports = {
// Some platforms take an array of button label names. // Some platforms take an array of button label names.
// Other platforms take a comma separated list. // Other platforms take a comma separated list.
// For compatibility, we convert to the desired type based on the platform. // For compatibility, we convert to the desired type based on the platform.
if (platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone") { if (platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone" || platform.id == "blackberry10") {
if (typeof _buttonLabels === 'string') { if (typeof _buttonLabels === 'string') {
var buttonLabelString = _buttonLabels; var buttonLabelString = _buttonLabels;
_buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here _buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here
@ -6303,12 +6323,14 @@ module.exports = {
* @param {Function} resultCallback The callback that is called when user clicks on a button. * @param {Function} resultCallback The callback that is called when user clicks on a button.
* @param {String} title Title of the dialog (default: "Prompt") * @param {String} title Title of the dialog (default: "Prompt")
* @param {Array} buttonLabels Array of strings for the button labels (default: ["OK","Cancel"]) * @param {Array} buttonLabels Array of strings for the button labels (default: ["OK","Cancel"])
* @param {String} defaultText Textbox input value (default: "Default text")
*/ */
prompt: function(message, resultCallback, title, buttonLabels) { prompt: function(message, resultCallback, title, buttonLabels, defaultText) {
var _message = (message || "Prompt message"); var _message = (message || "Prompt message");
var _title = (title || "Prompt"); var _title = (title || "Prompt");
var _buttonLabels = (buttonLabels || ["OK","Cancel"]); var _buttonLabels = (buttonLabels || ["OK","Cancel"]);
exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels]); var _defaultText = (defaultText || "Default text");
exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]);
}, },
/** /**
@ -6650,9 +6672,7 @@ function UUIDcreatePart(length) {
}); });
window.cordova = require('cordova'); window.cordova = require('cordova');
// file: lib/scripts/bootstrap.js // file: lib/scripts/bootstrap.js
(function (context) { (function (context) {
@ -6768,7 +6788,7 @@ require('cordova/channel').onNativeReady.fire();
// 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 XHR response handler will just call finishPluginLoading(). // Otherwise the XHR response handler will just call finishPluginLoading().
function handlePluginsObject(modules) { function handlePluginsObject(modules, path) {
// First create the callback for when all plugins are loaded. // First create the callback for when all plugins are loaded.
var mapper = context.cordova.require('cordova/modulemapper'); var mapper = context.cordova.require('cordova/modulemapper');
onScriptLoadingComplete = function() { onScriptLoadingComplete = function() {
@ -6802,35 +6822,49 @@ require('cordova/channel').onNativeReady.fire();
// Now inject the scripts. // Now inject the scripts.
for (var i = 0; i < modules.length; i++) { for (var i = 0; i < modules.length; i++) {
injectScript(modules[i].file); injectScript(path + modules[i].file);
} }
} }
// Find the root of the app
// Try to XHR the cordova_plugins.json file asynchronously. var path = '';
try { // we commented we were going to try, so let us actually try and catch var scripts = document.getElementsByTagName('script');
var xhr = new context.XMLHttpRequest(); var term = 'cordova.js';
xhr.onload = function() { for (var n = scripts.length-1; n>-1; n--) {
// If the response is a JSON string which composes an array, call handlePluginsObject. var src = scripts[n].src;
// If the request fails, or the response is not a JSON array, just call finishPluginLoading. if (src.indexOf(term) == (src.length - term.length)) {
var obj = JSON.parse(this.responseText); path = src.substring(0, src.length - term.length);
if (obj && obj instanceof Array && obj.length > 0) { break;
handlePluginsObject(obj); }
} else {
finishPluginLoading();
}
};
xhr.onerror = function() {
finishPluginLoading();
};
xhr.open('GET', 'cordova_plugins.json', true); // Async
xhr.send();
} }
catch(err){ // Try to XHR the cordova_plugins.json file asynchronously.
var xhr = new XMLHttpRequest();
xhr.onload = function() {
// If the response is a JSON string which composes an array, call handlePluginsObject.
// If the request fails, or the response is not a JSON array, just call finishPluginLoading.
var obj;
try {
obj = (this.status == 0 || this.status == 200) && this.responseText && JSON.parse(this.responseText);
} catch (err) {
// obj will be undefined.
}
if (Array.isArray(obj) && obj.length > 0) {
handlePluginsObject(obj, path);
} else {
finishPluginLoading();
}
};
xhr.onerror = function() {
finishPluginLoading();
};
var plugins_json = path + 'cordova_plugins.json';
try { // we commented we were going to try, so let us actually try and catch
xhr.open('GET', plugins_json, true); // Async
xhr.send();
} catch(err){
finishPluginLoading(); finishPluginLoading();
} }
}(window)); }(window));
})(); })();

View File

@ -38,7 +38,7 @@ import android.telephony.TelephonyManager;
public class Device extends CordovaPlugin { public class Device extends CordovaPlugin {
public static final String TAG = "Device"; public static final String TAG = "Device";
public static String cordovaVersion = "dev"; // Cordova version public static String cordovaVersion = "2.8.0rc1"; // Cordova version
public static String platform = "Android"; // Device OS public static String platform = "Android"; // Device OS
public static String uuid; // Device UUID public static String uuid; // Device UUID