Updated Branches: refs/heads/master 9814d1902 -> c9b3345a7
Updated VERSION and associated references to 1.8.0rc1. Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/c9b3345a Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/c9b3345a Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/c9b3345a Branch: refs/heads/master Commit: c9b3345a7ec5300e284f10d11ee561c9d99ad430 Parents: c566549 Author: Shazron Abdullah <shaz...@apache.org> Authored: Thu May 24 16:08:20 2012 -0700 Committer: Shazron Abdullah <shaz...@apache.org> Committed: Thu May 24 16:08:20 2012 -0700 ---------------------------------------------------------------------- CordovaInstaller/docs/releasenotes.md | 31 ++ CordovaLib/Classes/CDVAvailability.h | 3 +- CordovaLib/VERSION | 2 +- CordovaLib/javascript/cordova.ios.js | 435 +++++++++++++++++++++++++++- 4 files changed, 462 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/c9b3345a/CordovaInstaller/docs/releasenotes.md ---------------------------------------------------------------------- diff --git a/CordovaInstaller/docs/releasenotes.md b/CordovaInstaller/docs/releasenotes.md index 59e1aa3..57ed5c9 100644 --- a/CordovaInstaller/docs/releasenotes.md +++ b/CordovaInstaller/docs/releasenotes.md @@ -22,6 +22,37 @@ Cordova is a static library and static framework that enables developers to include the Cordova API in their iOS application projects easily, and also create new Cordova-based iOS application projects through an Xcode project template. +### 1.8.0rc1 (20120524) ### + +* Fixes CB-819 fail callback not invoked +* [CB-794] Add HTTP status code to FileTransferError object for iOS +* [CB-359] Updates to adhere to W3C spec for geolocation. Changing actions based on changes incorporated into cordova-js +* [CB-683] pause/resume events now should pass in event object into handlers +* [CB-464] rewrite of accel plugin, simplified accel to start/stop actions. +* [CB-623] added Logger plugin +* Fixed CB-513 - Remove cast functionality from CDVPluginResult, obsolete +* Fixed CB-594 - Remove checks for retainCount +* Fixed CB-637 - Add a doc on how to update the template project in the bin subfolder +* Updated bin folder scripts. +* Fixed CB-669 - verify.sh file in a new Cordova-based application project should not be included in the .app bundle +* Fixes CB-471 - LocalFileSystem.PERSISTENT "do not back up" file attribute iOS +* Fixed typo in File.getMetadata - error callback had OK instead of ERROR status +* Fixes CB-610 - Capture.bundle missing microphone image resources for retina iPad results in mis-drawn recording interface +* Fixes CB-751 - Undefined function is called when orientation change +* Fixes CB-754 - Use of -weak_library in 'other library flags' of generated template XCode app causes crashes in Simulator when Obj-C Blocks are used +* Fixes CB-628 - Scrub installation process, document artifacts of Xcode 3 support, mention no ARC +* Fixed CB-628 - Scrub installation process, document artifacts of Xcode 3 support, mention no ARC +* Fixes CB-684 - Not enough time for background execution of WebSQL/LocalStorage backup (when app goes to the background) +* Fixes CB-766 - Update bin/debug shell script to point to Homebrew ios-sim 1.4 download +* Fixes CB-464 - Refactor accelerometer native code in iOS +* Fixes CB-760 - Camera returns incorrect image size +* Fixed warning in CDVLocation +* Fixed EXC_BAD_ACCESS error in CDVAccelerometer +* Fixes CB-818 - Make CDVViewController also implement initWithNibName +* Fixes CB-825 - Makefile: remove direct download of Markdown and wkhtmltopdf (uses homebrew to download) + +<br /> + ### 1.7.0 (20120430) ### * Fixed CB-183, CB-54 - ios camera targetWidth/Height don't match the documentation Fixes CB-183 and CB-54 http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/c9b3345a/CordovaLib/Classes/CDVAvailability.h ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVAvailability.h b/CordovaLib/Classes/CDVAvailability.h index e4822f1..be8326d 100644 --- a/CordovaLib/Classes/CDVAvailability.h +++ b/CordovaLib/Classes/CDVAvailability.h @@ -28,6 +28,7 @@ #define __CORDOVA_1_6_0 10600 #define __CORDOVA_1_6_1 10601 #define __CORDOVA_1_7_0 10700 +#define __CORDOVA_1_8_0 10800 #define __CORDOVA_NA 99999 /* not available */ @@ -39,7 +40,7 @@ #endif */ #ifndef CORDOVA_VERSION_MIN_REQUIRED - #define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_1_7_0 + #define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_1_8_0 #endif /* http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/c9b3345a/CordovaLib/VERSION ---------------------------------------------------------------------- diff --git a/CordovaLib/VERSION b/CordovaLib/VERSION index 9dbb0c0..a1c17c9 100644 --- a/CordovaLib/VERSION +++ b/CordovaLib/VERSION @@ -1 +1 @@ -1.7.0 \ No newline at end of file +1.8.0rc1 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/c9b3345a/CordovaLib/javascript/cordova.ios.js ---------------------------------------------------------------------- diff --git a/CordovaLib/javascript/cordova.ios.js b/CordovaLib/javascript/cordova.ios.js index 18bf5a9..723324c 100644 --- a/CordovaLib/javascript/cordova.ios.js +++ b/CordovaLib/javascript/cordova.ios.js @@ -1,6 +1,6 @@ -// commit 4a4ba9985c920850fe3f229abc60de984e196ab5 +// commit 95f199e1c207dc89b84e79a9a7b27d6a3cc8fe14 -// File generated at :: Fri May 18 2012 14:54:13 GMT-0700 (PDT) +// File generated at :: Thu May 24 2012 15:40:28 GMT-0700 (PDT) /* Licensed to the Apache Software Foundation (ASF) under one @@ -711,6 +711,9 @@ module.exports = { children: { exec: { path: 'cordova/exec' + }, + logger: { + path: 'cordova/plugin/logger' } } }, @@ -1052,6 +1055,11 @@ module.exports = { } } }; + +// use the native logger +var logger = require("cordova/plugin/logger"); +logger.useConsole(false); + }); // file: lib/common/plugin/Acceleration.js @@ -1083,7 +1091,7 @@ for (var key in Camera) { * Gets a picture from source defined by "options.sourceType", and returns the * image as defined by the "options.destinationType" option. - * The defaults are sourceType=CAMERA and destinationType=FILE_URL. + * The defaults are sourceType=CAMERA and destinationType=FILE_URI. * * @param {Function} successCallback * @param {Function} errorCallback @@ -2029,7 +2037,7 @@ Entry.prototype.toURL = function() { Entry.prototype.toURI = function(mimeType) { console.log("DEPRECATED: Update your code to use 'toURL'"); // fullPath attribute contains the full URI - return this.fullPath; + return this.toURL(); }; /** @@ -3706,6 +3714,177 @@ var exec = require('cordova/exec'), module.exports = compass; }); +// file: lib/common/plugin/console-via-logger.js +define("cordova/plugin/console-via-logger", function(require, exports, module) { +//------------------------------------------------------------------------------ + +var logger = require("cordova/plugin/logger"); +var utils = require("cordova/utils"); + +//------------------------------------------------------------------------------ +// object that we're exporting +//------------------------------------------------------------------------------ +var console = module.exports; + +//------------------------------------------------------------------------------ +// copy of the original console object +//------------------------------------------------------------------------------ +var WinConsole = window.console; + +//------------------------------------------------------------------------------ +// whether to use the logger +//------------------------------------------------------------------------------ +var UseLogger = false; + +//------------------------------------------------------------------------------ +// Timers +//------------------------------------------------------------------------------ +var Timers = {}; + +//------------------------------------------------------------------------------ +// used for unimplemented methods +//------------------------------------------------------------------------------ +function noop() {} + +//------------------------------------------------------------------------------ +// used for unimplemented methods +//------------------------------------------------------------------------------ +console.useLogger = function (value) { + if (arguments.length) UseLogger = !!value; + + if (UseLogger) { + if (logger.useConsole()) { + throw new Error("console and logger are too intertwingly"); + } + } + + return UseLogger; +}; + +//------------------------------------------------------------------------------ +console.log = function() { + if (logger.useConsole()) return; + logger.log.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.error = function() { + if (logger.useConsole()) return; + logger.error.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.warn = function() { + if (logger.useConsole()) return; + logger.warn.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.info = function() { + if (logger.useConsole()) return; + logger.info.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.debug = function() { + if (logger.useConsole()) return; + logger.debug.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.assert = function(expression) { + if (expression) return; + + var message = utils.vformat(arguments[1], [].slice.call(arguments, 2)); + console.log("ASSERT: " + message); +}; + +//------------------------------------------------------------------------------ +console.clear = function() {}; + +//------------------------------------------------------------------------------ +console.dir = function(object) { + console.log("%o", object); +}; + +//------------------------------------------------------------------------------ +console.dirxml = function(node) { + console.log(node.innerHTML); +}; + +//------------------------------------------------------------------------------ +console.trace = noop; + +//------------------------------------------------------------------------------ +console.group = console.log; + +//------------------------------------------------------------------------------ +console.groupCollapsed = console.log; + +//------------------------------------------------------------------------------ +console.groupEnd = noop; + +//------------------------------------------------------------------------------ +console.time = function(name) { + Timers[name] = new Date().valueOf(); +}; + +//------------------------------------------------------------------------------ +console.timeEnd = function(name) { + var timeStart = Timers[name]; + if (!timeStart) { + console.warn("unknown timer: " + name); + return; + } + + var timeElapsed = new Date().valueOf() - timeStart; + console.log(name + ": " + timeElapsed + "ms"); +}; + +//------------------------------------------------------------------------------ +console.timeStamp = noop; + +//------------------------------------------------------------------------------ +console.profile = noop; + +//------------------------------------------------------------------------------ +console.profileEnd = noop; + +//------------------------------------------------------------------------------ +console.count = noop; + +//------------------------------------------------------------------------------ +console.exception = console.log; + +//------------------------------------------------------------------------------ +console.table = function(data, columns) { + console.log("%o", data); +}; + +//------------------------------------------------------------------------------ +// return a new function that calls both functions passed as args +//------------------------------------------------------------------------------ +function wrapperedOrigCall(orgFunc, newFunc) { + return function() { + var args = [].slice.call(arguments); + try { orgFunc.apply(WinConsole, args); } catch (e) {} + try { newFunc.apply(console, args); } catch (e) {} + }; +} + +//------------------------------------------------------------------------------ +// For every function that exists in the original console object, that +// also exists in the new console object, wrap the new console method +// with one that calls both +//------------------------------------------------------------------------------ +for (var key in console) { + if (typeof WinConsole[key] == "function") { + console[key] = wrapperedOrigCall(WinConsole[key], console[key]); + } +} + +}); + // file: lib/common/plugin/contacts.js define("cordova/plugin/contacts", function(require, exports, module) { var exec = require('cordova/exec'), @@ -4281,6 +4460,233 @@ module.exports = { }; }); +// file: lib/common/plugin/logger.js +define("cordova/plugin/logger", function(require, exports, module) { +//------------------------------------------------------------------------------ +// The logger module exports the following properties/functions: +// +// LOG - constant for the level LOG +// ERROR - constant for the level ERROR +// WARN - constant for the level WARN +// INFO - constant for the level INFO +// DEBUG - constant for the level DEBUG +// logLevel() - returns current log level +// logLevel(value) - sets and returns a new log level +// useConsole() - returns whether logger is using console +// useConsole(value) - sets and returns whether logger is using console +// log(message,...) - logs a message at level LOG +// error(message,...) - logs a message at level ERROR +// warn(message,...) - logs a message at level WARN +// info(message,...) - logs a message at level INFO +// debug(message,...) - logs a message at level DEBUG +// logLevel(level,message,...) - logs a message specified level +// +//------------------------------------------------------------------------------ + +var logger = exports; + +var exec = require('cordova/exec'); +var utils = require('cordova/utils'); + +var UseConsole = true; +var Queued = []; +var DeviceReady = false; +var CurrentLevel; + +/** + * Logging levels + */ + +var Levels = [ + "LOG", + "ERROR", + "WARN", + "INFO", + "DEBUG" +]; + +/* + * add the logging levels to the logger object and + * to a separate levelsMap object for testing + */ + +var LevelsMap = {}; +for (var i=0; i<Levels.length; i++) { + var level = Levels[i]; + LevelsMap[level] = i; + logger[level] = level; +} + +CurrentLevel = LevelsMap.WARN; + +/** + * Getter/Setter for the logging level + * + * Returns the current logging level. + * + * When a value is passed, sets the logging level to that value. + * The values should be one of the following constants: + * logger.LOG + * logger.ERROR + * logger.WARN + * logger.INFO + * logger.DEBUG + * + * The value used determines which messages get printed. The logging + * values above are in order, and only messages logged at the logging + * level or above will actually be displayed to the user. Eg, the + * default level is WARN, so only messages logged with LOG, ERROR, or + * WARN will be displayed; INFO and DEBUG messages will be ignored. + */ +logger.level = function (value) { + if (arguments.length) { + if (LevelsMap[value] === null) { + throw new Error("invalid logging level: " + value); + } + CurrentLevel = LevelsMap[value]; + } + + return Levels[CurrentLevel]; +}; + +/** + * Getter/Setter for the useConsole functionality + * + * When useConsole is true, the logger will log via the + * browser 'console' object. Otherwise, it will use the + * native Logger plugin. + */ +logger.useConsole = function (value) { + if (arguments.length) UseConsole = !!value; + + if (UseConsole) { + if (typeof console == "undefined") { + throw new Error("global console object is not defined"); + } + + if (typeof console.log != "function") { + throw new Error("global console object does not have a log function"); + } + + if (typeof console.useLogger == "function") { + if (console.useLogger()) { + throw new Error("console and logger are too intertwingly"); + } + } + } + + return UseConsole; +}; + +/** + * Logs a message at the LOG level. + * + * Parameters passed after message are used applied to + * the message with utils.format() + */ +logger.log = function(message) { logWithArgs("LOG", arguments); }; + +/** + * Logs a message at the ERROR level. + * + * Parameters passed after message are used applied to + * the message with utils.format() + */ +logger.error = function(message) { logWithArgs("ERROR", arguments); }; + +/** + * Logs a message at the WARN level. + * + * Parameters passed after message are used applied to + * the message with utils.format() + */ +logger.warn = function(message) { logWithArgs("WARN", arguments); }; + +/** + * Logs a message at the INFO level. + * + * Parameters passed after message are used applied to + * the message with utils.format() + */ +logger.info = function(message) { logWithArgs("INFO", arguments); }; + +/** + * Logs a message at the DEBUG level. + * + * Parameters passed after message are used applied to + * the message with utils.format() + */ +logger.debug = function(message) { logWithArgs("DEBUG", arguments); }; + +// log at the specified level with args +function logWithArgs(level, args) { + args = [level].concat([].slice.call(args)); + logger.logLevel.apply(logger, args); +} + +/** + * Logs a message at the specified level. + * + * Parameters passed after message are used applied to + * the message with utils.format() + */ +logger.logLevel = function(level, message /* , ... */) { + // format the message with the parameters + var formatArgs = [].slice.call(arguments, 2); + message = utils.vformat(message, formatArgs); + + if (LevelsMap[level] === null) { + throw new Error("invalid logging level: " + level); + } + + if (LevelsMap[level] > CurrentLevel) return; + + // queue the message if not yet at deviceready + if (!DeviceReady && !UseConsole) { + Queued.push([level, message]); + return; + } + + // if not using the console, use the native logger + if (!UseConsole) { + exec(null, null, "Logger", "logLevel", [level, message]); + return; + } + + // make sure console is not using logger + if (console.__usingCordovaLogger) { + throw new Error("console and logger are too intertwingly"); + } + + // log to the console + switch (level) { + case logger.LOG: console.log(message); break; + case logger.ERROR: console.log("ERROR: " + message); break; + case logger.WARN: console.log("WARN: " + message); break; + case logger.INFO: console.log("INFO: " + message); break; + case logger.DEBUG: console.log("DEBUG: " + message); break; + } +}; + +// when deviceready fires, log queued messages +logger.__onDeviceReady = function() { + if (DeviceReady) return; + + DeviceReady = true; + + for (var i=0; i<Queued.length; i++) { + var messageArgs = Queued[i]; + logger.logLevel(messageArgs[0], messageArgs[1]); + } + + Queued = null; +}; + +// add a deviceready event to log queued messages +document.addEventListener("deviceready", logger.__onDeviceReady, false); + +}); + // file: lib/common/plugin/network.js define("cordova/plugin/network", function(require, exports, module) { var exec = require('cordova/exec'), @@ -4469,10 +4875,16 @@ module.exports = function(uri, successCallback, errorCallback) { errorCallback(new FileError(error)); } }; + // sanity check for 'not:valid:filename' + if(!uri || uri.split(":").length > 2) { + setTimeout( function() { + fail(FileError.ENCODING_ERR); + },0); + return; + } // if successful, return either a file or directory entry var success = function(entry) { var result; - if (entry) { if (typeof successCallback === 'function') { // create appropriate Entry object @@ -4610,6 +5022,16 @@ utils.alert = function(msg) { /** * Formats a string and arguments following it ala sprintf() * + * see utils.vformat() for more information + */ +utils.format = function(formatString /* ,... */) { + var args = [].slice.call(arguments, 1); + return utils.vformat(formatString, args); +}; + +/** + * Formats a string and arguments following it ala vsprintf() + * * format chars: * %j - format arg as JSON * %o - format arg as JSON @@ -4621,14 +5043,13 @@ utils.alert = function(msg) { * for rationale, see FireBug's Console API: * http://getfirebug.com/wiki/index.php/Console_API */ -utils.format = function(formatString /* ,... */) { +utils.vformat = function(formatString, args) { if (formatString === null || formatString === undefined) return ""; if (arguments.length == 1) return formatString.toString(); var pattern = /(.*?)%(.)(.*)/; var rest = formatString.toString(); var result = []; - var args = [].slice.call(arguments,1); while (args.length) { var arg = args.shift();