You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/05/17 03:52:03 UTC
[01/21] ios commit: [CB-3394] Cordova iOS crashes when multiple
access elements in config.xml
Updated Branches:
refs/heads/3.0.0 fc82f05c7 -> 98edd9277
[CB-3394] Cordova iOS crashes when multiple access elements in config.xml
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/8fce6749
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/8fce6749
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/8fce6749
Branch: refs/heads/3.0.0
Commit: 8fce6749ebce9e1b8d17bfd45add2988dcb4d90b
Parents: 4b672e0
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed May 15 12:52:01 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed May 15 12:52:01 2013 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDVWhitelist.m | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8fce6749/CordovaLib/Classes/CDVWhitelist.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWhitelist.m b/CordovaLib/Classes/CDVWhitelist.m
index 686a0ed..13a2572 100644
--- a/CordovaLib/Classes/CDVWhitelist.m
+++ b/CordovaLib/Classes/CDVWhitelist.m
@@ -124,7 +124,7 @@ NSString* const kCDVDefaultSchemeName = @"cdv-default-scheme";
// check for single wildcard '*', if found set allowAll to YES
if ([host isEqualToString:@"*"]) {
- [_expandedWhitelists setObject:[NSArray arrayWithObject:host] forKey:scheme];
+ [_expandedWhitelists setObject:[NSMutableArray arrayWithObject:host] forKey:scheme];
continue;
}
[16/21] ios commit: updated js
Posted by st...@apache.org.
updated js
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/03f6d175
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/03f6d175
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/03f6d175
Branch: refs/heads/3.0.0
Commit: 03f6d175c5d1513147c7e7ff4458d7061fde0207
Parents: d54eb3b
Author: Steven Gill <st...@gmail.com>
Authored: Tue May 14 17:09:10 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:48:52 2013 -0700
----------------------------------------------------------------------
CordovaLib/cordova.js | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/03f6d175/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index fd5f13d..df1879c 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -1,5 +1,5 @@
// Platform: ios
-// 2.7.0rc1-48-gfa57a36
+// 2.7.0rc1-52-g75b136a
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -19,7 +19,7 @@
under the License.
*/
;(function() {
-var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-48-gfa57a36';
+var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-52-g75b136a';
// file: lib/scripts/require.js
var require,
@@ -6119,7 +6119,7 @@ require('cordova/channel').onNativeReady.fire();
finishPluginLoading();
};
try { // we commented we were going to try, so let us actually try and catch
- xhr.open('GET', '/cordova_plugins.json', true); // Async
+ xhr.open('GET', 'cordova_plugins.json', true); // Async
xhr.send();
} catch(err){
finishPluginLoading();
[21/21] ios commit: Merge branch '3.0.0' of
https://git-wip-us.apache.org/repos/asf/cordova-ios into 3.0.0
Posted by st...@apache.org.
Merge branch '3.0.0' of https://git-wip-us.apache.org/repos/asf/cordova-ios into 3.0.0
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/98edd927
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/98edd927
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/98edd927
Branch: refs/heads/3.0.0
Commit: 98edd9277cad3c56a20dc2a6aac7ead2471b164e
Parents: 4b2365e fc82f05
Author: Steven Gill <st...@gmail.com>
Authored: Thu May 16 18:51:52 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:51:52 2013 -0700
----------------------------------------------------------------------
----------------------------------------------------------------------
[13/21] ios commit: removed geolocation from config.xml
Posted by st...@apache.org.
removed geolocation from config.xml
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/6aa4511a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/6aa4511a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/6aa4511a
Branch: refs/heads/3.0.0
Commit: 6aa4511a70ae1563264a307867755e3101beb914
Parents: ae298cf
Author: Steven Gill <st...@gmail.com>
Authored: Tue May 14 14:30:11 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:48:52 2013 -0700
----------------------------------------------------------------------
bin/templates/project/__TESTING__/config.xml | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6aa4511a/bin/templates/project/__TESTING__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/config.xml b/bin/templates/project/__TESTING__/config.xml
index d1da01d..c43360e 100644
--- a/bin/templates/project/__TESTING__/config.xml
+++ b/bin/templates/project/__TESTING__/config.xml
@@ -35,9 +35,6 @@
<preference name="TopActivityIndicator" value="gray" />
- <feature name="Geolocation">
- <param name="ios-package" value="CDVLocation"/>
- </feature>
<feature name="Device">
<param name="ios-package" value="CDVDevice"/>
</feature>
[08/21] ios commit: Re-added LocalStorage core plugin to config.xml
Posted by st...@apache.org.
Re-added LocalStorage core plugin to config.xml
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/e425e846
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/e425e846
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/e425e846
Branch: refs/heads/3.0.0
Commit: e425e84637cba793150a47dc11e8b03d81a64673
Parents: 93784cd
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu May 16 11:12:03 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu May 16 11:12:03 2013 -0700
----------------------------------------------------------------------
CordovaLibTests/CordovaLibApp/config.xml | 3 +++
bin/templates/project/__TESTING__/config.xml | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e425e846/CordovaLibTests/CordovaLibApp/config.xml
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CordovaLibApp/config.xml b/CordovaLibTests/CordovaLibApp/config.xml
index cc1256a..3e84967 100644
--- a/CordovaLibTests/CordovaLibApp/config.xml
+++ b/CordovaLibTests/CordovaLibApp/config.xml
@@ -89,4 +89,7 @@
<feature name="Logger">
<param name="ios-package" value="CDVLogger"/>
</feature>
+ <feature name="LocalStorage">
+ <param name="ios-package" value="CDVLocalStorage"/>
+ </feature>
</widget>
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e425e846/bin/templates/project/__TESTING__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/config.xml b/bin/templates/project/__TESTING__/config.xml
index cc1256a..3e84967 100644
--- a/bin/templates/project/__TESTING__/config.xml
+++ b/bin/templates/project/__TESTING__/config.xml
@@ -89,4 +89,7 @@
<feature name="Logger">
<param name="ios-package" value="CDVLogger"/>
</feature>
+ <feature name="LocalStorage">
+ <param name="ios-package" value="CDVLocalStorage"/>
+ </feature>
</widget>
[11/21] ios commit: updated js by removing Accel code
Posted by st...@apache.org.
updated js by removing Accel code
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/ad8fc472
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/ad8fc472
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/ad8fc472
Branch: refs/heads/3.0.0
Commit: ad8fc472822403568c1d68676d54a1dc40a15a49
Parents: d2b1c4b
Author: Steven Gill <st...@gmail.com>
Authored: Thu May 2 13:14:05 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:47:52 2013 -0700
----------------------------------------------------------------------
CordovaLib/cordova.js | 247 ++++++--------------------------------------
1 files changed, 32 insertions(+), 215 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ad8fc472/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index b716939..9f72dd6 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -1,9 +1,6 @@
// Platform: ios
-
-// commit cd29cf0f224ccf25e9d422a33fd02ef67d3a78f4
-
-// File generated at :: Mon Apr 29 2013 16:14:47 GMT-0700 (PDT)
-
+// 2.7.0rc1-9-g2dde8a7
+// File generated at :: Thu May 02 2013 12:01:11 GMT-0700 (PDT)
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -22,9 +19,8 @@
specific language governing permissions and limitations
under the License.
*/
-
;(function() {
-
+var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-9-g2dde8a7';
// file: lib/scripts/require.js
var require,
@@ -1139,20 +1135,6 @@ module.exports = {
});
-// file: lib/common/plugin/Acceleration.js
-define("cordova/plugin/Acceleration", function(require, exports, module) {
-
-var Acceleration = function(x, y, z, timestamp) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.timestamp = timestamp || (new Date()).getTime();
-};
-
-module.exports = Acceleration;
-
-});
-
// file: lib/common/plugin/Camera.js
define("cordova/plugin/Camera", function(require, exports, module) {
@@ -1301,8 +1283,6 @@ var CaptureAudioOptions = function(){
this.limit = 1;
// Maximum duration of a single sound clip in seconds.
this.duration = 0;
- // The selected audio mode. Must match with one of the elements in supportedAudioModes array.
- this.mode = null;
};
module.exports = CaptureAudioOptions;
@@ -1343,8 +1323,6 @@ define("cordova/plugin/CaptureImageOptions", function(require, exports, module)
var CaptureImageOptions = function(){
// Upper limit of images user can take. Value must be equal or greater than 1.
this.limit = 1;
- // The selected image mode. Must match with one of the elements in supportedImageModes array.
- this.mode = null;
};
module.exports = CaptureImageOptions;
@@ -1362,8 +1340,6 @@ var CaptureVideoOptions = function(){
this.limit = 1;
// Maximum duration of a single video clip in seconds.
this.duration = 0;
- // The selected video mode. Must match with one of the elements in supportedVideoModes array.
- this.mode = null;
};
module.exports = CaptureVideoOptions;
@@ -3767,172 +3743,6 @@ module.exports = ProgressEvent;
});
-// file: lib/common/plugin/accelerometer.js
-define("cordova/plugin/accelerometer", function(require, exports, module) {
-
-/**
- * This class provides access to device accelerometer data.
- * @constructor
- */
-var argscheck = require('cordova/argscheck'),
- utils = require("cordova/utils"),
- exec = require("cordova/exec"),
- Acceleration = require('cordova/plugin/Acceleration');
-
-// Is the accel sensor running?
-var running = false;
-
-// Keeps reference to watchAcceleration calls.
-var timers = {};
-
-// Array of listeners; used to keep track of when we should call start and stop.
-var listeners = [];
-
-// Last returned acceleration object from native
-var accel = null;
-
-// Tells native to start.
-function start() {
- exec(function(a) {
- var tempListeners = listeners.slice(0);
- accel = new Acceleration(a.x, a.y, a.z, a.timestamp);
- for (var i = 0, l = tempListeners.length; i < l; i++) {
- tempListeners[i].win(accel);
- }
- }, function(e) {
- var tempListeners = listeners.slice(0);
- for (var i = 0, l = tempListeners.length; i < l; i++) {
- tempListeners[i].fail(e);
- }
- }, "Accelerometer", "start", []);
- running = true;
-}
-
-// Tells native to stop.
-function stop() {
- exec(null, null, "Accelerometer", "stop", []);
- running = false;
-}
-
-// Adds a callback pair to the listeners array
-function createCallbackPair(win, fail) {
- return {win:win, fail:fail};
-}
-
-// Removes a win/fail listener pair from the listeners array
-function removeListeners(l) {
- var idx = listeners.indexOf(l);
- if (idx > -1) {
- listeners.splice(idx, 1);
- if (listeners.length === 0) {
- stop();
- }
- }
-}
-
-var accelerometer = {
- /**
- * Asynchronously acquires the current acceleration.
- *
- * @param {Function} successCallback The function to call when the acceleration data is available
- * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL)
- * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
- */
- getCurrentAcceleration: function(successCallback, errorCallback, options) {
- argscheck.checkArgs('fFO', 'accelerometer.getCurrentAcceleration', arguments);
-
- var p;
- var win = function(a) {
- removeListeners(p);
- successCallback(a);
- };
- var fail = function(e) {
- removeListeners(p);
- errorCallback && errorCallback(e);
- };
-
- p = createCallbackPair(win, fail);
- listeners.push(p);
-
- if (!running) {
- start();
- }
- },
-
- /**
- * Asynchronously acquires the acceleration repeatedly at a given interval.
- *
- * @param {Function} successCallback The function to call each time the acceleration data is available
- * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL)
- * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
- * @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;
-
- // 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 && errorCallback(e);
- });
- listeners.push(p);
-
- timers[id] = {
- timer:window.setInterval(function() {
- if (accel) {
- successCallback(accel);
- }
- }, frequency),
- listeners:p
- };
-
- 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) {
- successCallback(accel);
- }
- } else {
- start();
- }
-
- return id;
- },
-
- /**
- * Clears the specified accelerometer watch.
- *
- * @param {String} id The id of the watch returned from #watchAcceleration.
- */
- clearWatch: function(id) {
- // Stop javascript timer & remove from timer list
- if (id && timers[id]) {
- window.clearInterval(timers[id].timer);
- removeListeners(timers[id].listeners);
- delete timers[id];
- }
- }
-};
-
-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/common/plugin/battery.js
define("cordova/plugin/battery", function(require, exports, module) {
@@ -4511,12 +4321,16 @@ function Device() {
channel.onCordovaReady.subscribe(function() {
me.getInfo(function(info) {
+ var buildLabel = info.cordova;
+ if (buildLabel != CORDOVA_JS_BUILD_LABEL) {
+ buildLabel += ' JS=' + CORDOVA_JS_BUILD_LABEL;
+ }
me.available = true;
me.platform = info.platform;
me.version = info.version;
me.name = info.name;
me.uuid = info.uuid;
- me.cordova = info.cordova;
+ me.cordova = buildLabel;
me.model = info.model;
channel.onCordovaInfoReady.fire();
},function(e) {
@@ -5886,12 +5700,14 @@ module.exports = {
* @param {Function} resultCallback The callback that is called when user clicks on a button.
* @param {String} title Title of the dialog (default: "Prompt")
* @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 _title = (title || "Prompt");
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]);
},
/**
@@ -6233,9 +6049,7 @@ function UUIDcreatePart(length) {
});
-
window.cordova = require('cordova');
-
// file: lib/scripts/bootstrap.js
(function (context) {
@@ -6391,29 +6205,32 @@ require('cordova/channel').onNativeReady.fire();
// Try to XHR the cordova_plugins.json file asynchronously.
- try { // we commented we were going to try, so let us actually try and catch
- var xhr = new context.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 = this.responseText && JSON.parse(this.responseText);
- if (obj && obj instanceof Array && obj.length > 0) {
- handlePluginsObject(obj);
- } else {
- finishPluginLoading();
- }
- };
- xhr.onerror = function() {
+ 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 == 200 && this.responseText && JSON.parse(this.responseText);
+ } catch (err) {
+ // obj will be undefined.
+ }
+ if (Array.isArray(obj) && obj.length > 0) {
+ handlePluginsObject(obj);
+ } else {
finishPluginLoading();
- };
+ }
+ };
+ xhr.onerror = function() {
+ finishPluginLoading();
+ };
+ try { // we commented we were going to try, so let us actually try and catch
xhr.open('GET', 'cordova_plugins.json', true); // Async
xhr.send();
- }
- catch(err){
+ } catch(err){
finishPluginLoading();
}
}(window));
-
})();
\ No newline at end of file
[04/21] ios commit: CordovaLib Unit Tests: Add missing ImageIO
framework
Posted by st...@apache.org.
CordovaLib Unit Tests: Add missing ImageIO framework
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/9f590ad4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/9f590ad4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/9f590ad4
Branch: refs/heads/3.0.0
Commit: 9f590ad41b86133a2c81a637cd463b8b2abddce8
Parents: 8eaefcf
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu May 16 09:40:07 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu May 16 09:40:07 2013 -0700
----------------------------------------------------------------------
.../CordovaTests.xcodeproj/project.pbxproj | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9f590ad4/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj b/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
index c759571..1a33241 100644
--- a/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
+++ b/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 302193F91745430F00BC8D2B /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 302193F81745430F00BC8D2B /* ImageIO.framework */; };
3035621714104C34006C2D43 /* CDVWhitelistTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 30356213141049E1006C2D43 /* CDVWhitelistTests.m */; };
303A406A152124BB00182201 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 686357AA141002F100DF4CF2 /* UIKit.framework */; };
303A406B152124BB00182201 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 686357AC141002F100DF4CF2 /* Foundation.framework */; };
@@ -76,6 +77,7 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
+ 302193F81745430F00BC8D2B /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
30356213141049E1006C2D43 /* CDVWhitelistTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWhitelistTests.m; sourceTree = "<group>"; };
303A4068152124BB00182201 /* CordovaLibApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CordovaLibApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
303A406F152124BB00182201 /* CordovaLibApp-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "CordovaLibApp-Info.plist"; sourceTree = "<group>"; };
@@ -122,6 +124,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 302193F91745430F00BC8D2B /* ImageIO.framework in Frameworks */,
EB3B34E9161B5532003DBE7D /* libCordova.a in Frameworks */,
8220B5C216D541BD00EC3921 /* AssetsLibrary.framework in Frameworks */,
30F8AE0C152125B6006625B3 /* MobileCoreServices.framework in Frameworks */,
@@ -185,6 +188,7 @@
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 302193F81745430F00BC8D2B /* ImageIO.framework */,
68A32D7414103017006B237C /* AddressBook.framework */,
8220B5C116D541BD00EC3921 /* AssetsLibrary.framework */,
686357DC14100B1600DF4CF2 /* CoreMedia.framework */,
[12/21] ios commit: removed accel & compass from config.xml
Posted by st...@apache.org.
removed accel & compass from config.xml
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/ae298cf1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/ae298cf1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/ae298cf1
Branch: refs/heads/3.0.0
Commit: ae298cf1beacdec183d8ed6ff2b4f9f6a6d16cbe
Parents: cfaa699
Author: Steven Gill <st...@gmail.com>
Authored: Mon May 13 14:00:07 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:48:52 2013 -0700
----------------------------------------------------------------------
bin/templates/project/__TESTING__/config.xml | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ae298cf1/bin/templates/project/__TESTING__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/config.xml b/bin/templates/project/__TESTING__/config.xml
index ca292c8..d1da01d 100644
--- a/bin/templates/project/__TESTING__/config.xml
+++ b/bin/templates/project/__TESTING__/config.xml
@@ -41,12 +41,6 @@
<feature name="Device">
<param name="ios-package" value="CDVDevice"/>
</feature>
- <feature name="Accelerometer">
- <param name="ios-package" value="CDVAccelerometer"/>
- </feature>
- <feature name="Compass">
- <param name="ios-package" value="CDVLocation"/>
- </feature>
<feature name="Media">
<param name="ios-package" value="CDVSound"/>
</feature>
[10/21] ios commit: Trivial formatting update
Posted by st...@apache.org.
Trivial formatting update
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/d2b1c4bf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/d2b1c4bf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/d2b1c4bf
Branch: refs/heads/3.0.0
Commit: d2b1c4bfbb3fb0e7f3f605e5d7b24b3f6dc29d98
Parents: a090eef
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu May 16 16:09:31 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu May 16 16:09:31 2013 -0700
----------------------------------------------------------------------
FirstRun.md | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/d2b1c4bf/FirstRun.md
----------------------------------------------------------------------
diff --git a/FirstRun.md b/FirstRun.md
index 5041249..58b79d7 100644
--- a/FirstRun.md
+++ b/FirstRun.md
@@ -43,7 +43,7 @@ Please see the **Cordova Plugin Upgrade Guide.md** document included in the **gu
## Project Upgrades
1. Please see the [**Upgrading Cordova iOS**](http://docs.cordova.io/en/edge/guide_upgrading_index.md.html) document on [http://docs.cordova.io](http://docs.cordova.io)
-2. See the FAQ in the README.md as well included in the source distribution
+2. See the **FAQ** in the README.md as well included in the source distribution
<br />
[19/21] ios commit: fixed merge issue with config.xml
Posted by st...@apache.org.
fixed merge issue with config.xml
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/8870e424
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/8870e424
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/8870e424
Branch: refs/heads/3.0.0
Commit: 8870e424fc6380f987c71a839162b6f95e5a7b17
Parents: e6b934a
Author: Steven Gill <st...@gmail.com>
Authored: Mon May 13 11:26:49 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:48:52 2013 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDV.h | 1 -
CordovaLib/Classes/CDVLocation.h | 104 ---
CordovaLib/Classes/CDVLocation.m | 623 ------------------
CordovaLib/Classes/CDVViewController.m | 9 -
CordovaLib/CordovaLib.xcodeproj/project.pbxproj | 8 -
5 files changed, 0 insertions(+), 745 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8870e424/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index 593e9b5..b559f2d 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -35,7 +35,6 @@
#import "CDVDevice.h"
#import "CDVFile.h"
#import "CDVFileTransfer.h"
-#import "CDVLocation.h"
#import "CDVNotification.h"
#import "CDVPluginResult.h"
#import "CDVReachability.h"
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8870e424/CordovaLib/Classes/CDVLocation.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVLocation.h b/CordovaLib/Classes/CDVLocation.h
deleted file mode 100644
index caf0798..0000000
--- a/CordovaLib/Classes/CDVLocation.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- 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.
- */
-
-#import <UIKit/UIKit.h>
-#import <CoreLocation/CoreLocation.h>
-#import "CDVPlugin.h"
-
-enum CDVHeadingStatus {
- HEADINGSTOPPED = 0,
- HEADINGSTARTING,
- HEADINGRUNNING,
- HEADINGERROR
-};
-typedef NSUInteger CDVHeadingStatus;
-
-enum CDVLocationStatus {
- PERMISSIONDENIED = 1,
- POSITIONUNAVAILABLE,
- TIMEOUT
-};
-typedef NSUInteger CDVLocationStatus;
-
-// simple object to keep track of heading information
-@interface CDVHeadingData : NSObject {}
-
-@property (nonatomic, assign) CDVHeadingStatus headingStatus;
-@property (nonatomic, strong) CLHeading* headingInfo;
-@property (nonatomic, strong) NSMutableArray* headingCallbacks;
-@property (nonatomic, copy) NSString* headingFilter;
-@property (nonatomic, strong) NSDate* headingTimestamp;
-@property (assign) NSInteger timeout;
-
-@end
-
-// simple object to keep track of location information
-@interface CDVLocationData : NSObject {
- CDVLocationStatus locationStatus;
- NSMutableArray* locationCallbacks;
- NSMutableDictionary* watchCallbacks;
- CLLocation* locationInfo;
-}
-
-@property (nonatomic, assign) CDVLocationStatus locationStatus;
-@property (nonatomic, strong) CLLocation* locationInfo;
-@property (nonatomic, strong) NSMutableArray* locationCallbacks;
-@property (nonatomic, strong) NSMutableDictionary* watchCallbacks;
-
-@end
-
-@interface CDVLocation : CDVPlugin <CLLocationManagerDelegate>{
- @private BOOL __locationStarted;
- @private BOOL __highAccuracyEnabled;
- CDVHeadingData* headingData;
- CDVLocationData* locationData;
-}
-
-@property (nonatomic, strong) CLLocationManager* locationManager;
-@property (strong) CDVHeadingData* headingData;
-@property (nonatomic, strong) CDVLocationData* locationData;
-
-- (BOOL)hasHeadingSupport;
-- (void)getLocation:(CDVInvokedUrlCommand*)command;
-- (void)addWatch:(CDVInvokedUrlCommand*)command;
-- (void)clearWatch:(CDVInvokedUrlCommand*)command;
-- (void)returnLocationInfo:(NSString*)callbackId andKeepCallback:(BOOL)keepCallback;
-- (void)returnLocationError:(NSUInteger)errorCode withMessage:(NSString*)message;
-- (void)startLocation:(BOOL)enableHighAccuracy;
-
-- (void)locationManager:(CLLocationManager*)manager
- didUpdateToLocation:(CLLocation*)newLocation
- fromLocation:(CLLocation*)oldLocation;
-
-- (void)locationManager:(CLLocationManager*)manager
- didFailWithError:(NSError*)error;
-
-- (BOOL)isLocationServicesEnabled;
-
-- (void)getHeading:(CDVInvokedUrlCommand*)command;
-- (void)returnHeadingInfo:(NSString*)callbackId keepCallback:(BOOL)bRetain;
-- (void)watchHeadingFilter:(CDVInvokedUrlCommand*)command;
-- (void)stopHeading:(CDVInvokedUrlCommand*)command;
-- (void)startHeadingWithFilter:(CLLocationDegrees)filter;
-- (void)locationManager:(CLLocationManager*)manager
- didUpdateHeading:(CLHeading*)heading;
-
-- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager*)manager;
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8870e424/CordovaLib/Classes/CDVLocation.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVLocation.m b/CordovaLib/Classes/CDVLocation.m
deleted file mode 100644
index ed9ec26..0000000
--- a/CordovaLib/Classes/CDVLocation.m
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- 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.
- */
-
-#import "CDVLocation.h"
-#import "NSArray+Comparisons.h"
-
-#pragma mark Constants
-
-#define kPGLocationErrorDomain @"kPGLocationErrorDomain"
-#define kPGLocationDesiredAccuracyKey @"desiredAccuracy"
-#define kPGLocationForcePromptKey @"forcePrompt"
-#define kPGLocationDistanceFilterKey @"distanceFilter"
-#define kPGLocationFrequencyKey @"frequency"
-
-#pragma mark -
-#pragma mark Categories
-
-@interface NSError (JSONMethods)
-
-- (NSString*)JSONRepresentation;
-
-@end
-
-@interface CLLocation (JSONMethods)
-
-- (NSString*)JSONRepresentation;
-
-@end
-
-@interface CLHeading (JSONMethods)
-
-- (NSString*)JSONRepresentation;
-
-@end
-
-#pragma mark -
-#pragma mark CDVHeadingData
-
-@implementation CDVHeadingData
-
-@synthesize headingStatus, headingInfo, headingCallbacks, headingFilter, headingTimestamp, timeout;
-- (CDVHeadingData*)init
-{
- self = (CDVHeadingData*)[super init];
- if (self) {
- self.headingStatus = HEADINGSTOPPED;
- self.headingInfo = nil;
- self.headingCallbacks = nil;
- self.headingFilter = nil;
- self.headingTimestamp = nil;
- self.timeout = 10;
- }
- return self;
-}
-
-@end
-
-@implementation CDVLocationData
-
-@synthesize locationStatus, locationInfo, locationCallbacks, watchCallbacks;
-- (CDVLocationData*)init
-{
- self = (CDVLocationData*)[super init];
- if (self) {
- self.locationInfo = nil;
- self.locationCallbacks = nil;
- self.watchCallbacks = nil;
- }
- return self;
-}
-
-@end
-
-#pragma mark -
-#pragma mark CDVLocation
-
-@implementation CDVLocation
-
-@synthesize locationManager, headingData, locationData;
-
-- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView
-{
- self = (CDVLocation*)[super initWithWebView:(UIWebView*)theWebView];
- if (self) {
- self.locationManager = [[CLLocationManager alloc] init];
- self.locationManager.delegate = self; // Tells the location manager to send updates to this object
- __locationStarted = NO;
- __highAccuracyEnabled = NO;
- self.headingData = nil;
- self.locationData = nil;
- }
- return self;
-}
-
-- (BOOL)hasHeadingSupport
-{
- BOOL headingInstancePropertyAvailable = [self.locationManager respondsToSelector:@selector(headingAvailable)]; // iOS 3.x
- BOOL headingClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(headingAvailable)]; // iOS 4.x
-
- if (headingInstancePropertyAvailable) { // iOS 3.x
- return [(id)self.locationManager headingAvailable];
- } else if (headingClassPropertyAvailable) { // iOS 4.x
- return [CLLocationManager headingAvailable];
- } else { // iOS 2.x
- return NO;
- }
-}
-
-- (BOOL)isAuthorized
-{
- BOOL authorizationStatusClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+
-
- if (authorizationStatusClassPropertyAvailable) {
- NSUInteger authStatus = [CLLocationManager authorizationStatus];
- return (authStatus == kCLAuthorizationStatusAuthorized) || (authStatus == kCLAuthorizationStatusNotDetermined);
- }
-
- // by default, assume YES (for iOS < 4.2)
- return YES;
-}
-
-- (BOOL)isLocationServicesEnabled
-{
- BOOL locationServicesEnabledInstancePropertyAvailable = [self.locationManager respondsToSelector:@selector(locationServicesEnabled)]; // iOS 3.x
- BOOL locationServicesEnabledClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(locationServicesEnabled)]; // iOS 4.x
-
- if (locationServicesEnabledClassPropertyAvailable) { // iOS 4.x
- return [CLLocationManager locationServicesEnabled];
- } else if (locationServicesEnabledInstancePropertyAvailable) { // iOS 2.x, iOS 3.x
- return [(id)self.locationManager locationServicesEnabled];
- } else {
- return NO;
- }
-}
-
-- (void)startLocation:(BOOL)enableHighAccuracy
-{
- if (![self isLocationServicesEnabled]) {
- [self returnLocationError:PERMISSIONDENIED withMessage:@"Location services are not enabled."];
- return;
- }
- if (![self isAuthorized]) {
- NSString* message = nil;
- BOOL authStatusAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+
- if (authStatusAvailable) {
- NSUInteger code = [CLLocationManager authorizationStatus];
- if (code == kCLAuthorizationStatusNotDetermined) {
- // could return POSITION_UNAVAILABLE but need to coordinate with other platforms
- message = @"User undecided on application's use of location services.";
- } else if (code == kCLAuthorizationStatusRestricted) {
- message = @"Application's use of location services is restricted.";
- }
- }
- // PERMISSIONDENIED is only PositionError that makes sense when authorization denied
- [self returnLocationError:PERMISSIONDENIED withMessage:message];
-
- return;
- }
-
- // Tell the location manager to start notifying us of location updates. We
- // first stop, and then start the updating to ensure we get at least one
- // update, even if our location did not change.
- [self.locationManager stopUpdatingLocation];
- [self.locationManager startUpdatingLocation];
- __locationStarted = YES;
- if (enableHighAccuracy) {
- __highAccuracyEnabled = YES;
- // Set to distance filter to "none" - which should be the minimum for best results.
- self.locationManager.distanceFilter = kCLDistanceFilterNone;
- // Set desired accuracy to Best.
- self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
- } else {
- __highAccuracyEnabled = NO;
- // TODO: Set distance filter to 10 meters? and desired accuracy to nearest ten meters? arbitrary.
- self.locationManager.distanceFilter = 10;
- self.locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
- }
-}
-
-- (void)_stopLocation
-{
- if (__locationStarted) {
- if (![self isLocationServicesEnabled]) {
- return;
- }
-
- [self.locationManager stopUpdatingLocation];
- __locationStarted = NO;
- __highAccuracyEnabled = NO;
- }
-}
-
-- (void)locationManager:(CLLocationManager*)manager
- didUpdateToLocation:(CLLocation*)newLocation
- fromLocation:(CLLocation*)oldLocation
-{
- CDVLocationData* cData = self.locationData;
-
- cData.locationInfo = newLocation;
- if (self.locationData.locationCallbacks.count > 0) {
- for (NSString* callbackId in self.locationData.locationCallbacks) {
- [self returnLocationInfo:callbackId andKeepCallback:NO];
- }
-
- [self.locationData.locationCallbacks removeAllObjects];
- }
- if (self.locationData.watchCallbacks.count > 0) {
- for (NSString* timerId in self.locationData.watchCallbacks) {
- [self returnLocationInfo:[self.locationData.watchCallbacks objectForKey:timerId] andKeepCallback:YES];
- }
- } else {
- // No callbacks waiting on us anymore, turn off listening.
- [self _stopLocation];
- }
-}
-
-- (void)getLocation:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- BOOL enableHighAccuracy = [[command.arguments objectAtIndex:0] boolValue];
-
- if ([self isLocationServicesEnabled] == NO) {
- NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:2];
- [posError setObject:[NSNumber numberWithInt:PERMISSIONDENIED] forKey:@"code"];
- [posError setObject:@"Location services are disabled." forKey:@"message"];
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:posError];
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- } else {
- if (!self.locationData) {
- self.locationData = [[CDVLocationData alloc] init];
- }
- CDVLocationData* lData = self.locationData;
- if (!lData.locationCallbacks) {
- lData.locationCallbacks = [NSMutableArray arrayWithCapacity:1];
- }
-
- if (!__locationStarted || (__highAccuracyEnabled != enableHighAccuracy)) {
- // add the callbackId into the array so we can call back when get data
- if (callbackId != nil) {
- [lData.locationCallbacks addObject:callbackId];
- }
- // Tell the location manager to start notifying us of heading updates
- [self startLocation:enableHighAccuracy];
- } else {
- [self returnLocationInfo:callbackId andKeepCallback:NO];
- }
- }
-}
-
-- (void)addWatch:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSString* timerId = [command.arguments objectAtIndex:0];
- BOOL enableHighAccuracy = [[command.arguments objectAtIndex:1] boolValue];
-
- if (!self.locationData) {
- self.locationData = [[CDVLocationData alloc] init];
- }
- CDVLocationData* lData = self.locationData;
-
- if (!lData.watchCallbacks) {
- lData.watchCallbacks = [NSMutableDictionary dictionaryWithCapacity:1];
- }
-
- // add the callbackId into the dictionary so we can call back whenever get data
- [lData.watchCallbacks setObject:callbackId forKey:timerId];
-
- if ([self isLocationServicesEnabled] == NO) {
- NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:2];
- [posError setObject:[NSNumber numberWithInt:PERMISSIONDENIED] forKey:@"code"];
- [posError setObject:@"Location services are disabled." forKey:@"message"];
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:posError];
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- } else {
- if (!__locationStarted || (__highAccuracyEnabled != enableHighAccuracy)) {
- // Tell the location manager to start notifying us of location updates
- [self startLocation:enableHighAccuracy];
- }
- }
-}
-
-- (void)clearWatch:(CDVInvokedUrlCommand*)command
-{
- NSString* timerId = [command.arguments objectAtIndex:0];
-
- if (self.locationData && self.locationData.watchCallbacks && [self.locationData.watchCallbacks objectForKey:timerId]) {
- [self.locationData.watchCallbacks removeObjectForKey:timerId];
- }
-}
-
-- (void)stopLocation:(CDVInvokedUrlCommand*)command
-{
- [self _stopLocation];
-}
-
-- (void)returnLocationInfo:(NSString*)callbackId andKeepCallback:(BOOL)keepCallback
-{
- CDVPluginResult* result = nil;
- CDVLocationData* lData = self.locationData;
-
- if (lData && !lData.locationInfo) {
- // return error
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:POSITIONUNAVAILABLE];
- } else if (lData && lData.locationInfo) {
- CLLocation* lInfo = lData.locationInfo;
- NSMutableDictionary* returnInfo = [NSMutableDictionary dictionaryWithCapacity:8];
- NSNumber* timestamp = [NSNumber numberWithDouble:([lInfo.timestamp timeIntervalSince1970] * 1000)];
- [returnInfo setObject:timestamp forKey:@"timestamp"];
- [returnInfo setObject:[NSNumber numberWithDouble:lInfo.speed] forKey:@"velocity"];
- [returnInfo setObject:[NSNumber numberWithDouble:lInfo.verticalAccuracy] forKey:@"altitudeAccuracy"];
- [returnInfo setObject:[NSNumber numberWithDouble:lInfo.horizontalAccuracy] forKey:@"accuracy"];
- [returnInfo setObject:[NSNumber numberWithDouble:lInfo.course] forKey:@"heading"];
- [returnInfo setObject:[NSNumber numberWithDouble:lInfo.altitude] forKey:@"altitude"];
- [returnInfo setObject:[NSNumber numberWithDouble:lInfo.coordinate.latitude] forKey:@"latitude"];
- [returnInfo setObject:[NSNumber numberWithDouble:lInfo.coordinate.longitude] forKey:@"longitude"];
-
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:returnInfo];
- [result setKeepCallbackAsBool:keepCallback];
- }
- if (result) {
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- }
-}
-
-- (void)returnLocationError:(NSUInteger)errorCode withMessage:(NSString*)message
-{
- NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:2];
-
- [posError setObject:[NSNumber numberWithInt:errorCode] forKey:@"code"];
- [posError setObject:message ? message:@"" forKey:@"message"];
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:posError];
-
- for (NSString* callbackId in self.locationData.locationCallbacks) {
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- }
-
- [self.locationData.locationCallbacks removeAllObjects];
-
- for (NSString* callbackId in self.locationData.watchCallbacks) {
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- }
-}
-
-// called to get the current heading
-// Will call location manager to startUpdatingHeading if necessary
-
-- (void)getHeading:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSDictionary* options = [command.arguments objectAtIndex:0 withDefault:nil];
- NSNumber* filter = [options valueForKey:@"filter"];
-
- if (filter) {
- [self watchHeadingFilter:command];
- return;
- }
- if ([self hasHeadingSupport] == NO) {
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:20];
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- } else {
- // heading retrieval does is not affected by disabling locationServices and authorization of app for location services
- if (!self.headingData) {
- self.headingData = [[CDVHeadingData alloc] init];
- }
- CDVHeadingData* hData = self.headingData;
-
- if (!hData.headingCallbacks) {
- hData.headingCallbacks = [NSMutableArray arrayWithCapacity:1];
- }
- // add the callbackId into the array so we can call back when get data
- [hData.headingCallbacks addObject:callbackId];
-
- if ((hData.headingStatus != HEADINGRUNNING) && (hData.headingStatus != HEADINGERROR)) {
- // Tell the location manager to start notifying us of heading updates
- [self startHeadingWithFilter:0.2];
- } else {
- [self returnHeadingInfo:callbackId keepCallback:NO];
- }
- }
-}
-
-// called to request heading updates when heading changes by a certain amount (filter)
-- (void)watchHeadingFilter:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSDictionary* options = [command.arguments objectAtIndex:0 withDefault:nil];
- NSNumber* filter = [options valueForKey:@"filter"];
- CDVHeadingData* hData = self.headingData;
-
- if ([self hasHeadingSupport] == NO) {
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:20];
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- } else {
- if (!hData) {
- self.headingData = [[CDVHeadingData alloc] init];
- hData = self.headingData;
- }
- if (hData.headingStatus != HEADINGRUNNING) {
- // Tell the location manager to start notifying us of heading updates
- [self startHeadingWithFilter:[filter doubleValue]];
- } else {
- // if already running check to see if due to existing watch filter
- if (hData.headingFilter && ![hData.headingFilter isEqualToString:callbackId]) {
- // new watch filter being specified
- // send heading data one last time to clear old successCallback
- [self returnHeadingInfo:hData.headingFilter keepCallback:NO];
- }
- }
- // save the new filter callback and update the headingFilter setting
- hData.headingFilter = callbackId;
- // check if need to stop and restart in order to change value???
- self.locationManager.headingFilter = [filter doubleValue];
- }
-}
-
-- (void)returnHeadingInfo:(NSString*)callbackId keepCallback:(BOOL)bRetain
-{
- CDVPluginResult* result = nil;
- CDVHeadingData* hData = self.headingData;
-
- self.headingData.headingTimestamp = [NSDate date];
-
- if (hData && (hData.headingStatus == HEADINGERROR)) {
- // return error
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:0];
- } else if (hData && (hData.headingStatus == HEADINGRUNNING) && hData.headingInfo) {
- // if there is heading info, return it
- CLHeading* hInfo = hData.headingInfo;
- NSMutableDictionary* returnInfo = [NSMutableDictionary dictionaryWithCapacity:4];
- NSNumber* timestamp = [NSNumber numberWithDouble:([hInfo.timestamp timeIntervalSince1970] * 1000)];
- [returnInfo setObject:timestamp forKey:@"timestamp"];
- [returnInfo setObject:[NSNumber numberWithDouble:hInfo.magneticHeading] forKey:@"magneticHeading"];
- id trueHeading = __locationStarted ? (id)[NSNumber numberWithDouble : hInfo.trueHeading] : (id)[NSNull null];
- [returnInfo setObject:trueHeading forKey:@"trueHeading"];
- [returnInfo setObject:[NSNumber numberWithDouble:hInfo.headingAccuracy] forKey:@"headingAccuracy"];
-
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:returnInfo];
- [result setKeepCallbackAsBool:bRetain];
- }
- if (result) {
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- }
-}
-
-- (void)stopHeading:(CDVInvokedUrlCommand*)command
-{
- // CDVHeadingData* hData = self.headingData;
- if (self.headingData && (self.headingData.headingStatus != HEADINGSTOPPED)) {
- if (self.headingData.headingFilter) {
- // callback one last time to clear callback
- [self returnHeadingInfo:self.headingData.headingFilter keepCallback:NO];
- self.headingData.headingFilter = nil;
- }
- [self.locationManager stopUpdatingHeading];
- NSLog(@"heading STOPPED");
- self.headingData = nil;
- }
-}
-
-// helper method to check the orientation and start updating headings
-- (void)startHeadingWithFilter:(CLLocationDegrees)filter
-{
- // FYI UIDeviceOrientation and CLDeviceOrientation enums are currently the same
- self.locationManager.headingOrientation = (CLDeviceOrientation)self.viewController.interfaceOrientation;
- self.locationManager.headingFilter = filter;
- [self.locationManager startUpdatingHeading];
- self.headingData.headingStatus = HEADINGSTARTING;
-}
-
-- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager*)manager
-{
- return YES;
-}
-
-- (void)locationManager:(CLLocationManager*)manager
- didUpdateHeading:(CLHeading*)heading
-{
- CDVHeadingData* hData = self.headingData;
-
- // normally we would clear the delegate to stop getting these notifications, but
- // we are sharing a CLLocationManager to get location data as well, so we do a nil check here
- // ideally heading and location should use their own CLLocationManager instances
- if (hData == nil) {
- return;
- }
-
- // save the data for next call into getHeadingData
- hData.headingInfo = heading;
- BOOL bTimeout = NO;
- if (!hData.headingFilter && hData.headingTimestamp) {
- bTimeout = fabs([hData.headingTimestamp timeIntervalSinceNow]) > hData.timeout;
- }
-
- if (hData.headingStatus == HEADINGSTARTING) {
- hData.headingStatus = HEADINGRUNNING; // so returnHeading info will work
-
- // this is the first update
- for (NSString* callbackId in hData.headingCallbacks) {
- [self returnHeadingInfo:callbackId keepCallback:NO];
- }
-
- [hData.headingCallbacks removeAllObjects];
- }
- if (hData.headingFilter) {
- [self returnHeadingInfo:hData.headingFilter keepCallback:YES];
- } else if (bTimeout) {
- [self stopHeading:nil];
- }
- hData.headingStatus = HEADINGRUNNING; // to clear any error
-}
-
-- (void)locationManager:(CLLocationManager*)manager didFailWithError:(NSError*)error
-{
- NSLog(@"locationManager::didFailWithError %@", [error localizedFailureReason]);
-
- // Compass Error
- if ([error code] == kCLErrorHeadingFailure) {
- CDVHeadingData* hData = self.headingData;
- if (hData) {
- if (hData.headingStatus == HEADINGSTARTING) {
- // heading error during startup - report error
- for (NSString* callbackId in hData.headingCallbacks) {
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:0];
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- }
-
- [hData.headingCallbacks removeAllObjects];
- } // else for frequency watches next call to getCurrentHeading will report error
- if (hData.headingFilter) {
- CDVPluginResult* resultFilter = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:0];
- [self.commandDelegate sendPluginResult:resultFilter callbackId:hData.headingFilter];
- }
- hData.headingStatus = HEADINGERROR;
- }
- }
- // Location Error
- else {
- CDVLocationData* lData = self.locationData;
- if (lData && __locationStarted) {
- // TODO: probably have to once over the various error codes and return one of:
- // PositionError.PERMISSION_DENIED = 1;
- // PositionError.POSITION_UNAVAILABLE = 2;
- // PositionError.TIMEOUT = 3;
- NSUInteger positionError = POSITIONUNAVAILABLE;
- if (error.code == kCLErrorDenied) {
- positionError = PERMISSIONDENIED;
- }
- [self returnLocationError:positionError withMessage:[error localizedDescription]];
- }
- }
-
- [self.locationManager stopUpdatingLocation];
- __locationStarted = NO;
-}
-
-- (void)dealloc
-{
- self.locationManager.delegate = nil;
-}
-
-- (void)onReset
-{
- [self _stopLocation];
- [self.locationManager stopUpdatingHeading];
- self.headingData = nil;
-}
-
-@end
-
-#pragma mark -
-#pragma mark CLLocation(JSONMethods)
-
-@implementation CLLocation (JSONMethods)
-
-- (NSString*)JSONRepresentation
-{
- return [NSString stringWithFormat:
- @"{ timestamp: %.00f, \
- coords: { latitude: %f, longitude: %f, altitude: %.02f, heading: %.02f, speed: %.02f, accuracy: %.02f, altitudeAccuracy: %.02f } \
- }",
- [self.timestamp timeIntervalSince1970] * 1000.0,
- self.coordinate.latitude,
- self.coordinate.longitude,
- self.altitude,
- self.course,
- self.speed,
- self.horizontalAccuracy,
- self.verticalAccuracy
- ];
-}
-
-@end
-
-#pragma mark NSError(JSONMethods)
-
-@implementation NSError (JSONMethods)
-
-- (NSString*)JSONRepresentation
-{
- return [NSString stringWithFormat:
- @"{ code: %d, message: '%@'}",
- self.code,
- [self localizedDescription]
- ];
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8870e424/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 94f4552..5bd347f 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -276,15 +276,6 @@
self.webView.scalesPageToFit = [enableViewportScale boolValue];
- /*
- * Fire up the GPS Service right away as it takes a moment for data to come back.
- */
-
- if ([enableLocation boolValue]) {
- NSLog(@"Deprecated: The 'EnableLocation' boolean property is deprecated in 2.5.0, and will be removed in 3.0.0. Use the 'onload' boolean attribute (of the CDVLocation plugin.");
- [[self.commandDelegate getCommandInstance:@"Geolocation"] getLocation:[CDVInvokedUrlCommand new]];
- }
-
if (hideKeyboardFormAccessoryBar) {
__weak CDVViewController* weakSelf = self;
[[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8870e424/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index b46ecdb..88e43c4 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -61,8 +61,6 @@
8887FD711090FBE7009987E8 /* CDVFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD311090FBE7009987E8 /* CDVFile.m */; };
8887FD741090FBE7009987E8 /* CDVInvokedUrlCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD341090FBE7009987E8 /* CDVInvokedUrlCommand.h */; settings = {ATTRIBUTES = (Public, ); }; };
8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */; };
- 8887FD851090FBE7009987E8 /* CDVLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD461090FBE7009987E8 /* CDVLocation.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 8887FD861090FBE7009987E8 /* CDVLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD471090FBE7009987E8 /* CDVLocation.m */; };
8887FD8D1090FBE7009987E8 /* CDVNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD4E1090FBE7009987E8 /* CDVNotification.h */; settings = {ATTRIBUTES = (Public, ); }; };
8887FD8E1090FBE7009987E8 /* CDVNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD4F1090FBE7009987E8 /* CDVNotification.m */; };
8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD501090FBE7009987E8 /* NSData+Base64.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -160,8 +158,6 @@
8887FD311090FBE7009987E8 /* CDVFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVFile.m; path = Classes/CDVFile.m; sourceTree = "<group>"; };
8887FD341090FBE7009987E8 /* CDVInvokedUrlCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVInvokedUrlCommand.h; path = Classes/CDVInvokedUrlCommand.h; sourceTree = "<group>"; };
8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVInvokedUrlCommand.m; path = Classes/CDVInvokedUrlCommand.m; sourceTree = "<group>"; };
- 8887FD461090FBE7009987E8 /* CDVLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVLocation.h; path = Classes/CDVLocation.h; sourceTree = "<group>"; };
- 8887FD471090FBE7009987E8 /* CDVLocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVLocation.m; path = Classes/CDVLocation.m; sourceTree = "<group>"; };
8887FD4E1090FBE7009987E8 /* CDVNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVNotification.h; path = Classes/CDVNotification.h; sourceTree = "<group>"; };
8887FD4F1090FBE7009987E8 /* CDVNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVNotification.m; path = Classes/CDVNotification.m; sourceTree = "<group>"; };
8887FD501090FBE7009987E8 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSData+Base64.h"; path = "Classes/NSData+Base64.h"; sourceTree = "<group>"; };
@@ -309,8 +305,6 @@
8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */,
C937A4541337599E002C4C79 /* CDVFileTransfer.h */,
C937A4551337599E002C4C79 /* CDVFileTransfer.m */,
- 8887FD461090FBE7009987E8 /* CDVLocation.h */,
- 8887FD471090FBE7009987E8 /* CDVLocation.m */,
8887FD4E1090FBE7009987E8 /* CDVNotification.h */,
8887FD4F1090FBE7009987E8 /* CDVNotification.m */,
8887FD5E1090FBE7009987E8 /* CDVReachability.h */,
@@ -376,7 +370,6 @@
8887FD6A1090FBE7009987E8 /* CDVContacts.h in Headers */,
8887FD701090FBE7009987E8 /* CDVFile.h in Headers */,
8887FD741090FBE7009987E8 /* CDVInvokedUrlCommand.h in Headers */,
- 8887FD851090FBE7009987E8 /* CDVLocation.h in Headers */,
8887FD8D1090FBE7009987E8 /* CDVNotification.h in Headers */,
8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */,
8887FD9D1090FBE7009987E8 /* CDVReachability.h in Headers */,
@@ -475,7 +468,6 @@
8887FD6B1090FBE7009987E8 /* CDVContacts.m in Sources */,
8887FD711090FBE7009987E8 /* CDVFile.m in Sources */,
8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */,
- 8887FD861090FBE7009987E8 /* CDVLocation.m in Sources */,
8887FD8E1090FBE7009987E8 /* CDVNotification.m in Sources */,
8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */,
8887FD9E1090FBE7009987E8 /* CDVReachability.m in Sources */,
[17/21] ios commit: updated cordova.js
Posted by st...@apache.org.
updated cordova.js
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/032c67c0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/032c67c0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/032c67c0
Branch: refs/heads/3.0.0
Commit: 032c67c0a8b042757bacd25b370041128ae0431e
Parents: 6aa4511
Author: Steven Gill <st...@gmail.com>
Authored: Tue May 14 14:31:05 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:48:52 2013 -0700
----------------------------------------------------------------------
CordovaLib/cordova.js | 281 ++++----------------------------------------
1 files changed, 21 insertions(+), 260 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/032c67c0/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index 2ff3b8c..3327cd0 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -1,5 +1,5 @@
// Platform: ios
-// 2.7.0rc1-17-g64dddf4
+// 2.7.0rc1-54-g7d503ee
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -19,24 +19,35 @@
under the License.
*/
;(function() {
-var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-17-g64dddf4';
+var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-54-g7d503ee';
// file: lib/scripts/require.js
var require,
define;
(function () {
- var modules = {};
+ var modules = {},
// Stack of moduleIds currently being built.
- var requireStack = [];
+ requireStack = [],
// Map of module ID -> index into requireStack of modules currently being built.
- var inProgressModules = {};
+ inProgressModules = {},
+ SEPERATOR = ".";
+
+
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 = {};
delete module.factory;
- factory(require, module.exports, module);
+ factory(localRequire, module.exports, module);
return module.exports;
}
@@ -3616,47 +3627,6 @@ module.exports = Metadata;
});
-// file: lib/common/plugin/Position.js
-define("cordova/plugin/Position", function(require, exports, module) {
-
-var Coordinates = require('cordova/plugin/Coordinates');
-
-var Position = function(coords, timestamp) {
- if (coords) {
- this.coords = new Coordinates(coords.latitude, coords.longitude, coords.altitude, coords.accuracy, coords.heading, coords.velocity, coords.altitudeAccuracy);
- } else {
- this.coords = new Coordinates();
- }
- this.timestamp = (timestamp !== undefined) ? timestamp : new Date();
-};
-
-module.exports = Position;
-
-});
-
-// file: lib/common/plugin/PositionError.js
-define("cordova/plugin/PositionError", function(require, exports, module) {
-
-/**
- * Position error object
- *
- * @constructor
- * @param code
- * @param message
- */
-var PositionError = function(code, message) {
- this.code = code || null;
- this.message = message || '';
-};
-
-PositionError.PERMISSION_DENIED = 1;
-PositionError.POSITION_UNAVAILABLE = 2;
-PositionError.TIMEOUT = 3;
-
-module.exports = PositionError;
-
-});
-
// file: lib/common/plugin/ProgressEvent.js
define("cordova/plugin/ProgressEvent", function(require, exports, module) {
@@ -4318,215 +4288,6 @@ modulemapper.clobbers('cordova/plugin/FileTransferError', 'FileTransferError');
});
-// file: lib/common/plugin/geolocation.js
-define("cordova/plugin/geolocation", function(require, exports, module) {
-
-var argscheck = require('cordova/argscheck'),
- utils = require('cordova/utils'),
- exec = require('cordova/exec'),
- PositionError = require('cordova/plugin/PositionError'),
- Position = require('cordova/plugin/Position');
-
-var timers = {}; // list of timers in use
-
-// Returns default params, overrides if provided with values
-function parseParameters(options) {
- var opt = {
- maximumAge: 0,
- enableHighAccuracy: false,
- timeout: Infinity
- };
-
- if (options) {
- if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) {
- opt.maximumAge = options.maximumAge;
- }
- if (options.enableHighAccuracy !== undefined) {
- opt.enableHighAccuracy = options.enableHighAccuracy;
- }
- if (options.timeout !== undefined && !isNaN(options.timeout)) {
- if (options.timeout < 0) {
- opt.timeout = 0;
- } else {
- opt.timeout = options.timeout;
- }
- }
- }
-
- return opt;
-}
-
-// Returns a timeout failure, closed over a specified timeout value and error callback.
-function createTimeout(errorCallback, timeout) {
- var t = setTimeout(function() {
- clearTimeout(t);
- t = null;
- errorCallback({
- code:PositionError.TIMEOUT,
- message:"Position retrieval timed out."
- });
- }, timeout);
- return t;
-}
-
-var geolocation = {
- lastPosition:null, // reference to last known (cached) position returned
- /**
- * Asynchronously acquires the current position.
- *
- * @param {Function} successCallback The function to call when the position data is available
- * @param {Function} errorCallback The function to call when there is an error getting the heading position. (OPTIONAL)
- * @param {PositionOptions} options The options for getting the position data. (OPTIONAL)
- */
- getCurrentPosition:function(successCallback, errorCallback, options) {
- argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
- options = parseParameters(options);
-
- // Timer var that will fire an error callback if no position is retrieved from native
- // before the "timeout" param provided expires
- var timeoutTimer = {timer:null};
-
- var win = function(p) {
- clearTimeout(timeoutTimer.timer);
- if (!(timeoutTimer.timer)) {
- // Timeout already happened, or native fired error callback for
- // this geo request.
- // Don't continue with success callback.
- return;
- }
- var pos = new Position(
- {
- latitude:p.latitude,
- longitude:p.longitude,
- altitude:p.altitude,
- accuracy:p.accuracy,
- heading:p.heading,
- velocity:p.velocity,
- altitudeAccuracy:p.altitudeAccuracy
- },
- (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp)))
- );
- geolocation.lastPosition = pos;
- successCallback(pos);
- };
- var fail = function(e) {
- clearTimeout(timeoutTimer.timer);
- timeoutTimer.timer = null;
- var err = new PositionError(e.code, e.message);
- if (errorCallback) {
- errorCallback(err);
- }
- };
-
- // Check our cached position, if its timestamp difference with current time is less than the maximumAge, then just
- // fire the success callback with the cached position.
- if (geolocation.lastPosition && options.maximumAge && (((new Date()).getTime() - geolocation.lastPosition.timestamp.getTime()) <= options.maximumAge)) {
- successCallback(geolocation.lastPosition);
- // If the cached position check failed and the timeout was set to 0, error out with a TIMEOUT error object.
- } else if (options.timeout === 0) {
- fail({
- code:PositionError.TIMEOUT,
- message:"timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceeds provided PositionOptions' maximumAge parameter."
- });
- // Otherwise we have to call into native to retrieve a position.
- } else {
- if (options.timeout !== Infinity) {
- // If the timeout value was not set to Infinity (default), then
- // set up a timeout function that will fire the error callback
- // if no successful position was retrieved before timeout expired.
- timeoutTimer.timer = createTimeout(fail, options.timeout);
- } else {
- // This is here so the check in the win function doesn't mess stuff up
- // may seem weird but this guarantees timeoutTimer is
- // always truthy before we call into native
- timeoutTimer.timer = true;
- }
- exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]);
- }
- return timeoutTimer;
- },
- /**
- * Asynchronously watches the geolocation for changes to geolocation. When a change occurs,
- * the successCallback is called with the new location.
- *
- * @param {Function} successCallback The function to call each time the location data is available
- * @param {Function} errorCallback The function to call when there is an error getting the location data. (OPTIONAL)
- * @param {PositionOptions} options The options for getting the location data such as frequency. (OPTIONAL)
- * @return String The watch id that must be passed to #clearWatch to stop watching.
- */
- watchPosition:function(successCallback, errorCallback, options) {
- argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
- options = parseParameters(options);
-
- var id = utils.createUUID();
-
- // Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPosition
- timers[id] = geolocation.getCurrentPosition(successCallback, errorCallback, options);
-
- var fail = function(e) {
- clearTimeout(timers[id].timer);
- var err = new PositionError(e.code, e.message);
- if (errorCallback) {
- errorCallback(err);
- }
- };
-
- var win = function(p) {
- clearTimeout(timers[id].timer);
- if (options.timeout !== Infinity) {
- timers[id].timer = createTimeout(fail, options.timeout);
- }
- var pos = new Position(
- {
- latitude:p.latitude,
- longitude:p.longitude,
- altitude:p.altitude,
- accuracy:p.accuracy,
- heading:p.heading,
- velocity:p.velocity,
- altitudeAccuracy:p.altitudeAccuracy
- },
- (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp)))
- );
- geolocation.lastPosition = pos;
- successCallback(pos);
- };
-
- exec(win, fail, "Geolocation", "addWatch", [id, options.enableHighAccuracy]);
-
- return id;
- },
- /**
- * Clears the specified heading watch.
- *
- * @param {String} id The ID of the watch returned from #watchPosition
- */
- clearWatch:function(id) {
- if (id && timers[id] !== undefined) {
- clearTimeout(timers[id].timer);
- timers[id].timer = false;
- exec(null, null, "Geolocation", "clearWatch", [id]);
- }
- }
-};
-
-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) {
@@ -5559,7 +5320,7 @@ module.exports = {
// Some platforms take an array of button label names.
// Other platforms take a comma separated list.
// 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') {
var buttonLabelString = _buttonLabels;
_buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here
@@ -6094,7 +5855,7 @@ require('cordova/channel').onNativeReady.fire();
// If the request fails, or the response is not a JSON array, just call finishPluginLoading.
var obj;
try {
- obj = this.status == 200 && this.responseText && JSON.parse(this.responseText);
+ obj = (this.status == 0 || this.status == 200) && this.responseText && JSON.parse(this.responseText);
} catch (err) {
// obj will be undefined.
}
@@ -6108,7 +5869,7 @@ require('cordova/channel').onNativeReady.fire();
finishPluginLoading();
};
try { // we commented we were going to try, so let us actually try and catch
- xhr.open('GET', 'cordova_plugins.json', true); // Async
+ xhr.open('GET', '/cordova_plugins.json', true); // Async
xhr.send();
} catch(err){
finishPluginLoading();
[07/21] ios commit: [CB-3394] Re-fix: Cordova iOS crashes when
multiple access elements in config.xml
Posted by st...@apache.org.
[CB-3394] Re-fix: Cordova iOS crashes when multiple access elements in config.xml
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/93784cd5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/93784cd5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/93784cd5
Branch: refs/heads/3.0.0
Commit: 93784cd5cd695bb4d70311f664ac245d9f1d29af
Parents: 6bbdd78
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu May 16 10:48:57 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu May 16 10:48:57 2013 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDVWhitelist.m | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/93784cd5/CordovaLib/Classes/CDVWhitelist.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWhitelist.m b/CordovaLib/Classes/CDVWhitelist.m
index 13a2572..e6807bd 100644
--- a/CordovaLib/Classes/CDVWhitelist.m
+++ b/CordovaLib/Classes/CDVWhitelist.m
@@ -212,6 +212,11 @@ NSString* const kCDVDefaultSchemeName = @"cdv-default-scheme";
while (regex = [enumerator nextObject]) {
NSPredicate* regex_test = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
+ // if wildcard, break out and allow
+ if ([regex isEqualToString:@"*"]) {
+ return YES;
+ }
+
if ([regex_test evaluateWithObject:urlHost] == YES) {
// if it matches at least one rule, return
return YES;
[15/21] ios commit: updated cordova.js, removed compass code
Posted by st...@apache.org.
updated cordova.js, removed compass code
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/cfaa699c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/cfaa699c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/cfaa699c
Branch: refs/heads/3.0.0
Commit: cfaa699c4b3b68f466a06da58cd7dc329cfc0c25
Parents: 8870e42
Author: Steven Gill <st...@gmail.com>
Authored: Mon May 13 13:24:48 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:48:52 2013 -0700
----------------------------------------------------------------------
CordovaLib/cordova.js | 187 ++++++++-----------------------------------
1 files changed, 35 insertions(+), 152 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/cfaa699c/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index 9f72dd6..2ff3b8c 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -1,6 +1,5 @@
// Platform: ios
-// 2.7.0rc1-9-g2dde8a7
-// File generated at :: Thu May 02 2013 12:01:11 GMT-0700 (PDT)
+// 2.7.0rc1-17-g64dddf4
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -20,7 +19,7 @@
under the License.
*/
;(function() {
-var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-9-g2dde8a7';
+var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-17-g64dddf4';
// file: lib/scripts/require.js
var require,
@@ -1346,39 +1345,6 @@ module.exports = CaptureVideoOptions;
});
-// file: lib/common/plugin/CompassError.js
-define("cordova/plugin/CompassError", function(require, exports, module) {
-
-/**
- * CompassError.
- * An error code assigned by an implementation when an error has occurred
- * @constructor
- */
-var CompassError = function(err) {
- this.code = (err !== undefined ? err : null);
-};
-
-CompassError.COMPASS_INTERNAL_ERR = 0;
-CompassError.COMPASS_NOT_SUPPORTED = 20;
-
-module.exports = CompassError;
-
-});
-
-// file: lib/common/plugin/CompassHeading.js
-define("cordova/plugin/CompassHeading", function(require, exports, module) {
-
-var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, timestamp) {
- this.magneticHeading = magneticHeading;
- this.trueHeading = trueHeading;
- this.headingAccuracy = headingAccuracy;
- this.timestamp = timestamp || new Date().getTime();
-};
-
-module.exports = CompassHeading;
-
-});
-
// file: lib/common/plugin/ConfigurationData.js
define("cordova/plugin/ConfigurationData", function(require, exports, module) {
@@ -3943,105 +3909,6 @@ modulemapper.clobbers('cordova/plugin/capture', 'navigator.device.capture');
});
-// file: lib/common/plugin/compass.js
-define("cordova/plugin/compass", function(require, exports, module) {
-
-var argscheck = require('cordova/argscheck'),
- exec = require('cordova/exec'),
- utils = require('cordova/utils'),
- CompassHeading = require('cordova/plugin/CompassHeading'),
- CompassError = require('cordova/plugin/CompassError'),
- timers = {},
- compass = {
- /**
- * Asynchronously acquires the current heading.
- * @param {Function} successCallback The function to call when the heading
- * data is available
- * @param {Function} errorCallback The function to call when there is an error
- * getting the heading data.
- * @param {CompassOptions} options The options for getting the heading data (not used).
- */
- getCurrentHeading:function(successCallback, errorCallback, options) {
- 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 = errorCallback && function(code) {
- var ce = new CompassError(code);
- errorCallback(ce);
- };
-
- // Get heading
- exec(win, fail, "Compass", "getHeading", [options]);
- },
-
- /**
- * Asynchronously acquires the heading repeatedly at a given interval.
- * @param {Function} successCallback The function to call each time the heading
- * data is available
- * @param {Function} errorCallback The function to call when there is an error
- * getting the heading data.
- * @param {HeadingOptions} options The options for getting the heading data
- * such as timeout and the frequency of the watch. For iOS, filter parameter
- * 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;
-
- var id = utils.createUUID();
- if (filter > 0) {
- // is an iOS request for watch by filter, no timer needed
- timers[id] = "iOS";
- compass.getCurrentHeading(successCallback, errorCallback, options);
- } else {
- // Start watch timer to get headings
- timers[id] = window.setInterval(function() {
- compass.getCurrentHeading(successCallback, errorCallback);
- }, frequency);
- }
-
- return id;
- },
-
- /**
- * Clears the specified heading watch.
- * @param {String} watchId The ID of the watch returned from #watchHeading.
- */
- clearWatch:function(id) {
- // Stop javascript timer & remove from timer list
- if (id && timers[id]) {
- if (timers[id] != "iOS") {
- clearInterval(timers[id]);
- } else {
- // is iOS watch by filter so call into device to stop
- exec(null, null, "Compass", "stopHeading", []);
- }
- delete timers[id];
- }
- }
- };
-
-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) {
@@ -5183,7 +5050,7 @@ define("cordova/plugin/ios/logger/plugininit", function(require, exports, module
// use the native logger
var logger = require("cordova/plugin/logger");
-logger.useConsole(false);
+logger.useConsole(true);
});
@@ -5240,10 +5107,13 @@ var exec = require('cordova/exec');
var utils = require('cordova/utils');
var UseConsole = true;
+var UseLogger = true;
var Queued = [];
var DeviceReady = false;
var CurrentLevel;
+var originalConsole = console;
+
/**
* Logging levels
*/
@@ -5304,8 +5174,7 @@ logger.level = function (value) {
* 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.
+ * browser 'console' object.
*/
logger.useConsole = function (value) {
if (arguments.length) UseConsole = !!value;
@@ -5330,6 +5199,18 @@ logger.useConsole = function (value) {
};
/**
+ * 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.
*
* Parameters passed after message are used applied to
@@ -5398,24 +5279,26 @@ logger.logLevel = function(level /* , ... */) {
return;
}
- // if not using the console, use the native logger
- if (!UseConsole) {
+ // Log using the native logger if that is enabled
+ if (UseLogger) {
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 using the console if that is enabled
+ if (UseConsole) {
+ // 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;
+ // log to the console
+ switch (level) {
+ case logger.LOG: originalConsole.log(message); break;
+ case logger.ERROR: originalConsole.log("ERROR: " + message); break;
+ case logger.WARN: originalConsole.log("WARN: " + message); break;
+ case logger.INFO: originalConsole.log("INFO: " + message); break;
+ case logger.DEBUG: originalConsole.log("DEBUG: " + message); break;
+ }
}
};
[14/21] ios commit: fixed merge issue
Posted by st...@apache.org.
fixed merge issue
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/e6b934ac
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/e6b934ac
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/e6b934ac
Branch: refs/heads/3.0.0
Commit: e6b934ac5a4bddc46909f1672d024595d40cfddc
Parents: ad8fc47
Author: Steven Gill <st...@gmail.com>
Authored: Mon May 13 11:24:39 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:48:52 2013 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDV.h | 1 -
CordovaLib/Classes/CDVAccelerometer.h | 39 ------
CordovaLib/Classes/CDVAccelerometer.m | 128 ------------------
CordovaLib/CordovaLib.xcodeproj/project.pbxproj | 8 -
4 files changed, 0 insertions(+), 176 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e6b934ac/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index 15d9316..593e9b5 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -25,7 +25,6 @@
#import "CDVURLProtocol.h"
#import "CDVInvokedUrlCommand.h"
-#import "CDVAccelerometer.h"
#import "CDVBattery.h"
#import "CDVCamera.h"
#import "CDVCapture.h"
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e6b934ac/CordovaLib/Classes/CDVAccelerometer.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVAccelerometer.h b/CordovaLib/Classes/CDVAccelerometer.h
deleted file mode 100644
index 044ca53..0000000
--- a/CordovaLib/Classes/CDVAccelerometer.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- 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.
- */
-
-#import <UIKit/UIKit.h>
-#import "CDVPlugin.h"
-
-@interface CDVAccelerometer : CDVPlugin <UIAccelerometerDelegate>
-{
- double x;
- double y;
- double z;
- NSTimeInterval timestamp;
-}
-
-@property (readonly, assign) BOOL isRunning;
-@property (nonatomic, strong) NSString* callbackId;
-
-- (CDVAccelerometer*)init;
-
-- (void)start:(CDVInvokedUrlCommand*)command;
-- (void)stop:(CDVInvokedUrlCommand*)command;
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e6b934ac/CordovaLib/Classes/CDVAccelerometer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVAccelerometer.m b/CordovaLib/Classes/CDVAccelerometer.m
deleted file mode 100644
index 33093d0..0000000
--- a/CordovaLib/Classes/CDVAccelerometer.m
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- 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.
- */
-
-#import "CDVAccelerometer.h"
-
-@interface CDVAccelerometer () {}
-@property (readwrite, assign) BOOL isRunning;
-@end
-
-@implementation CDVAccelerometer
-
-@synthesize callbackId, isRunning;
-
-// defaults to 10 msec
-#define kAccelerometerInterval 40
-// g constant: -9.81 m/s^2
-#define kGravitationalConstant -9.81
-
-- (CDVAccelerometer*)init
-{
- self = [super init];
- if (self) {
- x = 0;
- y = 0;
- z = 0;
- timestamp = 0;
- self.callbackId = nil;
- self.isRunning = NO;
- }
- return self;
-}
-
-- (void)dealloc
-{
- [self stop:nil];
-}
-
-- (void)start:(CDVInvokedUrlCommand*)command
-{
- NSString* cbId = command.callbackId;
- NSTimeInterval desiredFrequency_num = kAccelerometerInterval;
- UIAccelerometer* pAccel = [UIAccelerometer sharedAccelerometer];
-
- // accelerometer expects fractional seconds, but we have msecs
- pAccel.updateInterval = desiredFrequency_num / 1000;
- self.callbackId = cbId;
- if (!self.isRunning) {
- pAccel.delegate = self;
- self.isRunning = YES;
- }
-}
-
-- (void)onReset
-{
- [self stop:nil];
-}
-
-- (void)stop:(CDVInvokedUrlCommand*)command
-{
- UIAccelerometer* theAccelerometer = [UIAccelerometer sharedAccelerometer];
-
- theAccelerometer.delegate = nil;
- self.isRunning = NO;
-}
-
-/**
- * Picks up accel updates from device and stores them in this class
- */
-- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration
-{
- if (self.isRunning) {
- x = acceleration.x;
- y = acceleration.y;
- z = acceleration.z;
- timestamp = ([[NSDate date] timeIntervalSince1970] * 1000);
- [self returnAccelInfo];
- }
-}
-
-- (void)returnAccelInfo
-{
- // Create an acceleration object
- NSMutableDictionary* accelProps = [NSMutableDictionary dictionaryWithCapacity:4];
-
- [accelProps setValue:[NSNumber numberWithDouble:x * kGravitationalConstant] forKey:@"x"];
- [accelProps setValue:[NSNumber numberWithDouble:y * kGravitationalConstant] forKey:@"y"];
- [accelProps setValue:[NSNumber numberWithDouble:z * kGravitationalConstant] forKey:@"z"];
- [accelProps setValue:[NSNumber numberWithDouble:timestamp] forKey:@"timestamp"];
-
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:accelProps];
- [result setKeepCallback:[NSNumber numberWithBool:YES]];
- [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
-}
-
-// TODO: Consider using filtering to isolate instantaneous data vs. gravity data -jm
-
-/*
- #define kFilteringFactor 0.1
-
- // Use a basic low-pass filter to keep only the gravity component of each axis.
- grav_accelX = (acceleration.x * kFilteringFactor) + ( grav_accelX * (1.0 - kFilteringFactor));
- grav_accelY = (acceleration.y * kFilteringFactor) + ( grav_accelY * (1.0 - kFilteringFactor));
- grav_accelZ = (acceleration.z * kFilteringFactor) + ( grav_accelZ * (1.0 - kFilteringFactor));
-
- // Subtract the low-pass value from the current value to get a simplified high-pass filter
- instant_accelX = acceleration.x - ( (acceleration.x * kFilteringFactor) + (instant_accelX * (1.0 - kFilteringFactor)) );
- instant_accelY = acceleration.y - ( (acceleration.y * kFilteringFactor) + (instant_accelY * (1.0 - kFilteringFactor)) );
- instant_accelZ = acceleration.z - ( (acceleration.z * kFilteringFactor) + (instant_accelZ * (1.0 - kFilteringFactor)) );
-
-
- */
-@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e6b934ac/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index c637d60..b46ecdb 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -71,8 +71,6 @@
8887FD9E1090FBE7009987E8 /* CDVReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD5F1090FBE7009987E8 /* CDVReachability.m */; };
8887FD9F1090FBE7009987E8 /* CDVSound.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD601090FBE7009987E8 /* CDVSound.h */; settings = {ATTRIBUTES = (Public, ); }; };
8887FDA01090FBE7009987E8 /* CDVSound.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD611090FBE7009987E8 /* CDVSound.m */; };
- 88BA573D109BB46F00FB5E78 /* CDVAccelerometer.h in Headers */ = {isa = PBXBuildFile; fileRef = 88BA573B109BB46F00FB5E78 /* CDVAccelerometer.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 88BA573E109BB46F00FB5E78 /* CDVAccelerometer.m in Sources */ = {isa = PBXBuildFile; fileRef = 88BA573C109BB46F00FB5E78 /* CDVAccelerometer.m */; };
9D76CF3C1625A4C50008A0F6 /* CDVGlobalization.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D76CF3A1625A4C50008A0F6 /* CDVGlobalization.h */; settings = {ATTRIBUTES = (Public, ); }; };
9D76CF3D1625A4C50008A0F6 /* CDVGlobalization.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D76CF3B1625A4C50008A0F6 /* CDVGlobalization.m */; };
C937A4561337599E002C4C79 /* CDVFileTransfer.h in Headers */ = {isa = PBXBuildFile; fileRef = C937A4541337599E002C4C79 /* CDVFileTransfer.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -172,8 +170,6 @@
8887FD5F1090FBE7009987E8 /* CDVReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVReachability.m; path = Classes/CDVReachability.m; sourceTree = "<group>"; };
8887FD601090FBE7009987E8 /* CDVSound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVSound.h; path = Classes/CDVSound.h; sourceTree = "<group>"; };
8887FD611090FBE7009987E8 /* CDVSound.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVSound.m; path = Classes/CDVSound.m; sourceTree = "<group>"; };
- 88BA573B109BB46F00FB5E78 /* CDVAccelerometer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAccelerometer.h; path = Classes/CDVAccelerometer.h; sourceTree = "<group>"; };
- 88BA573C109BB46F00FB5E78 /* CDVAccelerometer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVAccelerometer.m; path = Classes/CDVAccelerometer.m; sourceTree = "<group>"; };
9D76CF3A1625A4C50008A0F6 /* CDVGlobalization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVGlobalization.h; path = Classes/CDVGlobalization.h; sourceTree = "<group>"; };
9D76CF3B1625A4C50008A0F6 /* CDVGlobalization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVGlobalization.m; path = Classes/CDVGlobalization.m; sourceTree = "<group>"; };
AA747D9E0F9514B9006C5449 /* CordovaLib_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CordovaLib_Prefix.pch; sourceTree = SOURCE_ROOT; };
@@ -294,8 +290,6 @@
307A8F9D1385A2EC00E43782 /* CDVConnection.m */,
1F92F49E1314023E0046367C /* CDVPluginResult.h */,
1F92F49F1314023E0046367C /* CDVPluginResult.m */,
- 88BA573B109BB46F00FB5E78 /* CDVAccelerometer.h */,
- 88BA573C109BB46F00FB5E78 /* CDVAccelerometer.m */,
8887FD261090FBE7009987E8 /* CDVCamera.h */,
8887FD271090FBE7009987E8 /* CDVCamera.m */,
1F584B991385A28900ED25E8 /* CDVCapture.h */,
@@ -387,7 +381,6 @@
8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */,
8887FD9D1090FBE7009987E8 /* CDVReachability.h in Headers */,
8887FD9F1090FBE7009987E8 /* CDVSound.h in Headers */,
- 88BA573D109BB46F00FB5E78 /* CDVAccelerometer.h in Headers */,
1F3C04CE12BC247D004F9E10 /* CDVContact.h in Headers */,
1F92F4A01314023E0046367C /* CDVPluginResult.h in Headers */,
C937A4561337599E002C4C79 /* CDVFileTransfer.h in Headers */,
@@ -487,7 +480,6 @@
8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */,
8887FD9E1090FBE7009987E8 /* CDVReachability.m in Sources */,
8887FDA01090FBE7009987E8 /* CDVSound.m in Sources */,
- 88BA573E109BB46F00FB5E78 /* CDVAccelerometer.m in Sources */,
1F3C04CF12BC247D004F9E10 /* CDVContact.m in Sources */,
1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */,
C937A4571337599E002C4C79 /* CDVFileTransfer.m in Sources */,
[02/21] ios commit: [CB-3405] InAppBrowser option to hide bottom bar
with Done/History buttons
Posted by st...@apache.org.
[CB-3405] InAppBrowser option to hide bottom bar with Done/History buttons
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/f9f50d38
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/f9f50d38
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/f9f50d38
Branch: refs/heads/3.0.0
Commit: f9f50d38f1f1344f07fd67f4cd117dcf645299d5
Parents: 8fce674
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed May 15 16:01:59 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed May 15 16:01:59 2013 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDVInAppBrowser.h | 2 +
CordovaLib/Classes/CDVInAppBrowser.m | 119 +++++++++++++++++++++++++----
2 files changed, 106 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/f9f50d38/CordovaLib/Classes/CDVInAppBrowser.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVInAppBrowser.h b/CordovaLib/Classes/CDVInAppBrowser.h
index 765326a..c1aa61a 100644
--- a/CordovaLib/Classes/CDVInAppBrowser.h
+++ b/CordovaLib/Classes/CDVInAppBrowser.h
@@ -60,6 +60,7 @@
- (void)close;
- (void)navigateTo:(NSURL*)url;
- (void)showLocationBar:(BOOL)show;
+- (void)showToolBar:(BOOL)show;
- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent;
@@ -68,6 +69,7 @@
@interface CDVInAppBrowserOptions : NSObject {}
@property (nonatomic, assign) BOOL location;
+@property (nonatomic, assign) BOOL toolbar;
@property (nonatomic, copy) NSString* presentationstyle;
@property (nonatomic, copy) NSString* transitionstyle;
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/f9f50d38/CordovaLib/Classes/CDVInAppBrowser.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVInAppBrowser.m b/CordovaLib/Classes/CDVInAppBrowser.m
index b03d1fe..dfc231d 100644
--- a/CordovaLib/Classes/CDVInAppBrowser.m
+++ b/CordovaLib/Classes/CDVInAppBrowser.m
@@ -103,6 +103,7 @@
CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options];
[self.inAppBrowserViewController showLocationBar:browserOptions.location];
+ [self.inAppBrowserViewController showToolBar:browserOptions.toolbar];
// Set Presentation Style
UIModalPresentationStyle presentationStyle = UIModalPresentationFullScreen; // default
@@ -469,30 +470,117 @@
- (void)showLocationBar:(BOOL)show
{
- CGRect addressLabelFrame = self.addressLabel.frame;
- BOOL locationBarVisible = (addressLabelFrame.size.height > 0);
+ CGRect toolbarFrame = self.toolbar.frame;
+ CGRect locationbarFrame = self.addressLabel.frame;
+
+ BOOL toolbarVisible = !self.toolbar.hidden;
// prevent double show/hide
- if (locationBarVisible == show) {
+ if (show == !(self.addressLabel.hidden)) {
return;
}
if (show) {
- CGRect webViewBounds = self.view.bounds;
- webViewBounds.size.height -= FOOTER_HEIGHT;
- self.webView.frame = webViewBounds;
+ self.addressLabel.hidden = NO;
+
+ if (toolbarVisible) {
+ // toolBar at the bottom, leave as is
+ // put locationBar on top of the toolBar
+
+ CGRect webViewBounds = self.view.bounds;
+ webViewBounds.size.height -= FOOTER_HEIGHT;
+ self.webView.frame = webViewBounds;
+
+ locationbarFrame.origin.y = webViewBounds.size.height;
+ self.addressLabel.frame = locationbarFrame;
+ } else {
+ // no toolBar, so put locationBar at the bottom
+
+ CGRect webViewBounds = self.view.bounds;
+ webViewBounds.size.height -= LOCATIONBAR_HEIGHT;
+ self.webView.frame = webViewBounds;
- CGRect addressLabelFrame = self.addressLabel.frame;
- addressLabelFrame.size.height = LOCATIONBAR_HEIGHT;
- self.addressLabel.frame = addressLabelFrame;
+ locationbarFrame.origin.y = webViewBounds.size.height;
+ self.addressLabel.frame = locationbarFrame;
+ }
} else {
- CGRect webViewBounds = self.view.bounds;
- webViewBounds.size.height -= TOOLBAR_HEIGHT;
- self.webView.frame = webViewBounds;
+ self.addressLabel.hidden = YES;
+
+ if (toolbarVisible) {
+ // locationBar is on top of toolBar, hide locationBar
- CGRect addressLabelFrame = self.addressLabel.frame;
- addressLabelFrame.size.height = 0;
- self.addressLabel.frame = addressLabelFrame;
+ // webView take up whole height less toolBar height
+ CGRect webViewBounds = self.view.bounds;
+ webViewBounds.size.height -= TOOLBAR_HEIGHT;
+ self.webView.frame = webViewBounds;
+ } else {
+ // no toolBar, expand webView to screen dimensions
+
+ CGRect webViewBounds = self.view.bounds;
+ self.webView.frame = webViewBounds;
+ }
+ }
+}
+
+- (void)showToolBar:(BOOL)show
+{
+ CGRect toolbarFrame = self.toolbar.frame;
+ CGRect locationbarFrame = self.addressLabel.frame;
+
+ BOOL locationbarVisible = !self.addressLabel.hidden;
+
+ // prevent double show/hide
+ if (show == !(self.toolbar.hidden)) {
+ return;
+ }
+
+ if (show) {
+ self.toolbar.hidden = NO;
+
+ if (locationbarVisible) {
+ // locationBar at the bottom, move locationBar up
+ // put toolBar at the bottom
+
+ CGRect webViewBounds = self.view.bounds;
+ webViewBounds.size.height -= FOOTER_HEIGHT;
+ self.webView.frame = webViewBounds;
+
+ locationbarFrame.origin.y = webViewBounds.size.height;
+ self.addressLabel.frame = locationbarFrame;
+
+ toolbarFrame.origin.y = (webViewBounds.size.height + LOCATIONBAR_HEIGHT);
+ self.toolbar.frame = toolbarFrame;
+ } else {
+ // no locationBar, so put toolBar at the bottom
+
+ CGRect webViewBounds = self.view.bounds;
+ webViewBounds.size.height -= TOOLBAR_HEIGHT;
+ self.webView.frame = webViewBounds;
+
+ toolbarFrame.origin.y = webViewBounds.size.height;
+ self.toolbar.frame = toolbarFrame;
+ }
+ } else {
+ self.toolbar.hidden = YES;
+
+ if (locationbarVisible) {
+ // locationBar is on top of toolBar, hide toolBar
+ // put locationBar at the bottom
+
+ // webView take up whole height less locationBar height
+ CGRect webViewBounds = self.view.bounds;
+ webViewBounds.size.height -= LOCATIONBAR_HEIGHT;
+ self.webView.frame = webViewBounds;
+
+ // move locationBar down
+ locationbarFrame.origin.y = webViewBounds.size.height;
+ self.addressLabel.frame = locationbarFrame;
+ } else {
+ // no locationBar, expand webView to screen dimensions
+
+ CGRect webViewBounds = self.view.bounds;
+ self.webView.frame = webViewBounds;
+ }
}
}
@@ -655,6 +743,7 @@
if (self = [super init]) {
// default values
self.location = YES;
+ self.toolbar = YES;
self.enableviewportscale = NO;
self.mediaplaybackrequiresuseraction = NO;
[20/21] ios commit: removed notification code
Posted by st...@apache.org.
removed notification code
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/4b2365ef
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/4b2365ef
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/4b2365ef
Branch: refs/heads/3.0.0
Commit: 4b2365ef2b90354dc7e2ebb87577a56e98cae2cd
Parents: 03f6d17
Author: Steven Gill <st...@gmail.com>
Authored: Thu May 16 14:28:43 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:48:53 2013 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDV.h | 1 -
CordovaLib/Classes/CDVContacts.m | 1 -
CordovaLib/Classes/CDVNotification.h | 37 -----
CordovaLib/Classes/CDVNotification.m | 130 ------------------
CordovaLib/CordovaLib.xcodeproj/project.pbxproj | 8 -
CordovaLib/cordova.js | 127 -----------------
bin/templates/project/__TESTING__/config.xml | 3 -
7 files changed, 0 insertions(+), 307 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4b2365ef/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index b559f2d..49342be 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -35,7 +35,6 @@
#import "CDVDevice.h"
#import "CDVFile.h"
#import "CDVFileTransfer.h"
-#import "CDVNotification.h"
#import "CDVPluginResult.h"
#import "CDVReachability.h"
#import "CDVSound.h"
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4b2365ef/CordovaLib/Classes/CDVContacts.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVContacts.m b/CordovaLib/Classes/CDVContacts.m
index 6cb9f08..40c038e 100644
--- a/CordovaLib/Classes/CDVContacts.m
+++ b/CordovaLib/Classes/CDVContacts.m
@@ -21,7 +21,6 @@
#import <UIKit/UIKit.h>
#import "NSArray+Comparisons.h"
#import "NSDictionary+Extensions.h"
-#import "CDVNotification.h"
@implementation CDVContactsPicker
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4b2365ef/CordovaLib/Classes/CDVNotification.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVNotification.h b/CordovaLib/Classes/CDVNotification.h
deleted file mode 100644
index 5b5b89f..0000000
--- a/CordovaLib/Classes/CDVNotification.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- 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.
- */
-
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-#import <AudioToolbox/AudioServices.h>
-#import "CDVPlugin.h"
-
-@interface CDVNotification : CDVPlugin <UIAlertViewDelegate>{}
-
-- (void)alert:(CDVInvokedUrlCommand*)command;
-- (void)confirm:(CDVInvokedUrlCommand*)command;
-- (void)prompt:(CDVInvokedUrlCommand*)command;
-- (void)vibrate:(CDVInvokedUrlCommand*)command;
-
-@end
-
-@interface CDVAlertView : UIAlertView {}
-@property (nonatomic, copy) NSString* callbackId;
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4b2365ef/CordovaLib/Classes/CDVNotification.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVNotification.m b/CordovaLib/Classes/CDVNotification.m
deleted file mode 100644
index 464eb1f..0000000
--- a/CordovaLib/Classes/CDVNotification.m
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- 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.
- */
-
-#import "CDVNotification.h"
-#import "NSDictionary+Extensions.h"
-
-#define DIALOG_TYPE_ALERT @"alert"
-#define DIALOG_TYPE_PROMPT @"prompt"
-
-@implementation CDVNotification
-
-/*
- * showDialogWithMessage - Common method to instantiate the alert view for alert, confirm, and prompt notifications.
- * Parameters:
- * message The alert view message.
- * title The alert view title.
- * buttons The array of customized strings for the buttons.
- * defaultText The input text for the textbox (if textbox exists).
- * callbackId The commmand callback id.
- * dialogType The type of alert view [alert | prompt].
- */
-- (void)showDialogWithMessage:(NSString*)message title:(NSString*)title buttons:(NSArray*)buttons defaultText:(NSString*)defaultText callbackId:(NSString*)callbackId dialogType:(NSString*)dialogType
-{
- CDVAlertView* alertView = [[CDVAlertView alloc]
- initWithTitle:title
- message:message
- delegate:self
- cancelButtonTitle:nil
- otherButtonTitles:nil];
-
- alertView.callbackId = callbackId;
-
- int count = [buttons count];
-
- for (int n = 0; n < count; n++) {
- [alertView addButtonWithTitle:[buttons objectAtIndex:n]];
- }
-
- if ([dialogType isEqualToString:DIALOG_TYPE_PROMPT]) {
- alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
- UITextField* textField = [alertView textFieldAtIndex:0];
- textField.text = defaultText;
- }
-
- [alertView show];
-}
-
-- (void)alert:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSString* message = [command argumentAtIndex:0];
- NSString* title = [command argumentAtIndex:1];
- NSString* buttons = [command argumentAtIndex:2];
-
- [self showDialogWithMessage:message title:title buttons:@[buttons] defaultText:nil callbackId:callbackId dialogType:DIALOG_TYPE_ALERT];
-}
-
-- (void)confirm:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSString* message = [command argumentAtIndex:0];
- NSString* title = [command argumentAtIndex:1];
- NSArray* buttons = [command argumentAtIndex:2];
-
- [self showDialogWithMessage:message title:title buttons:buttons defaultText:nil callbackId:callbackId dialogType:DIALOG_TYPE_ALERT];
-}
-
-- (void)prompt:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSString* message = [command argumentAtIndex:0];
- NSString* title = [command argumentAtIndex:1];
- NSArray* buttons = [command argumentAtIndex:2];
- NSString* defaultText = [command argumentAtIndex:3];
-
- [self showDialogWithMessage:message title:title buttons:buttons defaultText:defaultText callbackId:callbackId dialogType:DIALOG_TYPE_PROMPT];
-}
-
-/**
- * Callback invoked when an alert dialog's buttons are clicked.
- */
-- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-{
- CDVAlertView* cdvAlertView = (CDVAlertView*)alertView;
- CDVPluginResult* result;
-
- // Determine what gets returned to JS based on the alert view type.
- if (alertView.alertViewStyle == UIAlertViewStyleDefault) {
- // For alert and confirm, return button index as int back to JS.
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:buttonIndex + 1];
- } else {
- // For prompt, return button index and input text back to JS.
- NSString* value0 = [[alertView textFieldAtIndex:0] text];
- NSDictionary* info = @{
- @"buttonIndex":@(buttonIndex + 1),
- @"input1":(value0 ? value0 : [NSNull null])
- };
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
- }
- [self.commandDelegate sendPluginResult:result callbackId:cdvAlertView.callbackId];
-}
-
-- (void)vibrate:(CDVInvokedUrlCommand*)command
-{
- AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
-}
-
-@end
-
-@implementation CDVAlertView
-
-@synthesize callbackId;
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4b2365ef/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 88e43c4..26f7b06 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -61,8 +61,6 @@
8887FD711090FBE7009987E8 /* CDVFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD311090FBE7009987E8 /* CDVFile.m */; };
8887FD741090FBE7009987E8 /* CDVInvokedUrlCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD341090FBE7009987E8 /* CDVInvokedUrlCommand.h */; settings = {ATTRIBUTES = (Public, ); }; };
8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */; };
- 8887FD8D1090FBE7009987E8 /* CDVNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD4E1090FBE7009987E8 /* CDVNotification.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 8887FD8E1090FBE7009987E8 /* CDVNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD4F1090FBE7009987E8 /* CDVNotification.m */; };
8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD501090FBE7009987E8 /* NSData+Base64.h */; settings = {ATTRIBUTES = (Public, ); }; };
8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD511090FBE7009987E8 /* NSData+Base64.m */; };
8887FD9D1090FBE7009987E8 /* CDVReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD5E1090FBE7009987E8 /* CDVReachability.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -158,8 +156,6 @@
8887FD311090FBE7009987E8 /* CDVFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVFile.m; path = Classes/CDVFile.m; sourceTree = "<group>"; };
8887FD341090FBE7009987E8 /* CDVInvokedUrlCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVInvokedUrlCommand.h; path = Classes/CDVInvokedUrlCommand.h; sourceTree = "<group>"; };
8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVInvokedUrlCommand.m; path = Classes/CDVInvokedUrlCommand.m; sourceTree = "<group>"; };
- 8887FD4E1090FBE7009987E8 /* CDVNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVNotification.h; path = Classes/CDVNotification.h; sourceTree = "<group>"; };
- 8887FD4F1090FBE7009987E8 /* CDVNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVNotification.m; path = Classes/CDVNotification.m; sourceTree = "<group>"; };
8887FD501090FBE7009987E8 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSData+Base64.h"; path = "Classes/NSData+Base64.h"; sourceTree = "<group>"; };
8887FD511090FBE7009987E8 /* NSData+Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSData+Base64.m"; path = "Classes/NSData+Base64.m"; sourceTree = "<group>"; };
8887FD5E1090FBE7009987E8 /* CDVReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVReachability.h; path = Classes/CDVReachability.h; sourceTree = "<group>"; };
@@ -305,8 +301,6 @@
8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */,
C937A4541337599E002C4C79 /* CDVFileTransfer.h */,
C937A4551337599E002C4C79 /* CDVFileTransfer.m */,
- 8887FD4E1090FBE7009987E8 /* CDVNotification.h */,
- 8887FD4F1090FBE7009987E8 /* CDVNotification.m */,
8887FD5E1090FBE7009987E8 /* CDVReachability.h */,
8887FD5F1090FBE7009987E8 /* CDVReachability.m */,
8887FD601090FBE7009987E8 /* CDVSound.h */,
@@ -370,7 +364,6 @@
8887FD6A1090FBE7009987E8 /* CDVContacts.h in Headers */,
8887FD701090FBE7009987E8 /* CDVFile.h in Headers */,
8887FD741090FBE7009987E8 /* CDVInvokedUrlCommand.h in Headers */,
- 8887FD8D1090FBE7009987E8 /* CDVNotification.h in Headers */,
8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */,
8887FD9D1090FBE7009987E8 /* CDVReachability.h in Headers */,
8887FD9F1090FBE7009987E8 /* CDVSound.h in Headers */,
@@ -468,7 +461,6 @@
8887FD6B1090FBE7009987E8 /* CDVContacts.m in Sources */,
8887FD711090FBE7009987E8 /* CDVFile.m in Sources */,
8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */,
- 8887FD8E1090FBE7009987E8 /* CDVNotification.m in Sources */,
8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */,
8887FD9E1090FBE7009987E8 /* CDVReachability.m in Sources */,
8887FDA01090FBE7009987E8 /* CDVSound.m in Sources */,
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4b2365ef/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index df1879c..7e56d7b 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -5075,19 +5075,6 @@ modulemapper.clobbers('cordova/plugin/logger', 'console');
});
-// file: lib/ios/plugin/ios/notification.js
-define("cordova/plugin/ios/notification", function(require, exports, module) {
-
-var Media = require('cordova/plugin/Media');
-
-module.exports = {
- beep:function(count) {
- (new Media('beep.wav')).play();
- }
-};
-
-});
-
// file: lib/common/plugin/logger.js
define("cordova/plugin/logger", function(require, exports, module) {
@@ -5523,120 +5510,6 @@ modulemapper.defaults('cordova/plugin/Connection', 'Connection');
});
-// file: lib/common/plugin/notification.js
-define("cordova/plugin/notification", function(require, exports, module) {
-
-var exec = require('cordova/exec');
-var platform = require('cordova/platform');
-
-/**
- * Provides access to notifications on the device.
- */
-
-module.exports = {
-
- /**
- * Open a native alert dialog, with a customizable title and button text.
- *
- * @param {String} message Message to print in the body of the alert
- * @param {Function} completeCallback The callback that is called when user clicks on a button.
- * @param {String} title Title of the alert dialog (default: Alert)
- * @param {String} buttonLabel Label of the close button (default: OK)
- */
- alert: function(message, completeCallback, title, buttonLabel) {
- var _title = (title || "Alert");
- var _buttonLabel = (buttonLabel || "OK");
- exec(completeCallback, null, "Notification", "alert", [message, _title, _buttonLabel]);
- },
-
- /**
- * Open a native confirm dialog, with a customizable title and button text.
- * The result that the user selects is returned to the result callback.
- *
- * @param {String} message Message to print in the body of the alert
- * @param {Function} resultCallback The callback that is called when user clicks on a button.
- * @param {String} title Title of the alert dialog (default: Confirm)
- * @param {Array} buttonLabels Array of the labels of the buttons (default: ['OK', 'Cancel'])
- */
- confirm: function(message, resultCallback, title, buttonLabels) {
- var _title = (title || "Confirm");
- var _buttonLabels = (buttonLabels || ["OK", "Cancel"]);
-
- // Strings are deprecated!
- if (typeof _buttonLabels === 'string') {
- console.log("Notification.confirm(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array).");
- }
-
- // Some platforms take an array of button label names.
- // Other platforms take a comma separated list.
- // For compatibility, we convert to the desired type based on the platform.
- if (platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone" || platform.id == "blackberry10") {
- if (typeof _buttonLabels === 'string') {
- var buttonLabelString = _buttonLabels;
- _buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here
- }
- } else {
- if (Array.isArray(_buttonLabels)) {
- var buttonLabelArray = _buttonLabels;
- _buttonLabels = buttonLabelArray.toString();
- }
- }
- exec(resultCallback, null, "Notification", "confirm", [message, _title, _buttonLabels]);
- },
-
- /**
- * Open a native prompt dialog, with a customizable title and button text.
- * The following results are returned to the result callback:
- * buttonIndex Index number of the button selected.
- * input1 The text entered in the prompt dialog box.
- *
- * @param {String} message Dialog message to display (default: "Prompt message")
- * @param {Function} resultCallback The callback that is called when user clicks on a button.
- * @param {String} title Title of the dialog (default: "Prompt")
- * @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, defaultText) {
- var _message = (message || "Prompt message");
- var _title = (title || "Prompt");
- var _buttonLabels = (buttonLabels || ["OK","Cancel"]);
- var _defaultText = (defaultText || "Default text");
- exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]);
- },
-
- /**
- * Causes the device to vibrate.
- *
- * @param {Integer} mills The number of milliseconds to vibrate for.
- */
- vibrate: function(mills) {
- exec(null, null, "Notification", "vibrate", [mills]);
- },
-
- /**
- * Causes the device to beep.
- * On Android, the default notification ringtone is played "count" times.
- *
- * @param {Integer} count The number of beeps.
- */
- beep: function(count) {
- exec(null, null, "Notification", "beep", [count]);
- }
-};
-
-});
-
-// file: lib/ios/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/ios/notification', 'navigator.notification');
-
-});
-
// file: lib/common/plugin/requestFileSystem.js
define("cordova/plugin/requestFileSystem", function(require, exports, module) {
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4b2365ef/bin/templates/project/__TESTING__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/config.xml b/bin/templates/project/__TESTING__/config.xml
index c43360e..0a69e16 100644
--- a/bin/templates/project/__TESTING__/config.xml
+++ b/bin/templates/project/__TESTING__/config.xml
@@ -53,9 +53,6 @@
<feature name="NetworkStatus">
<param name="ios-package" value="CDVConnection"/>
</feature>
- <feature name="Notification">
- <param name="ios-package" value="CDVNotification"/>
- </feature>
<feature name="FileTransfer">
<param name="ios-package" value="CDVFileTransfer"/>
</feature>
[18/21] ios commit: updated cordova.js to work again
Posted by st...@apache.org.
updated cordova.js to work again
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/d54eb3b8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/d54eb3b8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/d54eb3b8
Branch: refs/heads/3.0.0
Commit: d54eb3b8be3112ecf971b8d68f2a8851742bf9d1
Parents: 032c67c
Author: Steven Gill <st...@gmail.com>
Authored: Tue May 14 15:53:09 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 18:48:52 2013 -0700
----------------------------------------------------------------------
CordovaLib/cordova.js | 254 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 252 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/d54eb3b8/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index 3327cd0..fd5f13d 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -1,5 +1,5 @@
// Platform: ios
-// 2.7.0rc1-54-g7d503ee
+// 2.7.0rc1-48-gfa57a36
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -19,7 +19,7 @@
under the License.
*/
;(function() {
-var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-54-g7d503ee';
+var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-48-gfa57a36';
// file: lib/scripts/require.js
var require,
@@ -3627,6 +3627,47 @@ module.exports = Metadata;
});
+// file: lib/common/plugin/Position.js
+define("cordova/plugin/Position", function(require, exports, module) {
+
+var Coordinates = require('cordova/plugin/Coordinates');
+
+var Position = function(coords, timestamp) {
+ if (coords) {
+ this.coords = new Coordinates(coords.latitude, coords.longitude, coords.altitude, coords.accuracy, coords.heading, coords.velocity, coords.altitudeAccuracy);
+ } else {
+ this.coords = new Coordinates();
+ }
+ this.timestamp = (timestamp !== undefined) ? timestamp : new Date();
+};
+
+module.exports = Position;
+
+});
+
+// file: lib/common/plugin/PositionError.js
+define("cordova/plugin/PositionError", function(require, exports, module) {
+
+/**
+ * Position error object
+ *
+ * @constructor
+ * @param code
+ * @param message
+ */
+var PositionError = function(code, message) {
+ this.code = code || null;
+ this.message = message || '';
+};
+
+PositionError.PERMISSION_DENIED = 1;
+PositionError.POSITION_UNAVAILABLE = 2;
+PositionError.TIMEOUT = 3;
+
+module.exports = PositionError;
+
+});
+
// file: lib/common/plugin/ProgressEvent.js
define("cordova/plugin/ProgressEvent", function(require, exports, module) {
@@ -4288,6 +4329,215 @@ modulemapper.clobbers('cordova/plugin/FileTransferError', 'FileTransferError');
});
+// file: lib/common/plugin/geolocation.js
+define("cordova/plugin/geolocation", function(require, exports, module) {
+
+var argscheck = require('cordova/argscheck'),
+ utils = require('cordova/utils'),
+ exec = require('cordova/exec'),
+ PositionError = require('cordova/plugin/PositionError'),
+ Position = require('cordova/plugin/Position');
+
+var timers = {}; // list of timers in use
+
+// Returns default params, overrides if provided with values
+function parseParameters(options) {
+ var opt = {
+ maximumAge: 0,
+ enableHighAccuracy: false,
+ timeout: Infinity
+ };
+
+ if (options) {
+ if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) {
+ opt.maximumAge = options.maximumAge;
+ }
+ if (options.enableHighAccuracy !== undefined) {
+ opt.enableHighAccuracy = options.enableHighAccuracy;
+ }
+ if (options.timeout !== undefined && !isNaN(options.timeout)) {
+ if (options.timeout < 0) {
+ opt.timeout = 0;
+ } else {
+ opt.timeout = options.timeout;
+ }
+ }
+ }
+
+ return opt;
+}
+
+// Returns a timeout failure, closed over a specified timeout value and error callback.
+function createTimeout(errorCallback, timeout) {
+ var t = setTimeout(function() {
+ clearTimeout(t);
+ t = null;
+ errorCallback({
+ code:PositionError.TIMEOUT,
+ message:"Position retrieval timed out."
+ });
+ }, timeout);
+ return t;
+}
+
+var geolocation = {
+ lastPosition:null, // reference to last known (cached) position returned
+ /**
+ * Asynchronously acquires the current position.
+ *
+ * @param {Function} successCallback The function to call when the position data is available
+ * @param {Function} errorCallback The function to call when there is an error getting the heading position. (OPTIONAL)
+ * @param {PositionOptions} options The options for getting the position data. (OPTIONAL)
+ */
+ getCurrentPosition:function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
+ options = parseParameters(options);
+
+ // Timer var that will fire an error callback if no position is retrieved from native
+ // before the "timeout" param provided expires
+ var timeoutTimer = {timer:null};
+
+ var win = function(p) {
+ clearTimeout(timeoutTimer.timer);
+ if (!(timeoutTimer.timer)) {
+ // Timeout already happened, or native fired error callback for
+ // this geo request.
+ // Don't continue with success callback.
+ return;
+ }
+ var pos = new Position(
+ {
+ latitude:p.latitude,
+ longitude:p.longitude,
+ altitude:p.altitude,
+ accuracy:p.accuracy,
+ heading:p.heading,
+ velocity:p.velocity,
+ altitudeAccuracy:p.altitudeAccuracy
+ },
+ (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp)))
+ );
+ geolocation.lastPosition = pos;
+ successCallback(pos);
+ };
+ var fail = function(e) {
+ clearTimeout(timeoutTimer.timer);
+ timeoutTimer.timer = null;
+ var err = new PositionError(e.code, e.message);
+ if (errorCallback) {
+ errorCallback(err);
+ }
+ };
+
+ // Check our cached position, if its timestamp difference with current time is less than the maximumAge, then just
+ // fire the success callback with the cached position.
+ if (geolocation.lastPosition && options.maximumAge && (((new Date()).getTime() - geolocation.lastPosition.timestamp.getTime()) <= options.maximumAge)) {
+ successCallback(geolocation.lastPosition);
+ // If the cached position check failed and the timeout was set to 0, error out with a TIMEOUT error object.
+ } else if (options.timeout === 0) {
+ fail({
+ code:PositionError.TIMEOUT,
+ message:"timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceeds provided PositionOptions' maximumAge parameter."
+ });
+ // Otherwise we have to call into native to retrieve a position.
+ } else {
+ if (options.timeout !== Infinity) {
+ // If the timeout value was not set to Infinity (default), then
+ // set up a timeout function that will fire the error callback
+ // if no successful position was retrieved before timeout expired.
+ timeoutTimer.timer = createTimeout(fail, options.timeout);
+ } else {
+ // This is here so the check in the win function doesn't mess stuff up
+ // may seem weird but this guarantees timeoutTimer is
+ // always truthy before we call into native
+ timeoutTimer.timer = true;
+ }
+ exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]);
+ }
+ return timeoutTimer;
+ },
+ /**
+ * Asynchronously watches the geolocation for changes to geolocation. When a change occurs,
+ * the successCallback is called with the new location.
+ *
+ * @param {Function} successCallback The function to call each time the location data is available
+ * @param {Function} errorCallback The function to call when there is an error getting the location data. (OPTIONAL)
+ * @param {PositionOptions} options The options for getting the location data such as frequency. (OPTIONAL)
+ * @return String The watch id that must be passed to #clearWatch to stop watching.
+ */
+ watchPosition:function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
+ options = parseParameters(options);
+
+ var id = utils.createUUID();
+
+ // Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPosition
+ timers[id] = geolocation.getCurrentPosition(successCallback, errorCallback, options);
+
+ var fail = function(e) {
+ clearTimeout(timers[id].timer);
+ var err = new PositionError(e.code, e.message);
+ if (errorCallback) {
+ errorCallback(err);
+ }
+ };
+
+ var win = function(p) {
+ clearTimeout(timers[id].timer);
+ if (options.timeout !== Infinity) {
+ timers[id].timer = createTimeout(fail, options.timeout);
+ }
+ var pos = new Position(
+ {
+ latitude:p.latitude,
+ longitude:p.longitude,
+ altitude:p.altitude,
+ accuracy:p.accuracy,
+ heading:p.heading,
+ velocity:p.velocity,
+ altitudeAccuracy:p.altitudeAccuracy
+ },
+ (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp)))
+ );
+ geolocation.lastPosition = pos;
+ successCallback(pos);
+ };
+
+ exec(win, fail, "Geolocation", "addWatch", [id, options.enableHighAccuracy]);
+
+ return id;
+ },
+ /**
+ * Clears the specified heading watch.
+ *
+ * @param {String} id The ID of the watch returned from #watchPosition
+ */
+ clearWatch:function(id) {
+ if (id && timers[id] !== undefined) {
+ clearTimeout(timers[id].timer);
+ timers[id].timer = false;
+ exec(null, null, "Geolocation", "clearWatch", [id]);
+ }
+ }
+};
+
+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) {
[09/21] ios commit: [CB-3416] adding empty element during
deprecation window.
Posted by st...@apache.org.
[CB-3416] adding empty <plugins> element during deprecation window.
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/a090eef3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/a090eef3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/a090eef3
Branch: refs/heads/3.0.0
Commit: a090eef357e2876384b08a4cf778bb283f540b09
Parents: e425e84
Author: Fil Maj <ma...@gmail.com>
Authored: Thu May 16 14:36:50 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Thu May 16 14:36:50 2013 -0700
----------------------------------------------------------------------
bin/templates/project/__TESTING__/config.xml | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a090eef3/bin/templates/project/__TESTING__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/config.xml b/bin/templates/project/__TESTING__/config.xml
index 3e84967..ca292c8 100644
--- a/bin/templates/project/__TESTING__/config.xml
+++ b/bin/templates/project/__TESTING__/config.xml
@@ -92,4 +92,7 @@
<feature name="LocalStorage">
<param name="ios-package" value="CDVLocalStorage"/>
</feature>
+ <!-- Deprecated plugins element. REmove in 3.0 -->
+ <plugins>
+ </plugins>
</widget>
[05/21] ios commit: CordovaLib Unit Tests: removed Cordova.plist
Posted by st...@apache.org.
CordovaLib Unit Tests: removed Cordova.plist
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/f108c406
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/f108c406
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/f108c406
Branch: refs/heads/3.0.0
Commit: f108c406499968c260c20957ce917b4e4b092ade
Parents: 9f590ad
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu May 16 09:50:19 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu May 16 09:50:19 2013 -0700
----------------------------------------------------------------------
.../CordovaTests.xcodeproj/project.pbxproj | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/f108c406/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj b/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
index 1a33241..220d189 100644
--- a/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
+++ b/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
@@ -91,7 +91,6 @@
30AE4E8C1419532F005A9C9A /* CDVContactsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVContactsTests.m; sourceTree = "<group>"; };
30B342F415224B360070E6A5 /* CDVWebViewTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWebViewTest.m; sourceTree = "<group>"; };
30D1B08B15A2B36D0060C291 /* CDVBase64Tests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVBase64Tests.m; sourceTree = "<group>"; };
- 30F8AE12152127CE006625B3 /* Cordova.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Cordova.plist; sourceTree = "<group>"; };
30F8AE1C152129DA006625B3 /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = "<group>"; };
686357A9141002F100DF4CF2 /* CordovaLibTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CordovaLibTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
686357AA141002F100DF4CF2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
@@ -221,7 +220,6 @@
303A406E152124BB00182201 /* Supporting Files */ = {
isa = PBXGroup;
children = (
- 30F8AE12152127CE006625B3 /* Cordova.plist */,
303A406F152124BB00182201 /* CordovaLibApp-Info.plist */,
303A4070152124BB00182201 /* InfoPlist.strings */,
303A4073152124BB00182201 /* main.m */,
[06/21] ios commit: CordovaLib Unit Tests: added test for CB-3394
Posted by st...@apache.org.
CordovaLib Unit Tests: added test for CB-3394
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/6bbdd789
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/6bbdd789
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/6bbdd789
Branch: refs/heads/3.0.0
Commit: 6bbdd78910657d45ddb560adf24003c7910ad0f2
Parents: f108c40
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu May 16 09:51:34 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu May 16 09:51:34 2013 -0700
----------------------------------------------------------------------
CordovaLibTests/CDVWhitelistTests.m | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6bbdd789/CordovaLibTests/CDVWhitelistTests.m
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CDVWhitelistTests.m b/CordovaLibTests/CDVWhitelistTests.m
index 21576a3..b809972 100644
--- a/CordovaLibTests/CDVWhitelistTests.m
+++ b/CordovaLibTests/CDVWhitelistTests.m
@@ -290,4 +290,22 @@
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://www.google.com"]], nil);
}
+- (void)testWildcardPlusOtherUrls
+{
+ // test for https://issues.apache.org/jira/browse/CB-3394
+
+ NSArray* allowedHosts = [NSArray arrayWithObjects:
+ @"*",
+ @"cordova.apache.org",
+ nil];
+
+ CDVWhitelist* whitelist = [[CDVWhitelist alloc] initWithArray:allowedHosts];
+
+ STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://*.apache.org"]], nil);
+ STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"https://www.google.com"]], nil);
+ STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"ftp://cordova.apache.org"]], nil);
+ STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://cordova.apache.org"]], nil);
+ STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"https://cordova.apache.org"]], nil);
+}
+
@end
[03/21] ios commit: [CB-3006] Customize InAppBrowser location bar
Posted by st...@apache.org.
[CB-3006] Customize InAppBrowser location bar
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/8eaefcf6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/8eaefcf6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/8eaefcf6
Branch: refs/heads/3.0.0
Commit: 8eaefcf6f198f0c09bb8e5b5ba856ca658a913da
Parents: f9f50d3
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed May 15 16:44:04 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed May 15 16:44:04 2013 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDVInAppBrowser.h | 3 ++
CordovaLib/Classes/CDVInAppBrowser.m | 41 +++++++++++++++++++---------
2 files changed, 31 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8eaefcf6/CordovaLib/Classes/CDVInAppBrowser.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVInAppBrowser.h b/CordovaLib/Classes/CDVInAppBrowser.h
index c1aa61a..f87baff 100644
--- a/CordovaLib/Classes/CDVInAppBrowser.h
+++ b/CordovaLib/Classes/CDVInAppBrowser.h
@@ -61,6 +61,7 @@
- (void)navigateTo:(NSURL*)url;
- (void)showLocationBar:(BOOL)show;
- (void)showToolBar:(BOOL)show;
+- (void)setCloseButtonTitle:(NSString*)title;
- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent;
@@ -70,6 +71,8 @@
@property (nonatomic, assign) BOOL location;
@property (nonatomic, assign) BOOL toolbar;
+@property (nonatomic, copy) NSString* closebuttoncaption;
+
@property (nonatomic, copy) NSString* presentationstyle;
@property (nonatomic, copy) NSString* transitionstyle;
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8eaefcf6/CordovaLib/Classes/CDVInAppBrowser.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVInAppBrowser.m b/CordovaLib/Classes/CDVInAppBrowser.m
index dfc231d..d5f06ec 100644
--- a/CordovaLib/Classes/CDVInAppBrowser.m
+++ b/CordovaLib/Classes/CDVInAppBrowser.m
@@ -104,13 +104,16 @@
CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options];
[self.inAppBrowserViewController showLocationBar:browserOptions.location];
[self.inAppBrowserViewController showToolBar:browserOptions.toolbar];
+ if (browserOptions.closebuttoncaption != nil) {
+ [self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption];
+ }
// Set Presentation Style
UIModalPresentationStyle presentationStyle = UIModalPresentationFullScreen; // default
if (browserOptions.presentationstyle != nil) {
- if ([browserOptions.presentationstyle isEqualToString:@"pagesheet"]) {
+ if ([[browserOptions.presentationstyle lowercaseString] isEqualToString:@"pagesheet"]) {
presentationStyle = UIModalPresentationPageSheet;
- } else if ([browserOptions.presentationstyle isEqualToString:@"formsheet"]) {
+ } else if ([[browserOptions.presentationstyle lowercaseString] isEqualToString:@"formsheet"]) {
presentationStyle = UIModalPresentationFormSheet;
}
}
@@ -119,9 +122,9 @@
// Set Transition Style
UIModalTransitionStyle transitionStyle = UIModalTransitionStyleCoverVertical; // default
if (browserOptions.transitionstyle != nil) {
- if ([browserOptions.transitionstyle isEqualToString:@"fliphorizontal"]) {
+ if ([[browserOptions.transitionstyle lowercaseString] isEqualToString:@"fliphorizontal"]) {
transitionStyle = UIModalTransitionStyleFlipHorizontal;
- } else if ([browserOptions.transitionstyle isEqualToString:@"crossdissolve"]) {
+ } else if ([[browserOptions.transitionstyle lowercaseString] isEqualToString:@"crossdissolve"]) {
transitionStyle = UIModalTransitionStyleCrossDissolve;
}
}
@@ -402,9 +405,6 @@
self.closeButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(close)];
self.closeButton.enabled = YES;
- self.closeButton.imageInsets = UIEdgeInsetsZero;
- self.closeButton.style = UIBarButtonItemStylePlain;
- self.closeButton.width = 32.000;
UIBarButtonItem* flexibleSpaceButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
@@ -468,9 +468,22 @@
[self.view addSubview:self.spinner];
}
+- (void)setCloseButtonTitle:(NSString*)title
+{
+ // the advantage of using UIBarButtonSystemItemDone is the system will localize it for you automatically
+ // but, if you want to set this yourself, knock yourself out (we can't set the title for a system Done button, so we have to create a new one)
+ self.closeButton = nil;
+ self.closeButton = [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStyleBordered target:self action:@selector(close)];
+ self.closeButton.enabled = YES;
+ self.closeButton.tintColor = [UIColor colorWithRed:60.0 / 255.0 green:136.0 / 255.0 blue:230.0 / 255.0 alpha:1];
+
+ NSMutableArray* items = [self.toolbar.items mutableCopy];
+ [items replaceObjectAtIndex:0 withObject:self.closeButton];
+ [self.toolbar setItems:items];
+}
+
- (void)showLocationBar:(BOOL)show
{
- CGRect toolbarFrame = self.toolbar.frame;
CGRect locationbarFrame = self.addressLabel.frame;
BOOL toolbarVisible = !self.toolbar.hidden;
@@ -744,6 +757,7 @@
// default values
self.location = YES;
self.toolbar = YES;
+ self.closebuttoncaption = nil;
self.enableviewportscale = NO;
self.mediaplaybackrequiresuseraction = NO;
@@ -768,19 +782,20 @@
if ([keyvalue count] == 2) {
NSString* key = [[keyvalue objectAtIndex:0] lowercaseString];
- NSString* value = [[keyvalue objectAtIndex:1] lowercaseString];
+ NSString* value = [keyvalue objectAtIndex:1];
+ NSString* value_lc = [value lowercaseString];
- BOOL isBoolean = [value isEqualToString:@"yes"] || [value isEqualToString:@"no"];
+ BOOL isBoolean = [value_lc isEqualToString:@"yes"] || [value_lc isEqualToString:@"no"];
NSNumberFormatter* numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setAllowsFloats:YES];
- BOOL isNumber = [numberFormatter numberFromString:value] != nil;
+ BOOL isNumber = [numberFormatter numberFromString:value_lc] != nil;
// set the property according to the key name
if ([obj respondsToSelector:NSSelectorFromString(key)]) {
if (isNumber) {
- [obj setValue:[numberFormatter numberFromString:value] forKey:key];
+ [obj setValue:[numberFormatter numberFromString:value_lc] forKey:key];
} else if (isBoolean) {
- [obj setValue:[NSNumber numberWithBool:[value isEqualToString:@"yes"]] forKey:key];
+ [obj setValue:[NSNumber numberWithBool:[value_lc isEqualToString:@"yes"]] forKey:key];
} else {
[obj setValue:value forKey:key];
}