cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [21/21] git commit: reorg so InAppBrowser is accessible to all projects + ConfigHandler, added config.xml to all templates
Date Wed, 23 Jan 2013 00:19:52 GMT
Updated Branches:
  refs/heads/master dc7f2d2a9 -> d9bd6abec
Updated Tags:  refs/tags/2.4.0rc1 [created] d9bd6abec


reorg so InAppBrowser is accessible to all projects + ConfigHandler, added config.xml to all
templates


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

Branch: refs/heads/master
Commit: d9bd6abece9821201b2784799337430d29247035
Parents: bef9a81
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Tue Jan 22 16:17:11 2013 -0800
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Tue Jan 22 16:17:11 2013 -0800

----------------------------------------------------------------------
 example/CordovaExample.csproj                      |    1 +
 example/config.xml                                 |   49 +++
 framework/WPCordovaClassLib.csproj                 |    7 +-
 templates/custom/CordovaAppProj.csproj             |    1 +
 templates/custom/config.xml                        |   49 +++
 templates/full/CordovaAppProj.csproj               |    1 +
 templates/full/README.md                           |    4 +-
 templates/full/config.xml                          |   49 +++
 templates/standalone/CordovaAppProj.csproj         |    3 +
 templates/standalone/README.md                     |    4 +-
 templates/standalone/config.xml                    |   49 +++
 .../standalone/cordovalib/Commands/InAppBrowser.cs |    1 -
 templates/standalone/cordovalib/ConfigHandler.cs   |  240 +++++++++++++++
 .../standalone/cordovalib/CordovaView.xaml.cs      |   27 --
 14 files changed, 452 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/example/CordovaExample.csproj
----------------------------------------------------------------------
diff --git a/example/CordovaExample.csproj b/example/CordovaExample.csproj
index 2f25d77..900de58 100644
--- a/example/CordovaExample.csproj
+++ b/example/CordovaExample.csproj
@@ -140,6 +140,7 @@
     </Page>
   </ItemGroup>
   <ItemGroup>
+    <Content Include="config.xml" />
     <Content Include="www\cordova-2.4.0.js" />
     <Content Include="www\cordova-current.js" />
     <Content Include="www\network.html">

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/example/config.xml
----------------------------------------------------------------------
diff --git a/example/config.xml b/example/config.xml
new file mode 100644
index 0000000..cac0c09
--- /dev/null
+++ b/example/config.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->
+<cordova>
+
+  <plugins>
+    <plugin name="Device"/>
+    <plugin name="Logger"/>
+    <plugin name="Compass"/>
+    <plugin name="Accelerometer"/>
+    <plugin name="Camera"/>
+    <plugin name="NetworkStatus"/>
+    <plugin name="Contacts"/>
+    <plugin name="DebugConsole" />
+    <plugin name="Echo"/>
+    <plugin name="File"/>
+    <plugin name="FileTransfer"/>
+    <plugin name="Geolocation"/>
+    <plugin name="Notification"/>
+    <plugin name="Media"/>
+    <plugin name="Capture"/>
+    <plugin name="SplashScreen"/>
+    <plugin name="Battery"/>
+    <plugin name="Globalization"/>
+    <plugin name="InAppBrowser"/>
+  </plugins>
+
+
+  <access origin="*"/>
+
+</cordova>

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/framework/WPCordovaClassLib.csproj
----------------------------------------------------------------------
diff --git a/framework/WPCordovaClassLib.csproj b/framework/WPCordovaClassLib.csproj
index f65d28e..9bc9a1c 100644
--- a/framework/WPCordovaClassLib.csproj
+++ b/framework/WPCordovaClassLib.csproj
@@ -167,6 +167,9 @@
     <Compile Include="..\templates\standalone\cordovalib\Commands\ImageExifHelper.cs">
       <Link>CordovaLib\Commands\ImageExifHelper.cs</Link>
     </Compile>
+    <Compile Include="..\templates\standalone\cordovalib\Commands\InAppBrowser.cs">
+      <Link>CordovaLib\Commands\InAppBrowser.cs</Link>
+    </Compile>
     <Compile Include="..\templates\standalone\cordovalib\Commands\Media.cs">
       <Link>CordovaLib\Commands\Media.cs</Link>
     </Compile>
@@ -179,6 +182,9 @@
     <Compile Include="..\templates\standalone\cordovalib\Commands\Notification.cs">
       <Link>CordovaLib\Commands\Notification.cs</Link>
     </Compile>
+    <Compile Include="..\templates\standalone\cordovalib\ConfigHandler.cs">
+      <Link>CordovaLib\ConfigHandler.cs</Link>
+    </Compile>
     <Compile Include="..\templates\standalone\cordovalib\CordovaCommandCall.cs">
       <Link>CordovaLib\CordovaCommandCall.cs</Link>
     </Compile>
@@ -226,7 +232,6 @@
       <Link>CordovaLib\UI\VideoRecorder.xaml.cs</Link>
       <DependentUpon>VideoRecorder.xaml</DependentUpon>
     </Compile>
-    <Compile Include="CordovaLib\ConfigHandler.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/custom/CordovaAppProj.csproj
----------------------------------------------------------------------
diff --git a/templates/custom/CordovaAppProj.csproj b/templates/custom/CordovaAppProj.csproj
index cf0ec83..c4ee430 100644
--- a/templates/custom/CordovaAppProj.csproj
+++ b/templates/custom/CordovaAppProj.csproj
@@ -91,6 +91,7 @@
     </ApplicationDefinition>
   </ItemGroup>
   <ItemGroup>
+    <Content Include="config.xml" />
     <Content Include="www\cordova-2.4.0.js" />
     <Content Include="www\css\index.css" />
     <Content Include="www\js\index.js" />

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/custom/config.xml
----------------------------------------------------------------------
diff --git a/templates/custom/config.xml b/templates/custom/config.xml
new file mode 100644
index 0000000..cac0c09
--- /dev/null
+++ b/templates/custom/config.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->
+<cordova>
+
+  <plugins>
+    <plugin name="Device"/>
+    <plugin name="Logger"/>
+    <plugin name="Compass"/>
+    <plugin name="Accelerometer"/>
+    <plugin name="Camera"/>
+    <plugin name="NetworkStatus"/>
+    <plugin name="Contacts"/>
+    <plugin name="DebugConsole" />
+    <plugin name="Echo"/>
+    <plugin name="File"/>
+    <plugin name="FileTransfer"/>
+    <plugin name="Geolocation"/>
+    <plugin name="Notification"/>
+    <plugin name="Media"/>
+    <plugin name="Capture"/>
+    <plugin name="SplashScreen"/>
+    <plugin name="Battery"/>
+    <plugin name="Globalization"/>
+    <plugin name="InAppBrowser"/>
+  </plugins>
+
+
+  <access origin="*"/>
+
+</cordova>

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/full/CordovaAppProj.csproj
----------------------------------------------------------------------
diff --git a/templates/full/CordovaAppProj.csproj b/templates/full/CordovaAppProj.csproj
index 84417a5..0faa3b3 100644
--- a/templates/full/CordovaAppProj.csproj
+++ b/templates/full/CordovaAppProj.csproj
@@ -141,6 +141,7 @@
     </Page>
   </ItemGroup>
   <ItemGroup>
+    <Content Include="config.xml" />
     <Content Include="CordovaLib\WPCordovaClassLib.dll" />
     <Content Include="www\cordova-2.4.0.js" />
     <Content Include="www\img\logo.png" />

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/full/README.md
----------------------------------------------------------------------
diff --git a/templates/full/README.md b/templates/full/README.md
index 3e616cf..b358c7f 100644
--- a/templates/full/README.md
+++ b/templates/full/README.md
@@ -3,9 +3,9 @@ Project Template
 
 This project template needs to be built to be installed.
 
-You will first need to build the Library project in the framework folder, and add the output
WP7CordovaClassLib.dll file to the CordovaLib folder of this project.
+You will first need to build the Library project in the framework folder, and add the output
WPCordovaClassLib.dll file to the CordovaLib folder of this project.
 
-In order to build it in Visual Studio Express for Windows Phone 7 :
+In order to build it in Visual Studio Express for Windows Phone 8 :
 
 1. Open the solution file in Visual Studio
 2. Choose File->Export Template and follow the directions.

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/full/config.xml
----------------------------------------------------------------------
diff --git a/templates/full/config.xml b/templates/full/config.xml
new file mode 100644
index 0000000..cac0c09
--- /dev/null
+++ b/templates/full/config.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->
+<cordova>
+
+  <plugins>
+    <plugin name="Device"/>
+    <plugin name="Logger"/>
+    <plugin name="Compass"/>
+    <plugin name="Accelerometer"/>
+    <plugin name="Camera"/>
+    <plugin name="NetworkStatus"/>
+    <plugin name="Contacts"/>
+    <plugin name="DebugConsole" />
+    <plugin name="Echo"/>
+    <plugin name="File"/>
+    <plugin name="FileTransfer"/>
+    <plugin name="Geolocation"/>
+    <plugin name="Notification"/>
+    <plugin name="Media"/>
+    <plugin name="Capture"/>
+    <plugin name="SplashScreen"/>
+    <plugin name="Battery"/>
+    <plugin name="Globalization"/>
+    <plugin name="InAppBrowser"/>
+  </plugins>
+
+
+  <access origin="*"/>
+
+</cordova>

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/standalone/CordovaAppProj.csproj
----------------------------------------------------------------------
diff --git a/templates/standalone/CordovaAppProj.csproj b/templates/standalone/CordovaAppProj.csproj
index 763933f..e0ca6d6 100644
--- a/templates/standalone/CordovaAppProj.csproj
+++ b/templates/standalone/CordovaAppProj.csproj
@@ -140,10 +140,12 @@
     <Compile Include="cordovalib\Commands\FileTransfer.cs" />
     <Compile Include="cordovalib\Commands\GeoLocation.cs" />
     <Compile Include="cordovalib\Commands\ImageExifHelper.cs" />
+    <Compile Include="cordovalib\Commands\InAppBrowser.cs" />
     <Compile Include="cordovalib\Commands\Media.cs" />
     <Compile Include="cordovalib\Commands\MimeTypeMapper.cs" />
     <Compile Include="cordovalib\Commands\NetworkStatus.cs" />
     <Compile Include="cordovalib\Commands\Notification.cs" />
+    <Compile Include="cordovalib\ConfigHandler.cs" />
     <Compile Include="cordovalib\CordovaCommandCall.cs" />
     <Compile Include="cordovalib\CordovaView.xaml.cs">
       <DependentUpon>CordovaView.xaml</DependentUpon>
@@ -204,6 +206,7 @@
     </Page>
   </ItemGroup>
   <ItemGroup>
+    <Content Include="config.xml" />
     <Content Include="resources\notification-beep.wav" />
     <Content Include="www\cordova-2.4.0.js" />
     <Content Include="www\img\logo.png" />

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/standalone/README.md
----------------------------------------------------------------------
diff --git a/templates/standalone/README.md b/templates/standalone/README.md
index 6374253..fea4f66 100644
--- a/templates/standalone/README.md
+++ b/templates/standalone/README.md
@@ -4,10 +4,10 @@ Project Template
 This project template needs to be built to be installed.
 
 
-This template includes the full source code for Windows Phone 7
+This template includes the full source code for Windows Phone 8
 
 
-In order to build this template in Visual Studio Express for Windows Phone 7 :
+In order to build this template in Visual Studio Express for Windows Phone 8 :
 
 1. Open the solution file in Visual Studio
 2. Choose File->Export Template and follow the directions.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/standalone/config.xml
----------------------------------------------------------------------
diff --git a/templates/standalone/config.xml b/templates/standalone/config.xml
new file mode 100644
index 0000000..cac0c09
--- /dev/null
+++ b/templates/standalone/config.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->
+<cordova>
+
+  <plugins>
+    <plugin name="Device"/>
+    <plugin name="Logger"/>
+    <plugin name="Compass"/>
+    <plugin name="Accelerometer"/>
+    <plugin name="Camera"/>
+    <plugin name="NetworkStatus"/>
+    <plugin name="Contacts"/>
+    <plugin name="DebugConsole" />
+    <plugin name="Echo"/>
+    <plugin name="File"/>
+    <plugin name="FileTransfer"/>
+    <plugin name="Geolocation"/>
+    <plugin name="Notification"/>
+    <plugin name="Media"/>
+    <plugin name="Capture"/>
+    <plugin name="SplashScreen"/>
+    <plugin name="Battery"/>
+    <plugin name="Globalization"/>
+    <plugin name="InAppBrowser"/>
+  </plugins>
+
+
+  <access origin="*"/>
+
+</cordova>

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/standalone/cordovalib/Commands/InAppBrowser.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Commands/InAppBrowser.cs b/templates/standalone/cordovalib/Commands/InAppBrowser.cs
index 6a29044..fc7769c 100644
--- a/templates/standalone/cordovalib/Commands/InAppBrowser.cs
+++ b/templates/standalone/cordovalib/Commands/InAppBrowser.cs
@@ -94,7 +94,6 @@ namespace WPCordovaClassLib.Cordova.Commands
         }
 
 
-        // Display an inderminate progress indicator
         private void ShowInAppBrowser(string url)
         {
             Uri loc = new Uri(url);

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/standalone/cordovalib/ConfigHandler.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/ConfigHandler.cs b/templates/standalone/cordovalib/ConfigHandler.cs
new file mode 100644
index 0000000..e2f12cd
--- /dev/null
+++ b/templates/standalone/cordovalib/ConfigHandler.cs
@@ -0,0 +1,240 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Resources;
+using System.Xml.Linq;
+
+namespace WPCordovaClassLib.CordovaLib
+{
+    class ConfigHandler
+    {
+        protected List<string> AllowedPlugins;
+        protected List<string> AllowedDomains;
+        protected Dictionary<string, string> Preferences;
+
+        protected bool AllowAllDomains = false;
+        protected bool AllowAllPlugins = false;
+
+        public ConfigHandler()
+        {
+            AllowedPlugins = new List<string>();
+            AllowedDomains = new List<string>();
+            Preferences = new Dictionary<string, string>();
+        }
+
+        public string GetPreference(string key)
+        {
+            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)
+        {
+            return AllowedSchemes.Contains(scheme);
+        }
+
+        protected void AddWhiteListEntry(string origin, bool allowSubdomains)
+        {
+
+            if (origin == "*")
+            {
+                AllowAllPlugins = true;
+            }
+
+            if (AllowAllPlugins)
+            {
+                return;
+            }
+
+            string hostMatchingRegex = "";
+            string hostName;
+
+            try
+            {
+
+                Uri uri = new Uri(origin.Replace("*", "replaced-text"), UriKind.Absolute);
+
+                string tempHostName = uri.Host.Replace("replaced-text", "*");
+                //if (uri.HostNameType == UriHostNameType.Dns){}        
+                // starts with wildcard match - we make the first '.' optional (so '*.org.apache.cordova'
will match 'org.apache.cordova')
+                if (tempHostName.StartsWith("*."))
+                {    //"(\\s{0}|*.)"
+                    hostName = @"\w*.*" + tempHostName.Substring(2).Replace(".", @"\.").Replace("*",
@"\w*");
+                }
+                else
+                {
+                    hostName = tempHostName.Replace(".", @"\.").Replace("*", @"\w*");
+                }
+                //  "^https?://"
+                hostMatchingRegex = uri.Scheme + "://" + hostName + uri.PathAndQuery;
+                Debug.WriteLine("Adding regex :: " + hostMatchingRegex);
+                AllowedDomains.Add(hostMatchingRegex);
+
+            }
+            catch (Exception)
+            {
+                Debug.WriteLine("Invalid Whitelist entry (probably missing the protocol)::
" + origin);
+            }
+
+        }
+
+        /**   
+         
+         An access request is granted for a given URI if there exists an item inside the
access-request list such that:
+
+            - The URI's scheme component is the same as scheme; and
+            - if subdomains is false or if the URI's host component is not a domain name
(as defined in [RFC1034]), the URI's host component is the same as host; or
+            - if subdomains is true, the URI's host component is either the same as host,
or is a subdomain of host (as defined in [RFC1034]); and
+            - the URI's port component is the same as port.
+         
+         **/
+
+        public bool URLIsAllowed(string url)
+        {
+            // Debug.WriteLine("Testing URLIsAllowed : " + url);
+            // easy case first
+            if (this.AllowAllDomains )
+            {
+                return true;
+            }
+            else
+            {
+                // start simple
+                Uri uri = new Uri(url,UriKind.RelativeOrAbsolute);
+                if (uri.IsAbsoluteUri)
+                {
+                    if (this.SchemeIsAllowed(uri.Scheme))
+                    {
+                        // additional test because our pattern will always have a trailing
'/'
+                        string matchUrl = url;
+                        if (uri.PathAndQuery == "/")
+                        {
+                            matchUrl = url + "/";
+                        }
+                        foreach (string pattern in AllowedDomains)
+                        {
+                            if (Regex.IsMatch(matchUrl, pattern))
+                            {
+                                // make sure it is at the start, and not part of the query
string
+                                // special case :: http://some.other.domain/page.html?x=1&g=http://build.apache.org/
+                                if ( Regex.IsMatch(uri.Scheme + "://" +  uri.Host + "/",
pattern) ||
+                                     (!Regex.IsMatch(uri.PathAndQuery, pattern)))
+                                {
+                                    return true;
+                                }
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public bool IsPluginAllowed(string key)
+        {
+            return AllowAllPlugins || AllowedPlugins.Contains(key);
+        }
+
+
+        public void LoadAppPackageConfig()
+        {
+            StreamResourceInfo streamInfo = Application.GetResourceStream(new Uri("config.xml",
UriKind.Relative));
+
+            if (streamInfo != null)
+            {
+                StreamReader sr = new StreamReader(streamInfo.Stream);
+                //This will Read Keys Collection for the xml file
+                XDocument document = XDocument.Parse(sr.ReadToEnd());
+
+                var plugins = from results in document.Descendants("plugin")
+                              select new { name = (string)results.Attribute("name") };
+
+
+                foreach (var plugin in plugins)
+                {
+                    Debug.WriteLine("plugin " + plugin.name);
+                    if (plugin.name == "*")
+                    {
+                        AllowAllPlugins = true;
+                        break;
+                    }
+                    else
+                    {
+                        AllowedPlugins.Add(plugin.name);
+                    }
+                }
+
+                var preferences = from results in document.Descendants("preference")
+                                  select new
+                                  {
+                                      name = (string)results.Attribute("name"),
+                                      value = (string)results.Attribute("value")
+                                  };
+
+                foreach (var pref in preferences)
+                {
+                    Debug.WriteLine("pref" + pref.name + ", " + pref.value);
+                }
+
+                var accessList = from results in document.Descendants("access")
+                                 select new
+                                 {
+                                     origin = (string)results.Attribute("origin"),
+                                     subdomains = (string)results.Attribute("subdomains")
== "true"
+                                 };
+
+                foreach (var accessElem in accessList)
+                {
+                    AddWhiteListEntry(accessElem.origin, accessElem.subdomains);
+                }
+            }
+            else
+            {
+                // no config.xml, allow all
+                AllowAllDomains = true;
+                AllowAllPlugins = true;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/d9bd6abe/templates/standalone/cordovalib/CordovaView.xaml.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/CordovaView.xaml.cs b/templates/standalone/cordovalib/CordovaView.xaml.cs
index c277d77..0182d2f 100644
--- a/templates/standalone/cordovalib/CordovaView.xaml.cs
+++ b/templates/standalone/cordovalib/CordovaView.xaml.cs
@@ -162,33 +162,6 @@ namespace WPCordovaClassLib
             configHandler = new ConfigHandler();
             configHandler.LoadAppPackageConfig();
 
-    configHandler.URLIsAllowed("http://app.google.com");
-    configHandler.URLIsAllowed("http://10.2.3.1/");
-    configHandler.URLIsAllowed("http://www.google.ca");
-    configHandler.URLIsAllowed("http://www.google.com/");
-    configHandler.URLIsAllowed("http://www.google.com?q=bobby");
-
-    configHandler.URLIsAllowed("https://app.google.com");
-    configHandler.URLIsAllowed("https://10.2.3.1/");
-    configHandler.URLIsAllowed("https://www.google.ca");
-    configHandler.URLIsAllowed("https://www.google.com/");
-    configHandler.URLIsAllowed("https://www.google.com?q=bobby");
-
-    configHandler.URLIsAllowed("http://build.apache.org");
-    configHandler.URLIsAllowed("http://build.apache.org/page.html?x=1&g=32");
-
-    configHandler.URLIsAllowed("http://apache.org" );
-    configHandler.URLIsAllowed("http://apache.org/page.html?x=1&g=32");
-
-    configHandler.URLIsAllowed("http://sub1.sub0.build.apache.org");
-    configHandler.URLIsAllowed("http://sub1.sub0.build.apache.org/page.html?x=1&g=32");
-
-    configHandler.URLIsAllowed("http://apache.org.ca");
-    configHandler.URLIsAllowed("http://apache.org.ca/page.html?x=1&g=32");
-
-    configHandler.URLIsAllowed("http://some.other.domain/page.html?x=1&g=http://build.apache.org/");
-
-
             nativeExecution = new NativeExecution(ref this.CordovaBrowser);
             bmHelper = new BrowserMouseHelper(ref this.CordovaBrowser);
         }


Mime
View raw message