Updated Branches:
  refs/heads/master 301de532c -> b5454942c

[CB-4486] Give iOS plugins the ability to override URL loading


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

Branch: refs/heads/master
Commit: b5454942cf333a5f4eadc4e0df64f65a9c8c1aef
Parents: 301de53
Author: Ian Clelland <[email protected]>
Authored: Fri Aug 2 00:28:12 2013 -0400
Committer: Ian Clelland <[email protected]>
Committed: Tue Aug 6 10:43:43 2013 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/b5454942/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m 
b/CordovaLib/Classes/CDVViewController.m
index e363275..30f9b96 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -650,9 +650,21 @@
     }
 
     /*
+     * Give plugins the chance to handle the url
+     */
+    for (NSString *pluginName in pluginObjects) {
+        CDVPlugin *plugin = [pluginObjects objectForKey:pluginName];
+        if ([plugin 
respondsToSelector:@selector(shouldOverrideLoadWithRequest:navigationType:)]) {
+            if ((BOOL)objc_msgSend(plugin, 
@selector(shouldOverrideLoadWithRequest:navigationType:), request, 
navigationType) == YES) {
+                return NO;
+            }
+        }
+    }
+
+    /*
      * If a URL is being loaded that's a file/http/https URL, just load it 
internally
      */
-    else if ([url isFileURL]) {
+    if ([url isFileURL]) {
         return YES;
     }
 

Reply via email to