cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [7/16] 2.5.0rc1 release prep
Date Wed, 20 Feb 2013 23:13:03 GMT
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a450ea82/templates/full/www/index.html
----------------------------------------------------------------------
diff --git a/templates/full/www/index.html b/templates/full/www/index.html
index 2a1c7a9..dc0224d 100644
--- a/templates/full/www/index.html
+++ b/templates/full/www/index.html
@@ -33,7 +33,7 @@
                 <p class="event received">Device is Ready</p>
             </div>
         </div>
-        <script type="text/javascript" src="cordova-2.4.0.js"></script>
+        <script type="text/javascript" src="cordova-2.5.0.js"></script>
         <script type="text/javascript" src="js/index.js"></script>
         <script type="text/javascript">
             app.initialize();

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a450ea82/templates/standalone/CordovaAppProj.csproj
----------------------------------------------------------------------
diff --git a/templates/standalone/CordovaAppProj.csproj b/templates/standalone/CordovaAppProj.csproj
index e0ca6d6..680a2b6 100644
--- a/templates/standalone/CordovaAppProj.csproj
+++ b/templates/standalone/CordovaAppProj.csproj
@@ -208,7 +208,7 @@
   <ItemGroup>
     <Content Include="config.xml" />
     <Content Include="resources\notification-beep.wav" />
-    <Content Include="www\cordova-2.4.0.js" />
+    <Content Include="www\cordova-2.5.0.js" />
     <Content Include="www\img\logo.png" />
     <Content Include="www\js\index.js" />
     <None Include="VERSION" />

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a450ea82/templates/standalone/VERSION
----------------------------------------------------------------------
diff --git a/templates/standalone/VERSION b/templates/standalone/VERSION
index 9183195..fad066f 100644
--- a/templates/standalone/VERSION
+++ b/templates/standalone/VERSION
@@ -1 +1 @@
-2.4.0
\ No newline at end of file
+2.5.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a450ea82/templates/standalone/cordovalib/Commands/BaseCommand.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Commands/BaseCommand.cs b/templates/standalone/cordovalib/Commands/BaseCommand.cs
index f6e45da..f9942eb 100644
--- a/templates/standalone/cordovalib/Commands/BaseCommand.cs
+++ b/templates/standalone/cordovalib/Commands/BaseCommand.cs
@@ -111,6 +111,14 @@ namespace WPCordovaClassLib.Cordova.Commands
         {
         }
 
+        /// <summary>
+        /// Occurs when the application is being loaded, and the config.xml has an autoload
entry
+        /// </summary>    
+        public virtual void OnInit()
+        {
+
+        }
+
 
         /// <summary>
         /// Occurs when the application is being deactivated.

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a450ea82/templates/standalone/cordovalib/Commands/Device.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Commands/Device.cs b/templates/standalone/cordovalib/Commands/Device.cs
index c07c6f1..95d1dc7 100644
--- a/templates/standalone/cordovalib/Commands/Device.cs
+++ b/templates/standalone/cordovalib/Commands/Device.cs
@@ -73,7 +73,7 @@ namespace WPCordovaClassLib.Cordova.Commands
             get
             {
                 // TODO: should be able to dynamically read the Cordova version from somewhere...
-                return "2.4.0";
+                return "2.5.0";
             }
         }
 

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a450ea82/templates/standalone/cordovalib/ConfigHandler.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/ConfigHandler.cs b/templates/standalone/cordovalib/ConfigHandler.cs
index e2f12cd..0684f6a 100644
--- a/templates/standalone/cordovalib/ConfigHandler.cs
+++ b/templates/standalone/cordovalib/ConfigHandler.cs
@@ -14,7 +14,18 @@ namespace WPCordovaClassLib.CordovaLib
 {
     class ConfigHandler
     {
-        protected List<string> AllowedPlugins;
+        public class PluginConfig
+        {
+            public PluginConfig(string name, bool autoLoad = false)
+            {
+                Name = name;
+                isAutoLoad = autoLoad;
+            }
+            public string Name;
+            public bool isAutoLoad;
+        }
+
+        protected Dictionary<string, PluginConfig> AllowedPlugins;
         protected List<string> AllowedDomains;
         protected Dictionary<string, string> Preferences;
 
@@ -23,7 +34,7 @@ namespace WPCordovaClassLib.CordovaLib
 
         public ConfigHandler()
         {
-            AllowedPlugins = new List<string>();
+            AllowedPlugins = new Dictionary<string, PluginConfig>();
             AllowedDomains = new List<string>();
             Preferences = new Dictionary<string, string>();
         }
@@ -33,37 +44,6 @@ namespace WPCordovaClassLib.CordovaLib
             return Preferences[key];
         }
 
-/*
-    - (BOOL)URLIsAllowed:(NSURL*)url
-{
-    if (self.expandedWhitelist == nil) {
-        return NO;
-    }
-
-    if (self.allowAll) {
-        return YES;
-    }
-
-    // iterate through settings ExternalHosts, check for equality
-    NSEnumerator* enumerator = [self.expandedWhitelist objectEnumerator];
-    id regex = nil;
-    NSString* urlHost = [url host];
-
-    // if the url host IS found in the whitelist, load it in the app (however UIWebViewNavigationTypeOther
kicks it out to Safari)
-    // if the url host IS NOT found in the whitelist, we do nothing
-    while (regex = [enumerator nextObject]) {
-        NSPredicate* regex_test = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
-
-        if ([regex_test evaluateWithObject:urlHost] == YES) {
-            // if it matches at least one rule, return
-            return YES;
-        }
-    }
-
-    NSLog(@"%@", [self errorStringForURL:url]);
-    // if we got here, the url host is not in the white-list, do nothing
-    return NO;
-}*/
         protected static string[] AllowedSchemes = {"http","https","ftp","ftps"};
         protected bool SchemeIsAllowed(string scheme)
         {
@@ -75,10 +55,10 @@ namespace WPCordovaClassLib.CordovaLib
 
             if (origin == "*")
             {
-                AllowAllPlugins = true;
+                AllowAllDomains = true;
             }
 
-            if (AllowAllPlugins)
+            if (AllowAllDomains)
             {
                 return;
             }
@@ -173,7 +153,24 @@ namespace WPCordovaClassLib.CordovaLib
 
         public bool IsPluginAllowed(string key)
         {
-            return AllowAllPlugins || AllowedPlugins.Contains(key);
+            return AllowAllPlugins || AllowedPlugins.Keys.Contains(key);
+        }
+
+        public string[] AutoloadPlugins {
+            get
+            {
+                var res = from results in AllowedPlugins.TakeWhile(p => p.Value.isAutoLoad)
+                          select results.Value.Name ;
+
+                foreach(var s in res)
+                {
+                    Debug.WriteLine(s);
+                }
+                //string[] res = from results in (AllowedPlugins.Where(p => p.Value.isAutoLoad)
)
+                //                select (string)results.Key;
+
+                return new string[] { "", "asd" };
+            }
         }
 
 
@@ -188,20 +185,24 @@ namespace WPCordovaClassLib.CordovaLib
                 XDocument document = XDocument.Parse(sr.ReadToEnd());
 
                 var plugins = from results in document.Descendants("plugin")
-                              select new { name = (string)results.Attribute("name") };
-
+                              select new
+                              {
+                                  name = (string)results.Attribute("name"),
+                                  autoLoad = results.Attribute("onload")
+                              };
 
                 foreach (var plugin in plugins)
                 {
                     Debug.WriteLine("plugin " + plugin.name);
-                    if (plugin.name == "*")
+                    PluginConfig pConfig = new PluginConfig(plugin.name, plugin.autoLoad
!= null && plugin.autoLoad.Value == "true");
+                    if (pConfig.Name == "*")
                     {
                         AllowAllPlugins = true;
-                        break;
+                        // break; wait, don't, some still could be autoload
                     }
                     else
                     {
-                        AllowedPlugins.Add(plugin.name);
+                        AllowedPlugins.Add(pConfig.Name, pConfig);
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a450ea82/templates/standalone/cordovalib/CordovaView.xaml.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/CordovaView.xaml.cs b/templates/standalone/cordovalib/CordovaView.xaml.cs
index 9ed7e0b..ec88576 100644
--- a/templates/standalone/cordovalib/CordovaView.xaml.cs
+++ b/templates/standalone/cordovalib/CordovaView.xaml.cs
@@ -378,6 +378,12 @@ namespace WPCordovaClassLib
 
         void CordovaBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs
e)
         {
+            string[] autoloadPlugs = this.configHandler.AutoloadPlugins;
+            foreach (string plugName in autoloadPlugs)
+            {
+               // nativeExecution.ProcessCommand(commandCallParams); 
+            }
+
             string nativeReady = "(function(){ cordova.require('cordova/channel').onNativeReady.fire()})();";
 
             try
@@ -466,7 +472,14 @@ namespace WPCordovaClassLib
 
         public void LoadPage(string url)
         {
-            this.configHandler.URLIsAllowed(url);
+            if (this.configHandler.URLIsAllowed(url))
+            {
+                this.CordovaBrowser.Navigate(new Uri(url, UriKind.RelativeOrAbsolute));
+            }
+            else
+            {
+                Debug.WriteLine("Oops, Can't load url based on config.xml :: " + url);
+            }
         }
 
         private void CordovaBrowser_Unloaded(object sender, RoutedEventArgs e)

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a450ea82/templates/standalone/cordovalib/NativeExecution.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/NativeExecution.cs b/templates/standalone/cordovalib/NativeExecution.cs
index e02625b..a0865ab 100644
--- a/templates/standalone/cordovalib/NativeExecution.cs
+++ b/templates/standalone/cordovalib/NativeExecution.cs
@@ -61,6 +61,16 @@ namespace WPCordovaClassLib.Cordova
             CommandFactory.ResetAllCommands();
         }
 
+        public void AutoLoadCommand(string commandService)
+        {
+            BaseCommand bc = CommandFactory.CreateByServiceName(commandService);
+            if (bc != null)
+            {
+                bc.OnInit();
+            }
+
+        }
+
         /// <summary>
         /// Executes command and returns result back.
         /// </summary>


Mime
View raw message