You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/11/06 01:38:28 UTC

[13/25] js commit: Update lib/windows8/plugin/windows8/DeviceProxy.js

Update lib/windows8/plugin/windows8/DeviceProxy.js

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/c1532c3c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/c1532c3c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/c1532c3c

Branch: refs/heads/master
Commit: c1532c3c15c1eee325c322b1a91038af15233f5a
Parents: 81c951b
Author: wangmingfeng <mi...@gmail.com>
Authored: Mon Oct 29 10:59:00 2012 +0800
Committer: wangmingfeng <mi...@gmail.com>
Committed: Mon Oct 29 10:59:00 2012 +0800

----------------------------------------------------------------------
 lib/windows8/plugin/windows8/DeviceProxy.js |   53 ++++++++++------------
 1 files changed, 24 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c1532c3c/lib/windows8/plugin/windows8/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/DeviceProxy.js b/lib/windows8/plugin/windows8/DeviceProxy.js
index 88d88c9..9f7bf1b 100644
--- a/lib/windows8/plugin/windows8/DeviceProxy.js
+++ b/lib/windows8/plugin/windows8/DeviceProxy.js
@@ -45,39 +45,34 @@ module.exports = {
                 var path = "C:\\Users\\" + fileName + "\\Documents";
                 Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(function (storageFolder) {
                     return storageFolder.createFileAsync("appDeviceIdentifier.txt", Windows.Storage.CreationCollisionOption.openIfExists);
-                }).then(
-                        function (storageFile) {
-                            var value = Windows.Storage.Streams.UnicodeEncoding.utf8;
-
-                            Windows.Storage.FileIO.readTextAsync(storageFile, value).then(
-                                function (fileContent) {
-                                    if (fileContent) {
-                                        deviceId = fileContent;
-                                        setTimeout(function () {
-                                            win({ platform: "windows8", version: "8", name: name, uuid: "TODO", cordova: "2.2.0" });
-                                        }, 0)
-                                    } else {
-                                        deviceId = utils.createUUID();
-                                        Windows.Storage.FileIO.writeTextAsync(storageFile, deviceId, Windows.Storage.Streams.UnicodeEncoding.utf8).done(
-                                            function () {
-                                                setTimeout(function () {
-                                                    win({ platform: "windows8", version: "8", name: name, uuid: "TODO", cordova: "2.2.0" });
-                                                }, 0)
-                                            }, function () {
-                                                fail(FileError.INVALID_MODIFICATION_ERR);
-                                            }
-
-                                        );
-                                    }
-                                },
+                }).then(function (storageFile) {
+                    var value = Windows.Storage.Streams.UnicodeEncoding.utf8;
+                    Windows.Storage.FileIO.readTextAsync(storageFile, value).then(function (fileContent) {
+                        if (fileContent) {
+                            deviceId = fileContent;
+                            setTimeout(function () {
+                                win({ platform: "windows8", version: "8", name: name, uuid: "TODO", cordova: "2.2.0" });
+                            }, 0)
+                        } else {
+                            deviceId = utils.createUUID();
+                            Windows.Storage.FileIO.writeTextAsync(storageFile, deviceId, Windows.Storage.Streams.UnicodeEncoding.utf8).done(
                                 function () {
-                                    fail(FileError.ENCODING_ERR);
+                                    setTimeout(function () {
+                                        win({ platform: "windows8", version: "8", name: name, uuid: "TODO", cordova: "2.2.0" });
+                                    }, 0)
+                                }, function () {
+                                    fail(FileError.INVALID_MODIFICATION_ERR);
                                 }
+
                             );
-                        }, function () {
-                            fail(FileError.NOT_FOUND_ERR);
                         }
-                    );
+                    },
+                    function () {
+                        fail(FileError.ENCODING_ERR);
+                    });
+                }, function () {
+                    fail(FileError.NOT_FOUND_ERR);
+                });
                 
             }, fail && fail());
         }