Permalink
Browse files

Merge branch 'master' of https://github.com/purplecabbage/incubator-c…

  • Loading branch information...
2 parents b543b5a + ce50b72 commit a56d60e22f02311c02ed1a1cc5740f0cf80d108b @purplecabbage purplecabbage committed Nov 15, 2012
Showing with 1,741 additions and 353 deletions.
  1. +6 −7 Jakefile
  2. +1 −1 VERSION
  3. +4 −26 build/packager.js
  4. +22 −13 lib/android/exec.js
  5. +1 −1 lib/bada/plugin/bada/device.js
  6. +4 −4 lib/{webworks → blackberry}/exec.js
  7. +48 −0 lib/blackberry/platform.js
  8. 0 lib/{webworks/air → blackberry}/plugin/air/DirectoryEntry.js
  9. 0 lib/{webworks/air → blackberry}/plugin/air/DirectoryReader.js
  10. 0 lib/{webworks/air → blackberry}/plugin/air/Entry.js
  11. 0 lib/{webworks/air → blackberry}/plugin/air/File.js
  12. 0 lib/{webworks/air → blackberry}/plugin/air/FileEntry.js
  13. 0 lib/{webworks/air → blackberry}/plugin/air/FileReader.js
  14. 0 lib/{webworks/air → blackberry}/plugin/air/FileTransfer.js
  15. 0 lib/{webworks/air → blackberry}/plugin/air/FileWriter.js
  16. 0 lib/{webworks/air → blackberry}/plugin/air/battery.js
  17. 0 lib/{webworks/air → blackberry}/plugin/air/camera.js
  18. 0 lib/{webworks/air → blackberry}/plugin/air/capture.js
  19. +1 −1 lib/{webworks/air → blackberry}/plugin/air/device.js
  20. 0 lib/{webworks/air/plugin → blackberry/plugin/air}/manager.js
  21. 0 lib/{webworks/air → blackberry}/plugin/air/network.js
  22. 0 lib/{webworks → blackberry/plugin}/air/platform.js
  23. 0 lib/{webworks/air → blackberry}/plugin/air/requestFileSystem.js
  24. 0 lib/{webworks/air → blackberry}/plugin/air/resolveLocalFileSystemURI.js
  25. 0 lib/{webworks/java → blackberry}/plugin/java/Contact.js
  26. 0 lib/{webworks/java → blackberry}/plugin/java/ContactUtils.js
  27. 0 lib/{webworks/java → blackberry}/plugin/java/DirectoryEntry.js
  28. 0 lib/{webworks/java → blackberry}/plugin/java/Entry.js
  29. 0 lib/{webworks/java → blackberry}/plugin/java/MediaError.js
  30. +3 −2 lib/{webworks/java → blackberry}/plugin/java/app.js
  31. 0 lib/{webworks/java → blackberry}/plugin/java/contacts.js
  32. 0 lib/{webworks/java/plugin → blackberry/plugin/java}/manager.js
  33. 0 lib/{webworks/java → blackberry}/plugin/java/notification.js
  34. +2 −1 lib/{webworks → blackberry/plugin}/java/platform.js
  35. +9 −5 lib/{webworks/qnx → blackberry}/plugin/qnx/battery.js
  36. 0 lib/{webworks/qnx → blackberry}/plugin/qnx/camera.js
  37. +1 −1 lib/{webworks/qnx → blackberry}/plugin/qnx/capture.js
  38. 0 lib/{webworks/qnx/plugin → blackberry/plugin/qnx}/compass.js
  39. +1 −1 lib/{webworks/qnx → blackberry}/plugin/qnx/device.js
  40. 0 lib/{webworks/qnx → blackberry}/plugin/qnx/fileTransfer.js
  41. 0 lib/{webworks/qnx/plugin/qnx/compass.js → blackberry/plugin/qnx/magnetometer.js}
  42. +1 −1 lib/{webworks/qnx/plugin → blackberry/plugin/qnx}/manager.js
  43. +1 −2 lib/{webworks/qnx → blackberry}/plugin/qnx/network.js
  44. +9 −0 lib/{webworks → blackberry/plugin}/qnx/platform.js
  45. 0 lib/{webworks/qnx → blackberry}/plugin/qnx/requestFileSystem.js
  46. 0 lib/{webworks/qnx → blackberry}/plugin/qnx/resolveLocalFileSystemURI.js
  47. +1 −1 lib/{webworks/common → blackberry}/plugin/webworks/accelerometer.js
  48. 0 lib/{webworks/common → blackberry}/plugin/webworks/logger.js
  49. +1 −6 lib/{webworks/common → blackberry}/plugin/webworks/media.js
  50. 0 lib/{webworks/common → blackberry}/plugin/webworks/notification.js
  51. +17 −4 lib/common/builder.js
  52. +9 −3 lib/common/common.js
  53. +1 −1 lib/common/plugin/FileTransfer.js
  54. +42 −46 lib/common/plugin/network.js
  55. +24 −0 lib/common/utils.js
  56. +21 −21 lib/ios/exec.js
  57. +13 −7 test/test.media.js → lib/scripts/bootstrap-blackberry.js
  58. +18 −8 lib/scripts/bootstrap.js
  59. +1 −0 lib/test/blackberryexec.js
  60. +1 −0 lib/test/blackberryplatform.js
  61. +1 −0 lib/test/iosexec.js
  62. +121 −0 lib/test/mockxhr.js
  63. +6 −1 lib/{scripts/bootstrap-playbook.js → test/platform.js}
  64. +1 −1 lib/tizen/plugin/tizen/Device.js
  65. +2 −1 lib/webos/plugin/webos/compass.js
  66. +1 −1 lib/webos/plugin/webos/device.js
  67. +21 −14 lib/windows8/platform.js
  68. +2 −8 lib/windows8/plugin/windows8/CameraProxy.js
  69. +1 −1 lib/windows8/plugin/windows8/CaptureProxy.js
  70. +48 −0 lib/windows8/plugin/windows8/ContactsProxy.js
  71. +17 −13 lib/windows8/plugin/windows8/DeviceProxy.js
  72. +6 −11 lib/windows8/plugin/windows8/FileProxy.js
  73. +5 −2 lib/windows8/plugin/windows8/MediaProxy.js
  74. +0 −112 lib/windows8/plugin/windows8/geolocation.js
  75. 0 lib/{wp7 → windowsphone}/exec.js
  76. +11 −8 lib/{wp7 → windowsphone}/platform.js
  77. +1 −1 lib/{wp7/plugin/wp7 → windowsphone/plugin/windowsphone}/CordovaCommandResult.js
  78. 0 lib/{wp7/plugin/wp7 → windowsphone/plugin/windowsphone}/CordovaMediaonStatus.js
  79. +18 −13 lib/{wp7/plugin/wp7 → windowsphone/plugin/windowsphone}/DOMStorage.js
  80. 0 lib/{wp7/plugin/wp7 → windowsphone/plugin/windowsphone}/FileTransfer.js
  81. 0 lib/{wp7/plugin/wp7 → windowsphone/plugin/windowsphone}/FileUploadOptions.js
  82. 0 lib/{wp7/plugin/wp7 → windowsphone/plugin/windowsphone}/XHRPatch.js
  83. 0 lib/{wp7/plugin/wp7 → windowsphone/plugin/windowsphone}/console.js
  84. +16 −0 test/android/test.exec.js
  85. +72 −0 test/blackberry/qnx/test.battery.js
  86. +59 −0 test/blackberry/qnx/test.camera.js
  87. +48 −0 test/blackberry/qnx/test.device.js
  88. +56 −0 test/blackberry/qnx/test.manager.js
  89. +17 −2 lib/scripts/bootstrap-qnx.js → test/blackberry/qnx/test.network.js
  90. +162 −0 test/blackberry/test.exec.js
  91. +95 −0 test/blackberry/test.platform.js
  92. +85 −0 test/blackberry/webworks/test.accelerometer.js
  93. +40 −0 test/blackberry/webworks/test.logger.js
  94. +319 −0 test/blackberry/webworks/test.media.js
  95. +88 −0 test/blackberry/webworks/test.notification.js
  96. +120 −0 test/ios/test.exec.js
  97. +4 −1 test/runner.js
  98. +2 −0 test/suite.html
  99. +33 −0 test/test.utils.js
View
@@ -69,7 +69,8 @@ task('clean', ['set-cwd'], function () {
var DEPLOY = path.join(__dirname,"pkg");
var cmd = 'rm -rf ' + DEPLOY + ' && ' +
- 'mkdir ' + DEPLOY;
+ 'mkdir ' + DEPLOY + ' && ' +
+ 'mkdir ' + DEPLOY + '/debug';
childProcess.exec(cmd,complete);
}, true);
@@ -88,10 +89,8 @@ task('build', ['clean', 'hint', 'update-version'], function () {
packager.generate("windows8",commitId);
packager.generate("blackberry",commitId);
- packager.generate("playbook",commitId);
- packager.generate("qnx",commitId);
packager.generate("ios",commitId);
- packager.generate("wp7",commitId);
+ packager.generate("windowsphone",commitId);
packager.generate("android",commitId);
packager.generate("bada",commitId);
packager.generate("tizen",commitId);
@@ -104,14 +103,14 @@ task('build', ['clean', 'hint', 'update-version'], function () {
desc("drops VERSION into JavaScript-based platforms");
task('update-version', ['set-cwd'], function() {
- var version = fs.readFileSync("VERSION", "utf-8").toString().split('\n').join('');
+ var version = fs.readFileSync("VERSION", "utf-8").toString().split(/\r?\n/).join('');
// List of files that need to be interpolated with matching regexes
var files = {
"lib/bada/plugin/bada/device.js":/(me\.cordova\s=\s").+(")/,
"lib/tizen/plugin/tizen/Device.js":/(this\.cordova\s=\s").+(")/,
- "lib/webworks/qnx/plugin/qnx/device.js":/(cordova:\s").+(")/,
- "lib/webworks/air/plugin/air/device.js":/(cordova:\s").+(")/
+ "lib/blackberry/plugin/qnx/device.js":/(cordova:\s").+(")/,
+ "lib/blackberry/plugin/air/device.js":/(cordova:\s").+(")/
};
for (var f in files) if (files.hasOwnProperty(f)) {
View
@@ -1 +1 @@
-2.2.0rc2
+2.2.0
View
@@ -37,7 +37,7 @@ packager.generate = function(platform, commitId) {
outFile = path.join('pkg', 'cordova.' + platform + '.js')
fs.writeFileSync(outFile, libraryRelease, 'utf8')
- outFile = path.join('pkg', 'cordova.' + platform + '-debug.js')
+ outFile = path.join('pkg/debug', 'cordova.' + platform + '-debug.js')
fs.writeFileSync(outFile, libraryDebug, 'utf8')
console.log('generated platform: ' + platform + ' in ' + time + 'ms')
@@ -50,35 +50,13 @@ packager.bundle = function(platform, debug, commitId ) {
modules[''] = 'lib/cordova.js'
- if (['playbook', 'blackberry', 'qnx'].indexOf(platform) > -1) {
- //BlackBerry is special ;)
-
- var lang = platform;
-
- switch (platform) {
- case 'blackberry':
- lang = 'java';
- break;
- case 'playbook':
- lang = 'air';
- break;
- default:
- break;
- }
-
- copyProps(modules, collectFile(path.join('lib', 'webworks'), '', 'exec.js'))
- copyProps(modules, collectFiles(path.join('lib', 'webworks/common')))
- copyProps(modules, collectFiles(path.join('lib', 'webworks/' + lang)))
- }
- else if (platform === 'test') {
+ if (platform === 'test') {
copyProps(modules, collectFiles(path.join('lib', platform)));
//Test platform needs to bring in platform specific plugin's for testing
- copyProps(modules, collectFiles(path.join('lib', 'webworks', 'air', 'plugin', 'air'), 'plugin/air'));
- copyProps(modules, collectFiles(path.join('lib', 'webworks', 'java', 'plugin', 'java'), 'plugin/java'));
- copyProps(modules, collectFiles(path.join('lib', 'webworks', 'qnx', 'plugin', 'qnx'), 'plugin/qnx'));
+ copyProps(modules, collectFiles(path.join('lib', 'blackberry', 'plugin'), 'plugin'));
copyProps(modules, collectFiles(path.join('lib', 'tizen', 'plugin', 'tizen'), 'plubin/tizen'));
- copyProps(modules, collectFiles(path.join('lib', 'wp7', 'plugin', 'wp7'), 'plugin/wp7'));
+ copyProps(modules, collectFiles(path.join('lib', 'windowsphone', 'plugin', 'windowsphone'), 'plugin/windowsphone'));
copyProps(modules, collectFiles(path.join('lib', 'windows8', 'plugin', 'windows8'), 'plugin/windows8'));
copyProps(modules, collectFiles(path.join('lib', 'ios', 'plugin', 'ios'), 'plugin/ios/'));
copyProps(modules, collectFiles(path.join('lib', 'bada', 'plugin', 'bada'), 'plugin/bada/'));
View
@@ -105,8 +105,8 @@ function pollOnce() {
function pollingTimerFunc() {
if (pollEnabled) {
- pollOnce();
- setTimeout(pollingTimerFunc, 50);
+ pollOnce();
+ setTimeout(pollingTimerFunc, 50);
}
}
@@ -199,25 +199,34 @@ function processMessage(message) {
// This is called from the NativeToJsMessageQueue.java.
androidExec.processMessages = function(messages) {
- messagesFromNative.push(messages);
- // Check for the reentrant case, and enqueue the message if that's the case.
- if (messagesFromNative.length > 1) {
- return;
- }
- while (messagesFromNative.length) {
- messages = messagesFromNative[0];
- while (messages) {
+ if (messages) {
+ messagesFromNative.push(messages);
+ while (messagesFromNative.length) {
+ messages = messagesFromNative.shift();
+ // The Java side can send a * message to indicate that it
+ // still has messages waiting to be retrieved.
+ // TODO(agrieve): This is currently disabled on the Java side
+ // since it breaks returning the result in exec of synchronous
+ // plugins. Once we remove this ability, we can remove this comment.
if (messages == '*') {
window.setTimeout(pollOnce, 0);
- break;
+ continue;
}
+
var spaceIdx = messages.indexOf(' ');
var msgLen = +messages.slice(0, spaceIdx);
var message = messages.substr(spaceIdx + 1, msgLen);
messages = messages.slice(spaceIdx + msgLen + 1);
- processMessage(message);
+ // Put the remaining messages back into queue in case an exec()
+ // is made by the callback.
+ if (messages) {
+ messagesFromNative.unshift(messages);
+ }
+
+ if (message) {
+ processMessage(message);
+ }
}
- messagesFromNative.shift();
}
};
@@ -72,7 +72,7 @@ Device.prototype.getDeviceInfo = function(success, fail, args) {
me.platform = os_vendor + " " + os_name;
me.version = os_version;
me.uuid = uuid;
- me.cordova = "2.2.0rc2";
+ me.cordova = "2.2.0";
success(me);
}
};
@@ -19,8 +19,8 @@
*
*/
-var manager = require('cordova/plugin/manager'),
- cordova = require('cordova'),
+var cordova = require('cordova'),
+ platform = require('cordova/platform'),
utils = require('cordova/utils');
/**
@@ -40,7 +40,8 @@ var manager = require('cordova/plugin/manager'),
module.exports = function(success, fail, service, action, args) {
try {
- var v = manager.exec(success, fail, service, action, args);
+ var manager = require('cordova/plugin/' + platform.runtime() + '/manager'),
+ v = manager.exec(success, fail, service, action, args);
// If status is OK, then return value back to caller
if (v.status == cordova.callbackStatus.OK) {
@@ -53,7 +54,6 @@ module.exports = function(success, fail, service, action, args) {
catch (e) {
console.log("Error in success callback: "+cordova.callbackId+" = "+e);
}
-
}
return v.message;
} else if (v.status == cordova.callbackStatus.NO_RESULT) {
View
@@ -0,0 +1,48 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+module.exports = {
+ id: "blackberry",
+ runtime: function () {
+ if (navigator.userAgent.indexOf("BB10") > -1) {
+ return 'qnx';
+ }
+ else if (navigator.userAgent.indexOf("PlayBook") > -1) {
+ return 'air';
+ }
+ else if (navigator.userAgent.indexOf("BlackBerry") > -1) {
+ return 'java';
+ }
+ else {
+ console.log("Unknown user agent?!?!? defaulting to java");
+ return 'java';
+ }
+ },
+ initialize: function() {
+ var builder = require('cordova/builder'),
+ platform = require('cordova/plugin/' + this.runtime() + '/platform');
+
+ builder.build(platform.objects).intoAndClobber(window);
+ builder.build(platform.merges).intoAndMerge(window);
+ platform.initialize();
+ },
+ objects: {}
+};
@@ -32,7 +32,7 @@ module.exports = {
version: blackberry.system.softwareVersion,
name: blackberry.system.model,
uuid: blackberry.identity.PIN,
- cordova: "2.2.0rc2"
+ cordova: "2.2.0"
});
return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "Device info returned" };
@@ -19,8 +19,9 @@
*
*/
-var exec = require('cordova/exec');
-var manager = require('cordova/plugin/manager');
+var exec = require('cordova/exec'),
+ platform = require('cordova/platform'),
+ manager = require('cordova/plugin/' + platform.runtime() + '/manager');
module.exports = {
/**
@@ -25,7 +25,8 @@ module.exports = {
var cordova = require('cordova'),
exec = require('cordova/exec'),
channel = require('cordova/channel'),
- manager = require('cordova/plugin/manager'),
+ platform = require('cordova/platform'),
+ manager = require('cordova/plugin/' + platform.runtime() + '/manager'),
app = require('cordova/plugin/java/app');
// BB OS 5 does not define window.console.
@@ -20,17 +20,21 @@
*/
var cordova = require('cordova'),
- handler;
+ interval;
module.exports = {
start: function (args, win, fail) {
- handler = win;
- blackberry.event.addEventListener("batterystatus", handler);
+ interval = window.setInterval(function () {
+ win({
+ level: navigator.webkitBattery.level * 100,
+ isPlugged: navigator.webkitBattery.charging
+ });
+ }, 500);
return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
},
stop: function (args, win, fail) {
- blackberry.event.removeEventListener("batterystatus", handler);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
+ window.clearInterval(interval);
+ return { "status" : cordova.callbackStatus.OK, "message" : "stopped" };
}
};
@@ -27,7 +27,7 @@ function capture(action, win, fail) {
blackberry.invoke.card.invokeCamera(action, function (path) {
var sb = blackberry.io.sandbox;
blackberry.io.sandbox = false;
- webkitRequestFileSystem(PERSISTENT, 1024, function (fs) {
+ window.webkitRequestFileSystem(window.PERSISTENT, 1024, function (fs) {
fs.root.getFile(path, {}, function (fe) {
fe.file(function (file) {
file.fullPath = fe.fullPath;
@@ -32,7 +32,7 @@ module.exports = {
version: blackberry.system.softwareVersion,
name: "Dev Alpha",
uuid: blackberry.identity.uuid,
- cordova: "2.2.0rc2"
+ cordova: "2.2.0"
});
return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "Device info returned" };
@@ -25,7 +25,7 @@ var cordova = require('cordova'),
'Accelerometer' : require('cordova/plugin/webworks/accelerometer'),
'Device' : require('cordova/plugin/qnx/device'),
'Battery' : require('cordova/plugin/qnx/battery'),
- 'Compass' : require('cordova/plugin/qnx/compass'),
+ 'Compass' : require('cordova/plugin/qnx/magnetometer'),
'Camera' : require('cordova/plugin/qnx/camera'),
'Capture' : require('cordova/plugin/qnx/capture'),
'Logger' : require('cordova/plugin/webworks/logger'),
@@ -19,8 +19,7 @@
*
*/
-var cordova = require('cordova'),
- connection = require('cordova/plugin/Connection');
+var cordova = require('cordova');
module.exports = {
getConnectionInfo: function (args, win, fail) {
@@ -48,5 +48,14 @@ module.exports = {
resolveLocalFileSystemURI:{
path: 'cordova/plugin/qnx/resolveLocalFileSystemURI'
}
+ },
+ merges: {
+ navigator: {
+ children: {
+ compass: {
+ path: 'cordova/plugin/qnx/compass'
+ }
+ }
+ }
}
};
@@ -38,6 +38,6 @@ module.exports = {
},
stop: function (args, win, fail) {
window.removeEventListener("devicemotion", callback);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
+ return { "status" : cordova.callbackStatus.OK, "message" : "removed" };
}
};
@@ -98,7 +98,6 @@ module.exports = {
result = {"status" : 1, "message" : "Seek to audio succeeded" };
}
-
return result;
},
pausePlayingAudio: function (args, win, fail) {
@@ -153,12 +152,8 @@ module.exports = {
return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
}
- var id = args[0],
- audio = audioObjects[id],
- result;
-
if (args.length <= 1) {
- result = {"status" : 9, "message" : "Media start recording, insufficient arguments"};
+ return {"status" : 9, "message" : "Media start recording, insufficient arguments"};
}
blackberry.media.microphone.record(args[1], win, fail);
Oops, something went wrong.

0 comments on commit a56d60e

Please sign in to comment.