incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject webworks commit: [CB-1037] Updating JS to use latest common device module.
Date Thu, 12 Jul 2012 20:39:10 GMT
Updated Branches:
  refs/heads/master 94b43f4de -> 500b60f79


[CB-1037] Updating JS to use latest common device module.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/commit/500b60f7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/tree/500b60f7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/diff/500b60f7

Branch: refs/heads/master
Commit: 500b60f7908af1e7c76178188551ef5f0463a2ec
Parents: 94b43f4
Author: Fil Maj <maj.fil@gmail.com>
Authored: Thu Jul 12 13:41:31 2012 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Thu Jul 12 13:41:31 2012 -0700

----------------------------------------------------------------------
 javascript/cordova.blackberry.js |  114 +++++++++++++++++++++-----------
 javascript/cordova.playbook.js   |   84 ++++++++++++++++++++++--
 2 files changed, 153 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/500b60f7/javascript/cordova.blackberry.js
----------------------------------------------------------------------
diff --git a/javascript/cordova.blackberry.js b/javascript/cordova.blackberry.js
index 58a8ddb..bba8f31 100644
--- a/javascript/cordova.blackberry.js
+++ b/javascript/cordova.blackberry.js
@@ -1,6 +1,6 @@
-// commit ec1cc3e911f1e1e3de91f8e9beae7afd54aee58b
+// commit 32e35b75c5ea2946dffebbc6cf4d0fbc16c0839e
 
-// File generated at :: Fri Jun 29 2012 14:43:48 GMT-0700 (PDT)
+// File generated at :: Thu Jul 12 2012 13:35:26 GMT-0700 (PDT)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -713,7 +713,6 @@ channel.create('onDestroy');
 
 // Channels that must fire before "deviceready" is fired.
 channel.waitForInitialization('onCordovaReady');
-channel.waitForInitialization('onCordovaInfoReady');
 channel.waitForInitialization('onCordovaConnectionReady');
 
 module.exports = channel;
@@ -848,6 +847,9 @@ module.exports = {
         Coordinates: {
             path: 'cordova/plugin/Coordinates'
         },
+        device: {
+            path: 'cordova/plugin/device'
+        },
         DirectoryEntry: {
             path: 'cordova/plugin/DirectoryEntry'
         },
@@ -1140,9 +1142,6 @@ module.exports = {
                 }
             }
         },
-        device: {
-            path: "cordova/plugin/blackberry/device"
-        },
         File: { // exists natively on BlackBerry OS 7, override
             path: "cordova/plugin/File"
         }
@@ -1153,9 +1152,6 @@ module.exports = {
                 contacts: {
                     path: 'cordova/plugin/blackberry/contacts'
                 },
-                device: {
-                    path: 'cordova/plugin/blackberry/device'
-                },
                 notification: {
                     path: 'cordova/plugin/blackberry/notification'
                 }
@@ -1887,7 +1883,7 @@ var utils = require('cordova/utils'),
  * {boolean} isDirectory always true (readonly)
  * {DOMString} name of the directory, excluding the path leading to it (readonly)
  * {DOMString} fullPath the absolute full path to the directory (readonly)
- * {FileSystem} filesystem on which the directory resides (readonly)
+ * TODO: implement this!!! {FileSystem} filesystem on which the directory resides (readonly)
  */
 var DirectoryEntry = function(name, fullPath) {
      DirectoryEntry.__super__.constructor.apply(this, [false, true, name, fullPath]);
@@ -2612,13 +2608,12 @@ var DirectoryEntry = require('cordova/plugin/DirectoryEntry');
 var FileSystem = function(name, root) {
     this.name = name || null;
     if (root) {
-        console.log('root.name ' + name);
-        console.log('root.root ' + root);
         this.root = new DirectoryEntry(root.name, root.fullPath);
     }
 };
 
 module.exports = FileSystem;
+
 });
 
 // file: lib/common/plugin/FileTransfer.js
@@ -4932,33 +4927,6 @@ module.exports = {
 
 });
 
-// file: lib/blackberry/plugin/blackberry/device.js
-define("cordova/plugin/blackberry/device", function(require, exports, module) {
-var me = {},
-    channel = require('cordova/channel'),
-    exec = require('cordova/exec');
-
-channel.onCordovaReady.subscribeOnce(function() {
-    exec(function (device) {
-        me.platform = device.platform;
-        me.version  = device.version;
-        me.name     = device.name;
-        me.uuid     = device.uuid;
-        me.cordova  = device.cordova;
-
-        channel.onCordovaInfoReady.fire();
-    },function (e) {
-        console.log("error initializing cordova: " + e);
-    },
-        "Device",
-        "getDeviceInfo",
-        []
-    );
-});
-
-module.exports = me;
-});
-
 // file: lib/blackberry/plugin/blackberry/notification.js
 define("cordova/plugin/blackberry/notification", function(require, exports, module) {
 var exec = require('cordova/exec');
@@ -5432,6 +5400,74 @@ module.exports = contacts;
 
 });
 
+// file: lib/common/plugin/device.js
+define("cordova/plugin/device", function(require, exports, module) {
+var channel = require('cordova/channel'),
+    utils = require('cordova/utils'),
+    exec = require('cordova/exec');
+
+// Tell cordova channel to wait on the CordovaInfoReady event
+channel.waitForInitialization('onCordovaInfoReady');
+
+/**
+ * This represents the mobile device, and provides properties for inspecting the model, version,
UUID of the
+ * phone, etc.
+ * @constructor
+ */
+function Device() {
+    this.available = false;
+    this.platform = null;
+    this.version = null;
+    this.name = null;
+    this.uuid = null;
+    this.cordova = null;
+
+    var me = this;
+
+    channel.onCordovaReady.subscribeOnce(function() {
+        me.getInfo(function(info) {
+            me.available = true;
+            me.platform = info.platform;
+            me.version = info.version;
+            me.name = info.name;
+            me.uuid = info.uuid;
+            me.cordova = info.cordova;
+            channel.onCordovaInfoReady.fire();
+        },function(e) {
+            me.available = false;
+            utils.alert("[ERROR] Error initializing Cordova: " + e);
+        });
+    });
+}
+
+/**
+ * Get device info
+ *
+ * @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. (OPTIONAL)
+ */
+Device.prototype.getInfo = function(successCallback, errorCallback) {
+
+    // successCallback required
+    if (typeof successCallback !== "function") {
+        console.log("Device Error: successCallback is not a function");
+        return;
+    }
+
+    // errorCallback optional
+    if (errorCallback && (typeof errorCallback !== "function")) {
+        console.log("Device Error: errorCallback is not a function");
+        return;
+    }
+
+    // Get info
+    exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
+};
+
+module.exports = new Device();
+
+});
+
 // file: lib/common/plugin/geolocation.js
 define("cordova/plugin/geolocation", function(require, exports, module) {
 var utils = require('cordova/utils'),

http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/500b60f7/javascript/cordova.playbook.js
----------------------------------------------------------------------
diff --git a/javascript/cordova.playbook.js b/javascript/cordova.playbook.js
index c4d5dd6..15e4286 100644
--- a/javascript/cordova.playbook.js
+++ b/javascript/cordova.playbook.js
@@ -1,6 +1,6 @@
-// commit ec1cc3e911f1e1e3de91f8e9beae7afd54aee58b
+// commit fc6866c92d076b9163f4c388f073c5962d115bc3
 
-// File generated at :: Fri Jun 29 2012 14:43:48 GMT-0700 (PDT)
+// File generated at :: Thu Jul 12 2012 13:40:57 GMT-0700 (PDT)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -713,7 +713,6 @@ channel.create('onDestroy');
 
 // Channels that must fire before "deviceready" is fired.
 channel.waitForInitialization('onCordovaReady');
-channel.waitForInitialization('onCordovaInfoReady');
 channel.waitForInitialization('onCordovaConnectionReady');
 
 module.exports = channel;
@@ -848,6 +847,9 @@ module.exports = {
         Coordinates: {
             path: 'cordova/plugin/Coordinates'
         },
+        device: {
+            path: 'cordova/plugin/device'
+        },
         DirectoryEntry: {
             path: 'cordova/plugin/DirectoryEntry'
         },
@@ -1750,7 +1752,7 @@ var utils = require('cordova/utils'),
  * {boolean} isDirectory always true (readonly)
  * {DOMString} name of the directory, excluding the path leading to it (readonly)
  * {DOMString} fullPath the absolute full path to the directory (readonly)
- * {FileSystem} filesystem on which the directory resides (readonly)
+ * TODO: implement this!!! {FileSystem} filesystem on which the directory resides (readonly)
  */
 var DirectoryEntry = function(name, fullPath) {
      DirectoryEntry.__super__.constructor.apply(this, [false, true, name, fullPath]);
@@ -2475,13 +2477,12 @@ var DirectoryEntry = require('cordova/plugin/DirectoryEntry');
 var FileSystem = function(name, root) {
     this.name = name || null;
     if (root) {
-        console.log('root.name ' + name);
-        console.log('root.root ' + root);
         this.root = new DirectoryEntry(root.name, root.fullPath);
     }
 };
 
 module.exports = FileSystem;
+
 });
 
 // file: lib/common/plugin/FileTransfer.js
@@ -3984,6 +3985,74 @@ module.exports = contacts;
 
 });
 
+// file: lib/common/plugin/device.js
+define("cordova/plugin/device", function(require, exports, module) {
+var channel = require('cordova/channel'),
+    utils = require('cordova/utils'),
+    exec = require('cordova/exec');
+
+// Tell cordova channel to wait on the CordovaInfoReady event
+channel.waitForInitialization('onCordovaInfoReady');
+
+/**
+ * This represents the mobile device, and provides properties for inspecting the model, version,
UUID of the
+ * phone, etc.
+ * @constructor
+ */
+function Device() {
+    this.available = false;
+    this.platform = null;
+    this.version = null;
+    this.name = null;
+    this.uuid = null;
+    this.cordova = null;
+
+    var me = this;
+
+    channel.onCordovaReady.subscribeOnce(function() {
+        me.getInfo(function(info) {
+            me.available = true;
+            me.platform = info.platform;
+            me.version = info.version;
+            me.name = info.name;
+            me.uuid = info.uuid;
+            me.cordova = info.cordova;
+            channel.onCordovaInfoReady.fire();
+        },function(e) {
+            me.available = false;
+            utils.alert("[ERROR] Error initializing Cordova: " + e);
+        });
+    });
+}
+
+/**
+ * Get device info
+ *
+ * @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. (OPTIONAL)
+ */
+Device.prototype.getInfo = function(successCallback, errorCallback) {
+
+    // successCallback required
+    if (typeof successCallback !== "function") {
+        console.log("Device Error: successCallback is not a function");
+        return;
+    }
+
+    // errorCallback optional
+    if (errorCallback && (typeof errorCallback !== "function")) {
+        console.log("Device Error: errorCallback is not a function");
+        return;
+    }
+
+    // Get info
+    exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
+};
+
+module.exports = new Device();
+
+});
+
 // file: lib/common/plugin/geolocation.js
 define("cordova/plugin/geolocation", function(require, exports, module) {
 var utils = require('cordova/utils'),
@@ -6042,6 +6111,9 @@ module.exports = {
 define("cordova/plugin/playbook/device", function(require, exports, module) {
 var channel = require('cordova/channel');
 
+// Tell cordova channel to wait on the CordovaInfoReady event
+channel.waitForInitialization('onCordovaInfoReady');
+
 module.exports = {
     platform: "PlayBook",
     version: blackberry.system.softwareVersion,


Mime
View raw message