cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [2/9] js commit: [Windows8] uuid is generated and stored in local storage, [common] deref window.alert, runtime complaint from VisualStudio
Date Wed, 17 Oct 2012 20:38:34 GMT
[Windows8] uuid is generated and stored in local storage, [common] deref window.alert, runtime
complaint from VisualStudio


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/f23599cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/f23599cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/f23599cc

Branch: refs/heads/master
Commit: f23599cc5a1d53c5029fa4d1cbfe4793e3a0a900
Parents: eeeb0c9
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Tue Oct 16 18:48:59 2012 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Tue Oct 16 18:48:59 2012 -0700

----------------------------------------------------------------------
 lib/common/utils.js                         |    4 +-
 lib/windows8/plugin/windows8/DeviceProxy.js |   40 +++++++++++++--------
 2 files changed, 27 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f23599cc/lib/common/utils.js
----------------------------------------------------------------------
diff --git a/lib/common/utils.js b/lib/common/utils.js
index b51f9a4..60afb02 100644
--- a/lib/common/utils.js
+++ b/lib/common/utils.js
@@ -119,8 +119,8 @@ utils.extend = (function() {
  * Alerts a message in any available way: alert or console.log.
  */
 utils.alert = function(msg) {
-    if (alert) {
-        alert(msg);
+    if (window.alert) {
+        window.alert(msg);
     } else if (console && console.log) {
         console.log(msg);
     }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f23599cc/lib/windows8/plugin/windows8/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/DeviceProxy.js b/lib/windows8/plugin/windows8/DeviceProxy.js
index 757c592..d54edb3 100644
--- a/lib/windows8/plugin/windows8/DeviceProxy.js
+++ b/lib/windows8/plugin/windows8/DeviceProxy.js
@@ -20,27 +20,37 @@
 */
 
 var cordova = require('cordova');
+var utils = require('cordova/utils');
 
 
 module.exports = {
 
-    getDeviceInfo:function(win,fail,args){
-        console.log("NativeProxy::getDeviceInfo");
-
-        var hostNames = Windows.Networking.Connectivity.NetworkInformation.getHostNames();
-            
-        var name = "unknown";
-        hostNames.some(function (nm) {
-            if (nm.displayName.indexOf(".local") > -1) {
-                name = nm.displayName.split(".local")[0];
-                return true;
+        getDeviceInfo:function(win,fail,args){
+            console.log("NativeProxy::getDeviceInfo");
+
+            // get the name ( hostName of the machine )
+            var hostNames = Windows.Networking.Connectivity.NetworkInformation.getHostNames();
+            var name = "unknown";
+            hostNames.some(function (nm) {
+                if (nm.displayName.indexOf(".local") > -1) {
+                    name = nm.displayName.split(".local")[0];
+                    return true;
+                }
+            });
+
+            // deviceId aka uuid
+            var deviceId = localStorage.deviceId;
+            if(!deviceId) {
+                deviceId = utils.createUUID();
+                console.log(deviceId);
+                localStorage.deviceId = deviceId;
             }
-        });
 
-        setTimeout(function(){
-            win({platform:"windows8", version:"8", name:name, uuid:"TODO", cordova:"2.2.0"});
-        },0);
-    }
+            setTimeout(function(){
+                win({platform:"windows8", version:"8", name:name, uuid:deviceId, cordova:"2.2.0"});
+            },0);
+        }
+
 };
 
 require("cordova/commandProxy").add("Device",module.exports);


Mime
View raw message