CB-12002 - Add getAllowIntents() to ConfigParser
authorDarryl Pogue <darryl@ayogo.com>
Wed, 12 Oct 2016 17:48:26 +0000 (10:48 -0700)
committerSteve Gill <stevengill97@gmail.com>
Wed, 12 Oct 2016 20:32:26 +0000 (13:32 -0700)
 This closes #502

spec/ConfigParser/ConfigParser.spec.js
spec/fixtures/test-config.xml
src/ConfigParser/ConfigParser.js

index 097fe61..22fbc99 100644 (file)
@@ -227,6 +227,10 @@ describe('config.xml parser', function () {
                 var navigations = cfg.getAllowNavigations();
                 expect(navigations.length).not.toEqual(0);
             });
+            it('it should read <allow-intent> tag entries', function(){
+                var intents = cfg.getAllowIntents();
+                expect(intents.length).not.toEqual(0);
+            });
         });
         describe('static resources', function() {
             var hasPlatformPropertyDefined = function (e) { return !!e.platform; };
index df47948..a656143 100644 (file)
@@ -74,6 +74,9 @@
     <allow-navigation href="*://server39.com" minimum-tls-version="TLSv1.1" requires-forward-secrecy="true" />
     <allow-navigation href="*://server40.com" minimum-tls-version="TLSv1.1" requires-forward-secrecy="false" />
 
+    <allow-intent href="https://*" />
+    <allow-intent href="com.example.myapp:*" />
+
     <preference name="fullscreen" value="true" />
     <preference name="webviewbounce" value="true" />
     <preference name="orientation" value="portrait" />
index f23df4d..6e74ce3 100644 (file)
@@ -480,6 +480,15 @@ ConfigParser.prototype = {
             };
         });
     },
+    /* Get all the allow-intent tags */
+    getAllowIntents: function() {
+        var allow_intents = this.doc.findall('./allow-intent');
+        return allow_intents.map(function(allow_intent){
+            return {
+                'href': allow_intent.attrib.href
+            };
+        });
+    },
     /* Get all edit-config tags */
     getEditConfigs: function(platform) {
         var platform_tag = this.doc.find('./platform[@name="' + platform + '"]');