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 2013/09/18 22:08:49 UTC

git commit: [CB-4850] only write device guid if it does not exist

Updated Branches:
  refs/heads/master aa6fd8c2b -> ab7871466


[CB-4850] only write device guid if it does not exist


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

Branch: refs/heads/master
Commit: ab7871466c26701bea7bcc19c9d8670c3e0f7f47
Parents: aa6fd8c
Author: purplecabbage <pu...@gmail.com>
Authored: Wed Sep 18 13:08:33 2013 -0700
Committer: purplecabbage <pu...@gmail.com>
Committed: Wed Sep 18 13:08:33 2013 -0700

----------------------------------------------------------------------
 wp7/template/cordovalib/CordovaView.xaml.cs | 38 +++++++++++-------------
 wp8/template/cordovalib/CordovaView.xaml.cs | 32 ++++++++++----------
 2 files changed, 33 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/ab787146/wp7/template/cordovalib/CordovaView.xaml.cs
----------------------------------------------------------------------
diff --git a/wp7/template/cordovalib/CordovaView.xaml.cs b/wp7/template/cordovalib/CordovaView.xaml.cs
index 3830634..f89a029 100644
--- a/wp7/template/cordovalib/CordovaView.xaml.cs
+++ b/wp7/template/cordovalib/CordovaView.xaml.cs
@@ -1,10 +1,10 @@
-/*  
+/*
 	Licensed 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.
@@ -161,9 +161,9 @@ namespace WPCordovaClassLib
                 {
                     this.StartPageUri = new Uri(AppRoot + "www/" + configHandler.ContentSrc, UriKind.Relative);
                 }
-            }  
+            }
+
 
-                                                                      
             browserDecorators = new Dictionary<string, IBrowserDecorator>();
 
             // initializes native execution logic
@@ -175,7 +175,7 @@ namespace WPCordovaClassLib
 
         /*
          *   browserDecorators are a collection of plugin-like classes (IBrowserDecorator) that add some bit of functionality to the browser.
-         *   These are somewhat different than plugins in that they are usually not async and patch a browser feature that we would 
+         *   These are somewhat different than plugins in that they are usually not async and patch a browser feature that we would
          *   already expect to have.  Essentially these are browser polyfills that are patched from the outside in.
          * */
         void CreateDecorators()
@@ -267,16 +267,14 @@ namespace WPCordovaClassLib
                     catch (Exception /*ex*/)
                     {
                         deviceUUID = Guid.NewGuid().ToString();
+                        Debug.WriteLine("Updating IsolatedStorage for APP:DeviceID :: " + deviceUUID);
+                        IsolatedStorageFileStream file = new IsolatedStorageFileStream("DeviceID.txt", FileMode.Create, FileAccess.Write, appStorage);
+                        using (StreamWriter writeFile = new StreamWriter(file))
+                        {
+                            writeFile.WriteLine(deviceUUID);
+                            writeFile.Close();
+                        }
                     }
-
-                    Debug.WriteLine("Updating IsolatedStorage for APP:DeviceID :: " + deviceUUID);
-                    IsolatedStorageFileStream file = new IsolatedStorageFileStream("DeviceID.txt", FileMode.Create, FileAccess.Write, appStorage);
-                    using (StreamWriter writeFile = new StreamWriter(file))
-                    {
-                        writeFile.WriteLine(deviceUUID);
-                        writeFile.Close();
-                    }
-
                 }
 
                 StreamResourceInfo streamInfo = Application.GetResourceStream(new Uri("CordovaSourceDictionary.xml", UriKind.Relative));
@@ -316,7 +314,7 @@ namespace WPCordovaClassLib
                                         appStorage.CreateDirectory(strBaseDir);
                                     }
 
-                                    // This will truncate/overwrite an existing file, or 
+                                    // This will truncate/overwrite an existing file, or
                                     using (IsolatedStorageFileStream outFile = appStorage.OpenFile(AppRoot + file.path, FileMode.Create))
                                     {
                                         Debug.WriteLine("INFO: Writing data for " + AppRoot + file.path + " and length = " + data.Length);
@@ -434,12 +432,12 @@ namespace WPCordovaClassLib
 
         /*
          *  This method does the work of routing commands
-         *  NotifyEventArgs.Value contains a string passed from JS 
+         *  NotifyEventArgs.Value contains a string passed from JS
          *  If the command already exists in our map, we will just attempt to call the method(action) specified, and pass the args along
          *  Otherwise, we create a new instance of the command, add it to the map, and call it ...
          *  This method may also receive JS error messages caught by window.onerror, in any case where the commandStr does not appear to be a valid command
          *  it is simply output to the debugger output, and the method returns.
-         * 
+         *
          **/
         void GapBrowser_ScriptNotify(object sender, NotifyEventArgs e)
         {
@@ -465,7 +463,7 @@ namespace WPCordovaClassLib
                 {
                     case "overridebackbutton":
                         string arg0 = JsonHelper.Deserialize<string[]>(commandCallParams.Args)[0];
-                        this.OverrideBackButton = (arg0 != null && arg0.Length > 0 && arg0.ToLower() == "true"); 
+                        this.OverrideBackButton = (arg0 != null && arg0.Length > 0 && arg0.ToLower() == "true");
                         break;
                 }
             }
@@ -484,7 +482,7 @@ namespace WPCordovaClassLib
 
         public void LoadPage(string url)
         {
-            try 
+            try
             {
                 Uri newLoc = new Uri(url,UriKind.RelativeOrAbsolute);
                 CordovaBrowser.Navigate(newLoc);

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/ab787146/wp8/template/cordovalib/CordovaView.xaml.cs
----------------------------------------------------------------------
diff --git a/wp8/template/cordovalib/CordovaView.xaml.cs b/wp8/template/cordovalib/CordovaView.xaml.cs
index 16e9aff..c4c4726 100644
--- a/wp8/template/cordovalib/CordovaView.xaml.cs
+++ b/wp8/template/cordovalib/CordovaView.xaml.cs
@@ -1,10 +1,10 @@
-/*  
+/*
     Licensed 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.
@@ -188,7 +188,7 @@ namespace WPCordovaClassLib
 
         /*
          *   browserDecorators are a collection of plugin-like classes (IBrowserDecorator) that add some bit of functionality to the browser.
-         *   These are somewhat different than plugins in that they are usually not async and patch a browser feature that we would 
+         *   These are somewhat different than plugins in that they are usually not async and patch a browser feature that we would
          *   already expect to have.  Essentially these are browser polyfills that are patched from the outside in.
          * */
         void CreateDecorators()
@@ -277,16 +277,14 @@ namespace WPCordovaClassLib
                     catch (Exception /*ex*/)
                     {
                         deviceUUID = Guid.NewGuid().ToString();
+                        Debug.WriteLine("Updating IsolatedStorage for APP:DeviceID :: " + deviceUUID);
+                        IsolatedStorageFileStream file = new IsolatedStorageFileStream("DeviceID.txt", FileMode.Create, FileAccess.Write, appStorage);
+                        using (StreamWriter writeFile = new StreamWriter(file))
+                        {
+                            writeFile.WriteLine(deviceUUID);
+                            writeFile.Close();
+                        }
                     }
-
-                    Debug.WriteLine("Updating IsolatedStorage for APP:DeviceID :: " + deviceUUID);
-                    IsolatedStorageFileStream file = new IsolatedStorageFileStream("DeviceID.txt", FileMode.Create, FileAccess.Write, appStorage);
-                    using (StreamWriter writeFile = new StreamWriter(file))
-                    {
-                        writeFile.WriteLine(deviceUUID);
-                        writeFile.Close();
-                    }
-
                 }
 
                 /*
@@ -331,7 +329,7 @@ namespace WPCordovaClassLib
                 //                        appStorage.CreateDirectory(strBaseDir);
                 //                    }
 
-                //                    // This will truncate/overwrite an existing file, or 
+                //                    // This will truncate/overwrite an existing file, or
                 //                    using (IsolatedStorageFileStream outFile = appStorage.OpenFile(AppRoot + file.path, FileMode.Create))
                 //                    {
                 //                        Debug.WriteLine("INFO: Writing data for " + AppRoot + file.path + " and length = " + data.Length);
@@ -416,7 +414,7 @@ namespace WPCordovaClassLib
             string[] autoloadPlugs = this.configHandler.AutoloadPlugins;
             foreach (string plugName in autoloadPlugs)
             {
-                //nativeExecution.ProcessCommand(commandCallParams); 
+                //nativeExecution.ProcessCommand(commandCallParams);
             }
 
             string nativeReady = "(function(){ cordova.require('cordova/channel').onNativeReady.fire()})();";
@@ -452,12 +450,12 @@ namespace WPCordovaClassLib
 
         /*
          *  This method does the work of routing commands
-         *  NotifyEventArgs.Value contains a string passed from JS 
+         *  NotifyEventArgs.Value contains a string passed from JS
          *  If the command already exists in our map, we will just attempt to call the method(action) specified, and pass the args along
          *  Otherwise, we create a new instance of the command, add it to the map, and call it ...
          *  This method may also receive JS error messages caught by window.onerror, in any case where the commandStr does not appear to be a valid command
          *  it is simply output to the debugger output, and the method returns.
-         * 
+         *
          **/
         void CordovaBrowser_ScriptNotify(object sender, NotifyEventArgs e)
         {