You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/03/07 01:18:14 UTC

[01/43] ios commit: WKWebView - squashed commit.

Repository: cordova-ios
Updated Branches:
  refs/heads/4.0.x c0085a8c8 -> ef66b33cb


WKWebView - squashed commit.

commit da7a3546f809c331cf230af180b3e6f1fb99cb2b
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jul 10 17:48:15 2014 -0700

    Support alert/confirm/prompt in WKWebView

commit 63552fd3f2548f407aec1bbfda997809d1f2a89d
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jul 10 14:52:44 2014 -0700

    Support config.xml preferences for WKWebView, and style fixups

commit e67e6bf2577c776c887453801af05f973fb90094
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jul 9 18:44:03 2014 -0700

    Use weakSelf in block

commit fc83f068388f3402935819f7891906ffa9029cc1
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jul 9 18:38:30 2014 -0700

    Support config.xml preferences for WKWebView

commit 4eeaf0c8730a30b8709d0d98aba4b2996e34d9f4
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jul 9 18:27:51 2014 -0700

    Break out config.xml preferences for UIWebView (related to WKWebView prefs support)

commit 9ba496297116f20a4ea0d7b83a9f142ceec2bc84
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jul 9 17:51:11 2014 -0700

    Re-add pragma message for iOS 8

commit 2e17db94a87da80a7d50f202eef40178c0a688c0
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jul 9 17:46:00 2014 -0700

    Removed unused WKWebView+Private header

commit 601eea1c8784e1acf00b0a39ca4a3ea5085b2098
Author: Shazron Abdullah <sh...@apache.org>
Date:   Mon Jul 7 15:59:30 2014 -0700

    Removed WKWebView+Private category since the functions it covers are already now in iOS 8 beta 3

commit 69c86d641c8a14e23843566ff2024ce77238fd79
Author: Shazron Abdullah <sh...@apache.org>
Date:   Mon Jun 23 11:59:51 2014 -0700

    Changed @import WebKit back to the old #import (for supporting older IPHONE_OS_DEPLOYMENT_TARGET reasons, bug in Xcode), add #pragma message to add WebKit.framework for iOS 8

commit c133640d264eba5456b3ffd2d3be83e3fd90bf42
Author: Shazron Abdullah <sh...@gmail.com>
Date:   Sat Jun 21 22:14:26 2014 -0700

    Removed WebKit.framework from templates.

commit b4832d132e6628a7ae0ef681eab54554ed913b77
Author: Shazron Abdullah <sh...@gmail.com>
Date:   Sat Jun 21 21:45:10 2014 -0700

    Using @import instead of #import for WebKit, which doesn't require us to list the framework in the project explicitly.
    This gives us a true Xcode 5 / 6 compile solution. HOWEVER there is a bug in Xcode (was there since 5) where if you do an @import for a framework, it won't link if your Deployment Target OS version does not also include the framework itself, when compiling for the Simulator. For example, if you @import WebKit, and build for the Simulator, your Deployment Target MUST be iOS 8.

    The workaround is, this bug does not appear if you build for a device. To make it work for the Simulator, you will have to explicitly add the framework in Build Phases -> Link Binary with Libraries.

commit df3d8391546b2bb6da659ca2102609beb7038f7d
Author: Shazron Abdullah <sh...@gmail.com>
Date:   Sat Jun 21 00:20:36 2014 -0700

    Unified the implementations to switch to WKWebView when available and fall back to UIWebView. The implementation even compiles under Xcode 5.1 -- however, the linker will complain under Xcode 5.1 that WebKit.framework is not available. Just remove the framework in "Link Binary With Libraries" Build Phase and it should run.

commit 52e27adcd4227621d329fea4743be73bfcb7f4bf
Author: Shazron Abdullah <sh...@apache.org>
Date:   Fri Jun 20 16:59:48 2014 -0700

    Re-add deprecated CDVPlugin functions

commit e16e914c3ba2f30324f25da27fbbc0efa9cde727
Merge: f3af6f2 2e1b00c
Author: Shazron Abdullah <sh...@apache.org>
Date:   Fri Jun 20 16:51:54 2014 -0700

    Merge branch 'wkwebview-only' of github.com:shazron/cordova-ios into wkwebview-only

    Conflicts:
    	CordovaLib/Classes/CDVPlugin.h

commit f3af6f2636dad50412da329ce7c21dfaf3717254
Author: Shazron Abdullah <sh...@apache.org>
Date:   Fri Jun 20 16:22:08 2014 -0700

    Changed webView property of CDVPlugin to UIView.

    Plugins need to coerce this into a UIWebView or WKWebView.

commit c33497742cfe9c7f0e2c7c8902b56cf6fba09ad9
Author: Shazron Abdullah <sh...@gmail.com>
Date:   Thu Jun 19 21:39:07 2014 -0700

    Fixed native commands not being called when called in a exec callback

commit b155b5d9e120a1b7ec2d4a8c3950073792281df5
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 16:22:04 2014 -0700

    Added new cordova.js to support WKWebView Cordova bridge

commit 6a96341da8d0f455ed9f977e6329af6d98c357fe
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 16:08:30 2014 -0700

    Implemented the WKWebView Cordova bridge.

commit 6eb29c716b8308a7f4824a313a232c7c16f421b8
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 13:42:49 2014 -0700

    Moved WKScriptMessageHandler to CDVCommandDelegateImpl

commit 374763daf13f73df872a64caa83a7371a0c58542
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:51:51 2014 -0700

    Updated templates for WebKit.framework use

commit be7fd66f708587bee48b9dbbc7c0b57b03002eb2
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:50:28 2014 -0700

    Updated AppDelegate.m to use WKWebView evaluateJavascript (private)

commit 05b5c5912e339d29623de75127c2f162e0c875ed
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:49:54 2014 -0700

    Added WKWebView support (not unified, stripped out UIWebView use)

commit a6ebfb01a7dbad504928b871783f75bbc95e0d85
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:49:00 2014 -0700

    Added WKWebView private functions.

commit 2e1b00cbb92164114db2f30df10b7f0ec918c9bc
Author: Shazron Abdullah <sh...@apache.org>
Date:   Fri Jun 20 16:22:08 2014 -0700

    Changed webView property of CDVPlugin to UIView.

    Plugins need to coerce this into a UIWebView or WKWebView.

commit 867647075c837c3782333eb6b4c865cb70451aa3
Author: Shazron Abdullah <sh...@gmail.com>
Date:   Thu Jun 19 21:39:07 2014 -0700

    Fixed native commands not being called when called in a exec callback

commit ad3ec2937633995309b77bc663ee22e0b07ac667
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 16:22:04 2014 -0700

    Added new cordova.js to support WKWebView Cordova bridge

commit ede3ad5cef804c67e777c0f2c750712df50883f5
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 16:08:30 2014 -0700

    Implemented the WKWebView Cordova bridge.

commit c1c39086ab220fcdc5a796b27d38a5d32f7f5f37
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 13:42:49 2014 -0700

    Moved WKScriptMessageHandler to CDVCommandDelegateImpl

commit 5d2b137645e5fffb460c8e84d16dc8f5d104d085
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:51:51 2014 -0700

    Updated templates for WebKit.framework use

commit 63bf9a7ca03f92f263a3a3d7226512aee784a171
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:50:28 2014 -0700

    Updated AppDelegate.m to use WKWebView evaluateJavascript (private)

commit 23c05db85e57f82a4c6fe03fc5faf49abaf947b8
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:49:54 2014 -0700

    Added WKWebView support (not unified, stripped out UIWebView use)

commit 74a0f4e678e4349849596f23f7f0714aaa574532
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:49:00 2014 -0700

    Added WKWebView private functions.


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

Branch: refs/heads/4.0.x
Commit: aa5d0e937ac68b10aa846d439bb1baba4da12049
Parents: 40b9ddf
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 14 12:03:19 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Jul 14 12:03:19 2014 -0700

----------------------------------------------------------------------
 CordovaLib/CDVWebViewUIDelegate.h               |  35 +++
 CordovaLib/CDVWebViewUIDelegate.m               | 126 +++++++++
 CordovaLib/Classes/CDV.h                        |   2 +
 CordovaLib/Classes/CDVCommandDelegateImpl.h     |   6 +-
 CordovaLib/Classes/CDVCommandDelegateImpl.m     |  39 +--
 CordovaLib/Classes/CDVCommandQueue.m            |  17 +-
 CordovaLib/Classes/CDVPlugin.h                  |   9 +-
 CordovaLib/Classes/CDVPlugin.m                  |   9 +-
 CordovaLib/Classes/CDVViewController.h          |  18 +-
 CordovaLib/Classes/CDVViewController.m          | 255 ++++++------------
 .../Classes/CDVWebViewOperationsDelegate.h      |  39 +++
 .../Classes/CDVWebViewOperationsDelegate.m      |  83 ++++++
 CordovaLib/Classes/CDVWebViewPreferences.h      |  32 +++
 CordovaLib/Classes/CDVWebViewPreferences.m      | 261 +++++++++++++++++++
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |  26 ++
 CordovaLib/cordova.js                           |  51 ++--
 CordovaLibTests/CordovaLibApp/config.xml        |   1 +
 .../project/__CLI__.xcodeproj/project.pbxproj   |   6 +
 .../__NON-CLI__.xcodeproj/project.pbxproj       |   8 +-
 .../__PROJECT_NAME__/Classes/AppDelegate.m      |  16 +-
 .../project/__PROJECT_NAME__/config.xml         |   1 +
 21 files changed, 812 insertions(+), 228 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/CDVWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/CDVWebViewUIDelegate.h b/CordovaLib/CDVWebViewUIDelegate.h
new file mode 100644
index 0000000..9ff2ac1
--- /dev/null
+++ b/CordovaLib/CDVWebViewUIDelegate.h
@@ -0,0 +1,35 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+
+#ifdef __IPHONE_8_0
+    #import <WebKit/WebKit.h>
+#endif
+
+@interface CDVWebViewUIDelegate : NSObject
+#ifdef __IPHONE_8_0
+                                      <WKUIDelegate>
+#endif
+
+@property (nonatomic, copy) NSString* title;
+
+- (instancetype)initWithTitle:(NSString*)title;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/CDVWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CDVWebViewUIDelegate.m b/CordovaLib/CDVWebViewUIDelegate.m
new file mode 100644
index 0000000..6f98327
--- /dev/null
+++ b/CordovaLib/CDVWebViewUIDelegate.m
@@ -0,0 +1,126 @@
+/*
+ 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.
+ */
+
+#ifdef __IPHONE_8_0
+
+#import "CDVWebViewUIDelegate.h"
+
+    @implementation CDVWebViewUIDelegate
+
+    - (instancetype)initWithTitle:(NSString*)title
+    {
+        self = [super init];
+        if (self) {
+            self.title = title;
+        }
+
+        return self;
+    }
+
+    - (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
+        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:message
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler();
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    - (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
+        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:message
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler(YES);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                                                         style:UIAlertActionStyleDefault
+                                                       handler:^(UIAlertAction* action)
+            {
+                completionHandler(NO);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+        [alert addAction:cancel];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    - (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
+              defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
+        completionHandler:(void (^)(NSString* result))completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:prompt
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler(((UITextField*)alert.textFields[0]).text);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                                                         style:UIAlertActionStyleDefault
+                                                       handler:^(UIAlertAction* action)
+            {
+                completionHandler(nil);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+        [alert addAction:cancel];
+
+        [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
+            textField.text = defaultText;
+        }];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    @end
+#endif /* ifdef __IPHONE_8_0 */

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index 6cf592a..d368961 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -31,6 +31,8 @@
 #import "CDVLocalStorage.h"
 #import "CDVScreenOrientationDelegate.h"
 #import "CDVTimer.h"
+#import "CDVWebViewPreferences.h"
+#import "CDVWebViewOperationsDelegate.h"
 
 #import "NSArray+Comparisons.h"
 #import "NSData+Base64.h"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVCommandDelegateImpl.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandDelegateImpl.h b/CordovaLib/Classes/CDVCommandDelegateImpl.h
index 0531134..4a74d55 100644
--- a/CordovaLib/Classes/CDVCommandDelegateImpl.h
+++ b/CordovaLib/Classes/CDVCommandDelegateImpl.h
@@ -6,9 +6,9 @@
  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
@@ -24,7 +24,7 @@
 @class CDVCommandQueue;
 
 @interface CDVCommandDelegateImpl : NSObject <CDVCommandDelegate>{
-    @private
+@private
     __weak CDVViewController* _viewController;
     NSRegularExpression* _callbackIdPattern;
     @protected

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandDelegateImpl.m b/CordovaLib/Classes/CDVCommandDelegateImpl.m
index 07100a2..59d19ba 100644
--- a/CordovaLib/Classes/CDVCommandDelegateImpl.m
+++ b/CordovaLib/Classes/CDVCommandDelegateImpl.m
@@ -6,9 +6,9 @@
  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
@@ -41,16 +41,16 @@
     NSBundle* mainBundle = [NSBundle mainBundle];
     NSMutableArray* directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]];
     NSString* filename = [directoryParts lastObject];
-
+    
     [directoryParts removeLastObject];
-
+    
     NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"];
     NSString* directoryStr = _viewController.wwwFolderName;
-
+    
     if ([directoryPartsJoined length] > 0) {
         directoryStr = [NSString stringWithFormat:@"%@/%@", _viewController.wwwFolderName, [directoryParts componentsJoinedByString:@"/"]];
     }
-
+    
     return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr];
 }
 
@@ -64,13 +64,18 @@
 - (void)evalJsHelper2:(NSString*)js
 {
     CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
-    NSString* commandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:js];
-    if ([commandsJSON length] > 0) {
-        CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
-    }
-
-    [_commandQueue enqueueCommandBatch:commandsJSON];
-    [_commandQueue executePending];
+    [_viewController.webViewOperationsDelegate evaluateJavaScript:js completionHandler:^(id obj, NSError* error) {
+        // TODO: obj can be something other than string
+        if ([obj isKindOfClass:[NSString class]]) {
+            NSString* commandsJSON = (NSString*)obj;
+            if ([commandsJSON length] > 0) {
+                CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
+            }
+            
+            [_commandQueue enqueueCommandBatch:commandsJSON];
+            [_commandQueue executePending];
+        }
+    }];
 }
 
 - (void)evalJsHelper:(NSString*)js
@@ -98,7 +103,7 @@
 - (BOOL)isValidCallbackId:(NSString*)callbackId
 {
     NSError* err = nil;
-
+    
     // Initialize on first use
     if (_callbackIdPattern == nil) {
         // Catch any invalid characters in the callback id.
@@ -130,9 +135,9 @@
     int status = [result.status intValue];
     BOOL keepCallback = [result.keepCallback boolValue];
     NSString* argumentsAsJSON = [result argumentsAsJSON];
-
+    
     NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)", callbackId, status, argumentsAsJSON, keepCallback];
-
+    
     [self evalJsHelper:js];
 }
 
@@ -169,7 +174,7 @@
 - (BOOL)URLIsWhitelisted:(NSURL*)url
 {
     return ![_viewController.whitelist schemeIsAllowed:[url scheme]] ||
-           [_viewController.whitelist URLIsAllowed:url logFailure:NO];
+    [_viewController.whitelist URLIsAllowed:url logFailure:NO];
 }
 
 - (NSDictionary*)settings

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index 1eddfe3..b4f1fa6 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -109,9 +109,22 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame.
 
 - (void)fetchCommandsFromJs
 {
+    NSString* js = @"cordova.require('cordova/exec').nativeFetchMessages()";
+    SEL ui_selector = NSSelectorFromString(@"stringByEvaluatingJavaScriptFromString:");
+
     // Grab all the queued commands from the JS side.
-    NSString* queuedCommandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:
-        @"cordova.require('cordova/exec').nativeFetchMessages()"];
+    NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:
+        [[_viewController.webView class] instanceMethodSignatureForSelector:ui_selector]];
+
+    [invocation setSelector:ui_selector];
+    [invocation setTarget:_viewController.webView];
+    // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation
+    [invocation setArgument:&(js) atIndex:2];
+
+    [invocation invoke];
+
+    NSString* queuedCommandsJSON;
+    [invocation getReturnValue:&(queuedCommandsJSON)];
 
     CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
     [self enqueueCommandBatch:queuedCommandsJSON];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVPlugin.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPlugin.h b/CordovaLib/Classes/CDVPlugin.h
index 20c209b..89fed08 100644
--- a/CordovaLib/Classes/CDVPlugin.h
+++ b/CordovaLib/Classes/CDVPlugin.h
@@ -22,6 +22,9 @@
 #import "CDVPluginResult.h"
 #import "NSMutableArray+QueueAdditions.h"
 #import "CDVCommandDelegate.h"
+#ifdef __IPHONE_8_0
+    #import <WebKit/WebKit.h>
+#endif
 
 extern NSString* const CDVPageDidLoadNotification;
 extern NSString* const CDVPluginHandleOpenURLNotification;
@@ -32,13 +35,13 @@ extern NSString* const CDVRemoteNotificationError;
 
 @interface CDVPlugin : NSObject {}
 
-@property (nonatomic, weak) UIWebView* webView;
+@property (nonatomic, weak) UIView* webView;
 @property (nonatomic, weak) UIViewController* viewController;
 @property (nonatomic, weak) id <CDVCommandDelegate> commandDelegate;
 
 @property (readonly, assign) BOOL hasPendingOperation;
 
-- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView;
+- (instancetype)initWithWebView:(UIView*)theWebView;
 - (void)pluginInitialize;
 
 - (void)handleOpenURL:(NSNotification*)notification;
@@ -58,7 +61,7 @@ extern NSString* const CDVRemoteNotificationError;
 
 - (id)appDelegate;
 
-// TODO(agrieve): Deprecate these in favour of using CDVCommandDelegate directly.
+// TODO(agrieve)x: Deprecate these in favour of using CDVCommandDelegate directly.
 - (NSString*)writeJavascript:(NSString*)javascript CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of evalJs:");
 
 - (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of sendPluginResult:callbackId");

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVPlugin.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPlugin.m b/CordovaLib/Classes/CDVPlugin.m
index ea81ddd..5f90311 100644
--- a/CordovaLib/Classes/CDVPlugin.m
+++ b/CordovaLib/Classes/CDVPlugin.m
@@ -18,6 +18,7 @@
  */
 
 #import "CDVPlugin.h"
+#import "CDVViewController.h"
 
 NSString* const CDVPageDidLoadNotification = @"CDVPageDidLoadNotification";
 NSString* const CDVPluginHandleOpenURLNotification = @"CDVPluginHandleOpenURLNotification";
@@ -36,12 +37,12 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
 @synthesize webView, viewController, commandDelegate, hasPendingOperation;
 
 // Do not override these methods. Use pluginInitialize instead.
-- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings
+- (instancetype)initWithWebView:(UIView*)theWebView settings:(NSDictionary*)classSettings
 {
     return [self initWithWebView:theWebView];
 }
 
-- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView
+- (instancetype)initWithWebView:(UIView*)theWebView
 {
     self = [super init];
     if (self) {
@@ -130,7 +131,9 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
 
 - (NSString*)writeJavascript:(NSString*)javascript
 {
-    return [self.webView stringByEvaluatingJavaScriptFromString:javascript];
+    // TODO: although deprecated, should have some solution here instead of removing it
+    [((CDVViewController*)self.viewController).webViewOperationsDelegate evaluateJavaScript : javascript completionHandler : nil]; // bad cast, but ok for now
+    return @"";
 }
 
 - (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index 1015c50..d38d9d3 100644
--- a/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/Classes/CDVViewController.h
@@ -26,8 +26,19 @@
 #import "CDVWhitelist.h"
 #import "CDVScreenOrientationDelegate.h"
 #import "CDVPlugin.h"
+#import "CDVWebViewOperationsDelegate.h"
+#ifdef __IPHONE_8_0
+    #import <WebKit/WebKit.h>
+#else
+    @protocol WKScriptMessageHandler
+    @end
+#endif
 
-@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
+@protocol WKScriptMessageHandler;
+
+@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate, WKScriptMessageHandler>{
+    @protected
+    CDVWebViewOperationsDelegate* _webViewOperationsDelegate;
     @protected
     id <CDVCommandDelegate> _commandDelegate;
     @protected
@@ -35,7 +46,7 @@
     NSString* _userAgent;
 }
 
-@property (nonatomic, strong) IBOutlet UIWebView* webView;
+@property (nonatomic, strong) IBOutlet UIView* webView;
 
 @property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects;
 @property (nonatomic, readonly, strong) NSDictionary* pluginsMap;
@@ -47,6 +58,7 @@
 @property (nonatomic, readwrite, copy) NSString* wwwFolderName;
 @property (nonatomic, readwrite, copy) NSString* startPage;
 @property (nonatomic, readonly, strong) CDVCommandQueue* commandQueue;
+@property (nonatomic, readonly, strong) CDVWebViewOperationsDelegate* webViewOperationsDelegate;
 @property (nonatomic, readonly, strong) id <CDVCommandDelegate> commandDelegate;
 @property (nonatomic, readonly) NSString* userAgent;
 
@@ -55,7 +67,7 @@
 
 - (void)printMultitaskingInfo;
 - (void)createGapView;
-- (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds;
+- (UIView*)newCordovaViewWithFrame:(CGRect)bounds;
 
 - (void)javascriptAlert:(NSString*)text;
 - (NSString*)appURLScheme;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 66c1850..d5aeb89 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -23,6 +23,7 @@
 #import "CDVConfigParser.h"
 #import "CDVUserAgentUtil.h"
 #import "CDVWebViewDelegate.h"
+#import "CDVWebViewUIDelegate.h"
 #import <AVFoundation/AVFoundation.h>
 
 #define degreesToRadian(x) (M_PI * (x) / 180.0)
@@ -30,6 +31,7 @@
 @interface CDVViewController () {
     NSInteger _userAgentLockToken;
     CDVWebViewDelegate* _webViewDelegate;
+    CDVWebViewUIDelegate* _webViewUIDelegate;
 }
 
 @property (nonatomic, readwrite, strong) NSXMLParser* configParser;
@@ -55,6 +57,7 @@
 @synthesize wwwFolderName, startPage, initialized, openURL;
 @synthesize commandDelegate = _commandDelegate;
 @synthesize commandQueue = _commandQueue;
+@synthesize webViewOperationsDelegate = _webViewOperationsDelegate;
 
 - (void)__init
 {
@@ -254,22 +257,15 @@
 
     // Configure WebView
     _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self];
-    self.webView.delegate = _webViewDelegate;
+    if ([webView respondsToSelector:@selector(setDelegate:)]) {
+        [webView setValue:_webViewDelegate forKey:@"delegate"];
+    }
 
     // register this viewcontroller with the NSURLProtocol, only after the User-Agent is set
     [CDVURLProtocol registerViewController:self];
 
     // /////////////////
 
-    NSString* enableViewportScale = [self settingForKey:@"EnableViewportScale"];
-    NSNumber* allowInlineMediaPlayback = [self settingForKey:@"AllowInlineMediaPlayback"];
-    BOOL mediaPlaybackRequiresUserAction = YES;  // default value
-    if ([self settingForKey:@"MediaPlaybackRequiresUserAction"]) {
-        mediaPlaybackRequiresUserAction = [(NSNumber*)[self settingForKey:@"MediaPlaybackRequiresUserAction"] boolValue];
-    }
-
-    self.webView.scalesPageToFit = [enableViewportScale boolValue];
-
     /*
      * Fire up CDVLocalStorage to work-around WebKit storage limitations: on all iOS 5.1+ versions for local-only backups, but only needed on iOS 5.1 for cloud backup.
      */
@@ -278,150 +274,8 @@
         [self registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])];
     }
 
-    /*
-     * This is for iOS 4.x, where you can allow inline <video> and <audio>, and also autoplay them
-     */
-    if ([allowInlineMediaPlayback boolValue] && [self.webView respondsToSelector:@selector(allowsInlineMediaPlayback)]) {
-        self.webView.allowsInlineMediaPlayback = YES;
-    }
-    if ((mediaPlaybackRequiresUserAction == NO) && [self.webView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)]) {
-        self.webView.mediaPlaybackRequiresUserAction = NO;
-    }
-
-    // By default, overscroll bouncing is allowed.
-    // UIWebViewBounce has been renamed to DisallowOverscroll, but both are checked.
-    BOOL bounceAllowed = YES;
-    NSNumber* disallowOverscroll = [self settingForKey:@"DisallowOverscroll"];
-    if (disallowOverscroll == nil) {
-        NSNumber* bouncePreference = [self settingForKey:@"UIWebViewBounce"];
-        bounceAllowed = (bouncePreference == nil || [bouncePreference boolValue]);
-    } else {
-        bounceAllowed = ![disallowOverscroll boolValue];
-    }
-
-    // prevent webView from bouncing
-    // based on the DisallowOverscroll/UIWebViewBounce key in config.xml
-    if (!bounceAllowed) {
-        if ([self.webView respondsToSelector:@selector(scrollView)]) {
-            ((UIScrollView*)[self.webView scrollView]).bounces = NO;
-        } else {
-            for (id subview in self.webView.subviews) {
-                if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
-                    ((UIScrollView*)subview).bounces = NO;
-                }
-            }
-        }
-    }
-
-    NSString* decelerationSetting = [self settingForKey:@"UIWebViewDecelerationSpeed"];
-    if (![@"fast" isEqualToString : decelerationSetting]) {
-        [self.webView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
-    }
-
-    /*
-     * iOS 6.0 UIWebView properties
-     */
-    if (IsAtLeastiOSVersion(@"6.0")) {
-        BOOL keyboardDisplayRequiresUserAction = YES; // KeyboardDisplayRequiresUserAction - defaults to YES
-        if ([self settingForKey:@"KeyboardDisplayRequiresUserAction"] != nil) {
-            if ([self settingForKey:@"KeyboardDisplayRequiresUserAction"]) {
-                keyboardDisplayRequiresUserAction = [(NSNumber*)[self settingForKey:@"KeyboardDisplayRequiresUserAction"] boolValue];
-            }
-        }
-
-        // property check for compiling under iOS < 6
-        if ([self.webView respondsToSelector:@selector(setKeyboardDisplayRequiresUserAction:)]) {
-            [self.webView setValue:[NSNumber numberWithBool:keyboardDisplayRequiresUserAction] forKey:@"keyboardDisplayRequiresUserAction"];
-        }
-
-        BOOL suppressesIncrementalRendering = NO; // SuppressesIncrementalRendering - defaults to NO
-        if ([self settingForKey:@"SuppressesIncrementalRendering"] != nil) {
-            if ([self settingForKey:@"SuppressesIncrementalRendering"]) {
-                suppressesIncrementalRendering = [(NSNumber*)[self settingForKey:@"SuppressesIncrementalRendering"] boolValue];
-            }
-        }
-
-        // property check for compiling under iOS < 6
-        if ([self.webView respondsToSelector:@selector(setSuppressesIncrementalRendering:)]) {
-            [self.webView setValue:[NSNumber numberWithBool:suppressesIncrementalRendering] forKey:@"suppressesIncrementalRendering"];
-        }
-    }
-
-    /*
-     * iOS 7.0 UIWebView properties
-     */
-    if (IsAtLeastiOSVersion(@"7.0")) {
-        SEL ios7sel = nil;
-        id prefObj = nil;
-
-        CGFloat gapBetweenPages = 0.0; // default
-        prefObj = [self settingForKey:@"GapBetweenPages"];
-        if (prefObj != nil) {
-            gapBetweenPages = [prefObj floatValue];
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setGapBetweenPages:");
-        if ([self.webView respondsToSelector:ios7sel]) {
-            [self.webView setValue:[NSNumber numberWithFloat:gapBetweenPages] forKey:@"gapBetweenPages"];
-        }
-
-        CGFloat pageLength = 0.0; // default
-        prefObj = [self settingForKey:@"PageLength"];
-        if (prefObj != nil) {
-            pageLength = [[self settingForKey:@"PageLength"] floatValue];
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setPageLength:");
-        if ([self.webView respondsToSelector:ios7sel]) {
-            [self.webView setValue:[NSNumber numberWithBool:pageLength] forKey:@"pageLength"];
-        }
-
-        NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage
-        prefObj = [self settingForKey:@"PaginationBreakingMode"];
-        if (prefObj != nil) {
-            NSArray* validValues = @[@"page", @"column"];
-            NSString* prefValue = [validValues objectAtIndex:0];
-
-            if ([prefObj isKindOfClass:[NSString class]]) {
-                prefValue = prefObj;
-            }
-
-            paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]];
-            if (paginationBreakingMode == NSNotFound) {
-                paginationBreakingMode = 0;
-            }
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setPaginationBreakingMode:");
-        if ([self.webView respondsToSelector:ios7sel]) {
-            [self.webView setValue:[NSNumber numberWithInteger:paginationBreakingMode] forKey:@"paginationBreakingMode"];
-        }
-
-        NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated
-        prefObj = [self settingForKey:@"PaginationMode"];
-        if (prefObj != nil) {
-            NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"];
-            NSString* prefValue = [validValues objectAtIndex:0];
-
-            if ([prefObj isKindOfClass:[NSString class]]) {
-                prefValue = prefObj;
-            }
-
-            paginationMode = [validValues indexOfObject:[prefValue lowercaseString]];
-            if (paginationMode == NSNotFound) {
-                paginationMode = 0;
-            }
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setPaginationMode:");
-        if ([self.webView respondsToSelector:ios7sel]) {
-            [self.webView setValue:[NSNumber numberWithInteger:paginationMode] forKey:@"paginationMode"];
-        }
-    }
+    CDVWebViewPreferences* prefs = [[CDVWebViewPreferences alloc] initWithWebView:webView];
+    [prefs updateSettings:self.settings];
 
     if ([self.startupPluginNames count] > 0) {
         [CDVTimer start:@"TotalPluginStartup"];
@@ -441,10 +295,10 @@
         [CDVUserAgentUtil setUserAgent:self.userAgent lockToken:lockToken];
         if (!loadErr) {
             NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
-            [self.webView loadRequest:appReq];
+            [_webViewOperationsDelegate loadRequest:appReq];
         } else {
             NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr];
-            [self.webView loadHTMLString:html baseURL:nil];
+            [_webViewOperationsDelegate loadHTMLString:html baseURL:nil];
         }
     }];
 }
@@ -508,20 +362,22 @@
     }
 }
 
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+- (void)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation completionHandler:(void (^)(BOOL))completionHandler
 {
     // First, ask the webview via JS if it supports the new orientation
     NSString* jsCall = [NSString stringWithFormat:
         @"window.shouldRotateToOrientation && window.shouldRotateToOrientation(%ld);"
         , (long)[self mapIosOrientationToJsOrientation:interfaceOrientation]];
-    NSString* res = [webView stringByEvaluatingJavaScriptFromString:jsCall];
+    __weak CDVViewController* weakSelf = self;
 
-    if ([res length] > 0) {
-        return [res boolValue];
-    }
-
-    // if js did not handle the new orientation (no return value), use values from the plist (via supportedOrientations)
-    return [self supportsOrientation:interfaceOrientation];
+    [_webViewOperationsDelegate evaluateJavaScript:jsCall completionHandler:^(NSString* obj, NSError* error) {
+        if ([obj length] > 0) {
+            completionHandler([obj boolValue]);
+        } else {
+            // if js did not handle the new orientation (no return value), use values from the plist (via supportedOrientations)
+            completionHandler([weakSelf supportsOrientation:interfaceOrientation]);
+        }
+    }];
 }
 
 - (BOOL)shouldAutorotate
@@ -554,9 +410,37 @@
     return [self.supportedOrientations containsObject:[NSNumber numberWithInt:orientation]];
 }
 
-- (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds
+- (UIView*)newCordovaViewWithFrame:(CGRect)bounds
 {
-    return [[UIWebView alloc] initWithFrame:bounds];
+    UIView* cordovaView = nil;
+    BOOL useWKWebView = NO;  // default value
+
+    if ([self settingForKey:@"UseWKWebView"]) {
+        useWKWebView = [(NSNumber*)[self settingForKey:@"UseWKWebView"] boolValue];
+    }
+
+    if (NSClassFromString(@"WKWebView") && useWKWebView) {
+#ifdef __IPHONE_8_0
+            WKUserContentController* userContentController = [[WKUserContentController alloc] init];
+
+            // scriptMessageHandler is the object that conforms to the WKScriptMessageHandler protocol
+            // see https://developer.apple.com/library/prerelease/ios/documentation/WebKit/Reference/WKScriptMessageHandler_Ref/index.html#//apple_ref/swift/intf/WKScriptMessageHandler
+            if ([_commandDelegate conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
+                [userContentController addScriptMessageHandler:self name:@"cordova"];
+            }
+
+            WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];
+            configuration.userContentController = userContentController;
+
+            cordovaView = [[WKWebView alloc] initWithFrame:bounds configuration:configuration];
+            _webViewUIDelegate = [[CDVWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
+            ((WKWebView*)cordovaView).UIDelegate = _webViewUIDelegate;
+#endif
+    } else {
+        cordovaView = [[UIWebView alloc] initWithFrame:bounds];
+    }
+
+    return cordovaView;
 }
 
 - (NSString*)userAgent
@@ -577,6 +461,7 @@
 
     self.webView = [self newCordovaViewWithFrame:webViewBounds];
     self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
+    _webViewOperationsDelegate = [[CDVWebViewOperationsDelegate alloc] initWithWebView:self.webView];
 
     [self.view addSubview:self.webView];
     [self.view sendSubviewToBack:self.webView];
@@ -612,7 +497,9 @@
     // Release any retained subviews of the main view.
     // e.g. self.myOutlet = nil;
 
-    self.webView.delegate = nil;
+    if ([webView respondsToSelector:@selector(setDelegate:)]) {
+        [webView setValue:nil forKey:@"delegate"];
+    }
     self.webView = nil;
     [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
 }
@@ -975,11 +862,38 @@
     if (self.openURL) {
         // calls into javascript global function 'handleOpenURL'
         NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", [self.openURL description]];
-        [self.webView stringByEvaluatingJavaScriptFromString:jsString];
+        [_webViewOperationsDelegate evaluateJavaScript:jsString completionHandler:nil];
         self.openURL = nil;
     }
 }
 
+#pragma mark WKScriptMessageHandler implementation
+
+#ifdef __IPHONE_8_0
+    - (void)userContentController:(WKUserContentController*)userContentController didReceiveScriptMessage:(WKScriptMessage*)message
+    {
+        if (![message.name isEqualToString:@"cordova"]) {
+            return;
+        }
+
+        NSArray* jsonEntry = message.body; // NSString:callbackId, NSString:service, NSString:action, NSArray:args
+        CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
+        CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);
+
+        if (![_commandQueue execute:command]) {
+    #ifdef DEBUG
+                NSString* commandJson = [jsonEntry JSONString];
+                static NSUInteger maxLogLength = 1024;
+                NSString* commandString = ([commandJson length] > maxLogLength) ?
+                    [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
+                    commandJson;
+
+                DLog(@"FAILED pluginJSON = %@", commandString);
+    #endif
+        }
+    }
+#endif /* ifdef __IPHONE_8_0 */
+
 // ///////////////////////
 
 - (void)dealloc
@@ -987,7 +901,10 @@
     [CDVURLProtocol unregisterViewController:self];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 
-    self.webView.delegate = nil;
+    if ([webView respondsToSelector:@selector(setDelegate:)]) {
+        [webView setValue:nil forKey:@"delegate"];
+    }
+
     self.webView = nil;
     [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
     [_commandQueue dispose];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewOperationsDelegate.h b/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
new file mode 100644
index 0000000..34330a1
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
@@ -0,0 +1,39 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+#ifdef __IPHONE_8_0
+#pragma message("For iOS 8 - Please add WebKit.framework into your 'Link Binary with Libraries' Build Phase Project Setting. This will be baked in once Xcode 6 is required.")
+#endif /* ifdef __IPHONE_8_0 */
+
+
+@interface CDVWebViewOperationsDelegate : NSObject {
+    @private
+    __weak UIView* _webView;
+}
+
+- (instancetype) initWithWebView:(UIView*)webView;
+
+- (void)loadRequest:(NSURLRequest*)request;
+- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL;
+- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewOperationsDelegate.m b/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
new file mode 100644
index 0000000..d243aba
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
@@ -0,0 +1,83 @@
+/*
+ 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.
+ */
+
+#import <objc/message.h>
+#import "CDVWebViewOperationsDelegate.h"
+
+@implementation CDVWebViewOperationsDelegate
+
+- (instancetype) initWithWebView:(UIView*)webView
+{
+    self = [super init];
+    if (self) {
+        Class wk_class = NSClassFromString(@"WKWebView");
+        if ( !([webView isKindOfClass:wk_class] || [webView isKindOfClass:[UIWebView class]] )) {
+            return nil;
+        }
+        _webView = webView;
+    }
+    
+    return self;
+}
+
+- (void)loadRequest:(NSURLRequest*)request
+{
+    SEL selector = NSSelectorFromString(@"loadRequest:");
+    if ([_webView respondsToSelector:selector]) {
+        // UIKit operations have to be on the main thread. and this method is synchronous
+        [_webView performSelectorOnMainThread:selector withObject:request waitUntilDone:YES];
+    }
+}
+
+- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL
+{
+    SEL selector = NSSelectorFromString(@"loadHTMLString:baseURL:");
+
+    dispatch_block_t invoke = ^(void) {
+        ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, selector, string, baseURL);
+    };
+    
+    if ([_webView respondsToSelector:selector]) {
+        // UIKit operations have to be on the main thread.
+        // perform a synchronous invoke on the main thread without deadlocking
+        if ([NSThread isMainThread]) {
+            invoke();
+        } else {
+            dispatch_sync(dispatch_get_main_queue(), invoke);
+        }
+    }
+}
+
+- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
+{
+    SEL ui_sel = NSSelectorFromString(@"stringByEvaluatingJavaScriptFromString:");
+    SEL wk_sel = NSSelectorFromString(@"evaluateJavaScript:completionHandler:");
+
+    // UIKit operations have to be on the main thread. This method does not need to be synchronous
+    dispatch_async(dispatch_get_main_queue(), ^{
+        if ([_webView respondsToSelector:ui_sel]) {
+            NSString* ret = ((NSString* (*)(id, SEL, id))objc_msgSend)(_webView, ui_sel, javaScriptString);
+            completionHandler(ret, nil);
+        } else if ([_webView respondsToSelector:wk_sel]) {
+            ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, javaScriptString, completionHandler);
+        }
+    });
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVWebViewPreferences.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.h b/CordovaLib/Classes/CDVWebViewPreferences.h
new file mode 100644
index 0000000..5058eef
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewPreferences.h
@@ -0,0 +1,32 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+@interface CDVWebViewPreferences: NSObject {
+    @private
+    __weak UIView* _webView;
+}
+
+- (instancetype) initWithWebView:(UIView*)webView;
+- (void) updateSettings:(NSDictionary*)settings;
+
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
new file mode 100644
index 0000000..a42b3aa
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewPreferences.m
@@ -0,0 +1,261 @@
+/*
+ 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.
+ */
+#import "CDVWebViewPreferences.h"
+#import "CDVAvailability.h"
+#import <objc/message.h>
+
+#ifdef __IPHONE_8_0
+    #import <WebKit/WebKit.h>
+#endif /* ifdef __IPHONE_8_0 */
+
+@implementation CDVWebViewPreferences
+
+- (instancetype)initWithWebView:(UIView*)webView
+{
+    self = [super init];
+    if (self) {
+        Class wk_class = NSClassFromString(@"WKWebView");
+        if (!([webView isKindOfClass:wk_class] || [webView isKindOfClass:[UIWebView class]])) {
+            return nil;
+        }
+        _webView = webView;
+    }
+
+    return self;
+}
+
+- (void)updateSettings:(NSDictionary*)settings
+{
+    Class wk_class = NSClassFromString(@"WKWebView");
+    SEL ui_sel = NSSelectorFromString(@"updateUIWebView:settings:");
+    SEL wk_sel = NSSelectorFromString(@"updateWKWebView:settings:");
+
+    __weak id weakSelf = self;
+
+    dispatch_block_t invoke = ^(void) {
+        if ([_webView isKindOfClass:[UIWebView class]] && [weakSelf respondsToSelector:ui_sel]) {
+            ((void (*)(id, SEL, id, id))objc_msgSend)(weakSelf, ui_sel, _webView, settings);
+        } else if ([_webView isKindOfClass:wk_class] && [weakSelf respondsToSelector:wk_sel]) {
+            ((void (*)(id, SEL, id, id))objc_msgSend)(weakSelf, wk_sel, _webView, settings);
+        }
+    };
+
+    // UIKit operations have to be on the main thread.
+    // perform a synchronous invoke on the main thread without deadlocking
+    if ([NSThread isMainThread]) {
+        invoke();
+    } else {
+        dispatch_sync(dispatch_get_main_queue(), invoke);
+    }
+}
+
+- (id)cordovaSettings:(NSDictionary*)settings forKey:(NSString*)key
+{
+    return [settings objectForKey:[key lowercaseString]];
+}
+
+- (void)updateUIWebView:(UIWebView*)theWebView settings:(NSDictionary*)settings
+{
+    NSString* enableViewportScale = [self cordovaSettings:settings forKey:@"EnableViewportScale"];
+    NSNumber* allowInlineMediaPlayback = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
+    BOOL mediaPlaybackRequiresUserAction = YES;  // default value
+
+    if ([self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"]) {
+        mediaPlaybackRequiresUserAction = [(NSNumber*)[self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"] boolValue];
+    }
+
+    theWebView.scalesPageToFit = [enableViewportScale boolValue];
+
+    /*
+     * This is for iOS 4.x, where you can allow inline <video> and <audio>, and also autoplay them
+     */
+    if ([allowInlineMediaPlayback boolValue] && [theWebView respondsToSelector:@selector(allowsInlineMediaPlayback)]) {
+        theWebView.allowsInlineMediaPlayback = YES;
+    }
+    if ((mediaPlaybackRequiresUserAction == NO) && [theWebView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)]) {
+        theWebView.mediaPlaybackRequiresUserAction = NO;
+    }
+
+    // By default, overscroll bouncing is allowed.
+    // UIWebViewBounce has been renamed to DisallowOverscroll, but both are checked.
+    BOOL bounceAllowed = YES;
+    NSNumber* disallowOverscroll = [self cordovaSettings:settings forKey:@"DisallowOverscroll"];
+    if (disallowOverscroll == nil) {
+        NSNumber* bouncePreference = [self cordovaSettings:settings forKey:@"UIWebViewBounce"];
+        bounceAllowed = (bouncePreference == nil || [bouncePreference boolValue]);
+    } else {
+        bounceAllowed = ![disallowOverscroll boolValue];
+    }
+
+    // prevent webView from bouncing
+    // based on the DisallowOverscroll/UIWebViewBounce key in config.xml
+    if (!bounceAllowed) {
+        if ([theWebView respondsToSelector:@selector(scrollView)]) {
+            ((UIScrollView*)[theWebView scrollView]).bounces = NO;
+        } else {
+            for (id subview in theWebView.subviews) {
+                if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
+                    ((UIScrollView*)subview).bounces = NO;
+                }
+            }
+        }
+    }
+
+    NSString* decelerationSetting = [self cordovaSettings:settings forKey:@"UIWebViewDecelerationSpeed"];
+    if (![@"fast" isEqualToString : decelerationSetting]) {
+        [theWebView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
+    }
+
+    /*
+     * iOS 6.0 UIWebView properties
+     */
+    if (IsAtLeastiOSVersion(@"6.0")) {
+        BOOL keyboardDisplayRequiresUserAction = YES; // KeyboardDisplayRequiresUserAction - defaults to YES
+        if ([self cordovaSettings:settings forKey:@"KeyboardDisplayRequiresUserAction"] != nil) {
+            if ([self cordovaSettings:settings forKey:@"KeyboardDisplayRequiresUserAction"]) {
+                keyboardDisplayRequiresUserAction = [(NSNumber*)[self cordovaSettings:settings forKey:@"KeyboardDisplayRequiresUserAction"] boolValue];
+            }
+        }
+
+        // property check for compiling under iOS < 6
+        if ([theWebView respondsToSelector:@selector(setKeyboardDisplayRequiresUserAction:)]) {
+            [theWebView setValue:[NSNumber numberWithBool:keyboardDisplayRequiresUserAction] forKey:@"keyboardDisplayRequiresUserAction"];
+        }
+
+        BOOL suppressesIncrementalRendering = NO; // SuppressesIncrementalRendering - defaults to NO
+        if ([self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"] != nil) {
+            if ([self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"]) {
+                suppressesIncrementalRendering = [(NSNumber*)[self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"] boolValue];
+            }
+        }
+
+        // property check for compiling under iOS < 6
+        if ([theWebView respondsToSelector:@selector(setSuppressesIncrementalRendering:)]) {
+            [theWebView setValue:[NSNumber numberWithBool:suppressesIncrementalRendering] forKey:@"suppressesIncrementalRendering"];
+        }
+    }
+
+    /*
+     * iOS 7.0 UIWebView properties
+     */
+    if (IsAtLeastiOSVersion(@"7.0")) {
+        SEL ios7sel = nil;
+        id prefObj = nil;
+
+        CGFloat gapBetweenPages = 0.0; // default
+        prefObj = [self cordovaSettings:settings forKey:@"GapBetweenPages"];
+        if (prefObj != nil) {
+            gapBetweenPages = [prefObj floatValue];
+        }
+
+        // property check for compiling under iOS < 7
+        ios7sel = NSSelectorFromString(@"setGapBetweenPages:");
+        if ([theWebView respondsToSelector:ios7sel]) {
+            [theWebView setValue:[NSNumber numberWithFloat:gapBetweenPages] forKey:@"gapBetweenPages"];
+        }
+
+        CGFloat pageLength = 0.0; // default
+        prefObj = [self cordovaSettings:settings forKey:@"PageLength"];
+        if (prefObj != nil) {
+            pageLength = [[self cordovaSettings:settings forKey:@"PageLength"] floatValue];
+        }
+
+        // property check for compiling under iOS < 7
+        ios7sel = NSSelectorFromString(@"setPageLength:");
+        if ([theWebView respondsToSelector:ios7sel]) {
+            [theWebView setValue:[NSNumber numberWithBool:pageLength] forKey:@"pageLength"];
+        }
+
+        NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage
+        prefObj = [self cordovaSettings:settings forKey:@"PaginationBreakingMode"];
+        if (prefObj != nil) {
+            NSArray* validValues = @[@"page", @"column"];
+            NSString* prefValue = [validValues objectAtIndex:0];
+
+            if ([prefObj isKindOfClass:[NSString class]]) {
+                prefValue = prefObj;
+            }
+
+            paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]];
+            if (paginationBreakingMode == NSNotFound) {
+                paginationBreakingMode = 0;
+            }
+        }
+
+        // property check for compiling under iOS < 7
+        ios7sel = NSSelectorFromString(@"setPaginationBreakingMode:");
+        if ([theWebView respondsToSelector:ios7sel]) {
+            [theWebView setValue:[NSNumber numberWithInteger:paginationBreakingMode] forKey:@"paginationBreakingMode"];
+        }
+
+        NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated
+        prefObj = [self cordovaSettings:settings forKey:@"PaginationMode"];
+        if (prefObj != nil) {
+            NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"];
+            NSString* prefValue = [validValues objectAtIndex:0];
+
+            if ([prefObj isKindOfClass:[NSString class]]) {
+                prefValue = prefObj;
+            }
+
+            paginationMode = [validValues indexOfObject:[prefValue lowercaseString]];
+            if (paginationMode == NSNotFound) {
+                paginationMode = 0;
+            }
+        }
+
+        // property check for compiling under iOS < 7
+        ios7sel = NSSelectorFromString(@"setPaginationMode:");
+        if ([theWebView respondsToSelector:ios7sel]) {
+            [theWebView setValue:[NSNumber numberWithInteger:paginationMode] forKey:@"paginationMode"];
+        }
+    }
+}
+
+#ifdef __IPHONE_8_0
+
+    - (void)updateWKWebView:(WKWebView*)theWebView settings:(NSDictionary*)settings
+    {
+        id prefObj = nil;
+
+        CGFloat minimumFontSize = 0.0; // default
+
+        prefObj = [self cordovaSettings:settings forKey:@"MinimumFontSize"];
+        if (prefObj != nil) {
+            minimumFontSize = [[self cordovaSettings:settings forKey:@"MinimumFontSize"] floatValue];
+        }
+        theWebView.configuration.preferences.minimumFontSize = minimumFontSize;
+
+        /*
+        BOOL javaScriptEnabled = YES;  // default value
+        if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {
+            javaScriptEnabled = [(NSNumber*)[self cordovaSettings:settings forKey:@"JavaScriptEnabled"] boolValue];
+        }
+        theWebView.configuration.preferences.javaScriptEnabled = javaScriptEnabled;
+
+        BOOL javaScriptCanOpenWindowsAutomatically = NO;  // default value
+        if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {
+            javaScriptCanOpenWindowsAutomatically = [(NSNumber*)[self cordovaSettings:settings forKey:@"JavaScriptEnabled"] boolValue];
+        }
+        theWebView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = javaScriptCanOpenWindowsAutomatically;
+         */
+    }
+#endif /* ifdef __IPHONE_8_0 */
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index a084d16..a2d5cc4 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -13,8 +13,10 @@
 		1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F92F49F1314023E0046367C /* CDVPluginResult.m */; };
 		301F2F2A14F3C9CA003FE9FC /* CDV.h in Headers */ = {isa = PBXBuildFile; fileRef = 301F2F2914F3C9CA003FE9FC /* CDV.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		302965BC13A94E9D007046C5 /* CDVDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 302965BB13A94E9D007046C5 /* CDVDebug.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		302D72FC19554BFC0028C99F /* CDVWebViewOperationsDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D72FA19554BFC0028C99F /* CDVWebViewOperationsDelegate.m */; };
 		3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 3034979A1513D56A0090E688 /* CDVLocalStorage.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3034979E1513D56A0090E688 /* CDVLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 3034979B1513D56A0090E688 /* CDVLocalStorage.m */; };
+		303820731955603600C91592 /* CDVWebViewOperationsDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 302D72F919554BFC0028C99F /* CDVWebViewOperationsDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */; };
@@ -32,6 +34,10 @@
 		30F5EBAB14CA26E700987760 /* CDVCommandDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E14B5A81705050A0032169E /* CDVTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E14B5A61705050A0032169E /* CDVTimer.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E14B5A91705050A0032169E /* CDVTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E14B5A71705050A0032169E /* CDVTimer.m */; };
+		7E785B9A196F508900ABBDC8 /* CDVWebViewUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		7E785B9B196F508900ABBDC8 /* CDVWebViewUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */; };
+		7EE9ECF819525D24004CA6B9 /* CDVWebViewPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		7EE9ECF919525D24004CA6B9 /* CDVWebViewPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */; };
 		8852C43A14B65FD800F0E735 /* CDVViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 8852C43614B65FD800F0E735 /* CDVViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		8852C43C14B65FD800F0E735 /* CDVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8852C43714B65FD800F0E735 /* CDVViewController.m */; };
 		8887FD681090FBE7009987E8 /* NSDictionary+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -61,6 +67,8 @@
 		1F92F49F1314023E0046367C /* CDVPluginResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVPluginResult.m; path = Classes/CDVPluginResult.m; sourceTree = "<group>"; };
 		301F2F2914F3C9CA003FE9FC /* CDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDV.h; path = Classes/CDV.h; sourceTree = "<group>"; };
 		302965BB13A94E9D007046C5 /* CDVDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVDebug.h; path = Classes/CDVDebug.h; sourceTree = "<group>"; };
+		302D72F919554BFC0028C99F /* CDVWebViewOperationsDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewOperationsDelegate.h; path = Classes/CDVWebViewOperationsDelegate.h; sourceTree = "<group>"; };
+		302D72FA19554BFC0028C99F /* CDVWebViewOperationsDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewOperationsDelegate.m; path = Classes/CDVWebViewOperationsDelegate.m; sourceTree = "<group>"; };
 		30325A0B136B343700982B63 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
 		3034979A1513D56A0090E688 /* CDVLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVLocalStorage.h; path = Classes/CDVLocalStorage.h; sourceTree = "<group>"; };
 		3034979B1513D56A0090E688 /* CDVLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVLocalStorage.m; path = Classes/CDVLocalStorage.m; sourceTree = "<group>"; };
@@ -93,6 +101,10 @@
 		68A32D7414103017006B237C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
 		7E14B5A61705050A0032169E /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVTimer.h; path = Classes/CDVTimer.h; sourceTree = "<group>"; };
 		7E14B5A71705050A0032169E /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVTimer.m; path = Classes/CDVTimer.m; sourceTree = "<group>"; };
+		7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVWebViewUIDelegate.h; sourceTree = "<group>"; };
+		7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWebViewUIDelegate.m; sourceTree = "<group>"; };
+		7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewPreferences.h; path = Classes/CDVWebViewPreferences.h; sourceTree = "<group>"; };
+		7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewPreferences.m; path = Classes/CDVWebViewPreferences.m; sourceTree = "<group>"; };
 		8220B5C316D5427E00EC3921 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
 		8852C43614B65FD800F0E735 /* CDVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVViewController.h; path = Classes/CDVViewController.h; sourceTree = "<group>"; };
 		8852C43714B65FD800F0E735 /* CDVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVViewController.m; path = Classes/CDVViewController.m; sourceTree = "<group>"; };
@@ -176,6 +188,12 @@
 				8852C43714B65FD800F0E735 /* CDVViewController.m */,
 				EB3B3545161CB44D003DBE7D /* CDVCommandQueue.h */,
 				EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */,
+				7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */,
+				7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */,
+				302D72F919554BFC0028C99F /* CDVWebViewOperationsDelegate.h */,
+				302D72FA19554BFC0028C99F /* CDVWebViewOperationsDelegate.m */,
+				7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */,
+				7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */,
 			);
 			name = Cleaver;
 			sourceTree = "<group>";
@@ -281,8 +299,11 @@
 				F858FBC6166009A8007DA594 /* CDVConfigParser.h in Headers */,
 				30F3930B169F839700B22307 /* CDVJSON.h in Headers */,
 				EBFF4DBD16D3FE2E008F452B /* CDVWebViewDelegate.h in Headers */,
+				7EE9ECF819525D24004CA6B9 /* CDVWebViewPreferences.h in Headers */,
 				EB96673B16A8970A00D86CDF /* CDVUserAgentUtil.h in Headers */,
 				7E14B5A81705050A0032169E /* CDVTimer.h in Headers */,
+				7E785B9A196F508900ABBDC8 /* CDVWebViewUIDelegate.h in Headers */,
+				303820731955603600C91592 /* CDVWebViewOperationsDelegate.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -344,6 +365,7 @@
 				8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */,
 				8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */,
 				1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */,
+				7EE9ECF919525D24004CA6B9 /* CDVWebViewPreferences.m in Sources */,
 				30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */,
 				30E563D013E217EC00C949AA /* NSMutableArray+QueueAdditions.m in Sources */,
 				30C684821406CB38004C1A8E /* CDVWhitelist.m in Sources */,
@@ -356,10 +378,12 @@
 				EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */,
 				F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */,
 				30F3930C169F839700B22307 /* CDVJSON.m in Sources */,
+				7E785B9B196F508900ABBDC8 /* CDVWebViewUIDelegate.m in Sources */,
 				EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */,
 				EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */,
 				7E14B5A91705050A0032169E /* CDVTimer.m in Sources */,
 				1B701029177A61CF00AE11F4 /* CDVShared.m in Sources */,
+				302D72FC19554BFC0028C99F /* CDVWebViewOperationsDelegate.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -370,6 +394,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = NO;
 				DSTROOT = "/tmp/$(PROJECT_NAME).dst";
@@ -393,6 +418,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				DSTROOT = "/tmp/$(PROJECT_NAME).dst";
 				GCC_MODEL_TUNING = G5;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index 4f64444..2470044 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -1,5 +1,5 @@
 // Platform: ios
-// 3.6.0-dev-7e845f3
+// 3.6.0-dev-f27458f
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '3.6.0-dev-7e845f3';
+var CORDOVA_JS_BUILD_LABEL = '3.6.0-dev-f27458f';
 // file: src/scripts/require.js
 
 /*jshint -W079 */
@@ -826,7 +826,8 @@ var cordova = require('cordova'),
         XHR_OPTIONAL_PAYLOAD: 3,
         IFRAME_HASH_NO_PAYLOAD: 4,
         // Bundling the payload turns out to be slower. Probably since it has to be URI encoded / decoded.
-        IFRAME_HASH_WITH_PAYLOAD: 5
+        IFRAME_HASH_WITH_PAYLOAD: 5,
+        WK_WEBVIEW_BINDING: 6
     },
     bridgeMode,
     execIframe,
@@ -921,9 +922,17 @@ function iOSExec() {
     // Use IFRAME_NAV elsewhere since it's faster and XHR bridge
     // seems to have bugs in newer OS's (CB-3900, CB-3359, CB-5457, CB-4970, CB-4998, CB-5134)
     if (bridgeMode === undefined) {
-        bridgeMode = navigator.userAgent.indexOf(' 5_') == -1 ? jsToNativeModes.IFRAME_NAV: jsToNativeModes.XHR_NO_PAYLOAD;
+        if (navigator.userAgent) {
+            bridgeMode = navigator.userAgent.indexOf(' 5_') == -1 ? jsToNativeModes.IFRAME_NAV: jsToNativeModes.XHR_NO_PAYLOAD;
+		} else {
+            bridgeMode = jsToNativeModes.IFRAME_NAV;
+        }
     }
-
+	
+    if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) {
+        bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING;
+    }
+    
     var successCallback, failCallback, service, action, actionArgs, splitCommand;
     var callbackId = null;
     if (typeof arguments[0] !== "string") {
@@ -973,20 +982,24 @@ function iOSExec() {
     // effectively clone the command arguments in case they are mutated before
     // the command is executed.
     commandQueue.push(JSON.stringify(command));
-
-    // If we're in the context of a stringByEvaluatingJavaScriptFromString call,
-    // then the queue will be flushed when it returns; no need for a poke.
-    // Also, if there is already a command in the queue, then we've already
-    // poked the native side, so there is no reason to do so again.
-    if (!isInContextOfEvalJs && commandQueue.length == 1) {
-        switch (bridgeMode) {
-        case jsToNativeModes.XHR_NO_PAYLOAD:
-        case jsToNativeModes.XHR_WITH_PAYLOAD:
-        case jsToNativeModes.XHR_OPTIONAL_PAYLOAD:
-            pokeNativeViaXhr();
-            break;
-        default: // iframe-based.
-            pokeNativeViaIframe();
+    
+    if (bridgeMode === jsToNativeModes.WK_WEBVIEW_BINDING) {
+        window.webkit.messageHandlers.cordova.postMessage(command);
+    } else {
+        // If we're in the context of a stringByEvaluatingJavaScriptFromString call,
+        // then the queue will be flushed when it returns; no need for a poke.
+        // Also, if there is already a command in the queue, then we've already
+        // poked the native side, so there is no reason to do so again.
+        if (!isInContextOfEvalJs && commandQueue.length == 1) {
+            switch (bridgeMode) {
+            case jsToNativeModes.XHR_NO_PAYLOAD:
+            case jsToNativeModes.XHR_WITH_PAYLOAD:
+            case jsToNativeModes.XHR_OPTIONAL_PAYLOAD:
+                pokeNativeViaXhr();
+                break;
+            default: // iframe-based.
+                pokeNativeViaIframe();
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/CordovaLibTests/CordovaLibApp/config.xml
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CordovaLibApp/config.xml b/CordovaLibTests/CordovaLibApp/config.xml
index 1fcc8d7..da6c067 100644
--- a/CordovaLibTests/CordovaLibApp/config.xml
+++ b/CordovaLibTests/CordovaLibApp/config.xml
@@ -36,6 +36,7 @@
     <content src="index.html" />
 
     <!-- Preferences for iOS -->
+    <preference name="UseWKWebView" value="false" />
     <preference name="AllowInlineMediaPlayback" value="false" />
     <preference name="BackupWebStorage" value="cloud" />
     <preference name="DisallowOverscroll" value="false" />

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/bin/templates/project/__CLI__.xcodeproj/project.pbxproj b/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
index 4fc1058..6248e1d 100755
--- a/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
+++ b/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
@@ -97,6 +97,7 @@
 		7E7966DB1810823500FA85AD /* icon-76@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76@2x.png"; sourceTree = "<group>"; };
 		7E7966DC1810823500FA85AD /* icon-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small.png"; sourceTree = "<group>"; };
 		7E7966DD1810823500FA85AD /* icon-small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small@2x.png"; sourceTree = "<group>"; };
+		7ED68E4519526A5A00B0A8AF /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
 		8D1107310486CEB800E47090 /* __PROJECT_NAME__-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "__PROJECT_NAME__-Info.plist"; path = "../__PROJECT_NAME__-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
 		D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x~iphone.png"; sourceTree = "<group>"; };
 		EB87FDF21871DA7A0020F90C /* merges */ = {isa = PBXFileReference; lastKnownFileType = folder; name = merges; path = ../../merges; sourceTree = "<group>"; };
@@ -204,6 +205,7 @@
 		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				7ED68E4519526A5A00B0A8AF /* WebKit.framework */,
 				5AEE5B34173C68D80009041E /* CoreLocation.framework */,
 				5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */,
 				288765FC0DF74451002DB57D /* CoreGraphics.framework */,
@@ -470,6 +472,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
@@ -503,6 +506,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -533,6 +537,7 @@
 		C01FCF4F08A954540054247B /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
@@ -579,6 +584,7 @@
 		C01FCF5008A954540054247B /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj b/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
index a59b3bd..c2d5ca4 100755
--- a/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
+++ b/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
@@ -97,6 +97,7 @@
 		7E7966DB1810823500FA85AD /* icon-76@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76@2x.png"; sourceTree = "<group>"; };
 		7E7966DC1810823500FA85AD /* icon-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small.png"; sourceTree = "<group>"; };
 		7E7966DD1810823500FA85AD /* icon-small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small@2x.png"; sourceTree = "<group>"; };
+		7EFADAF51952687D00F28308 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
 		8D1107310486CEB800E47090 /* __PROJECT_NAME__-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "__PROJECT_NAME__-Info.plist"; path = "../__PROJECT_NAME__-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
 		D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x~iphone.png"; sourceTree = "<group>"; };
 		F840E1F0165FE0F500CFE078 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = "__PROJECT_NAME__/config.xml"; sourceTree = "<group>"; };
@@ -199,6 +200,7 @@
 		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				7EFADAF51952687D00F28308 /* WebKit.framework */,
 				5AEE5B34173C68D80009041E /* CoreLocation.framework */,
 				5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */,
 				288765FC0DF74451002DB57D /* CoreGraphics.framework */,
@@ -391,7 +393,7 @@
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
 			shellScript = "cordova/lib/copy-www-build-step.sh";
-            showEnvVarsInLog = 0;
+			showEnvVarsInLog = 0;
 		};
 /* End PBXShellScriptBuildPhase section */
 
@@ -456,6 +458,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
@@ -489,6 +492,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -519,6 +523,7 @@
 		C01FCF4F08A954540054247B /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
@@ -565,6 +570,7 @@
 		C01FCF5008A954540054247B /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m
----------------------------------------------------------------------
diff --git a/bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m b/bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m
index cc82260..ea2fb7c 100644
--- a/bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m
+++ b/bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m
@@ -101,7 +101,7 @@
 
     // calls into javascript global function 'handleOpenURL'
     NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", url];
-    [self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];
+    [self.viewController.webViewOperationsDelegate evaluateJavaScript:jsString completionHandler:nil];
 
     // all plugins will get the notification, and their handlers will be called
     [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
@@ -117,20 +117,20 @@
     [[NSNotificationCenter defaultCenter] postNotificationName:CDVLocalNotification object:notification];
 }
 
-- (void)                                application:(UIApplication *)application
-   didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
+- (void)                                 application:(UIApplication*)application
+    didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
 {
     // re-post ( broadcast )
     NSString* token = [[[[deviceToken description]
-                         stringByReplacingOccurrencesOfString: @"<" withString: @""]
-                        stringByReplacingOccurrencesOfString: @">" withString: @""]
-                       stringByReplacingOccurrencesOfString: @" " withString: @""];
+        stringByReplacingOccurrencesOfString:@"<" withString:@""]
+        stringByReplacingOccurrencesOfString:@">" withString:@""]
+        stringByReplacingOccurrencesOfString:@" " withString:@""];
 
     [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotification object:token];
 }
 
-- (void)                                 application:(UIApplication *)application
-    didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
+- (void)                                 application:(UIApplication*)application
+    didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
 {
     // re-post ( broadcast )
     [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotificationError object:error];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aa5d0e93/bin/templates/project/__PROJECT_NAME__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__PROJECT_NAME__/config.xml b/bin/templates/project/__PROJECT_NAME__/config.xml
index 1fcc8d7..da6c067 100644
--- a/bin/templates/project/__PROJECT_NAME__/config.xml
+++ b/bin/templates/project/__PROJECT_NAME__/config.xml
@@ -36,6 +36,7 @@
     <content src="index.html" />
 
     <!-- Preferences for iOS -->
+    <preference name="UseWKWebView" value="false" />
     <preference name="AllowInlineMediaPlayback" value="false" />
     <preference name="BackupWebStorage" value="cloud" />
     <preference name="DisallowOverscroll" value="false" />


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[20/43] ios commit: Add support for loadFileUrl (and style mixups)

Posted by sh...@apache.org.
Add support for loadFileUrl (and style mixups)


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

Branch: refs/heads/4.0.x
Commit: 3a4182461d22c2477dab58e8ebe0d3604216b2e4
Parents: f13ba3a
Author: Shazron Abdullah <sh...@apache.org>
Authored: Sun Nov 2 00:02:07 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Sun Nov 2 00:02:07 2014 -0700

----------------------------------------------------------------------
 .../Classes/CDVWebViewOperationsDelegate.h      | 10 ++--
 .../Classes/CDVWebViewOperationsDelegate.m      | 55 ++++++++++++++------
 2 files changed, 43 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/3a418246/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewOperationsDelegate.h b/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
index 34330a1..ee539f7 100644
--- a/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
+++ b/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
@@ -6,9 +6,9 @@
  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
@@ -21,19 +21,19 @@
 #import <UIKit/UIKit.h>
 
 #ifdef __IPHONE_8_0
-#pragma message("For iOS 8 - Please add WebKit.framework into your 'Link Binary with Libraries' Build Phase Project Setting. This will be baked in once Xcode 6 is required.")
+    #pragma message("For iOS 8 - Please add WebKit.framework into your 'Link Binary with Libraries' Build Phase Project Setting. This will be baked in once Xcode 6 is required.")
 #endif /* ifdef __IPHONE_8_0 */
 
-
 @interface CDVWebViewOperationsDelegate : NSObject {
     @private
     __weak UIView* _webView;
 }
 
-- (instancetype) initWithWebView:(UIView*)webView;
+- (instancetype)initWithWebView:(UIView*)webView;
 
 - (void)loadRequest:(NSURLRequest*)request;
 - (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL;
 - (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler;
+- (void)loadFileURL:(NSURL*)URL allowingReadAccessToURL:(NSURL*)readAccessURL;
 
 @end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/3a418246/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewOperationsDelegate.m b/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
index d243aba..8f32539 100644
--- a/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
+++ b/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
@@ -6,9 +6,9 @@
  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
@@ -22,37 +22,53 @@
 
 @implementation CDVWebViewOperationsDelegate
 
-- (instancetype) initWithWebView:(UIView*)webView
+- (instancetype)initWithWebView:(UIView*)webView
 {
     self = [super init];
     if (self) {
         Class wk_class = NSClassFromString(@"WKWebView");
-        if ( !([webView isKindOfClass:wk_class] || [webView isKindOfClass:[UIWebView class]] )) {
+        if (!([webView isKindOfClass:wk_class] || [webView isKindOfClass:[UIWebView class]])) {
             return nil;
         }
         _webView = webView;
     }
-    
+
     return self;
 }
 
 - (void)loadRequest:(NSURLRequest*)request
 {
-    SEL selector = NSSelectorFromString(@"loadRequest:");
+    SEL selector = @selector(loadRequest:);
+
     if ([_webView respondsToSelector:selector]) {
         // UIKit operations have to be on the main thread. and this method is synchronous
         [_webView performSelectorOnMainThread:selector withObject:request waitUntilDone:YES];
     }
 }
 
+- (void)loadFileURL:(NSURL*)url allowingReadAccessToURL:(NSURL*)readAccessURL
+{
+    SEL wk_sel = @selector(loadFileURL:allowingReadAccessToURL:);
+    __weak CDVWebViewOperationsDelegate* weakSelf = self;
+
+    // UIKit operations have to be on the main thread. This method does not need to be synchronous
+    dispatch_async(dispatch_get_main_queue(), ^{
+            if ([_webView respondsToSelector:wk_sel] && [[url scheme] isEqualToString:@"file"]) {
+                ((id (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, url, readAccessURL);
+            } else {
+                [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
+            }
+        });
+}
+
 - (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL
 {
-    SEL selector = NSSelectorFromString(@"loadHTMLString:baseURL:");
+    SEL selector = @selector(loadHTMLString:baseURL:);
 
     dispatch_block_t invoke = ^(void) {
         ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, selector, string, baseURL);
     };
-    
+
     if ([_webView respondsToSelector:selector]) {
         // UIKit operations have to be on the main thread.
         // perform a synchronous invoke on the main thread without deadlocking
@@ -66,18 +82,23 @@
 
 - (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
 {
-    SEL ui_sel = NSSelectorFromString(@"stringByEvaluatingJavaScriptFromString:");
-    SEL wk_sel = NSSelectorFromString(@"evaluateJavaScript:completionHandler:");
+    SEL ui_sel = @selector(stringByEvaluatingJavaScriptFromString:);
+    SEL wk_sel = @selector(evaluateJavaScript:completionHandler:);
 
     // UIKit operations have to be on the main thread. This method does not need to be synchronous
     dispatch_async(dispatch_get_main_queue(), ^{
-        if ([_webView respondsToSelector:ui_sel]) {
-            NSString* ret = ((NSString* (*)(id, SEL, id))objc_msgSend)(_webView, ui_sel, javaScriptString);
-            completionHandler(ret, nil);
-        } else if ([_webView respondsToSelector:wk_sel]) {
-            ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, javaScriptString, completionHandler);
-        }
-    });
+            if ([_webView respondsToSelector:ui_sel]) {
+                NSString* ret = ((NSString * (*)(id, SEL, id))objc_msgSend)(_webView, ui_sel, javaScriptString);
+                completionHandler(ret, nil);
+            } else if ([_webView respondsToSelector:wk_sel]) {
+                ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, javaScriptString, completionHandler);
+            }
+        });
+}
+
+- (id)forwardingTargetForSelector:(SEL)aSelector
+{
+    return _webView;
 }
 
 @end


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[06/43] ios commit: CB-7184 - Implement support for mediaPlaybackAllowsAirPlay in UIWebView and WKWebView

Posted by sh...@apache.org.
CB-7184 - Implement support for mediaPlaybackAllowsAirPlay in UIWebView and WKWebView

plus config cleanup.


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

Branch: refs/heads/4.0.x
Commit: 3d39ef4e34e2ff994ee725fe5e2b956334eee854
Parents: 7ce625b
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 21 14:48:51 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Jul 21 14:48:51 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewPreferences.m | 42 +++++++++++++++++--------
 1 file changed, 29 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/3d39ef4e/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
index f1cb48f..eb55c9d 100644
--- a/CordovaLib/Classes/CDVWebViewPreferences.m
+++ b/CordovaLib/Classes/CDVWebViewPreferences.m
@@ -72,25 +72,34 @@
 
 - (void)updateUIWebView:(UIWebView*)theWebView settings:(NSDictionary*)settings
 {
-    NSString* enableViewportScale = [self cordovaSettings:settings forKey:@"EnableViewportScale"];
-    NSNumber* allowInlineMediaPlayback = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
-    BOOL mediaPlaybackRequiresUserAction = YES;  // default value
+    BOOL scalesPageToFit = NO; // default
+    id prefObj = [self cordovaSettings:settings forKey:@"EnableViewportScale"];
 
-    if ([self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"]) {
-        mediaPlaybackRequiresUserAction = [(NSNumber*)[self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"] boolValue];
+    if (prefObj != nil) {
+        scalesPageToFit = [(NSNumber*)prefObj boolValue];
     }
+    theWebView.scalesPageToFit = scalesPageToFit;
 
-    theWebView.scalesPageToFit = [enableViewportScale boolValue];
+    BOOL allowInlineMediaPlayback = NO; // default
+    prefObj = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
+    if (prefObj != nil) {
+        allowInlineMediaPlayback = [(NSNumber*)prefObj boolValue];
+    }
+    theWebView.allowsInlineMediaPlayback = allowInlineMediaPlayback;
 
-    /*
-     * This is for iOS 4.x, where you can allow inline <video> and <audio>, and also autoplay them
-     */
-    if ([allowInlineMediaPlayback boolValue] && [theWebView respondsToSelector:@selector(allowsInlineMediaPlayback)]) {
-        theWebView.allowsInlineMediaPlayback = YES;
+    BOOL mediaPlaybackRequiresUserAction = YES;  // default
+    prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
+    if (prefObj != nil) {
+        mediaPlaybackRequiresUserAction = [(NSNumber*)prefObj boolValue];
     }
-    if ((mediaPlaybackRequiresUserAction == NO) && [theWebView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)]) {
-        theWebView.mediaPlaybackRequiresUserAction = NO;
+    theWebView.mediaPlaybackRequiresUserAction = mediaPlaybackRequiresUserAction;
+
+    BOOL mediaPlaybackAllowsAirPlay = YES;  // default
+    prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackAllowsAirPlay"];
+    if (prefObj != nil) {
+        mediaPlaybackAllowsAirPlay = [(NSNumber*)prefObj boolValue];
     }
+    theWebView.mediaPlaybackAllowsAirPlay = mediaPlaybackAllowsAirPlay;
 
     // By default, overscroll bouncing is allowed.
     // UIWebViewBounce has been renamed to DisallowOverscroll, but both are checked.
@@ -263,6 +272,13 @@
         }
         theWebView.configuration.suppressesIncrementalRendering = suppressesIncrementalRendering;
 
+        BOOL mediaPlaybackAllowsAirPlay = YES;  // default
+        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackAllowsAirPlay"];
+        if (prefObj != nil) {
+            mediaPlaybackAllowsAirPlay = [(NSNumber*)prefObj boolValue];
+        }
+        theWebView.configuration.mediaPlaybackAllowsAirPlay = mediaPlaybackAllowsAirPlay;
+
         /*
         BOOL javaScriptEnabled = YES;  // default value
         if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[28/43] ios commit: Removed the CordovaWebViewEngine preference. This will be installed by the wkwebview-engine plugin.

Posted by sh...@apache.org.
Removed the CordovaWebViewEngine preference. This will be installed by the wkwebview-engine plugin.


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

Branch: refs/heads/4.0.x
Commit: 96fd4cb74022962815ba2daf1e7b146e1fbd4db2
Parents: 03e9c71
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri Nov 7 10:31:21 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Nov 7 10:31:21 2014 -0800

----------------------------------------------------------------------
 bin/templates/project/__PROJECT_NAME__/config.xml | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/96fd4cb7/bin/templates/project/__PROJECT_NAME__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__PROJECT_NAME__/config.xml b/bin/templates/project/__PROJECT_NAME__/config.xml
index c6830d9..1fcc8d7 100644
--- a/bin/templates/project/__PROJECT_NAME__/config.xml
+++ b/bin/templates/project/__PROJECT_NAME__/config.xml
@@ -36,7 +36,6 @@
     <content src="index.html" />
 
     <!-- Preferences for iOS -->
-    <preference name="CordovaWebViewEngine" value="CDVUIWebViewEngine" />
     <preference name="AllowInlineMediaPlayback" value="false" />
     <preference name="BackupWebStorage" value="cloud" />
     <preference name="DisallowOverscroll" value="false" />


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[26/43] ios commit: Removed WebKit.framework dependencies in core files, WKWebView and UIWebView are fully pluginized. WKWebView will need a local web server for use on device currently (Simulator is fine)

Posted by sh...@apache.org.
Removed WebKit.framework dependencies in core files, WKWebView and UIWebView are fully pluginized. WKWebView will need a local web server for use on device currently (Simulator is fine)


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

Branch: refs/heads/4.0.x
Commit: af1ec2c40e2fb5ae4d01c87407a64d25d0b85b02
Parents: ce6604d
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Nov 6 15:28:13 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Nov 6 15:28:13 2014 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVUIWebViewDelegate.m     |   1 -
 CordovaLib/Classes/CDVUIWebViewEngine.h       |   5 +-
 CordovaLib/Classes/CDVUIWebViewEngine.m       |  28 +++-
 CordovaLib/Classes/CDVViewController.h        |  11 +-
 CordovaLib/Classes/CDVViewController.m        |  47 +-----
 CordovaLib/Classes/CDVWKWebViewEngine.h       |   7 +-
 CordovaLib/Classes/CDVWKWebViewEngine.m       |  66 +++++++-
 CordovaLib/Classes/CDVWKWebViewUIDelegate.h   |   1 -
 CordovaLib/Classes/CDVWKWebViewUIDelegate.m   | 169 ++++++++++-----------
 CordovaLib/Classes/CDVWebViewEngineProtocol.h |   3 +-
 10 files changed, 176 insertions(+), 162 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/af1ec2c4/CordovaLib/Classes/CDVUIWebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewDelegate.m b/CordovaLib/Classes/CDVUIWebViewDelegate.m
index 230a7fa..d880a4b 100644
--- a/CordovaLib/Classes/CDVUIWebViewDelegate.m
+++ b/CordovaLib/Classes/CDVUIWebViewDelegate.m
@@ -77,7 +77,6 @@
 //
 
 #import "CDVUIWebViewDelegate.h"
-#import "CDVAvailability.h"
 
 // #define VerboseLog NSLog
 #define VerboseLog(...) do {} while (0)

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/af1ec2c4/CordovaLib/Classes/CDVUIWebViewEngine.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewEngine.h b/CordovaLib/Classes/CDVUIWebViewEngine.h
index ea1d8f5..6a9ee77 100644
--- a/CordovaLib/Classes/CDVUIWebViewEngine.h
+++ b/CordovaLib/Classes/CDVUIWebViewEngine.h
@@ -17,10 +17,11 @@
  under the License.
  */
 
-#import <Foundation/Foundation.h>
-#import "CDVWebViewEngineProtocol.h"
 #import "CDVPlugin.h"
+#import "CDVWebViewEngineProtocol.h"
 
 @interface CDVUIWebViewEngine : CDVPlugin <CDVWebViewEngineProtocol>
 
+@property (nonatomic, strong, readonly) id <UIWebViewDelegate> uiWebViewDelegate;
+
 @end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/af1ec2c4/CordovaLib/Classes/CDVUIWebViewEngine.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewEngine.m b/CordovaLib/Classes/CDVUIWebViewEngine.m
index e81778f..f2594ad 100644
--- a/CordovaLib/Classes/CDVUIWebViewEngine.m
+++ b/CordovaLib/Classes/CDVUIWebViewEngine.m
@@ -26,6 +26,7 @@
 @interface CDVUIWebViewEngine ()
 
 @property (nonatomic, strong, readwrite) UIView* engineWebView;
+@property (nonatomic, strong, readwrite) id <UIWebViewDelegate> uiWebViewDelegate;
 
 @end
 
@@ -47,9 +48,23 @@
     return self;
 }
 
+- (void)pluginInitialize
+{
+    // viewController would be available now. we attempt to set all possible delegates to it, by default
+
+    UIWebView* uiWebView = (UIWebView*)_engineWebView;
+
+    if ([self.viewController conformsToProtocol:@protocol(UIWebViewDelegate)]) {
+        self.uiWebViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:(id <UIWebViewDelegate>)self.viewController];
+        uiWebView.delegate = self.uiWebViewDelegate;
+    }
+
+    [self updateSettings:self.commandDelegate.settings];
+}
+
 - (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
 {
-    NSString* ret = [(UIWebView*)_engineWebView stringByEvaluatingJavaScriptFromString : javaScriptString];
+    NSString* ret = [(UIWebView*)_engineWebView stringByEvaluatingJavaScriptFromString:javaScriptString];
 
     if (completionHandler) {
         completionHandler(ret, nil);
@@ -62,8 +77,8 @@
 
     // UIKit operations have to be on the main thread. This method does not need to be synchronous
     dispatch_async(dispatch_get_main_queue(), ^{
-            [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
-        });
+        [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
+    });
 }
 
 - (void)updateSettings:(NSDictionary*)settings
@@ -98,7 +113,7 @@
     }
 
     NSString* decelerationSetting = [settings cordovaSettingForKey:@"UIWebViewDecelerationSpeed"];
-    if (![@"fast" isEqualToString : decelerationSetting]) {
+    if (![@"fast" isEqualToString:decelerationSetting]) {
         [uiWebView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
     }
 
@@ -139,12 +154,15 @@
 
 - (void)updateWithInfo:(NSDictionary*)info
 {
+    UIWebView* uiWebView = (UIWebView*)_engineWebView;
+
     id <UIWebViewDelegate> uiWebViewDelegate = [info objectForKey:kCDVWebViewEngineUIWebViewDelegate];
     NSDictionary* settings = [info objectForKey:kCDVWebViewEngineWebViewPreferences];
 
     if (uiWebViewDelegate &&
         [uiWebViewDelegate conformsToProtocol:@protocol(UIWebViewDelegate)]) {
-        ((UIWebView*)_engineWebView).delegate = uiWebViewDelegate;
+        self.uiWebViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:(id <UIWebViewDelegate>)self.viewController];
+        uiWebView.delegate = self.uiWebViewDelegate;
     }
 
     if (settings && [settings isKindOfClass:[NSDictionary class]]) {

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/af1ec2c4/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index 453ce30..68297d4 100644
--- a/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/Classes/CDVViewController.h
@@ -28,16 +28,7 @@
 #import "CDVPlugin.h"
 #import "CDVWebViewEngineProtocol.h"
 
-#ifdef __IPHONE_8_0
-    #import <WebKit/WebKit.h>
-#else
-    @protocol WKScriptMessageHandler
-    @end
-#endif
-
-@protocol WKScriptMessageHandler;
-
-@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate, WKScriptMessageHandler>{
+@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
     @protected
     id <CDVWebViewEngineProtocol> _webViewEngine;
     @protected

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/af1ec2c4/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 10c68ec..a76b6e7 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -18,17 +18,12 @@
  */
 
 #import "CDV.h"
-#import "CDVCommandDelegateImpl.h"
-#import "CDVConfigParser.h"
-#import "CDVUserAgentUtil.h"
 #import "CDVUIWebViewDelegate.h"
 #import "NSDictionary+CordovaPreferences.h"
 
 #import <objc/message.h>
 #import <AVFoundation/AVFoundation.h>
 
-#define degreesToRadian(x) (M_PI * (x) / 180.0)
-
 @interface CDVViewController () {
     NSInteger _userAgentLockToken;
 }
@@ -293,10 +288,6 @@
         [self registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])];
     }
 
-    // TODO:
-    //    CDVWebViewPreferences* prefs = [[CDVWebViewPreferences alloc] initWithWebView:webView settings:self.settings];
-    //    [prefs update];
-
     if ([self.startupPluginNames count] > 0) {
         [CDVTimer start:@"TotalPluginStartup"];
 
@@ -448,12 +439,9 @@
         self.webViewEngine = [[NSClassFromString(defaultWebViewEngineClass) alloc] initWithFrame:bounds];
     }
 
-    NSMutableDictionary* info = [NSMutableDictionary dictionaryWithCapacity:1];
-    [info setValue:@{@"cordova" : self} forKey:kCDVWebViewEngineScriptMessageHandlers];
-    [info setValue:self forKey:kCDVWebViewEngineUIWebViewDelegate];
-    [info setValue:self.settings forKey:kCDVWebViewEngineWebViewPreferences];
-
-    [self.webViewEngine updateWithInfo:info];
+    if ([self.webViewEngine isKindOfClass:[CDVPlugin class]]) {
+        [self registerPlugin:(CDVPlugin*)self.webViewEngine withClassName:webViewEngineClass];
+    }
 
     return self.webViewEngine.engineWebView;
 }
@@ -688,7 +676,7 @@
 + (NSString*)applicationDocumentsDirectory
 {
     NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-    NSString* basePath = (([paths count] > 0) ? ([paths objectAtIndex:0]) : nil);
+    NSString* basePath = (([paths count] > 0) ? ([paths objectAtIndex : 0]) : nil);
 
     return basePath;
 }
@@ -905,33 +893,6 @@
     [self processOpenUrl:url pageLoaded:NO];
 }
 
-#pragma mark WKScriptMessageHandler implementation
-
-#ifdef __IPHONE_8_0
-    - (void)userContentController:(WKUserContentController*)userContentController didReceiveScriptMessage:(WKScriptMessage*)message
-    {
-        if (![message.name isEqualToString:@"cordova"]) {
-            return;
-        }
-
-        NSArray* jsonEntry = message.body; // NSString:callbackId, NSString:service, NSString:action, NSArray:args
-        CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
-        CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);
-
-        if (![_commandQueue execute:command]) {
-    #ifdef DEBUG
-                NSString* commandJson = [jsonEntry JSONString];
-                static NSUInteger maxLogLength = 1024;
-                NSString* commandString = ([commandJson length] > maxLogLength) ?
-                    [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
-                    commandJson;
-
-                DLog(@"FAILED pluginJSON = %@", commandString);
-    #endif
-        }
-    }
-#endif /* ifdef __IPHONE_8_0 */
-
 // ///////////////////////
 
 - (void)dealloc

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/af1ec2c4/CordovaLib/Classes/CDVWKWebViewEngine.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewEngine.h b/CordovaLib/Classes/CDVWKWebViewEngine.h
index fde1d11..e138b84 100644
--- a/CordovaLib/Classes/CDVWKWebViewEngine.h
+++ b/CordovaLib/Classes/CDVWKWebViewEngine.h
@@ -17,11 +17,10 @@
  under the License.
  */
 
-#import <Foundation/Foundation.h>
-#import "CDVWebViewEngineProtocol.h"
-#import "CDVPlugin.h"
+#import <WebKit/WebKit.h>
+#import "CDV.h"
 
-@interface CDVWKWebViewEngine : CDVPlugin <CDVWebViewEngineProtocol>
+@interface CDVWKWebViewEngine : CDVPlugin <CDVWebViewEngineProtocol, WKScriptMessageHandler>
 
 @property (nonatomic, strong, readonly) id <WKUIDelegate> uiDelegate;
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/af1ec2c4/CordovaLib/Classes/CDVWKWebViewEngine.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewEngine.m b/CordovaLib/Classes/CDVWKWebViewEngine.m
index 4907572..94ef0b2 100644
--- a/CordovaLib/Classes/CDVWKWebViewEngine.m
+++ b/CordovaLib/Classes/CDVWKWebViewEngine.m
@@ -19,10 +19,10 @@
 
 #import "CDVWKWebViewEngine.h"
 #import "CDVWKWebViewUIDelegate.h"
-#import "NSDictionary+CordovaPreferences.h"
 
 #import <objc/message.h>
-#import <WebKit/WebKit.h>
+
+#define CDV_BRIDGE_NAME @"cordova"
 
 @interface CDVWKWebViewEngine ()
 
@@ -45,6 +45,7 @@
         self.uiDelegate = [[CDVWKWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
 
         WKUserContentController* userContentController = [[WKUserContentController alloc] init];
+        [userContentController addScriptMessageHandler:self name:CDV_BRIDGE_NAME];
 
         WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];
         configuration.userContentController = userContentController;
@@ -52,6 +53,7 @@
         WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:frame configuration:configuration];
 
         wkWebView.UIDelegate = self.uiDelegate;
+
         self.engineWebView = wkWebView;
 
         NSLog(@"Using WKWebView");
@@ -60,6 +62,27 @@
     return self;
 }
 
+- (void)pluginInitialize
+{
+    // viewController would be available now. we attempt to set all possible delegates to it, by default
+
+    WKWebView* wkWebView = (WKWebView*)_engineWebView;
+
+    if ([self.viewController conformsToProtocol:@protocol(WKUIDelegate)]) {
+        wkWebView.UIDelegate = (id <WKUIDelegate>)self.viewController;
+    }
+
+    if ([self.viewController conformsToProtocol:@protocol(WKNavigationDelegate)]) {
+        wkWebView.navigationDelegate = (id <WKNavigationDelegate>)self.viewController;
+    }
+
+    if ([self.viewController conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
+        [wkWebView.configuration.userContentController addScriptMessageHandler:(id < WKScriptMessageHandler >)self.viewController name:@"cordova"];
+    }
+
+    [self updateSettings:self.commandDelegate.settings];
+}
+
 // We implement this here because certain versions of iOS 8 do not implement this
 // in WKWebView, so we need to test for this during runtime.
 // It is speculated that this selector will be available in iOS 8.2 for WKWebView
@@ -70,12 +93,12 @@
 
     // UIKit operations have to be on the main thread. This method does not need to be synchronous
     dispatch_async(dispatch_get_main_queue(), ^{
-            if ([_engineWebView respondsToSelector:wk_sel] && [[url scheme] isEqualToString:@"file"]) {
-                ((id (*)(id, SEL, id, id))objc_msgSend)(_engineWebView, wk_sel, url, readAccessURL);
-            } else {
-                [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
-            }
-        });
+        if ([_engineWebView respondsToSelector:wk_sel] && [[url scheme] isEqualToString:@"file"]) {
+            ((id (*)(id, SEL, id, id))objc_msgSend)(_engineWebView, wk_sel, url, readAccessURL);
+        } else {
+            [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
+        }
+    });
 }
 
 - (void)updateSettings:(NSDictionary*)settings
@@ -136,4 +159,31 @@
     return _engineWebView;
 }
 
+#pragma mark WKScriptMessageHandler implementation
+
+- (void)userContentController:(WKUserContentController*)userContentController didReceiveScriptMessage:(WKScriptMessage*)message
+{
+    if (![message.name isEqualToString:CDV_BRIDGE_NAME]) {
+        return;
+    }
+
+    CDVViewController* vc = (CDVViewController*)self.viewController;
+
+    NSArray* jsonEntry = message.body; // NSString:callbackId, NSString:service, NSString:action, NSArray:args
+    CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
+    CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);
+
+    if (![vc.commandQueue execute:command]) {
+#ifdef DEBUG
+            NSString* commandJson = [jsonEntry JSONString];
+            static NSUInteger maxLogLength = 1024;
+            NSString* commandString = ([commandJson length] > maxLogLength) ?
+                [NSString stringWithFormat : @"%@[...]", [commandJson substringToIndex:maxLogLength]] :
+                commandJson;
+
+            DLog(@"FAILED pluginJSON = %@", commandString);
+#endif
+    }
+}
+
 @end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/af1ec2c4/CordovaLib/Classes/CDVWKWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewUIDelegate.h b/CordovaLib/Classes/CDVWKWebViewUIDelegate.h
index f8971a9..33a179b 100644
--- a/CordovaLib/Classes/CDVWKWebViewUIDelegate.h
+++ b/CordovaLib/Classes/CDVWKWebViewUIDelegate.h
@@ -17,7 +17,6 @@
  under the License.
  */
 
-#import <Foundation/Foundation.h>
 #import <WebKit/WebKit.h>
 
 @interface CDVWKWebViewUIDelegate : NSObject <WKUIDelegate>

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/af1ec2c4/CordovaLib/Classes/CDVWKWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewUIDelegate.m b/CordovaLib/Classes/CDVWKWebViewUIDelegate.m
index e3024b0..c9e5ce9 100644
--- a/CordovaLib/Classes/CDVWKWebViewUIDelegate.m
+++ b/CordovaLib/Classes/CDVWKWebViewUIDelegate.m
@@ -17,110 +17,107 @@
  under the License.
  */
 
-#ifdef __IPHONE_8_0
-
 #import "CDVWKWebViewUIDelegate.h"
 
-    @implementation CDVWKWebViewUIDelegate
-
-    - (instancetype)initWithTitle:(NSString*)title
-    {
-        self = [super init];
-        if (self) {
-            self.title = title;
-        }
+@implementation CDVWKWebViewUIDelegate
 
-        return self;
+- (instancetype)initWithTitle:(NSString*)title
+{
+    self = [super init];
+    if (self) {
+        self.title = title;
     }
 
-    - (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
-        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:message
-                                                                preferredStyle:UIAlertControllerStyleAlert];
+    return self;
+}
+
+- (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
+    initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
+{
+    UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                   message:message
+                                                            preferredStyle:UIAlertControllerStyleAlert];
+
+    UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                 style:UIAlertActionStyleDefault
+                                               handler:^(UIAlertAction* action)
+        {
+            completionHandler();
+            [alert dismissViewControllerAnimated:YES completion:nil];
+        }];
 
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-            {
-                completionHandler();
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
+    [alert addAction:ok];
 
-        [alert addAction:ok];
+    UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
 
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+    [rootController presentViewController:alert animated:YES completion:nil];
+}
 
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
+- (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
+    initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
+{
+    UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                   message:message
+                                                            preferredStyle:UIAlertControllerStyleAlert];
+
+    UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                 style:UIAlertActionStyleDefault
+                                               handler:^(UIAlertAction* action)
+        {
+            completionHandler(YES);
+            [alert dismissViewControllerAnimated:YES completion:nil];
+        }];
 
-    - (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
-        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:message
-                                                                preferredStyle:UIAlertControllerStyleAlert];
+    [alert addAction:ok];
 
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+    UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
                                                      style:UIAlertActionStyleDefault
                                                    handler:^(UIAlertAction* action)
-            {
-                completionHandler(YES);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                                                         style:UIAlertActionStyleDefault
-                                                       handler:^(UIAlertAction* action)
-            {
-                completionHandler(NO);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-        [alert addAction:cancel];
-
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
+        {
+            completionHandler(NO);
+            [alert dismissViewControllerAnimated:YES completion:nil];
+        }];
+    [alert addAction:cancel];
+
+    UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+    [rootController presentViewController:alert animated:YES completion:nil];
+}
+
+- (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
+          defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
+    completionHandler:(void (^)(NSString* result))completionHandler
+{
+    UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                   message:prompt
+                                                            preferredStyle:UIAlertControllerStyleAlert];
+
+    UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                 style:UIAlertActionStyleDefault
+                                               handler:^(UIAlertAction* action)
+        {
+            completionHandler(((UITextField*)alert.textFields[0]).text);
+            [alert dismissViewControllerAnimated:YES completion:nil];
+        }];
 
-    - (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
-              defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
-        completionHandler:(void (^)(NSString* result))completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:prompt
-                                                                preferredStyle:UIAlertControllerStyleAlert];
+    [alert addAction:ok];
 
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+    UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
                                                      style:UIAlertActionStyleDefault
                                                    handler:^(UIAlertAction* action)
-            {
-                completionHandler(((UITextField*)alert.textFields[0]).text);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                                                         style:UIAlertActionStyleDefault
-                                                       handler:^(UIAlertAction* action)
-            {
-                completionHandler(nil);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-        [alert addAction:cancel];
-
-        [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
-            textField.text = defaultText;
+        {
+            completionHandler(nil);
+            [alert dismissViewControllerAnimated:YES completion:nil];
         }];
+    [alert addAction:cancel];
 
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+    [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
+        textField.text = defaultText;
+    }];
 
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
+    UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+    [rootController presentViewController:alert animated:YES completion:nil];
+}
 
-    @end
-#endif /* ifdef __IPHONE_8_0 */
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/af1ec2c4/CordovaLib/Classes/CDVWebViewEngineProtocol.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewEngineProtocol.h b/CordovaLib/Classes/CDVWebViewEngineProtocol.h
index 0c15c63..f560f1d 100644
--- a/CordovaLib/Classes/CDVWebViewEngineProtocol.h
+++ b/CordovaLib/Classes/CDVWebViewEngineProtocol.h
@@ -17,7 +17,6 @@
  under the License.
  */
 
-#import <Foundation/Foundation.h>
 #import <UIKit/UIKit.h>
 
 #define kCDVWebViewEngineScriptMessageHandlers @"kCDVWebViewEngineScriptMessageHandlers"
@@ -26,7 +25,7 @@
 #define kCDVWebViewEngineWKUIDelegate @"kCDVWebViewEngineWKUIDelegate"
 #define kCDVWebViewEngineWebViewPreferences @"kCDVWebViewEngineWebViewPreferences"
 
-@protocol CDVWebViewEngineProtocol
+@protocol CDVWebViewEngineProtocol <NSObject>
 
 @property (nonatomic, strong, readonly) UIView* engineWebView;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[29/43] ios commit: Fixed the failing unit-tests, plus style fix-ups.

Posted by sh...@apache.org.
Fixed the failing unit-tests, plus style fix-ups.

Note that some of these tests, like the User-Agent tests, are specific to UIWebView and are treated as such. The StartPage test should also work for WKWebView, and should be changed to support that as well, although it is not trivial.


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

Branch: refs/heads/4.0.x
Commit: c343e2ec3ab1d1956f28b7c6b052bf7136fb5cc0
Parents: 96fd4cb
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri Nov 7 12:08:08 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Nov 7 12:08:08 2014 -0800

----------------------------------------------------------------------
 tests/CordovaLibTests/CDVStartPageTests.m       | 14 ++++--
 tests/CordovaLibTests/CDVUserAgentTest.m        | 52 +++++++++++++++-----
 tests/CordovaLibTests/CDVWebViewDelegateTests.m | 10 ++--
 tests/CordovaLibTests/CDVWebViewTest.m          |  6 +--
 4 files changed, 58 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/c343e2ec/tests/CordovaLibTests/CDVStartPageTests.m
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CDVStartPageTests.m b/tests/CordovaLibTests/CDVStartPageTests.m
index 5df0057..85cd3da 100644
--- a/tests/CordovaLibTests/CDVStartPageTests.m
+++ b/tests/CordovaLibTests/CDVStartPageTests.m
@@ -80,15 +80,23 @@
 
     self.appDelegate.window.rootViewController = rootVc;
 
+    UIWebView* vc1WebView = (UIWebView*)rootVc.vc1.webView;
+    UIWebView* vc2WebView = (UIWebView*)rootVc.vc2.webView;
+
+    // sanity check
+    if (![vc1WebView isKindOfClass:[UIWebView class]] && ![vc2WebView isKindOfClass:[UIWebView class]]) {
+        return;
+    }
+
     NSString* geHREF = @"window.location.href";
     [self waitForConditionName:@"getting href" block:^{
-        return (BOOL)(rootVc.vc1.webView.request != nil && rootVc.vc1.webView.request != nil);
+        return (BOOL)(vc1WebView.request != nil && vc1WebView.request != nil);
     }];
 
-    NSString* href = [rootVc.vc1.webView stringByEvaluatingJavaScriptFromString:geHREF];
+    NSString* href = [vc1WebView stringByEvaluatingJavaScriptFromString:geHREF];
     XCTAssertTrue([href hasSuffix:@"index.html"], @"href should point to index.html");
 
-    href = [rootVc.vc2.webView stringByEvaluatingJavaScriptFromString:geHREF];
+    href = [vc2WebView stringByEvaluatingJavaScriptFromString:geHREF];
     XCTAssertTrue([href hasSuffix:@"index.html?delta=true"], @"href should point to index.html?delta=true");
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/c343e2ec/tests/CordovaLibTests/CDVUserAgentTest.m
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CDVUserAgentTest.m b/tests/CordovaLibTests/CDVUserAgentTest.m
index 42d238c..f52178a 100644
--- a/tests/CordovaLibTests/CDVUserAgentTest.m
+++ b/tests/CordovaLibTests/CDVUserAgentTest.m
@@ -85,17 +85,26 @@
 - (void)testDefaultUserAgent
 {
     CDVUserAgentTestViewController* rootVc = [[CDVUserAgentTestViewController alloc] init];
-    
+
     self.appDelegate.window.rootViewController = rootVc;
-    
-    
+
+    // These tests only work on a UIWebView, which is the default web engine
+
+    UIWebView* vc1WebView = (UIWebView*)rootVc.vc1.webView;
+    UIWebView* vc2WebView = (UIWebView*)rootVc.vc2.webView;
+
+    // sanity check
+    if (![vc1WebView isKindOfClass:[UIWebView class]] && ![vc2WebView isKindOfClass:[UIWebView class]]) {
+        return;
+    }
+
     NSString* getWebUserAgent = @"navigator.userAgent";
     [self waitForConditionName:@"getting user-agents" block:^BOOL {
-        return (rootVc.vc1.webView.request != nil && rootVc.vc2.webView.request != nil);
+        return vc1WebView.request != nil && vc2WebView.request != nil;
     }];
-    NSString* webUserAgent = [rootVc.vc1.webView stringByEvaluatingJavaScriptFromString:getWebUserAgent];
+    NSString* webUserAgent = [vc1WebView stringByEvaluatingJavaScriptFromString:getWebUserAgent];
     NSString* cordovaUserAgent = rootVc.vc1.userAgent;
-    
+
     XCTAssertTrue([cordovaUserAgent hasPrefix:webUserAgent], @"Default Cordova user agent should be based on navigator.userAgent.");
 }
 
@@ -105,12 +114,20 @@
 
     self.appDelegate.window.rootViewController = rootVc;
 
+    UIWebView* vc1WebView = (UIWebView*)rootVc.vc1.webView;
+    UIWebView* vc2WebView = (UIWebView*)rootVc.vc2.webView;
+
+    // sanity check
+    if (![vc1WebView isKindOfClass:[UIWebView class]] && ![vc2WebView isKindOfClass:[UIWebView class]]) {
+        return;
+    }
+
     NSString* getUserAgentCode = @"navigator.userAgent";
     [self waitForConditionName:@"getting user-agents" block:^BOOL {
-        return (rootVc.vc1.webView.request != nil && rootVc.vc2.webView.request != nil);
+        return vc1WebView.request != nil && vc2WebView.request != nil;
     }];
-    NSString* ua1 = [rootVc.vc1.webView stringByEvaluatingJavaScriptFromString:getUserAgentCode];
-    NSString* ua2 = [rootVc.vc2.webView stringByEvaluatingJavaScriptFromString:getUserAgentCode];
+    NSString* ua1 = [vc1WebView stringByEvaluatingJavaScriptFromString:getUserAgentCode];
+    NSString* ua2 = [vc2WebView stringByEvaluatingJavaScriptFromString:getUserAgentCode];
 
     XCTAssertFalse([ua1 isEqual:ua2], @"User-Agents should be different.");
 }
@@ -118,17 +135,26 @@
 - (void)testBaseUserAgent
 {
     CDVUserAgentTestViewController* rootVc = [[CDVUserAgentTestViewController alloc] init];
+
     rootVc.vc1.baseUserAgent = @"A different baseline user agent 1";
     rootVc.vc2.baseUserAgent = @"A different baseline user agent 2";
-    
+
     self.appDelegate.window.rootViewController = rootVc;
-    
+
+    UIWebView* vc1WebView = (UIWebView*)rootVc.vc1.webView;
+    UIWebView* vc2WebView = (UIWebView*)rootVc.vc2.webView;
+
+    // sanity check
+    if (![vc1WebView isKindOfClass:[UIWebView class]] && ![vc2WebView isKindOfClass:[UIWebView class]]) {
+        return;
+    }
+
     [self waitForConditionName:@"getting user-agents" block:^BOOL {
-        return (rootVc.vc1.webView.request != nil && rootVc.vc2.webView.request != nil);
+        return vc1WebView.request != nil && vc2WebView.request != nil;
     }];
     NSString* cordovaUserAgent1 = rootVc.vc1.userAgent;
     NSString* cordovaUserAgent2 = rootVc.vc2.userAgent;
-    
+
     XCTAssertTrue([cordovaUserAgent1 hasPrefix:rootVc.vc1.baseUserAgent], @"Cordova user agent should be based on base user agent.");
     XCTAssertTrue([cordovaUserAgent2 hasPrefix:rootVc.vc2.baseUserAgent], @"Cordova user agent should be based on base user agent.");
 }

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/c343e2ec/tests/CordovaLibTests/CDVWebViewDelegateTests.m
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CDVWebViewDelegateTests.m b/tests/CordovaLibTests/CDVWebViewDelegateTests.m
index 3413638..5606db6 100644
--- a/tests/CordovaLibTests/CDVWebViewDelegateTests.m
+++ b/tests/CordovaLibTests/CDVWebViewDelegateTests.m
@@ -19,9 +19,9 @@
 
 #import <XCTest/XCTest.h>
 
-#import <Cordova/CDVWebViewDelegate.h>
+#import <Cordova/CDVUIWebViewDelegate.h>
 
-@interface CDVWebViewDelegate2 : CDVWebViewDelegate {}
+@interface CDVWebViewDelegate2 : CDVUIWebViewDelegate {}
 
 - (void)setState:(NSInteger)state;
 - (NSInteger)state;
@@ -42,7 +42,7 @@
 
 @end
 
-@interface CDVWebViewDelegate ()
+@interface CDVUIWebViewDelegate ()
 
 // expose private interface
 - (BOOL)shouldLoadRequest:(NSURLRequest*)request;
@@ -80,7 +80,7 @@
 
 - (void)testShouldLoadRequest
 {
-    CDVWebViewDelegate* wvd = [[CDVWebViewDelegate alloc] initWithDelegate:nil]; // not really testing delegate handling
+    CDVUIWebViewDelegate* wvd = [[CDVUIWebViewDelegate alloc] initWithDelegate:nil]; // not really testing delegate handling
 
     NSURLRequest* mailtoUrl = [NSURLRequest requestWithURL:[NSURL URLWithString:@"mailto:dev@cordova.apache.org"]];
     NSURLRequest* telUrl = [NSURLRequest requestWithURL:[NSURL URLWithString:@"tel:12345"]];
@@ -109,7 +109,7 @@
 
 - (void)doTestFragmentIdentifiersWithBaseUrl:(NSString*)baseUrl fragment:(NSString*)fragment
 {
-    CDVWebViewDelegate* wvd = [[CDVWebViewDelegate alloc] initWithDelegate:nil]; // not really testing delegate handling
+    CDVUIWebViewDelegate* wvd = [[CDVUIWebViewDelegate alloc] initWithDelegate:nil]; // not really testing delegate handling
 
     NSString* originalUrlString = baseUrl;
     NSURL* originalUrl = [NSURL URLWithString:originalUrlString];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/c343e2ec/tests/CordovaLibTests/CDVWebViewTest.m
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CDVWebViewTest.m b/tests/CordovaLibTests/CDVWebViewTest.m
index c395f48..02513c1 100644
--- a/tests/CordovaLibTests/CDVWebViewTest.m
+++ b/tests/CordovaLibTests/CDVWebViewTest.m
@@ -38,7 +38,7 @@
     // first exception makes it much easier to identify the source of the error.
     // On iOS < 5 there is a bug in SenTestingKit where the exception is
     // uncaught and the app crashes upon a failed STAssert (oh well).
-    //[self raiseAfterFailure];
+    // [self raiseAfterFailure];
 }
 
 - (void)tearDown
@@ -71,7 +71,7 @@
 
 - (UIWebView*)webView
 {
-    return self.viewController.webView;
+    return (UIWebView*)self.viewController.webView;
 }
 
 - (id)pluginInstance:(NSString*)pluginName
@@ -110,7 +110,7 @@
 - (void)waitForPageLoad
 {
     [self waitForConditionName:@"PageLoad" block:^{
-        return [@"true" isEqualToString :[self evalJs:@"window.pageIsLoaded"]];
+        return [@"true" isEqualToString:[self evalJs:@"window.pageIsLoaded"]];
     }];
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[07/43] ios commit: Merge branch 'master' into wkwebview

Posted by sh...@apache.org.
Merge branch 'master' into wkwebview

Conflicts:
	CordovaLib/Classes/CDVPlugin.h
	CordovaLib/CordovaLib.xcodeproj/project.pbxproj
	bin/templates/project/__CLI__.xcodeproj/project.pbxproj
	bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj


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

Branch: refs/heads/4.0.x
Commit: 1e84e301b098385a9b67a620c589c55b515db771
Parents: 3d39ef4 bab65b9
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 21 22:25:20 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Jul 21 22:25:20 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVPlugin.h                  |  7 +--
 CordovaLib/Classes/CDVPluginResult.h            |  9 ++-
 CordovaLib/Classes/CDVShared.h                  | 15 +----
 CordovaLib/Classes/CDVShared.m                  | 59 --------------------
 CordovaLib/Classes/CDVURLProtocol.m             |  4 +-
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |  4 --
 .../project/__CLI__.xcodeproj/project.pbxproj   |  5 --
 .../__NON-CLI__.xcodeproj/project.pbxproj       |  5 --
 .../Classes/MainViewController.m                |  2 +-
 hooks/pre-commit                                |  2 +
 10 files changed, 16 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1e84e301/CordovaLib/Classes/CDVPlugin.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1e84e301/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --cc CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 844db7b,6e67777..141fee8
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@@ -382,8 -356,6 +379,7 @@@
  				EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */,
  				EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */,
  				7E14B5A91705050A0032169E /* CDVTimer.m in Sources */,
- 				1B701029177A61CF00AE11F4 /* CDVShared.m in Sources */,
 +				302D72FC19554BFC0028C99F /* CDVWebViewOperationsDelegate.m in Sources */,
  			);
  			runOnlyForDeploymentPostprocessing = 0;
  		};

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1e84e301/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1e84e301/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[13/43] ios commit: CB-7182 - Running mobile-spec in an iOS 8 project but using UIWebView results in an exception

Posted by sh...@apache.org.
CB-7182 - Running mobile-spec in an iOS 8 project but using UIWebView results in an exception


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

Branch: refs/heads/4.0.x
Commit: 686ef8a3a8c6c5cc1d025d9a5010dd28e6380206
Parents: 4c0556b
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 21 14:02:43 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 15:37:43 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVCommandQueue.m | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/686ef8a3/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index b4f1fa6..bb2788b 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -109,25 +109,19 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame.
 
 - (void)fetchCommandsFromJs
 {
+    __weak CDVCommandQueue* weakSelf = self;
     NSString* js = @"cordova.require('cordova/exec').nativeFetchMessages()";
-    SEL ui_selector = NSSelectorFromString(@"stringByEvaluatingJavaScriptFromString:");
 
-    // Grab all the queued commands from the JS side.
-    NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:
-        [[_viewController.webView class] instanceMethodSignatureForSelector:ui_selector]];
-
-    [invocation setSelector:ui_selector];
-    [invocation setTarget:_viewController.webView];
-    // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation
-    [invocation setArgument:&(js) atIndex:2];
-
-    [invocation invoke];
-
-    NSString* queuedCommandsJSON;
-    [invocation getReturnValue:&(queuedCommandsJSON)];
-
-    CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
-    [self enqueueCommandBatch:queuedCommandsJSON];
+    [_viewController.webViewOperationsDelegate evaluateJavaScript:js
+                                                completionHandler:^(id obj, NSError* error) {
+        if ((error == nil) && [obj isKindOfClass:[NSString class]]) {
+            NSString* queuedCommandsJSON = (NSString*)obj;
+            CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
+            [weakSelf enqueueCommandBatch:queuedCommandsJSON];
+            // this has to be called here now, because fetchCommandsFromJs is now async (previously: synchronous)
+            [self executePending];
+        }
+    }];
 }
 
 - (void)executePending


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[17/43] ios commit: WKWebView - squashed commit.

Posted by sh...@apache.org.
WKWebView - squashed commit.

commit da7a3546f809c331cf230af180b3e6f1fb99cb2b
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jul 10 17:48:15 2014 -0700

    Support alert/confirm/prompt in WKWebView

commit 63552fd3f2548f407aec1bbfda997809d1f2a89d
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jul 10 14:52:44 2014 -0700

    Support config.xml preferences for WKWebView, and style fixups

commit e67e6bf2577c776c887453801af05f973fb90094
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jul 9 18:44:03 2014 -0700

    Use weakSelf in block

commit fc83f068388f3402935819f7891906ffa9029cc1
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jul 9 18:38:30 2014 -0700

    Support config.xml preferences for WKWebView

commit 4eeaf0c8730a30b8709d0d98aba4b2996e34d9f4
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jul 9 18:27:51 2014 -0700

    Break out config.xml preferences for UIWebView (related to WKWebView prefs support)

commit 9ba496297116f20a4ea0d7b83a9f142ceec2bc84
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jul 9 17:51:11 2014 -0700

    Re-add pragma message for iOS 8

commit 2e17db94a87da80a7d50f202eef40178c0a688c0
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jul 9 17:46:00 2014 -0700

    Removed unused WKWebView+Private header

commit 601eea1c8784e1acf00b0a39ca4a3ea5085b2098
Author: Shazron Abdullah <sh...@apache.org>
Date:   Mon Jul 7 15:59:30 2014 -0700

    Removed WKWebView+Private category since the functions it covers are already now in iOS 8 beta 3

commit 69c86d641c8a14e23843566ff2024ce77238fd79
Author: Shazron Abdullah <sh...@apache.org>
Date:   Mon Jun 23 11:59:51 2014 -0700

    Changed @import WebKit back to the old #import (for supporting older IPHONE_OS_DEPLOYMENT_TARGET reasons, bug in Xcode), add #pragma message to add WebKit.framework for iOS 8

commit c133640d264eba5456b3ffd2d3be83e3fd90bf42
Author: Shazron Abdullah <sh...@gmail.com>
Date:   Sat Jun 21 22:14:26 2014 -0700

    Removed WebKit.framework from templates.

commit b4832d132e6628a7ae0ef681eab54554ed913b77
Author: Shazron Abdullah <sh...@gmail.com>
Date:   Sat Jun 21 21:45:10 2014 -0700

    Using @import instead of #import for WebKit, which doesn't require us to list the framework in the project explicitly.
    This gives us a true Xcode 5 / 6 compile solution. HOWEVER there is a bug in Xcode (was there since 5) where if you do an @import for a framework, it won't link if your Deployment Target OS version does not also include the framework itself, when compiling for the Simulator. For example, if you @import WebKit, and build for the Simulator, your Deployment Target MUST be iOS 8.

    The workaround is, this bug does not appear if you build for a device. To make it work for the Simulator, you will have to explicitly add the framework in Build Phases -> Link Binary with Libraries.

commit df3d8391546b2bb6da659ca2102609beb7038f7d
Author: Shazron Abdullah <sh...@gmail.com>
Date:   Sat Jun 21 00:20:36 2014 -0700

    Unified the implementations to switch to WKWebView when available and fall back to UIWebView. The implementation even compiles under Xcode 5.1 -- however, the linker will complain under Xcode 5.1 that WebKit.framework is not available. Just remove the framework in "Link Binary With Libraries" Build Phase and it should run.

commit 52e27adcd4227621d329fea4743be73bfcb7f4bf
Author: Shazron Abdullah <sh...@apache.org>
Date:   Fri Jun 20 16:59:48 2014 -0700

    Re-add deprecated CDVPlugin functions

commit e16e914c3ba2f30324f25da27fbbc0efa9cde727
Merge: f3af6f2 2e1b00c
Author: Shazron Abdullah <sh...@apache.org>
Date:   Fri Jun 20 16:51:54 2014 -0700

    Merge branch 'wkwebview-only' of github.com:shazron/cordova-ios into wkwebview-only

    Conflicts:
    	CordovaLib/Classes/CDVPlugin.h

commit f3af6f2636dad50412da329ce7c21dfaf3717254
Author: Shazron Abdullah <sh...@apache.org>
Date:   Fri Jun 20 16:22:08 2014 -0700

    Changed webView property of CDVPlugin to UIView.

    Plugins need to coerce this into a UIWebView or WKWebView.

commit c33497742cfe9c7f0e2c7c8902b56cf6fba09ad9
Author: Shazron Abdullah <sh...@gmail.com>
Date:   Thu Jun 19 21:39:07 2014 -0700

    Fixed native commands not being called when called in a exec callback

commit b155b5d9e120a1b7ec2d4a8c3950073792281df5
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 16:22:04 2014 -0700

    Added new cordova.js to support WKWebView Cordova bridge

commit 6a96341da8d0f455ed9f977e6329af6d98c357fe
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 16:08:30 2014 -0700

    Implemented the WKWebView Cordova bridge.

commit 6eb29c716b8308a7f4824a313a232c7c16f421b8
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 13:42:49 2014 -0700

    Moved WKScriptMessageHandler to CDVCommandDelegateImpl

commit 374763daf13f73df872a64caa83a7371a0c58542
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:51:51 2014 -0700

    Updated templates for WebKit.framework use

commit be7fd66f708587bee48b9dbbc7c0b57b03002eb2
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:50:28 2014 -0700

    Updated AppDelegate.m to use WKWebView evaluateJavascript (private)

commit 05b5c5912e339d29623de75127c2f162e0c875ed
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:49:54 2014 -0700

    Added WKWebView support (not unified, stripped out UIWebView use)

commit a6ebfb01a7dbad504928b871783f75bbc95e0d85
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:49:00 2014 -0700

    Added WKWebView private functions.

commit 2e1b00cbb92164114db2f30df10b7f0ec918c9bc
Author: Shazron Abdullah <sh...@apache.org>
Date:   Fri Jun 20 16:22:08 2014 -0700

    Changed webView property of CDVPlugin to UIView.

    Plugins need to coerce this into a UIWebView or WKWebView.

commit 867647075c837c3782333eb6b4c865cb70451aa3
Author: Shazron Abdullah <sh...@gmail.com>
Date:   Thu Jun 19 21:39:07 2014 -0700

    Fixed native commands not being called when called in a exec callback

commit ad3ec2937633995309b77bc663ee22e0b07ac667
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 16:22:04 2014 -0700

    Added new cordova.js to support WKWebView Cordova bridge

commit ede3ad5cef804c67e777c0f2c750712df50883f5
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 16:08:30 2014 -0700

    Implemented the WKWebView Cordova bridge.

commit c1c39086ab220fcdc5a796b27d38a5d32f7f5f37
Author: Shazron Abdullah <sh...@apache.org>
Date:   Thu Jun 19 13:42:49 2014 -0700

    Moved WKScriptMessageHandler to CDVCommandDelegateImpl

commit 5d2b137645e5fffb460c8e84d16dc8f5d104d085
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:51:51 2014 -0700

    Updated templates for WebKit.framework use

commit 63bf9a7ca03f92f263a3a3d7226512aee784a171
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:50:28 2014 -0700

    Updated AppDelegate.m to use WKWebView evaluateJavascript (private)

commit 23c05db85e57f82a4c6fe03fc5faf49abaf947b8
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:49:54 2014 -0700

    Added WKWebView support (not unified, stripped out UIWebView use)

commit 74a0f4e678e4349849596f23f7f0714aaa574532
Author: Shazron Abdullah <sh...@apache.org>
Date:   Wed Jun 18 17:49:00 2014 -0700

    Added WKWebView private functions.


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

Branch: refs/heads/4.0.x
Commit: 1a759ac7fd7fa24aa658f868dbf413ef8ca34396
Parents: 5769d58
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 14 12:03:19 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 15:37:43 2014 -0700

----------------------------------------------------------------------
 CordovaLib/CDVWebViewUIDelegate.h               |  35 +++
 CordovaLib/CDVWebViewUIDelegate.m               | 126 +++++++++
 CordovaLib/Classes/CDV.h                        |   2 +
 CordovaLib/Classes/CDVCommandDelegateImpl.h     |   6 +-
 CordovaLib/Classes/CDVCommandDelegateImpl.m     |  37 +--
 CordovaLib/Classes/CDVCommandQueue.m            |  17 +-
 CordovaLib/Classes/CDVPlugin.h                  |   7 +-
 CordovaLib/Classes/CDVPlugin.m                  |   9 +-
 CordovaLib/Classes/CDVViewController.h          |  18 +-
 CordovaLib/Classes/CDVViewController.m          | 250 ++++++------------
 .../Classes/CDVWebViewOperationsDelegate.h      |  39 +++
 .../Classes/CDVWebViewOperationsDelegate.m      |  83 ++++++
 CordovaLib/Classes/CDVWebViewPreferences.h      |  32 +++
 CordovaLib/Classes/CDVWebViewPreferences.m      | 261 +++++++++++++++++++
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |  26 ++
 CordovaLib/cordova.js                           |   8 +-
 .../project/__CLI__.xcodeproj/project.pbxproj   |   6 +
 .../__NON-CLI__.xcodeproj/project.pbxproj       |   6 +
 .../project/__PROJECT_NAME__/config.xml         |   1 +
 tests/CordovaLibTests/CordovaLibApp/config.xml  |   1 +
 20 files changed, 767 insertions(+), 203 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/CDVWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/CDVWebViewUIDelegate.h b/CordovaLib/CDVWebViewUIDelegate.h
new file mode 100644
index 0000000..9ff2ac1
--- /dev/null
+++ b/CordovaLib/CDVWebViewUIDelegate.h
@@ -0,0 +1,35 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+
+#ifdef __IPHONE_8_0
+    #import <WebKit/WebKit.h>
+#endif
+
+@interface CDVWebViewUIDelegate : NSObject
+#ifdef __IPHONE_8_0
+                                      <WKUIDelegate>
+#endif
+
+@property (nonatomic, copy) NSString* title;
+
+- (instancetype)initWithTitle:(NSString*)title;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/CDVWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CDVWebViewUIDelegate.m b/CordovaLib/CDVWebViewUIDelegate.m
new file mode 100644
index 0000000..6f98327
--- /dev/null
+++ b/CordovaLib/CDVWebViewUIDelegate.m
@@ -0,0 +1,126 @@
+/*
+ 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.
+ */
+
+#ifdef __IPHONE_8_0
+
+#import "CDVWebViewUIDelegate.h"
+
+    @implementation CDVWebViewUIDelegate
+
+    - (instancetype)initWithTitle:(NSString*)title
+    {
+        self = [super init];
+        if (self) {
+            self.title = title;
+        }
+
+        return self;
+    }
+
+    - (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
+        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:message
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler();
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    - (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
+        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:message
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler(YES);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                                                         style:UIAlertActionStyleDefault
+                                                       handler:^(UIAlertAction* action)
+            {
+                completionHandler(NO);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+        [alert addAction:cancel];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    - (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
+              defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
+        completionHandler:(void (^)(NSString* result))completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:prompt
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler(((UITextField*)alert.textFields[0]).text);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                                                         style:UIAlertActionStyleDefault
+                                                       handler:^(UIAlertAction* action)
+            {
+                completionHandler(nil);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+        [alert addAction:cancel];
+
+        [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
+            textField.text = defaultText;
+        }];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    @end
+#endif /* ifdef __IPHONE_8_0 */

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index 6cf592a..d368961 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -31,6 +31,8 @@
 #import "CDVLocalStorage.h"
 #import "CDVScreenOrientationDelegate.h"
 #import "CDVTimer.h"
+#import "CDVWebViewPreferences.h"
+#import "CDVWebViewOperationsDelegate.h"
 
 #import "NSArray+Comparisons.h"
 #import "NSData+Base64.h"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVCommandDelegateImpl.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandDelegateImpl.h b/CordovaLib/Classes/CDVCommandDelegateImpl.h
index 0531134..4a74d55 100644
--- a/CordovaLib/Classes/CDVCommandDelegateImpl.h
+++ b/CordovaLib/Classes/CDVCommandDelegateImpl.h
@@ -6,9 +6,9 @@
  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
@@ -24,7 +24,7 @@
 @class CDVCommandQueue;
 
 @interface CDVCommandDelegateImpl : NSObject <CDVCommandDelegate>{
-    @private
+@private
     __weak CDVViewController* _viewController;
     NSRegularExpression* _callbackIdPattern;
     @protected

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandDelegateImpl.m b/CordovaLib/Classes/CDVCommandDelegateImpl.m
index fc3346d..02e3064 100644
--- a/CordovaLib/Classes/CDVCommandDelegateImpl.m
+++ b/CordovaLib/Classes/CDVCommandDelegateImpl.m
@@ -6,9 +6,9 @@
  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
@@ -48,16 +48,16 @@
     NSBundle* mainBundle = [NSBundle mainBundle];
     NSMutableArray* directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]];
     NSString* filename = [directoryParts lastObject];
-
+    
     [directoryParts removeLastObject];
-
+    
     NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"];
     NSString* directoryStr = _viewController.wwwFolderName;
-
+    
     if ([directoryPartsJoined length] > 0) {
         directoryStr = [NSString stringWithFormat:@"%@/%@", _viewController.wwwFolderName, [directoryParts componentsJoinedByString:@"/"]];
     }
-
+    
     return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr];
 }
 
@@ -71,13 +71,18 @@
 - (void)evalJsHelper2:(NSString*)js
 {
     CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
-    NSString* commandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:js];
-    if ([commandsJSON length] > 0) {
-        CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
-    }
-
-    [_commandQueue enqueueCommandBatch:commandsJSON];
-    [_commandQueue executePending];
+    [_viewController.webViewOperationsDelegate evaluateJavaScript:js completionHandler:^(id obj, NSError* error) {
+        // TODO: obj can be something other than string
+        if ([obj isKindOfClass:[NSString class]]) {
+            NSString* commandsJSON = (NSString*)obj;
+            if ([commandsJSON length] > 0) {
+                CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
+            }
+            
+            [_commandQueue enqueueCommandBatch:commandsJSON];
+            [_commandQueue executePending];
+        }
+    }];
 }
 
 - (void)evalJsHelper:(NSString*)js
@@ -131,9 +136,9 @@
     int status = [result.status intValue];
     BOOL keepCallback = [result.keepCallback boolValue];
     NSString* argumentsAsJSON = [result argumentsAsJSON];
-
+    
     NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)", callbackId, status, argumentsAsJSON, keepCallback];
-
+    
     [self evalJsHelper:js];
 }
 
@@ -170,7 +175,7 @@
 - (BOOL)URLIsWhitelisted:(NSURL*)url
 {
     return ![_viewController.whitelist schemeIsAllowed:[url scheme]] ||
-           [_viewController.whitelist URLIsAllowed:url logFailure:NO];
+    [_viewController.whitelist URLIsAllowed:url logFailure:NO];
 }
 
 - (NSDictionary*)settings

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index 1eddfe3..b4f1fa6 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -109,9 +109,22 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame.
 
 - (void)fetchCommandsFromJs
 {
+    NSString* js = @"cordova.require('cordova/exec').nativeFetchMessages()";
+    SEL ui_selector = NSSelectorFromString(@"stringByEvaluatingJavaScriptFromString:");
+
     // Grab all the queued commands from the JS side.
-    NSString* queuedCommandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:
-        @"cordova.require('cordova/exec').nativeFetchMessages()"];
+    NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:
+        [[_viewController.webView class] instanceMethodSignatureForSelector:ui_selector]];
+
+    [invocation setSelector:ui_selector];
+    [invocation setTarget:_viewController.webView];
+    // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation
+    [invocation setArgument:&(js) atIndex:2];
+
+    [invocation invoke];
+
+    NSString* queuedCommandsJSON;
+    [invocation getReturnValue:&(queuedCommandsJSON)];
 
     CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
     [self enqueueCommandBatch:queuedCommandsJSON];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVPlugin.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPlugin.h b/CordovaLib/Classes/CDVPlugin.h
index 5e8b283..35d4cc2 100644
--- a/CordovaLib/Classes/CDVPlugin.h
+++ b/CordovaLib/Classes/CDVPlugin.h
@@ -22,6 +22,9 @@
 #import "CDVPluginResult.h"
 #import "NSMutableArray+QueueAdditions.h"
 #import "CDVCommandDelegate.h"
+#ifdef __IPHONE_8_0
+    #import <WebKit/WebKit.h>
+#endif
 
 extern NSString* const CDVPageDidLoadNotification;
 extern NSString* const CDVPluginHandleOpenURLNotification;
@@ -32,13 +35,13 @@ extern NSString* const CDVRemoteNotificationError;
 
 @interface CDVPlugin : NSObject {}
 
-@property (nonatomic, weak) UIWebView* webView;
+@property (nonatomic, weak) UIView* webView;
 @property (nonatomic, weak) UIViewController* viewController;
 @property (nonatomic, weak) id <CDVCommandDelegate> commandDelegate;
 
 @property (readonly, assign) BOOL hasPendingOperation;
 
-- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView;
+- (instancetype)initWithWebView:(UIView*)theWebView;
 - (void)pluginInitialize;
 
 - (void)handleOpenURL:(NSNotification*)notification;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVPlugin.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPlugin.m b/CordovaLib/Classes/CDVPlugin.m
index ea81ddd..5f90311 100644
--- a/CordovaLib/Classes/CDVPlugin.m
+++ b/CordovaLib/Classes/CDVPlugin.m
@@ -18,6 +18,7 @@
  */
 
 #import "CDVPlugin.h"
+#import "CDVViewController.h"
 
 NSString* const CDVPageDidLoadNotification = @"CDVPageDidLoadNotification";
 NSString* const CDVPluginHandleOpenURLNotification = @"CDVPluginHandleOpenURLNotification";
@@ -36,12 +37,12 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
 @synthesize webView, viewController, commandDelegate, hasPendingOperation;
 
 // Do not override these methods. Use pluginInitialize instead.
-- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings
+- (instancetype)initWithWebView:(UIView*)theWebView settings:(NSDictionary*)classSettings
 {
     return [self initWithWebView:theWebView];
 }
 
-- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView
+- (instancetype)initWithWebView:(UIView*)theWebView
 {
     self = [super init];
     if (self) {
@@ -130,7 +131,9 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
 
 - (NSString*)writeJavascript:(NSString*)javascript
 {
-    return [self.webView stringByEvaluatingJavaScriptFromString:javascript];
+    // TODO: although deprecated, should have some solution here instead of removing it
+    [((CDVViewController*)self.viewController).webViewOperationsDelegate evaluateJavaScript : javascript completionHandler : nil]; // bad cast, but ok for now
+    return @"";
 }
 
 - (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index 51863a5..7bc005a 100644
--- a/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/Classes/CDVViewController.h
@@ -26,8 +26,19 @@
 #import "CDVWhitelist.h"
 #import "CDVScreenOrientationDelegate.h"
 #import "CDVPlugin.h"
+#import "CDVWebViewOperationsDelegate.h"
+#ifdef __IPHONE_8_0
+    #import <WebKit/WebKit.h>
+#else
+    @protocol WKScriptMessageHandler
+    @end
+#endif
 
-@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
+@protocol WKScriptMessageHandler;
+
+@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate, WKScriptMessageHandler>{
+    @protected
+    CDVWebViewOperationsDelegate* _webViewOperationsDelegate;
     @protected
     id <CDVCommandDelegate> _commandDelegate;
     @protected
@@ -35,7 +46,7 @@
     NSString* _userAgent;
 }
 
-@property (nonatomic, strong) IBOutlet UIWebView* webView;
+@property (nonatomic, strong) IBOutlet UIView* webView;
 
 @property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects;
 @property (nonatomic, readonly, strong) NSDictionary* pluginsMap;
@@ -47,6 +58,7 @@
 @property (nonatomic, readwrite, copy) NSString* wwwFolderName;
 @property (nonatomic, readwrite, copy) NSString* startPage;
 @property (nonatomic, readonly, strong) CDVCommandQueue* commandQueue;
+@property (nonatomic, readonly, strong) CDVWebViewOperationsDelegate* webViewOperationsDelegate;
 @property (nonatomic, readonly, strong) id <CDVCommandDelegate> commandDelegate;
 
 /**
@@ -66,7 +78,7 @@
 
 - (void)printMultitaskingInfo;
 - (void)createGapView;
-- (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds;
+- (UIView*)newCordovaViewWithFrame:(CGRect)bounds;
 
 - (void)javascriptAlert:(NSString*)text;
 - (NSString*)appURLScheme;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index eb056ce..6730239 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -23,6 +23,7 @@
 #import "CDVConfigParser.h"
 #import "CDVUserAgentUtil.h"
 #import "CDVWebViewDelegate.h"
+#import "CDVWebViewUIDelegate.h"
 #import <AVFoundation/AVFoundation.h>
 
 #define degreesToRadian(x) (M_PI * (x) / 180.0)
@@ -30,6 +31,7 @@
 @interface CDVViewController () {
     NSInteger _userAgentLockToken;
     CDVWebViewDelegate* _webViewDelegate;
+    CDVWebViewUIDelegate* _webViewUIDelegate;
 }
 
 @property (nonatomic, readwrite, strong) NSXMLParser* configParser;
@@ -55,6 +57,7 @@
 @synthesize wwwFolderName, startPage, initialized, openURL, baseUserAgent;
 @synthesize commandDelegate = _commandDelegate;
 @synthesize commandQueue = _commandQueue;
+@synthesize webViewOperationsDelegate = _webViewOperationsDelegate;
 
 - (void)__init
 {
@@ -279,22 +282,15 @@
 
     // Configure WebView
     _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self];
-    self.webView.delegate = _webViewDelegate;
+    if ([webView respondsToSelector:@selector(setDelegate:)]) {
+        [webView setValue:_webViewDelegate forKey:@"delegate"];
+    }
 
     // register this viewcontroller with the NSURLProtocol, only after the User-Agent is set
     [CDVURLProtocol registerViewController:self];
 
     // /////////////////
 
-    NSString* enableViewportScale = [self settingForKey:@"EnableViewportScale"];
-    NSNumber* allowInlineMediaPlayback = [self settingForKey:@"AllowInlineMediaPlayback"];
-    BOOL mediaPlaybackRequiresUserAction = YES;  // default value
-    if ([self settingForKey:@"MediaPlaybackRequiresUserAction"]) {
-        mediaPlaybackRequiresUserAction = [(NSNumber*)[self settingForKey:@"MediaPlaybackRequiresUserAction"] boolValue];
-    }
-
-    self.webView.scalesPageToFit = [enableViewportScale boolValue];
-
     /*
      * Fire up CDVLocalStorage to work-around WebKit storage limitations: on all iOS 5.1+ versions for local-only backups, but only needed on iOS 5.1 for cloud backup.
      */
@@ -303,150 +299,8 @@
         [self registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])];
     }
 
-    /*
-     * This is for iOS 4.x, where you can allow inline <video> and <audio>, and also autoplay them
-     */
-    if ([allowInlineMediaPlayback boolValue] && [self.webView respondsToSelector:@selector(allowsInlineMediaPlayback)]) {
-        self.webView.allowsInlineMediaPlayback = YES;
-    }
-    if ((mediaPlaybackRequiresUserAction == NO) && [self.webView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)]) {
-        self.webView.mediaPlaybackRequiresUserAction = NO;
-    }
-
-    // By default, overscroll bouncing is allowed.
-    // UIWebViewBounce has been renamed to DisallowOverscroll, but both are checked.
-    BOOL bounceAllowed = YES;
-    NSNumber* disallowOverscroll = [self settingForKey:@"DisallowOverscroll"];
-    if (disallowOverscroll == nil) {
-        NSNumber* bouncePreference = [self settingForKey:@"UIWebViewBounce"];
-        bounceAllowed = (bouncePreference == nil || [bouncePreference boolValue]);
-    } else {
-        bounceAllowed = ![disallowOverscroll boolValue];
-    }
-
-    // prevent webView from bouncing
-    // based on the DisallowOverscroll/UIWebViewBounce key in config.xml
-    if (!bounceAllowed) {
-        if ([self.webView respondsToSelector:@selector(scrollView)]) {
-            ((UIScrollView*)[self.webView scrollView]).bounces = NO;
-        } else {
-            for (id subview in self.webView.subviews) {
-                if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
-                    ((UIScrollView*)subview).bounces = NO;
-                }
-            }
-        }
-    }
-
-    NSString* decelerationSetting = [self settingForKey:@"UIWebViewDecelerationSpeed"];
-    if (![@"fast" isEqualToString:decelerationSetting]) {
-        [self.webView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
-    }
-
-    /*
-     * iOS 6.0 UIWebView properties
-     */
-    if (IsAtLeastiOSVersion(@"6.0")) {
-        BOOL keyboardDisplayRequiresUserAction = YES; // KeyboardDisplayRequiresUserAction - defaults to YES
-        if ([self settingForKey:@"KeyboardDisplayRequiresUserAction"] != nil) {
-            if ([self settingForKey:@"KeyboardDisplayRequiresUserAction"]) {
-                keyboardDisplayRequiresUserAction = [(NSNumber*)[self settingForKey:@"KeyboardDisplayRequiresUserAction"] boolValue];
-            }
-        }
-
-        // property check for compiling under iOS < 6
-        if ([self.webView respondsToSelector:@selector(setKeyboardDisplayRequiresUserAction:)]) {
-            [self.webView setValue:[NSNumber numberWithBool:keyboardDisplayRequiresUserAction] forKey:@"keyboardDisplayRequiresUserAction"];
-        }
-
-        BOOL suppressesIncrementalRendering = NO; // SuppressesIncrementalRendering - defaults to NO
-        if ([self settingForKey:@"SuppressesIncrementalRendering"] != nil) {
-            if ([self settingForKey:@"SuppressesIncrementalRendering"]) {
-                suppressesIncrementalRendering = [(NSNumber*)[self settingForKey:@"SuppressesIncrementalRendering"] boolValue];
-            }
-        }
-
-        // property check for compiling under iOS < 6
-        if ([self.webView respondsToSelector:@selector(setSuppressesIncrementalRendering:)]) {
-            [self.webView setValue:[NSNumber numberWithBool:suppressesIncrementalRendering] forKey:@"suppressesIncrementalRendering"];
-        }
-    }
-
-    /*
-     * iOS 7.0 UIWebView properties
-     */
-    if (IsAtLeastiOSVersion(@"7.0")) {
-        SEL ios7sel = nil;
-        id prefObj = nil;
-
-        CGFloat gapBetweenPages = 0.0; // default
-        prefObj = [self settingForKey:@"GapBetweenPages"];
-        if (prefObj != nil) {
-            gapBetweenPages = [prefObj floatValue];
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setGapBetweenPages:");
-        if ([self.webView respondsToSelector:ios7sel]) {
-            [self.webView setValue:[NSNumber numberWithFloat:gapBetweenPages] forKey:@"gapBetweenPages"];
-        }
-
-        CGFloat pageLength = 0.0; // default
-        prefObj = [self settingForKey:@"PageLength"];
-        if (prefObj != nil) {
-            pageLength = [[self settingForKey:@"PageLength"] floatValue];
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setPageLength:");
-        if ([self.webView respondsToSelector:ios7sel]) {
-            [self.webView setValue:[NSNumber numberWithBool:pageLength] forKey:@"pageLength"];
-        }
-
-        NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage
-        prefObj = [self settingForKey:@"PaginationBreakingMode"];
-        if (prefObj != nil) {
-            NSArray* validValues = @[@"page", @"column"];
-            NSString* prefValue = [validValues objectAtIndex:0];
-
-            if ([prefObj isKindOfClass:[NSString class]]) {
-                prefValue = prefObj;
-            }
-
-            paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]];
-            if (paginationBreakingMode == NSNotFound) {
-                paginationBreakingMode = 0;
-            }
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setPaginationBreakingMode:");
-        if ([self.webView respondsToSelector:ios7sel]) {
-            [self.webView setValue:[NSNumber numberWithInteger:paginationBreakingMode] forKey:@"paginationBreakingMode"];
-        }
-
-        NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated
-        prefObj = [self settingForKey:@"PaginationMode"];
-        if (prefObj != nil) {
-            NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"];
-            NSString* prefValue = [validValues objectAtIndex:0];
-
-            if ([prefObj isKindOfClass:[NSString class]]) {
-                prefValue = prefObj;
-            }
-
-            paginationMode = [validValues indexOfObject:[prefValue lowercaseString]];
-            if (paginationMode == NSNotFound) {
-                paginationMode = 0;
-            }
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setPaginationMode:");
-        if ([self.webView respondsToSelector:ios7sel]) {
-            [self.webView setValue:[NSNumber numberWithInteger:paginationMode] forKey:@"paginationMode"];
-        }
-    }
+    CDVWebViewPreferences* prefs = [[CDVWebViewPreferences alloc] initWithWebView:webView];
+    [prefs updateSettings:self.settings];
 
     if ([self.startupPluginNames count] > 0) {
         [CDVTimer start:@"TotalPluginStartup"];
@@ -468,7 +322,7 @@
         [CDVUserAgentUtil setUserAgent:self.userAgent lockToken:lockToken];
         if (appURL) {
             NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
-            [self.webView loadRequest:appReq];
+            [_webViewOperationsDelegate loadRequest:appReq];
         } else {
             NSString* loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.", self.wwwFolderName, self.startPage];
             NSLog(@"%@", loadErr);
@@ -479,8 +333,8 @@
                 NSLog(@"%@", [errorUrl absoluteString]);
                 [self.webView loadRequest:[NSURLRequest requestWithURL:errorUrl]];
             } else {
-                NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr];
-                [self.webView loadHTMLString:html baseURL:nil];
+            NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr];
+            [_webViewOperationsDelegate loadHTMLString:html baseURL:nil];
             }
         }
     }];
@@ -545,20 +399,22 @@
     }
 }
 
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+- (void)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation completionHandler:(void (^)(BOOL))completionHandler
 {
     // First, ask the webview via JS if it supports the new orientation
     NSString* jsCall = [NSString stringWithFormat:
         @"window.shouldRotateToOrientation && window.shouldRotateToOrientation(%ld);"
         , (long)[self mapIosOrientationToJsOrientation:interfaceOrientation]];
-    NSString* res = [webView stringByEvaluatingJavaScriptFromString:jsCall];
+    __weak CDVViewController* weakSelf = self;
 
-    if ([res length] > 0) {
-        return [res boolValue];
-    }
-
-    // if js did not handle the new orientation (no return value), use values from the plist (via supportedOrientations)
-    return [self supportsOrientation:interfaceOrientation];
+    [_webViewOperationsDelegate evaluateJavaScript:jsCall completionHandler:^(NSString* obj, NSError* error) {
+        if ([obj length] > 0) {
+            completionHandler([obj boolValue]);
+        } else {
+            // if js did not handle the new orientation (no return value), use values from the plist (via supportedOrientations)
+            completionHandler([weakSelf supportsOrientation:interfaceOrientation]);
+        }
+    }];
 }
 
 - (BOOL)shouldAutorotate
@@ -591,9 +447,37 @@
     return [self.supportedOrientations containsObject:[NSNumber numberWithInt:orientation]];
 }
 
-- (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds
+- (UIView*)newCordovaViewWithFrame:(CGRect)bounds
 {
-    return [[UIWebView alloc] initWithFrame:bounds];
+    UIView* cordovaView = nil;
+    BOOL useWKWebView = NO;  // default value
+
+    if ([self settingForKey:@"UseWKWebView"]) {
+        useWKWebView = [(NSNumber*)[self settingForKey:@"UseWKWebView"] boolValue];
+    }
+
+    if (NSClassFromString(@"WKWebView") && useWKWebView) {
+#ifdef __IPHONE_8_0
+            WKUserContentController* userContentController = [[WKUserContentController alloc] init];
+
+            // scriptMessageHandler is the object that conforms to the WKScriptMessageHandler protocol
+            // see https://developer.apple.com/library/prerelease/ios/documentation/WebKit/Reference/WKScriptMessageHandler_Ref/index.html#//apple_ref/swift/intf/WKScriptMessageHandler
+            if ([_commandDelegate conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
+                [userContentController addScriptMessageHandler:self name:@"cordova"];
+            }
+
+            WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];
+            configuration.userContentController = userContentController;
+
+            cordovaView = [[WKWebView alloc] initWithFrame:bounds configuration:configuration];
+            _webViewUIDelegate = [[CDVWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
+            ((WKWebView*)cordovaView).UIDelegate = _webViewUIDelegate;
+#endif
+    } else {
+        cordovaView = [[UIWebView alloc] initWithFrame:bounds];
+    }
+
+    return cordovaView;
 }
 
 - (NSString*)userAgent
@@ -619,6 +503,7 @@
 
     self.webView = [self newCordovaViewWithFrame:webViewBounds];
     self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
+    _webViewOperationsDelegate = [[CDVWebViewOperationsDelegate alloc] initWithWebView:self.webView];
 
     [self.view addSubview:self.webView];
     [self.view sendSubviewToBack:self.webView];
@@ -654,7 +539,9 @@
     // Release any retained subviews of the main view.
     // e.g. self.myOutlet = nil;
 
-    self.webView.delegate = nil;
+    if ([webView respondsToSelector:@selector(setDelegate:)]) {
+        [webView setValue:nil forKey:@"delegate"];
+    }
     self.webView = nil;
     [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
 
@@ -1002,10 +889,25 @@
 {
     if (self.openURL) {
         [self processOpenUrl:self.openURL pageLoaded:YES];
+        NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", [self.openURL description]];
+        [_webViewOperationsDelegate evaluateJavaScript:jsString completionHandler:nil];
         self.openURL = nil;
     }
 }
 
+#pragma mark WKScriptMessageHandler implementation
+
+#ifdef __IPHONE_8_0
+    - (void)userContentController:(WKUserContentController*)userContentController didReceiveScriptMessage:(WKScriptMessage*)message
+    {
+        if (![message.name isEqualToString:@"cordova"]) {
+            return;
+        }
+
+        NSArray* jsonEntry = message.body; // NSString:callbackId, NSString:service, NSString:action, NSArray:args
+        CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
+        CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);
+
 - (void)processOpenUrl:(NSURL*)url pageLoaded:(BOOL)pageLoaded
 {
     if (!pageLoaded) {
@@ -1015,16 +917,17 @@
     }
 
     if (pageLoaded) {
-        // calls into javascript global function 'handleOpenURL'
+                DLog(@"FAILED pluginJSON = %@", commandString);
         NSString* jsString = [NSString stringWithFormat:@"if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}", url];
-        [self.webView stringByEvaluatingJavaScriptFromString:jsString];
+    #endif
+        }
     } else {
         // save for when page has loaded
         self.openURL = url;
     }
 }
 
-- (void)processOpenUrl:(NSURL*)url
+#endif /* ifdef __IPHONE_8_0 */
 {
     [self processOpenUrl:url pageLoaded:NO];
 }
@@ -1036,7 +939,10 @@
     [CDVURLProtocol unregisterViewController:self];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 
-    self.webView.delegate = nil;
+    if ([webView respondsToSelector:@selector(setDelegate:)]) {
+        [webView setValue:nil forKey:@"delegate"];
+    }
+
     self.webView = nil;
     [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
     [_commandQueue dispose];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewOperationsDelegate.h b/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
new file mode 100644
index 0000000..34330a1
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
@@ -0,0 +1,39 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+#ifdef __IPHONE_8_0
+#pragma message("For iOS 8 - Please add WebKit.framework into your 'Link Binary with Libraries' Build Phase Project Setting. This will be baked in once Xcode 6 is required.")
+#endif /* ifdef __IPHONE_8_0 */
+
+
+@interface CDVWebViewOperationsDelegate : NSObject {
+    @private
+    __weak UIView* _webView;
+}
+
+- (instancetype) initWithWebView:(UIView*)webView;
+
+- (void)loadRequest:(NSURLRequest*)request;
+- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL;
+- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewOperationsDelegate.m b/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
new file mode 100644
index 0000000..d243aba
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
@@ -0,0 +1,83 @@
+/*
+ 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.
+ */
+
+#import <objc/message.h>
+#import "CDVWebViewOperationsDelegate.h"
+
+@implementation CDVWebViewOperationsDelegate
+
+- (instancetype) initWithWebView:(UIView*)webView
+{
+    self = [super init];
+    if (self) {
+        Class wk_class = NSClassFromString(@"WKWebView");
+        if ( !([webView isKindOfClass:wk_class] || [webView isKindOfClass:[UIWebView class]] )) {
+            return nil;
+        }
+        _webView = webView;
+    }
+    
+    return self;
+}
+
+- (void)loadRequest:(NSURLRequest*)request
+{
+    SEL selector = NSSelectorFromString(@"loadRequest:");
+    if ([_webView respondsToSelector:selector]) {
+        // UIKit operations have to be on the main thread. and this method is synchronous
+        [_webView performSelectorOnMainThread:selector withObject:request waitUntilDone:YES];
+    }
+}
+
+- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL
+{
+    SEL selector = NSSelectorFromString(@"loadHTMLString:baseURL:");
+
+    dispatch_block_t invoke = ^(void) {
+        ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, selector, string, baseURL);
+    };
+    
+    if ([_webView respondsToSelector:selector]) {
+        // UIKit operations have to be on the main thread.
+        // perform a synchronous invoke on the main thread without deadlocking
+        if ([NSThread isMainThread]) {
+            invoke();
+        } else {
+            dispatch_sync(dispatch_get_main_queue(), invoke);
+        }
+    }
+}
+
+- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
+{
+    SEL ui_sel = NSSelectorFromString(@"stringByEvaluatingJavaScriptFromString:");
+    SEL wk_sel = NSSelectorFromString(@"evaluateJavaScript:completionHandler:");
+
+    // UIKit operations have to be on the main thread. This method does not need to be synchronous
+    dispatch_async(dispatch_get_main_queue(), ^{
+        if ([_webView respondsToSelector:ui_sel]) {
+            NSString* ret = ((NSString* (*)(id, SEL, id))objc_msgSend)(_webView, ui_sel, javaScriptString);
+            completionHandler(ret, nil);
+        } else if ([_webView respondsToSelector:wk_sel]) {
+            ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, javaScriptString, completionHandler);
+        }
+    });
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVWebViewPreferences.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.h b/CordovaLib/Classes/CDVWebViewPreferences.h
new file mode 100644
index 0000000..5058eef
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewPreferences.h
@@ -0,0 +1,32 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+@interface CDVWebViewPreferences: NSObject {
+    @private
+    __weak UIView* _webView;
+}
+
+- (instancetype) initWithWebView:(UIView*)webView;
+- (void) updateSettings:(NSDictionary*)settings;
+
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
new file mode 100644
index 0000000..a42b3aa
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewPreferences.m
@@ -0,0 +1,261 @@
+/*
+ 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.
+ */
+#import "CDVWebViewPreferences.h"
+#import "CDVAvailability.h"
+#import <objc/message.h>
+
+#ifdef __IPHONE_8_0
+    #import <WebKit/WebKit.h>
+#endif /* ifdef __IPHONE_8_0 */
+
+@implementation CDVWebViewPreferences
+
+- (instancetype)initWithWebView:(UIView*)webView
+{
+    self = [super init];
+    if (self) {
+        Class wk_class = NSClassFromString(@"WKWebView");
+        if (!([webView isKindOfClass:wk_class] || [webView isKindOfClass:[UIWebView class]])) {
+            return nil;
+        }
+        _webView = webView;
+    }
+
+    return self;
+}
+
+- (void)updateSettings:(NSDictionary*)settings
+{
+    Class wk_class = NSClassFromString(@"WKWebView");
+    SEL ui_sel = NSSelectorFromString(@"updateUIWebView:settings:");
+    SEL wk_sel = NSSelectorFromString(@"updateWKWebView:settings:");
+
+    __weak id weakSelf = self;
+
+    dispatch_block_t invoke = ^(void) {
+        if ([_webView isKindOfClass:[UIWebView class]] && [weakSelf respondsToSelector:ui_sel]) {
+            ((void (*)(id, SEL, id, id))objc_msgSend)(weakSelf, ui_sel, _webView, settings);
+        } else if ([_webView isKindOfClass:wk_class] && [weakSelf respondsToSelector:wk_sel]) {
+            ((void (*)(id, SEL, id, id))objc_msgSend)(weakSelf, wk_sel, _webView, settings);
+        }
+    };
+
+    // UIKit operations have to be on the main thread.
+    // perform a synchronous invoke on the main thread without deadlocking
+    if ([NSThread isMainThread]) {
+        invoke();
+    } else {
+        dispatch_sync(dispatch_get_main_queue(), invoke);
+    }
+}
+
+- (id)cordovaSettings:(NSDictionary*)settings forKey:(NSString*)key
+{
+    return [settings objectForKey:[key lowercaseString]];
+}
+
+- (void)updateUIWebView:(UIWebView*)theWebView settings:(NSDictionary*)settings
+{
+    NSString* enableViewportScale = [self cordovaSettings:settings forKey:@"EnableViewportScale"];
+    NSNumber* allowInlineMediaPlayback = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
+    BOOL mediaPlaybackRequiresUserAction = YES;  // default value
+
+    if ([self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"]) {
+        mediaPlaybackRequiresUserAction = [(NSNumber*)[self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"] boolValue];
+    }
+
+    theWebView.scalesPageToFit = [enableViewportScale boolValue];
+
+    /*
+     * This is for iOS 4.x, where you can allow inline <video> and <audio>, and also autoplay them
+     */
+    if ([allowInlineMediaPlayback boolValue] && [theWebView respondsToSelector:@selector(allowsInlineMediaPlayback)]) {
+        theWebView.allowsInlineMediaPlayback = YES;
+    }
+    if ((mediaPlaybackRequiresUserAction == NO) && [theWebView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)]) {
+        theWebView.mediaPlaybackRequiresUserAction = NO;
+    }
+
+    // By default, overscroll bouncing is allowed.
+    // UIWebViewBounce has been renamed to DisallowOverscroll, but both are checked.
+    BOOL bounceAllowed = YES;
+    NSNumber* disallowOverscroll = [self cordovaSettings:settings forKey:@"DisallowOverscroll"];
+    if (disallowOverscroll == nil) {
+        NSNumber* bouncePreference = [self cordovaSettings:settings forKey:@"UIWebViewBounce"];
+        bounceAllowed = (bouncePreference == nil || [bouncePreference boolValue]);
+    } else {
+        bounceAllowed = ![disallowOverscroll boolValue];
+    }
+
+    // prevent webView from bouncing
+    // based on the DisallowOverscroll/UIWebViewBounce key in config.xml
+    if (!bounceAllowed) {
+        if ([theWebView respondsToSelector:@selector(scrollView)]) {
+            ((UIScrollView*)[theWebView scrollView]).bounces = NO;
+        } else {
+            for (id subview in theWebView.subviews) {
+                if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
+                    ((UIScrollView*)subview).bounces = NO;
+                }
+            }
+        }
+    }
+
+    NSString* decelerationSetting = [self cordovaSettings:settings forKey:@"UIWebViewDecelerationSpeed"];
+    if (![@"fast" isEqualToString : decelerationSetting]) {
+        [theWebView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
+    }
+
+    /*
+     * iOS 6.0 UIWebView properties
+     */
+    if (IsAtLeastiOSVersion(@"6.0")) {
+        BOOL keyboardDisplayRequiresUserAction = YES; // KeyboardDisplayRequiresUserAction - defaults to YES
+        if ([self cordovaSettings:settings forKey:@"KeyboardDisplayRequiresUserAction"] != nil) {
+            if ([self cordovaSettings:settings forKey:@"KeyboardDisplayRequiresUserAction"]) {
+                keyboardDisplayRequiresUserAction = [(NSNumber*)[self cordovaSettings:settings forKey:@"KeyboardDisplayRequiresUserAction"] boolValue];
+            }
+        }
+
+        // property check for compiling under iOS < 6
+        if ([theWebView respondsToSelector:@selector(setKeyboardDisplayRequiresUserAction:)]) {
+            [theWebView setValue:[NSNumber numberWithBool:keyboardDisplayRequiresUserAction] forKey:@"keyboardDisplayRequiresUserAction"];
+        }
+
+        BOOL suppressesIncrementalRendering = NO; // SuppressesIncrementalRendering - defaults to NO
+        if ([self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"] != nil) {
+            if ([self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"]) {
+                suppressesIncrementalRendering = [(NSNumber*)[self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"] boolValue];
+            }
+        }
+
+        // property check for compiling under iOS < 6
+        if ([theWebView respondsToSelector:@selector(setSuppressesIncrementalRendering:)]) {
+            [theWebView setValue:[NSNumber numberWithBool:suppressesIncrementalRendering] forKey:@"suppressesIncrementalRendering"];
+        }
+    }
+
+    /*
+     * iOS 7.0 UIWebView properties
+     */
+    if (IsAtLeastiOSVersion(@"7.0")) {
+        SEL ios7sel = nil;
+        id prefObj = nil;
+
+        CGFloat gapBetweenPages = 0.0; // default
+        prefObj = [self cordovaSettings:settings forKey:@"GapBetweenPages"];
+        if (prefObj != nil) {
+            gapBetweenPages = [prefObj floatValue];
+        }
+
+        // property check for compiling under iOS < 7
+        ios7sel = NSSelectorFromString(@"setGapBetweenPages:");
+        if ([theWebView respondsToSelector:ios7sel]) {
+            [theWebView setValue:[NSNumber numberWithFloat:gapBetweenPages] forKey:@"gapBetweenPages"];
+        }
+
+        CGFloat pageLength = 0.0; // default
+        prefObj = [self cordovaSettings:settings forKey:@"PageLength"];
+        if (prefObj != nil) {
+            pageLength = [[self cordovaSettings:settings forKey:@"PageLength"] floatValue];
+        }
+
+        // property check for compiling under iOS < 7
+        ios7sel = NSSelectorFromString(@"setPageLength:");
+        if ([theWebView respondsToSelector:ios7sel]) {
+            [theWebView setValue:[NSNumber numberWithBool:pageLength] forKey:@"pageLength"];
+        }
+
+        NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage
+        prefObj = [self cordovaSettings:settings forKey:@"PaginationBreakingMode"];
+        if (prefObj != nil) {
+            NSArray* validValues = @[@"page", @"column"];
+            NSString* prefValue = [validValues objectAtIndex:0];
+
+            if ([prefObj isKindOfClass:[NSString class]]) {
+                prefValue = prefObj;
+            }
+
+            paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]];
+            if (paginationBreakingMode == NSNotFound) {
+                paginationBreakingMode = 0;
+            }
+        }
+
+        // property check for compiling under iOS < 7
+        ios7sel = NSSelectorFromString(@"setPaginationBreakingMode:");
+        if ([theWebView respondsToSelector:ios7sel]) {
+            [theWebView setValue:[NSNumber numberWithInteger:paginationBreakingMode] forKey:@"paginationBreakingMode"];
+        }
+
+        NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated
+        prefObj = [self cordovaSettings:settings forKey:@"PaginationMode"];
+        if (prefObj != nil) {
+            NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"];
+            NSString* prefValue = [validValues objectAtIndex:0];
+
+            if ([prefObj isKindOfClass:[NSString class]]) {
+                prefValue = prefObj;
+            }
+
+            paginationMode = [validValues indexOfObject:[prefValue lowercaseString]];
+            if (paginationMode == NSNotFound) {
+                paginationMode = 0;
+            }
+        }
+
+        // property check for compiling under iOS < 7
+        ios7sel = NSSelectorFromString(@"setPaginationMode:");
+        if ([theWebView respondsToSelector:ios7sel]) {
+            [theWebView setValue:[NSNumber numberWithInteger:paginationMode] forKey:@"paginationMode"];
+        }
+    }
+}
+
+#ifdef __IPHONE_8_0
+
+    - (void)updateWKWebView:(WKWebView*)theWebView settings:(NSDictionary*)settings
+    {
+        id prefObj = nil;
+
+        CGFloat minimumFontSize = 0.0; // default
+
+        prefObj = [self cordovaSettings:settings forKey:@"MinimumFontSize"];
+        if (prefObj != nil) {
+            minimumFontSize = [[self cordovaSettings:settings forKey:@"MinimumFontSize"] floatValue];
+        }
+        theWebView.configuration.preferences.minimumFontSize = minimumFontSize;
+
+        /*
+        BOOL javaScriptEnabled = YES;  // default value
+        if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {
+            javaScriptEnabled = [(NSNumber*)[self cordovaSettings:settings forKey:@"JavaScriptEnabled"] boolValue];
+        }
+        theWebView.configuration.preferences.javaScriptEnabled = javaScriptEnabled;
+
+        BOOL javaScriptCanOpenWindowsAutomatically = NO;  // default value
+        if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {
+            javaScriptCanOpenWindowsAutomatically = [(NSNumber*)[self cordovaSettings:settings forKey:@"JavaScriptEnabled"] boolValue];
+        }
+        theWebView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = javaScriptCanOpenWindowsAutomatically;
+         */
+    }
+#endif /* ifdef __IPHONE_8_0 */
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 63c294c..941fa15 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -12,8 +12,10 @@
 		1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F92F49F1314023E0046367C /* CDVPluginResult.m */; };
 		301F2F2A14F3C9CA003FE9FC /* CDV.h in Headers */ = {isa = PBXBuildFile; fileRef = 301F2F2914F3C9CA003FE9FC /* CDV.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		302965BC13A94E9D007046C5 /* CDVDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 302965BB13A94E9D007046C5 /* CDVDebug.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		302D72FC19554BFC0028C99F /* CDVWebViewOperationsDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D72FA19554BFC0028C99F /* CDVWebViewOperationsDelegate.m */; };
 		3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 3034979A1513D56A0090E688 /* CDVLocalStorage.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3034979E1513D56A0090E688 /* CDVLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 3034979B1513D56A0090E688 /* CDVLocalStorage.m */; };
+		303820731955603600C91592 /* CDVWebViewOperationsDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 302D72F919554BFC0028C99F /* CDVWebViewOperationsDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */; };
@@ -31,7 +33,11 @@
 		30F5EBAB14CA26E700987760 /* CDVCommandDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E14B5A81705050A0032169E /* CDVTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E14B5A61705050A0032169E /* CDVTimer.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E14B5A91705050A0032169E /* CDVTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E14B5A71705050A0032169E /* CDVTimer.m */; };
+		7E785B9A196F508900ABBDC8 /* CDVWebViewUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		7E785B9B196F508900ABBDC8 /* CDVWebViewUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */; };
+		7EE9ECF819525D24004CA6B9 /* CDVWebViewPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		7EE9ECF919525D24004CA6B9 /* CDVWebViewPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */; };
 		8852C43A14B65FD800F0E735 /* CDVViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 8852C43614B65FD800F0E735 /* CDVViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		8852C43C14B65FD800F0E735 /* CDVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8852C43714B65FD800F0E735 /* CDVViewController.m */; };
 		8887FD681090FBE7009987E8 /* NSDictionary+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -60,6 +66,8 @@
 		1F92F49F1314023E0046367C /* CDVPluginResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVPluginResult.m; path = Classes/CDVPluginResult.m; sourceTree = "<group>"; };
 		301F2F2914F3C9CA003FE9FC /* CDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDV.h; path = Classes/CDV.h; sourceTree = "<group>"; };
 		302965BB13A94E9D007046C5 /* CDVDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVDebug.h; path = Classes/CDVDebug.h; sourceTree = "<group>"; };
+		302D72F919554BFC0028C99F /* CDVWebViewOperationsDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewOperationsDelegate.h; path = Classes/CDVWebViewOperationsDelegate.h; sourceTree = "<group>"; };
+		302D72FA19554BFC0028C99F /* CDVWebViewOperationsDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewOperationsDelegate.m; path = Classes/CDVWebViewOperationsDelegate.m; sourceTree = "<group>"; };
 		30325A0B136B343700982B63 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
 		3034979A1513D56A0090E688 /* CDVLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVLocalStorage.h; path = Classes/CDVLocalStorage.h; sourceTree = "<group>"; };
 		3034979B1513D56A0090E688 /* CDVLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVLocalStorage.m; path = Classes/CDVLocalStorage.m; sourceTree = "<group>"; };
@@ -92,7 +100,11 @@
 		68A32D7414103017006B237C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
 		7E14B5A61705050A0032169E /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVTimer.h; path = Classes/CDVTimer.h; sourceTree = "<group>"; };
 		7E14B5A71705050A0032169E /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVTimer.m; path = Classes/CDVTimer.m; sourceTree = "<group>"; };
+		7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVWebViewUIDelegate.h; sourceTree = "<group>"; };
+		7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWebViewUIDelegate.m; sourceTree = "<group>"; };
+		7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewPreferences.h; path = Classes/CDVWebViewPreferences.h; sourceTree = "<group>"; };
 		7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailabilityDeprecated.h; path = Classes/CDVAvailabilityDeprecated.h; sourceTree = "<group>"; };
+		7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewPreferences.m; path = Classes/CDVWebViewPreferences.m; sourceTree = "<group>"; };
 		8220B5C316D5427E00EC3921 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
 		8852C43614B65FD800F0E735 /* CDVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVViewController.h; path = Classes/CDVViewController.h; sourceTree = "<group>"; };
 		8852C43714B65FD800F0E735 /* CDVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVViewController.m; path = Classes/CDVViewController.m; sourceTree = "<group>"; };
@@ -176,6 +188,12 @@
 				8852C43714B65FD800F0E735 /* CDVViewController.m */,
 				EB3B3545161CB44D003DBE7D /* CDVCommandQueue.h */,
 				EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */,
+				7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */,
+				7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */,
+				302D72F919554BFC0028C99F /* CDVWebViewOperationsDelegate.h */,
+				302D72FA19554BFC0028C99F /* CDVWebViewOperationsDelegate.m */,
+				7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */,
+				7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */,
 			);
 			name = Cleaver;
 			sourceTree = "<group>";
@@ -282,8 +300,11 @@
 				F858FBC6166009A8007DA594 /* CDVConfigParser.h in Headers */,
 				30F3930B169F839700B22307 /* CDVJSON.h in Headers */,
 				EBFF4DBD16D3FE2E008F452B /* CDVWebViewDelegate.h in Headers */,
+				7EE9ECF819525D24004CA6B9 /* CDVWebViewPreferences.h in Headers */,
 				EB96673B16A8970A00D86CDF /* CDVUserAgentUtil.h in Headers */,
 				7E14B5A81705050A0032169E /* CDVTimer.h in Headers */,
+				7E785B9A196F508900ABBDC8 /* CDVWebViewUIDelegate.h in Headers */,
+				303820731955603600C91592 /* CDVWebViewOperationsDelegate.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -345,6 +366,7 @@
 				8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */,
 				8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */,
 				1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */,
+				7EE9ECF919525D24004CA6B9 /* CDVWebViewPreferences.m in Sources */,
 				30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */,
 				30E563D013E217EC00C949AA /* NSMutableArray+QueueAdditions.m in Sources */,
 				30C684821406CB38004C1A8E /* CDVWhitelist.m in Sources */,
@@ -357,9 +379,11 @@
 				EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */,
 				F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */,
 				30F3930C169F839700B22307 /* CDVJSON.m in Sources */,
+				7E785B9B196F508900ABBDC8 /* CDVWebViewUIDelegate.m in Sources */,
 				EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */,
 				EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */,
 				7E14B5A91705050A0032169E /* CDVTimer.m in Sources */,
+				302D72FC19554BFC0028C99F /* CDVWebViewOperationsDelegate.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -370,6 +394,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = NO;
 				DSTROOT = "/tmp/$(PROJECT_NAME).dst";
@@ -393,6 +418,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				DSTROOT = "/tmp/$(PROJECT_NAME).dst";
 				GCC_MODEL_TUNING = G5;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index 75729c1..36dfa1b 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -925,13 +925,17 @@ function convertMessageToArgsNativeToJs(message) {
 
 function iOSExec() {
     if (bridgeMode === undefined) {
+        if (navigator.userAgent) {
+            bridgeMode = navigator.userAgent.indexOf(' 5_') == -1 ? jsToNativeModes.IFRAME_NAV: jsToNativeModes.XHR_NO_PAYLOAD;
+		} else {
         bridgeMode = jsToNativeModes.IFRAME_NAV;
+        }
     }
 
     if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) {
         bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING;
     }
-
+    
     var successCallback, failCallback, service, action, actionArgs, splitCommand;
     var callbackId = null;
     if (typeof arguments[0] !== "string") {
@@ -1802,4 +1806,4 @@ window.cordova = require('cordova');
 
 require('cordova/init');
 
-})();
\ No newline at end of file
+})();

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/bin/templates/project/__CLI__.xcodeproj/project.pbxproj b/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
index 9edef21..100a9ea 100755
--- a/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
+++ b/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
@@ -99,6 +99,7 @@
 		7E7966DB1810823500FA85AD /* icon-76@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76@2x.png"; sourceTree = "<group>"; };
 		7E7966DC1810823500FA85AD /* icon-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small.png"; sourceTree = "<group>"; };
 		7E7966DD1810823500FA85AD /* icon-small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small@2x.png"; sourceTree = "<group>"; };
+		7ED68E4519526A5A00B0A8AF /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
 		8D1107310486CEB800E47090 /* __PROJECT_NAME__-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "__PROJECT_NAME__-Info.plist"; path = "../__PROJECT_NAME__-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
 		D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x~iphone.png"; sourceTree = "<group>"; };
 		EB87FDF21871DA7A0020F90C /* merges */ = {isa = PBXFileReference; lastKnownFileType = folder; name = merges; path = ../../merges; sourceTree = "<group>"; };
@@ -185,6 +186,7 @@
 		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				7ED68E4519526A5A00B0A8AF /* WebKit.framework */,
 				5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */,
 				288765FC0DF74451002DB57D /* CoreGraphics.framework */,
 				305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */,
@@ -405,6 +407,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
@@ -436,6 +439,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -464,6 +468,7 @@
 		C01FCF4F08A954540054247B /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
@@ -508,6 +513,7 @@
 		C01FCF5008A954540054247B /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj b/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
index 47db3a2..c48f3ed 100755
--- a/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
+++ b/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
@@ -97,6 +97,7 @@
 		7E7966DB1810823500FA85AD /* icon-76@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76@2x.png"; sourceTree = "<group>"; };
 		7E7966DC1810823500FA85AD /* icon-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small.png"; sourceTree = "<group>"; };
 		7E7966DD1810823500FA85AD /* icon-small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small@2x.png"; sourceTree = "<group>"; };
+		7EFADAF51952687D00F28308 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
 		8D1107310486CEB800E47090 /* __PROJECT_NAME__-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "__PROJECT_NAME__-Info.plist"; path = "../__PROJECT_NAME__-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
 		D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x~iphone.png"; sourceTree = "<group>"; };
 		F840E1F0165FE0F500CFE078 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = "__PROJECT_NAME__/config.xml"; sourceTree = "<group>"; };
@@ -178,6 +179,7 @@
 		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				7EFADAF51952687D00F28308 /* WebKit.framework */,
 				5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */,
 				288765FC0DF74451002DB57D /* CoreGraphics.framework */,
 				305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */,
@@ -389,6 +391,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
@@ -420,6 +423,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -448,6 +452,7 @@
 		C01FCF4F08A954540054247B /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
@@ -492,6 +497,7 @@
 		C01FCF5008A954540054247B /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/bin/templates/project/__PROJECT_NAME__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__PROJECT_NAME__/config.xml b/bin/templates/project/__PROJECT_NAME__/config.xml
index 1fcc8d7..da6c067 100644
--- a/bin/templates/project/__PROJECT_NAME__/config.xml
+++ b/bin/templates/project/__PROJECT_NAME__/config.xml
@@ -36,6 +36,7 @@
     <content src="index.html" />
 
     <!-- Preferences for iOS -->
+    <preference name="UseWKWebView" value="false" />
     <preference name="AllowInlineMediaPlayback" value="false" />
     <preference name="BackupWebStorage" value="cloud" />
     <preference name="DisallowOverscroll" value="false" />

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a759ac7/tests/CordovaLibTests/CordovaLibApp/config.xml
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CordovaLibApp/config.xml b/tests/CordovaLibTests/CordovaLibApp/config.xml
index 1fcc8d7..da6c067 100644
--- a/tests/CordovaLibTests/CordovaLibApp/config.xml
+++ b/tests/CordovaLibTests/CordovaLibApp/config.xml
@@ -36,6 +36,7 @@
     <content src="index.html" />
 
     <!-- Preferences for iOS -->
+    <preference name="UseWKWebView" value="false" />
     <preference name="AllowInlineMediaPlayback" value="false" />
     <preference name="BackupWebStorage" value="cloud" />
     <preference name="DisallowOverscroll" value="false" />


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[19/43] ios commit: Merge branch 'wkwebview' of https://git-wip-us.apache.org/repos/asf/cordova-ios into wkwebview

Posted by sh...@apache.org.
Merge branch 'wkwebview' of https://git-wip-us.apache.org/repos/asf/cordova-ios into wkwebview

Conflicts:
	CordovaLib/Classes/CDVCommandDelegateImpl.m
	CordovaLib/Classes/CDVViewController.m
	CordovaLib/CordovaLib.xcodeproj/project.pbxproj
	CordovaLib/cordova.js
	bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m


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

Branch: refs/heads/4.0.x
Commit: f13ba3a49405db39cb2856fe10804eee8b6a835e
Parents: 1a7dbfa 2a38ad2
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri Oct 31 16:39:10 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 16:39:10 2014 -0700

----------------------------------------------------------------------
 CordovaLib/cordova.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/f13ba3a4/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --cc CordovaLib/cordova.js
index 36dfa1b,2470044..41db627
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@@ -928,10 -925,10 +928,10 @@@ function iOSExec() 
          if (navigator.userAgent) {
              bridgeMode = navigator.userAgent.indexOf(' 5_') == -1 ? jsToNativeModes.IFRAME_NAV: jsToNativeModes.XHR_NO_PAYLOAD;
  		} else {
 -            bridgeMode = jsToNativeModes.IFRAME_NAV;
 +        bridgeMode = jsToNativeModes.IFRAME_NAV;
          }
      }
- 
+ 	
      if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) {
          bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING;
      }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[05/43] ios commit: CB-7047 - typo fix

Posted by sh...@apache.org.
CB-7047 - typo fix


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

Branch: refs/heads/4.0.x
Commit: 7ce625ba9279716e4a2f3958a49bf31e13e87fcd
Parents: 641992c
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 21 14:43:36 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Jul 21 14:43:36 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewPreferences.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/7ce625ba/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
index 55f447b..f1cb48f 100644
--- a/CordovaLib/Classes/CDVWebViewPreferences.m
+++ b/CordovaLib/Classes/CDVWebViewPreferences.m
@@ -257,7 +257,7 @@
         theWebView.configuration.mediaPlaybackRequiresUserAction = mediaPlaybackRequiresUserAction;
 
         BOOL suppressesIncrementalRendering = NO; // default
-        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
+        prefObj = [self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"];
         if (prefObj != nil) {
             suppressesIncrementalRendering = [(NSNumber*)prefObj boolValue];
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[03/43] ios commit: CB-7182 - Running mobile-spec in an iOS 8 project but using UIWebView results in an exception

Posted by sh...@apache.org.
CB-7182 - Running mobile-spec in an iOS 8 project but using UIWebView results in an exception


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

Branch: refs/heads/4.0.x
Commit: 6d6ab0a161f93eee92faa1d3888318e3144e6f29
Parents: 28b4475
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 21 14:02:43 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Jul 21 14:02:43 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVCommandQueue.m | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6d6ab0a1/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index b4f1fa6..bb2788b 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -109,25 +109,19 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame.
 
 - (void)fetchCommandsFromJs
 {
+    __weak CDVCommandQueue* weakSelf = self;
     NSString* js = @"cordova.require('cordova/exec').nativeFetchMessages()";
-    SEL ui_selector = NSSelectorFromString(@"stringByEvaluatingJavaScriptFromString:");
 
-    // Grab all the queued commands from the JS side.
-    NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:
-        [[_viewController.webView class] instanceMethodSignatureForSelector:ui_selector]];
-
-    [invocation setSelector:ui_selector];
-    [invocation setTarget:_viewController.webView];
-    // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation
-    [invocation setArgument:&(js) atIndex:2];
-
-    [invocation invoke];
-
-    NSString* queuedCommandsJSON;
-    [invocation getReturnValue:&(queuedCommandsJSON)];
-
-    CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
-    [self enqueueCommandBatch:queuedCommandsJSON];
+    [_viewController.webViewOperationsDelegate evaluateJavaScript:js
+                                                completionHandler:^(id obj, NSError* error) {
+        if ((error == nil) && [obj isKindOfClass:[NSString class]]) {
+            NSString* queuedCommandsJSON = (NSString*)obj;
+            CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
+            [weakSelf enqueueCommandBatch:queuedCommandsJSON];
+            // this has to be called here now, because fetchCommandsFromJs is now async (previously: synchronous)
+            [self executePending];
+        }
+    }];
 }
 
 - (void)executePending


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[31/43] ios commit: Remove deleted preference from config.xml in the test app.

Posted by sh...@apache.org.
Remove deleted preference from config.xml in the test app.


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

Branch: refs/heads/4.0.x
Commit: 62aa5b854d0616507785e44f0747c49efdf1d59b
Parents: 3487ffb
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Nov 10 14:19:39 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Nov 10 14:19:39 2014 -0800

----------------------------------------------------------------------
 tests/CordovaLibTests/CordovaLibApp/config.xml | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/62aa5b85/tests/CordovaLibTests/CordovaLibApp/config.xml
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CordovaLibApp/config.xml b/tests/CordovaLibTests/CordovaLibApp/config.xml
index da6c067..1fcc8d7 100644
--- a/tests/CordovaLibTests/CordovaLibApp/config.xml
+++ b/tests/CordovaLibTests/CordovaLibApp/config.xml
@@ -36,7 +36,6 @@
     <content src="index.html" />
 
     <!-- Preferences for iOS -->
-    <preference name="UseWKWebView" value="false" />
     <preference name="AllowInlineMediaPlayback" value="false" />
     <preference name="BackupWebStorage" value="cloud" />
     <preference name="DisallowOverscroll" value="false" />


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[11/43] ios commit: CB-7184 - Implement support for mediaPlaybackAllowsAirPlay in UIWebView and WKWebView

Posted by sh...@apache.org.
CB-7184 - Implement support for mediaPlaybackAllowsAirPlay in UIWebView and WKWebView

plus config cleanup.


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

Branch: refs/heads/4.0.x
Commit: b3fbd850672a2cccb5163bca3720d618118d72bd
Parents: e22c8fb
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 21 14:48:51 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 15:37:43 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewPreferences.m | 42 +++++++++++++++++--------
 1 file changed, 29 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/b3fbd850/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
index f1cb48f..eb55c9d 100644
--- a/CordovaLib/Classes/CDVWebViewPreferences.m
+++ b/CordovaLib/Classes/CDVWebViewPreferences.m
@@ -72,25 +72,34 @@
 
 - (void)updateUIWebView:(UIWebView*)theWebView settings:(NSDictionary*)settings
 {
-    NSString* enableViewportScale = [self cordovaSettings:settings forKey:@"EnableViewportScale"];
-    NSNumber* allowInlineMediaPlayback = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
-    BOOL mediaPlaybackRequiresUserAction = YES;  // default value
+    BOOL scalesPageToFit = NO; // default
+    id prefObj = [self cordovaSettings:settings forKey:@"EnableViewportScale"];
 
-    if ([self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"]) {
-        mediaPlaybackRequiresUserAction = [(NSNumber*)[self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"] boolValue];
+    if (prefObj != nil) {
+        scalesPageToFit = [(NSNumber*)prefObj boolValue];
     }
+    theWebView.scalesPageToFit = scalesPageToFit;
 
-    theWebView.scalesPageToFit = [enableViewportScale boolValue];
+    BOOL allowInlineMediaPlayback = NO; // default
+    prefObj = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
+    if (prefObj != nil) {
+        allowInlineMediaPlayback = [(NSNumber*)prefObj boolValue];
+    }
+    theWebView.allowsInlineMediaPlayback = allowInlineMediaPlayback;
 
-    /*
-     * This is for iOS 4.x, where you can allow inline <video> and <audio>, and also autoplay them
-     */
-    if ([allowInlineMediaPlayback boolValue] && [theWebView respondsToSelector:@selector(allowsInlineMediaPlayback)]) {
-        theWebView.allowsInlineMediaPlayback = YES;
+    BOOL mediaPlaybackRequiresUserAction = YES;  // default
+    prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
+    if (prefObj != nil) {
+        mediaPlaybackRequiresUserAction = [(NSNumber*)prefObj boolValue];
     }
-    if ((mediaPlaybackRequiresUserAction == NO) && [theWebView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)]) {
-        theWebView.mediaPlaybackRequiresUserAction = NO;
+    theWebView.mediaPlaybackRequiresUserAction = mediaPlaybackRequiresUserAction;
+
+    BOOL mediaPlaybackAllowsAirPlay = YES;  // default
+    prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackAllowsAirPlay"];
+    if (prefObj != nil) {
+        mediaPlaybackAllowsAirPlay = [(NSNumber*)prefObj boolValue];
     }
+    theWebView.mediaPlaybackAllowsAirPlay = mediaPlaybackAllowsAirPlay;
 
     // By default, overscroll bouncing is allowed.
     // UIWebViewBounce has been renamed to DisallowOverscroll, but both are checked.
@@ -263,6 +272,13 @@
         }
         theWebView.configuration.suppressesIncrementalRendering = suppressesIncrementalRendering;
 
+        BOOL mediaPlaybackAllowsAirPlay = YES;  // default
+        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackAllowsAirPlay"];
+        if (prefObj != nil) {
+            mediaPlaybackAllowsAirPlay = [(NSNumber*)prefObj boolValue];
+        }
+        theWebView.configuration.mediaPlaybackAllowsAirPlay = mediaPlaybackAllowsAirPlay;
+
         /*
         BOOL javaScriptEnabled = YES;  // default value
         if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[18/43] ios commit: Fixed processOpenUrl and userContentController:didReceiveScriptMessage bad merge.

Posted by sh...@apache.org.
Fixed processOpenUrl and userContentController:didReceiveScriptMessage bad merge.

Converted processOpenUrl to use the webViewOperationsDelegate.


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

Branch: refs/heads/4.0.x
Commit: 1a7dbfa65bec49f9ef003bd2bd5b4d2bff9dd71d
Parents: f6d89c6
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri Oct 31 16:28:53 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 16:28:53 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m | 74 +++++++++++++++++++----------
 1 file changed, 50 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1a7dbfa6/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 79d16b8..f8ced8b 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -331,10 +331,10 @@
             if (errorUrl) {
                 errorUrl = [NSURL URLWithString:[NSString stringWithFormat:@"?error=%@", [loadErr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] relativeToURL:errorUrl];
                 NSLog(@"%@", [errorUrl absoluteString]);
-                [self.webView loadRequest:[NSURLRequest requestWithURL:errorUrl]];
+                [_webViewOperationsDelegate loadRequest:[NSURLRequest requestWithURL:errorUrl]];
             } else {
-            NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr];
-            [_webViewOperationsDelegate loadHTMLString:html baseURL:nil];
+                NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr];
+                [_webViewOperationsDelegate loadHTMLString:html baseURL:nil];
             }
         }
     }];
@@ -716,7 +716,7 @@
 + (NSString*)applicationDocumentsDirectory
 {
     NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-    NSString* basePath = (([paths count] > 0) ? ([paths objectAtIndex : 0]) : nil);
+    NSString* basePath = (([paths count] > 0) ? ([paths objectAtIndex:0]) : nil);
 
     return basePath;
 }
@@ -891,12 +891,48 @@
 {
     if (self.openURL) {
         [self processOpenUrl:self.openURL pageLoaded:YES];
-        NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", [self.openURL description]];
-        [_webViewOperationsDelegate evaluateJavaScript:jsString completionHandler:nil];
-        self.openURL = nil;
     }
 }
 
+- (void)processOpenUrl:(NSURL*)url pageLoaded:(BOOL)pageLoaded
+{
+    __weak CDVViewController* weakSelf = self;
+
+    dispatch_block_t handleOpenUrl = ^(void) {
+        NSString* jsString = [NSString stringWithFormat:@"if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}", url];
+        [_webViewOperationsDelegate evaluateJavaScript:jsString
+                                     completionHandler:^(id object, NSError* error) {
+            if (error == nil) {
+                weakSelf.openURL = nil;
+            }
+        }];
+    };
+
+    if (!pageLoaded) {
+        // query the webview for readystate
+        NSString* jsString = @"document.readystate";
+        [_webViewOperationsDelegate evaluateJavaScript:jsString
+                                     completionHandler:^(id object, NSError* error) {
+            if ((error == nil) && [object isKindOfClass:[NSString class]]) {
+                NSString* readyState = (NSString*)object;
+                BOOL ready = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
+                if (ready) {
+                    handleOpenUrl();
+                } else {
+                    weakSelf.openURL = url;
+                }
+            }
+        }];
+    } else {
+        handleOpenUrl();
+    }
+}
+
+- (void)processOpenUrl:(NSURL*)url
+{
+    [self processOpenUrl:url pageLoaded:NO];
+}
+
 #pragma mark WKScriptMessageHandler implementation
 
 #ifdef __IPHONE_8_0
@@ -910,29 +946,19 @@
         CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
         CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);
 
-- (void)processOpenUrl:(NSURL*)url pageLoaded:(BOOL)pageLoaded
-{
-    if (!pageLoaded) {
-        // query the webview for readystate
-        NSString* readyState = [webView stringByEvaluatingJavaScriptFromString:@"document.readyState"];
-        pageLoaded = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
-    }
+        if (![_commandQueue execute:command]) {
+    #ifdef DEBUG
+                NSString* commandJson = [jsonEntry JSONString];
+                static NSUInteger maxLogLength = 1024;
+                NSString* commandString = ([commandJson length] > maxLogLength) ?
+                    [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
+                    commandJson;
 
-    if (pageLoaded) {
                 DLog(@"FAILED pluginJSON = %@", commandString);
-        NSString* jsString = [NSString stringWithFormat:@"if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}", url];
     #endif
         }
-    } else {
-        // save for when page has loaded
-        self.openURL = url;
     }
-}
-
 #endif /* ifdef __IPHONE_8_0 */
-{
-    [self processOpenUrl:url pageLoaded:NO];
-}
 
 // ///////////////////////
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[30/43] ios commit: Use default web view engine (UIWebView) if external web engine is not supported in the current runtime version, or it doesn't conform to the protocol.

Posted by sh...@apache.org.
Use default web view engine (UIWebView) if external web engine is not supported in the current runtime version, or it doesn't conform to the protocol.


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

Branch: refs/heads/4.0.x
Commit: 3487ffba992bd3f2cca447d357f6768f0dacaf37
Parents: c343e2e
Author: Shazron Abdullah <sh...@gmail.com>
Authored: Mon Nov 10 09:43:37 2014 -0800
Committer: Shazron Abdullah <sh...@gmail.com>
Committed: Mon Nov 10 09:43:37 2014 -0800

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


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/3487ffba/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index a76b6e7..e59bdd7 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -435,6 +435,10 @@
     // Find webViewEngine
     if (NSClassFromString(webViewEngineClass)) {
         self.webViewEngine = [[NSClassFromString(webViewEngineClass) alloc] initWithFrame:bounds];
+        // if a webView engine returns nil (not supported by the current iOS version) or doesn't conform to the protocol, we use UIWebView
+        if (!self.webViewEngine || ![self.webViewEngine conformsToProtocol:@protocol(CDVWebViewEngineProtocol)]) {
+            self.webViewEngine = [[NSClassFromString(defaultWebViewEngineClass) alloc] initWithFrame:bounds];
+        }
     } else {
         self.webViewEngine = [[NSClassFromString(defaultWebViewEngineClass) alloc] initWithFrame:bounds];
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[14/43] ios commit: CB-7047 - typo fix

Posted by sh...@apache.org.
CB-7047 - typo fix


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

Branch: refs/heads/4.0.x
Commit: e22c8fb73cee4c44eac3803b51e4b632098d0795
Parents: d801bac
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 21 14:43:36 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 15:37:43 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewPreferences.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e22c8fb7/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
index 55f447b..f1cb48f 100644
--- a/CordovaLib/Classes/CDVWebViewPreferences.m
+++ b/CordovaLib/Classes/CDVWebViewPreferences.m
@@ -257,7 +257,7 @@
         theWebView.configuration.mediaPlaybackRequiresUserAction = mediaPlaybackRequiresUserAction;
 
         BOOL suppressesIncrementalRendering = NO; // default
-        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
+        prefObj = [self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"];
         if (prefObj != nil) {
             suppressesIncrementalRendering = [(NSNumber*)prefObj boolValue];
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[34/43] ios commit: Removed 'WebKit.framework' from project tree.

Posted by sh...@apache.org.
Removed 'WebKit.framework' from project tree.

It was removed from Link Binary with Libraries - but removing it there will not remove it from the project tree. This was the cause of CB-8024.


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

Branch: refs/heads/4.0.x
Commit: ed4f28b97546a2d78afd94c40a79532f36feec56
Parents: a11803a
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Nov 27 01:08:31 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Nov 27 01:08:31 2014 -0800

----------------------------------------------------------------------
 bin/templates/project/__CLI__.xcodeproj/project.pbxproj     | 2 --
 bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj | 2 --
 2 files changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ed4f28b9/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/bin/templates/project/__CLI__.xcodeproj/project.pbxproj b/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
index 100a9ea..4e6769f 100755
--- a/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
+++ b/bin/templates/project/__CLI__.xcodeproj/project.pbxproj
@@ -99,7 +99,6 @@
 		7E7966DB1810823500FA85AD /* icon-76@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76@2x.png"; sourceTree = "<group>"; };
 		7E7966DC1810823500FA85AD /* icon-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small.png"; sourceTree = "<group>"; };
 		7E7966DD1810823500FA85AD /* icon-small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small@2x.png"; sourceTree = "<group>"; };
-		7ED68E4519526A5A00B0A8AF /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
 		8D1107310486CEB800E47090 /* __PROJECT_NAME__-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "__PROJECT_NAME__-Info.plist"; path = "../__PROJECT_NAME__-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
 		D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x~iphone.png"; sourceTree = "<group>"; };
 		EB87FDF21871DA7A0020F90C /* merges */ = {isa = PBXFileReference; lastKnownFileType = folder; name = merges; path = ../../merges; sourceTree = "<group>"; };
@@ -186,7 +185,6 @@
 		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
-				7ED68E4519526A5A00B0A8AF /* WebKit.framework */,
 				5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */,
 				288765FC0DF74451002DB57D /* CoreGraphics.framework */,
 				305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */,

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ed4f28b9/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj b/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
index c48f3ed..016cb4f 100755
--- a/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
+++ b/bin/templates/project/__NON-CLI__.xcodeproj/project.pbxproj
@@ -97,7 +97,6 @@
 		7E7966DB1810823500FA85AD /* icon-76@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76@2x.png"; sourceTree = "<group>"; };
 		7E7966DC1810823500FA85AD /* icon-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small.png"; sourceTree = "<group>"; };
 		7E7966DD1810823500FA85AD /* icon-small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small@2x.png"; sourceTree = "<group>"; };
-		7EFADAF51952687D00F28308 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
 		8D1107310486CEB800E47090 /* __PROJECT_NAME__-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "__PROJECT_NAME__-Info.plist"; path = "../__PROJECT_NAME__-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
 		D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x~iphone.png"; sourceTree = "<group>"; };
 		F840E1F0165FE0F500CFE078 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = "__PROJECT_NAME__/config.xml"; sourceTree = "<group>"; };
@@ -179,7 +178,6 @@
 		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
-				7EFADAF51952687D00F28308 /* WebKit.framework */,
 				5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */,
 				288765FC0DF74451002DB57D /* CoreGraphics.framework */,
 				305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[38/43] ios commit: Merge branch 'master' into wkwebview

Posted by sh...@apache.org.
Merge branch 'master' into wkwebview


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

Branch: refs/heads/4.0.x
Commit: 93d819fafd34fccd967c5fd459bf7ed80d863ff8
Parents: e0dc744 a98144b
Author: Shazron Abdullah <sh...@apache.org>
Authored: Tue Jan 20 13:01:28 2015 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Tue Jan 20 13:01:28 2015 -0800

----------------------------------------------------------------------
 .gitignore                                          |  2 +-
 .reviewboardrc                                      |  8 --------
 .travis.yml                                         |  1 +
 CordovaLib/Classes/CDVCommandQueue.m                |  6 +++---
 CordovaLib/Classes/CDVJSON.h                        |  8 ++++----
 CordovaLib/Classes/CDVJSON.m                        |  9 +++++----
 CordovaLib/Classes/CDVPluginResult.m                |  2 +-
 .../CDVPluginResultJSONSerializationTests.m         | 16 ++++++++--------
 8 files changed, 23 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/93d819fa/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[42/43] ios commit: Merge wkwebview with master

Posted by sh...@apache.org.
Merge wkwebview with master


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

Branch: refs/heads/4.0.x
Commit: 270002c403755e47733d2c4aa96029fe3fdb79e6
Parents: 5fae77d b3c26fc
Author: Shazron Abdullah <sh...@gmail.com>
Authored: Fri Mar 6 14:24:11 2015 -0800
Committer: Shazron Abdullah <sh...@gmail.com>
Committed: Fri Mar 6 14:24:11 2015 -0800

----------------------------------------------------------------------
 .jshintignore                                   |   2 +
 .jshintrc                                       |  10 +
 .travis.yml                                     |   5 +-
 CordovaLib/Classes/CDVAvailability.h            |   6 +-
 CordovaLib/Classes/CDVCommandDelegateImpl.m     |   2 +-
 CordovaLib/Classes/CDVCommandQueue.m            |  15 +-
 CordovaLib/Classes/CDVHandleOpenURL.h           |  27 +
 CordovaLib/Classes/CDVHandleOpenURL.m           |  86 ++
 CordovaLib/Classes/CDVInvokedUrlCommand.m       |   4 +-
 CordovaLib/Classes/CDVJSON.h                    |  14 +-
 CordovaLib/Classes/CDVJSON.m                    |  58 +-
 CordovaLib/Classes/CDVJSON_private.h            |  31 +
 CordovaLib/Classes/CDVJSON_private.m            |  91 ++
 CordovaLib/Classes/CDVPluginResult.m            |   6 +-
 CordovaLib/Classes/CDVViewController.m          |  10 +-
 CordovaLib/Classes/NSArray+Comparisons.h        |   3 +-
 CordovaLib/Classes/NSData+Base64.h              |   9 +-
 CordovaLib/Classes/NSData+Base64.m              |  14 +-
 CordovaLib/Classes/NSDictionary+Extensions.h    |  26 +-
 CordovaLib/Classes/UIDevice+Extensions.h        |   3 +-
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |  14 +
 CordovaLib/VERSION                              |   2 +-
 CordovaLib/cordova.js                           |  19 +-
 RELEASENOTES.md                                 |  29 +-
 bin/apple_xcode_version                         |   6 +-
 bin/check_reqs                                  |  58 +-
 bin/check_reqs.bat                              |  25 +
 bin/create                                      |  27 +-
 bin/lib/check_reqs.js                           |  94 +++
 bin/lib/create.js                               | 207 ++---
 bin/lib/update.js                               |  72 --
 bin/lib/versions.js                             |  99 ++-
 bin/node_modules/.bin/shjs                      |  51 --
 bin/node_modules/nopt/LICENSE                   |  23 +
 bin/node_modules/nopt/lib/nopt.js               | 414 ++++++++++
 .../nopt/node_modules/abbrev/LICENSE            |  23 +
 .../nopt/node_modules/abbrev/abbrev.js          |  62 ++
 .../nopt/node_modules/abbrev/package.json       |  31 +
 bin/node_modules/nopt/package.json              |  41 +
 bin/node_modules/q/CONTRIBUTING.md              |  40 -
 bin/node_modules/q/README.md                    | 820 -------------------
 .../q/benchmark/compare-with-callbacks.js       |  71 --
 bin/node_modules/q/benchmark/scenarios.js       |  36 -
 bin/node_modules/shelljs/.documentup.json       |   6 -
 bin/node_modules/shelljs/.npmignore             |   1 -
 bin/node_modules/shelljs/.travis.yml            |   5 -
 bin/node_modules/shelljs/README.md              | 513 ------------
 bin/node_modules/shelljs/bin/shjs               |  51 --
 bin/node_modules/shelljs/global.js              |   3 -
 bin/node_modules/shelljs/jshint.json            |   4 -
 bin/node_modules/shelljs/make.js                |  48 --
 bin/node_modules/shelljs/scripts/docs.js        |  15 -
 bin/node_modules/shelljs/scripts/run-tests.js   |  50 --
 bin/node_modules/which/LICENSE                  |  23 -
 bin/node_modules/which/README.md                |   5 -
 bin/node_modules/which/bin/which                |  14 -
 bin/node_modules/which/package.json             |  31 -
 bin/node_modules/which/which.js                 | 104 ---
 .../__PROJECT_NAME__/Classes/AppDelegate.m      |  37 +-
 .../project/__PROJECT_NAME__/config.xml         |  19 +-
 bin/templates/project/www/index.html            |  11 +-
 bin/templates/scripts/cordova/build             |  92 +--
 bin/templates/scripts/cordova/clean             |  69 +-
 bin/templates/scripts/cordova/clean.bat         |  25 +
 bin/templates/scripts/cordova/defaults.xml      |   5 -
 bin/templates/scripts/cordova/emulate           |  59 --
 bin/templates/scripts/cordova/lib/build.js      | 148 ++++
 bin/templates/scripts/cordova/lib/clean.js      |  46 ++
 .../scripts/cordova/lib/install-device          |  52 --
 .../scripts/cordova/lib/install-emulator        |  91 --
 bin/templates/scripts/cordova/lib/list-devices  |  85 +-
 .../scripts/cordova/lib/list-emulator-images    |  92 ++-
 .../scripts/cordova/lib/list-started-emulators  |  81 +-
 bin/templates/scripts/cordova/lib/run.js        | 177 ++++
 bin/templates/scripts/cordova/lib/spawn.js      |  50 ++
 bin/templates/scripts/cordova/run               | 222 +----
 bin/templates/scripts/cordova/run.bat           |  25 +
 bin/templates/scripts/cordova/version           |   2 +-
 bin/uncrustify.sh                               |   9 +-
 bin/update                                      |  22 +-
 cordova-js-src/exec.js                          | 323 ++++++++
 cordova-js-src/platform.js                      |  28 +
 hooks/pre-commit                                |   5 -
 package.json                                    |  11 +-
 tests/.jshintrc                                 |  11 +
 .../CDVPluginResultJSONSerializationTests.m     |  16 +-
 tests/CordovaLibTests/CordovaLibApp/config.xml  |   1 -
 tests/spec/cordovalib.spec.js                   |   2 +-
 tests/spec/create.spec.js                       |   4 +
 89 files changed, 2537 insertions(+), 2842 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVAvailability.h
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVAvailability.h
index 1d37be0,71e20b9..5c5430f
--- a/CordovaLib/Classes/CDVAvailability.h
+++ b/CordovaLib/Classes/CDVAvailability.h
@@@ -87,5 -88,5 +88,6 @@@
  #if CDV_ENABLE_EXEC_LOGGING
      #define CDV_EXEC_LOG NSLog
  #else
--    #define CDV_EXEC_LOG(...) do {} while (NO)
++    #define CDV_EXEC_LOG(...) do { \
++} while (NO)
  #endif

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVCommandDelegateImpl.m
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVCommandQueue.m
index e88ed61,48264b2..df218c5
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@@ -73,12 -74,12 +74,12 @@@ static const double MAX_EXECUTION_TIME 
              [commandBatchHolder addObject:[batchJSON cdv_JSONObject]];
          } else {
              dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^() {
--                    NSMutableArray* result = [batchJSON cdv_JSONObject];
--                    @synchronized(commandBatchHolder) {
--                        [commandBatchHolder addObject:result];
--                    }
--                    [self performSelectorOnMainThread:@selector(executePending) withObject:nil waitUntilDone:NO];
--                });
++                NSMutableArray* result = [batchJSON cdv_JSONObject];
++                @synchronized(commandBatchHolder) {
++                    [commandBatchHolder addObject:result];
++                }
++                [self performSelectorOnMainThread:@selector(executePending) withObject:nil waitUntilDone:NO];
++            });
          }
      }
  }
@@@ -159,7 -153,7 +160,7 @@@
                              NSString* commandJson = [jsonEntry cdv_JSONString];
                              static NSUInteger maxLogLength = 1024;
                              NSString* commandString = ([commandJson length] > maxLogLength) ?
--                                [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
++                                [NSString stringWithFormat : @"%@[...]", [commandJson substringToIndex:maxLogLength]] :
                                  commandJson;
  
                              DLog(@"FAILED pluginJSON = %@", commandString);

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVHandleOpenURL.h
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVHandleOpenURL.h
index 0000000,24f461f..f9b0bff
mode 000000,100644..100644
--- a/CordovaLib/Classes/CDVHandleOpenURL.h
+++ b/CordovaLib/Classes/CDVHandleOpenURL.h
@@@ -1,0 -1,28 +1,27 @@@
+ /*
+  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.
+  */
+ 
+ #import "CDVPlugin.h"
+ 
+ @interface CDVHandleOpenURL : CDVPlugin
+ 
+ @property (nonatomic, strong) NSURL* url;
+ @property (nonatomic, assign) BOOL pageLoaded;
+ 
+ @end
 -

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVHandleOpenURL.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVHandleOpenURL.m
index 0000000,e5dcdd5..60fbf8e
mode 000000,100644..100644
--- a/CordovaLib/Classes/CDVHandleOpenURL.m
+++ b/CordovaLib/Classes/CDVHandleOpenURL.m
@@@ -1,0 -1,74 +1,86 @@@
+ /*
+  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.
+  */
+ 
+ #import "CDVHandleOpenURL.h"
+ #import "CDV.h"
+ 
+ @implementation CDVHandleOpenURL
+ 
+ - (void)pluginInitialize
+ {
+     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationLaunchedWithUrl:) name:CDVPluginHandleOpenURLNotification object:nil];
+     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationPageDidLoad:) name:CDVPageDidLoadNotification object:nil];
+ }
+ 
+ - (void)applicationLaunchedWithUrl:(NSNotification*)notification
+ {
 -    NSURL *url = [notification object];
++    NSURL* url = [notification object];
++
+     self.url = url;
 -    
++
+     // warm-start handler
+     if (self.pageLoaded) {
+         [self processOpenUrl:self.url pageLoaded:YES];
+         self.url = nil;
+     }
+ }
+ 
+ - (void)applicationPageDidLoad:(NSNotification*)notification
+ {
+     // cold-start handler
 -    
++
+     self.pageLoaded = YES;
+ 
+     if (self.url) {
+         [self processOpenUrl:self.url pageLoaded:YES];
+         self.url = nil;
+     }
+ }
+ 
+ - (void)processOpenUrl:(NSURL*)url pageLoaded:(BOOL)pageLoaded
+ {
 -    if (!pageLoaded) {
 -        // query the webview for readystate
 -        NSString* readyState = [self.webView stringByEvaluatingJavaScriptFromString:@"document.readyState"];
 -        pageLoaded = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
 -    }
 -    
 -    if (pageLoaded) {
++    __weak __typeof(self) weakSelf = self;
++
++    dispatch_block_t handleOpenUrl = ^(void) {
+         // calls into javascript global function 'handleOpenURL'
 -                NSString* jsString = [NSString stringWithFormat:@"document.addEventListener('deviceready',function(){if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}});", url];
 -        [self.webView stringByEvaluatingJavaScriptFromString:jsString];
++        NSString* jsString = [NSString stringWithFormat:@"document.addEventListener('deviceready',function(){if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}});", url];
++
++        [weakSelf.webViewEngine evaluateJavaScript:jsString completionHandler:nil];
++    };
++
++    if (!pageLoaded) {
++        NSString* jsString = @"document.readystate";
++        [self.webViewEngine evaluateJavaScript:jsString
++                             completionHandler:^(id object, NSError* error) {
++            if ((error == nil) && [object isKindOfClass:[NSString class]]) {
++                NSString* readyState = (NSString*)object;
++                BOOL ready = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
++                if (ready) {
++                    handleOpenUrl();
++                } else {
++                    self.url = url;
++                }
++            }
++        }];
+     } else {
 -        // save for when page has loaded
 -        self.url = url;
++        handleOpenUrl();
+     }
+ }
+ 
 -
+ @end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVPluginResult.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVPluginResult.m
index b8b69ed,13839ef..bba70e3
--- a/CordovaLib/Classes/CDVPluginResult.m
+++ b/CordovaLib/Classes/CDVPluginResult.m
@@@ -168,7 -168,7 +168,7 @@@ id messageFromMultipart(NSArray* theMes
  {
      NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
          self.status, @"status",
--        self.message ? self.                                message:[NSNull null], @"message",
++        self.message ? self.message : [NSNull null], @"message",
          self.keepCallback, @"keepCallback",
          nil];
  

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVViewController.m
index 21136f7,6d81e8d..946c723
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@@ -17,12 -17,16 +17,16 @@@
   under the License.
   */
  
+ #import <objc/message.h>
  #import "CDV.h"
 -#import "CDVCommandDelegateImpl.h"
 +#import "CDVUIWebViewDelegate.h"
+ #import "CDVConfigParser.h"
+ #import "CDVUserAgentUtil.h"
 -#import "CDVWebViewDelegate.h"
+ #import <AVFoundation/AVFoundation.h>
 +#import "NSDictionary+CordovaPreferences.h"
+ #import "CDVHandleOpenURL.h"
  
- #import <objc/message.h>
- #import <AVFoundation/AVFoundation.h>
+ #define degreesToRadian(x) (M_PI * (x) / 180.0)
  
  @interface CDVViewController () {
      NSInteger _userAgentLockToken;
@@@ -309,7 -460,9 +313,9 @@@
  
          [CDVTimer stop:@"TotalPluginStartup"];
      }
 -    
 -    [self registerPlugin:[[CDVHandleOpenURL alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVHandleOpenURL class])];
 -    
 +
++    [self registerPlugin:[[CDVHandleOpenURL alloc] initWithWebViewEngine:self.webViewEngine] withClassName:NSStringFromClass([CDVHandleOpenURL class])];
++
      // /////////////////
      NSURL* appURL = [self appUrl];
  

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --cc CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 2a13f87,c6b0f23..a1677ef
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@@ -214,7 -198,11 +221,9 @@@
  		888700D710922F56009987E8 /* Commands */ = {
  			isa = PBXGroup;
  			children = (
+ 				30E6B8CB1A8ADD900025B9EE /* CDVHandleOpenURL.h */,
+ 				30E6B8CC1A8ADD900025B9EE /* CDVHandleOpenURL.m */,
  				7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */,
 -				EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */,
 -				EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */,
  				301F2F2914F3C9CA003FE9FC /* CDV.h */,
  				3034979A1513D56A0090E688 /* CDVLocalStorage.h */,
  				3034979B1513D56A0090E688 /* CDVLocalStorage.m */,
@@@ -384,9 -370,9 +397,10 @@@
  				EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */,
  				F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */,
  				30F3930C169F839700B22307 /* CDVJSON.m in Sources */,
 +				3083EB991A0AF23A00548672 /* CDVUIWebViewEngine.m in Sources */,
  				EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */,
+ 				30E6B8CE1A8ADD900025B9EE /* CDVHandleOpenURL.m in Sources */,
 -				EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */,
 +				EBFF4DBC16D3FE2E008F452B /* CDVUIWebViewDelegate.m in Sources */,
  				7E14B5A91705050A0032169E /* CDVTimer.m in Sources */,
  			);
  			runOnlyForDeploymentPostprocessing = 0;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/cordova.js
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[35/43] ios commit: CB-8032 - Add new property in CDVCommandDelegate (urlTransformer), plus style fixups.

Posted by sh...@apache.org.
CB-8032 - Add new property in CDVCommandDelegate (urlTransformer), plus style fixups.


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

Branch: refs/heads/4.0.x
Commit: 0838a073021a81b73a9b0dbb9215e06c010a5789
Parents: ed4f28b
Author: Shazron Abdullah <sh...@apache.org>
Authored: Tue Dec 9 14:57:38 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Tue Dec 9 14:57:38 2014 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVCommandDelegate.h     | 1 +
 CordovaLib/Classes/CDVCommandDelegateImpl.m | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/0838a073/CordovaLib/Classes/CDVCommandDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandDelegate.h b/CordovaLib/Classes/CDVCommandDelegate.h
index 04df6bc..2062519 100644
--- a/CordovaLib/Classes/CDVCommandDelegate.h
+++ b/CordovaLib/Classes/CDVCommandDelegate.h
@@ -27,6 +27,7 @@
 @protocol CDVCommandDelegate <NSObject>
 
 @property (nonatomic, readonly) NSDictionary* settings;
+@property (nonatomic, copy) NSURL*(^urlTransformer)(NSURL*);
 
 - (NSString*)pathForResource:(NSString*)resourcepath;
 - (id)getCommandInstance:(NSString*)pluginName;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/0838a073/CordovaLib/Classes/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandDelegateImpl.m b/CordovaLib/Classes/CDVCommandDelegateImpl.m
index 7f4254a..dc57316 100644
--- a/CordovaLib/Classes/CDVCommandDelegateImpl.m
+++ b/CordovaLib/Classes/CDVCommandDelegateImpl.m
@@ -25,6 +25,8 @@
 
 @implementation CDVCommandDelegateImpl
 
+@synthesize urlTransformer;
+
 - (id)initWithViewController:(CDVViewController*)viewController
 {
     self = [super init];
@@ -124,7 +126,7 @@
 {
     CDV_EXEC_LOG(@"Exec(%@): Sending result. Status=%@", callbackId, result.status);
     // This occurs when there is are no win/fail callbacks for the call.
-    if ([@"INVALID" isEqualToString : callbackId]) {
+    if ([@"INVALID" isEqualToString:callbackId]) {
         return;
     }
     // This occurs when the callback id is malformed.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[41/43] ios commit: Make webView property dynamic in CDVViewController and CDVPlugin (from CDVWebViewEngineProtocol reference). Added scrollView category to UIView for backwards compatibility reasons.

Posted by sh...@apache.org.
Make webView property dynamic in CDVViewController and CDVPlugin (from CDVWebViewEngineProtocol reference). Added scrollView category to UIView for backwards compatibility reasons.


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

Branch: refs/heads/4.0.x
Commit: 5fae77df00adb905e28b3e1a865603d896f78b56
Parents: 93d819f
Author: Shazron Abdullah <sh...@gmail.com>
Authored: Fri Mar 6 11:35:45 2015 -0800
Committer: Shazron Abdullah <sh...@gmail.com>
Committed: Fri Mar 6 11:39:11 2015 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVPlugin.h         | 14 +++++++--
 CordovaLib/Classes/CDVPlugin.m         | 45 ++++++++++++++++++++++-------
 CordovaLib/Classes/CDVViewController.h |  2 +-
 CordovaLib/Classes/CDVViewController.m | 26 +++++++++++------
 4 files changed, 64 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5fae77df/CordovaLib/Classes/CDVPlugin.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPlugin.h b/CordovaLib/Classes/CDVPlugin.h
index 35d4cc2..b87685b 100644
--- a/CordovaLib/Classes/CDVPlugin.h
+++ b/CordovaLib/Classes/CDVPlugin.h
@@ -22,10 +22,18 @@
 #import "CDVPluginResult.h"
 #import "NSMutableArray+QueueAdditions.h"
 #import "CDVCommandDelegate.h"
+#import "CDVWebViewEngineProtocol.h"
+
 #ifdef __IPHONE_8_0
     #import <WebKit/WebKit.h>
 #endif
 
+@interface UIView (org_apache_cordova_UIView_Extension)
+
+@property (nonatomic, weak) UIScrollView* scrollView;
+
+@end
+
 extern NSString* const CDVPageDidLoadNotification;
 extern NSString* const CDVPluginHandleOpenURLNotification;
 extern NSString* const CDVPluginResetNotification;
@@ -35,13 +43,15 @@ extern NSString* const CDVRemoteNotificationError;
 
 @interface CDVPlugin : NSObject {}
 
-@property (nonatomic, weak) UIView* webView;
+@property (nonatomic, readonly, weak) UIView* webView;
+@property (nonatomic, readonly, weak) id <CDVWebViewEngineProtocol> webViewEngine;
+
 @property (nonatomic, weak) UIViewController* viewController;
 @property (nonatomic, weak) id <CDVCommandDelegate> commandDelegate;
 
 @property (readonly, assign) BOOL hasPendingOperation;
 
-- (instancetype)initWithWebView:(UIView*)theWebView;
+- (instancetype)initWithWebViewEngine:(id <CDVWebViewEngineProtocol>)theWebViewEngine;
 - (void)pluginInitialize;
 
 - (void)handleOpenURL:(NSNotification*)notification;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5fae77df/CordovaLib/Classes/CDVPlugin.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPlugin.m b/CordovaLib/Classes/CDVPlugin.m
index ac1ac4d..03c0c73 100644
--- a/CordovaLib/Classes/CDVPlugin.m
+++ b/CordovaLib/Classes/CDVPlugin.m
@@ -19,6 +19,24 @@
 
 #import "CDVPlugin.h"
 #import "CDVViewController.h"
+#include <objc/message.h>
+
+@implementation UIView (org_apache_cordova_UIView_Extension)
+
+@dynamic scrollView;
+
+- (UIScrollView*)scrollView
+{
+    SEL scrollViewSelector = NSSelectorFromString(@"scrollView");
+
+    if ([self respondsToSelector:scrollViewSelector]) {
+        return ((id (*)(id, SEL))objc_msgSend)(self, scrollViewSelector);
+    }
+
+    return nil;
+}
+
+@end
 
 NSString* const CDVPageDidLoadNotification = @"CDVPageDidLoadNotification";
 NSString* const CDVPluginHandleOpenURLNotification = @"CDVPluginHandleOpenURLNotification";
@@ -30,28 +48,25 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
 @interface CDVPlugin ()
 
 @property (readwrite, assign) BOOL hasPendingOperation;
+@property (nonatomic, readwrite, weak) id <CDVWebViewEngineProtocol> webViewEngine;
 
 @end
 
 @implementation CDVPlugin
-@synthesize webView, viewController, commandDelegate, hasPendingOperation;
+@synthesize webViewEngine, viewController, commandDelegate, hasPendingOperation;
+@dynamic webView;
 
 // Do not override these methods. Use pluginInitialize instead.
-- (instancetype)initWithWebView:(UIView*)theWebView settings:(NSDictionary*)classSettings
-{
-    return [self initWithWebView:theWebView];
-}
-
-- (instancetype)initWithWebView:(UIView*)theWebView
+- (instancetype)initWithWebViewEngine:(id <CDVWebViewEngineProtocol>)theWebViewEngine
 {
     self = [super init];
     if (self) {
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppTerminate) name:UIApplicationWillTerminateNotification object:nil];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:CDVPluginHandleOpenURLNotification object:nil];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onReset) name:CDVPluginResetNotification object:theWebView];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onReset) name:CDVPluginResetNotification object:theWebViewEngine.engineWebView];
 
-        self.webView = theWebView;
+        self.webViewEngine = theWebViewEngine;
     }
     return self;
 }
@@ -79,7 +94,15 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
 {
     viewController = nil;
     commandDelegate = nil;
-    webView = nil;
+}
+
+- (UIView*)webView
+{
+    if (self.webViewEngine != nil) {
+        return self.webViewEngine.engineWebView;
+    }
+
+    return nil;
 }
 
 /*
@@ -132,7 +155,7 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
 - (NSString*)writeJavascript:(NSString*)javascript
 {
     // TODO: although deprecated, should have some solution here instead of removing it
-    [((CDVViewController*)self.viewController).webViewEngine evaluateJavaScript : javascript completionHandler : nil]; // bad cast, but ok for now
+    [((CDVViewController*)self.viewController).webViewEngine evaluateJavaScript:javascript completionHandler:nil];     // bad cast, but ok for now
     return @"";
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5fae77df/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index 68297d4..4836f14 100644
--- a/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/Classes/CDVViewController.h
@@ -38,7 +38,7 @@
     NSString* _userAgent;
 }
 
-@property (nonatomic, strong) IBOutlet UIView* webView;
+@property (nonatomic, readonly, weak) IBOutlet UIView* webView;
 
 @property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects;
 @property (nonatomic, readonly, strong) NSDictionary* pluginsMap;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5fae77df/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index e59bdd7..21136f7 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -46,13 +46,14 @@
 
 @implementation CDVViewController
 
-@synthesize webView, supportedOrientations;
+@synthesize supportedOrientations;
 @synthesize pluginObjects, pluginsMap, whitelist, startupPluginNames;
 @synthesize configParser, settings, loadFromString;
 @synthesize wwwFolderName, startPage, initialized, openURL, baseUserAgent;
 @synthesize commandDelegate = _commandDelegate;
 @synthesize commandQueue = _commandQueue;
 @synthesize webViewEngine = _webViewEngine;
+@dynamic webView;
 
 - (void)__init
 {
@@ -250,6 +251,15 @@
     return errorURL;
 }
 
+- (UIView*)webView
+{
+    if (self.webViewEngine != nil) {
+        return self.webViewEngine.engineWebView;
+    }
+
+    return nil;
+}
+
 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
 - (void)viewDidLoad
 {
@@ -285,7 +295,7 @@
      */
     if (IsAtLeastiOSVersion(@"5.1") && (([backupWebStorageType isEqualToString:@"local"]) ||
         ([backupWebStorageType isEqualToString:@"cloud"] && !IsAtLeastiOSVersion(@"6.0")))) {
-        [self registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])];
+        [self registerPlugin:[[CDVLocalStorage alloc] initWithWebViewEngine:self.webViewEngine] withClassName:NSStringFromClass([CDVLocalStorage class])];
     }
 
     if ([self.startupPluginNames count] > 0) {
@@ -471,11 +481,11 @@
 
     webViewBounds.origin = self.view.bounds.origin;
 
-    self.webView = [self newCordovaViewWithFrame:webViewBounds];
+    UIView* view = [self newCordovaViewWithFrame:webViewBounds];
 
-    self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
-    [self.view addSubview:self.webView];
-    [self.view sendSubviewToBack:self.webView];
+    view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
+    [self.view addSubview:view];
+    [self.view sendSubviewToBack:view];
 }
 
 - (void)didReceiveMemoryWarning
@@ -508,7 +518,6 @@
     // Release any retained subviews of the main view.
     // e.g. self.myOutlet = nil;
 
-    self.webView = nil;
     [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
 
     [super viewDidUnload];
@@ -735,7 +744,7 @@
 
     id obj = [self.pluginObjects objectForKey:className];
     if (!obj) {
-        obj = [[NSClassFromString(className)alloc] initWithWebView:webView];
+        obj = [[NSClassFromString(className)alloc] initWithWebViewEngine:_webViewEngine];
 
         if (obj != nil) {
             [self registerPlugin:obj withClassName:className];
@@ -904,7 +913,6 @@
     [CDVURLProtocol unregisterViewController:self];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 
-    self.webView = nil;
     [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
     [_commandQueue dispose];
     [[self.pluginObjects allValues] makeObjectsPerformSelector:@selector(dispose)];


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[37/43] ios commit: Merge branch 'master' into wkwebview

Posted by sh...@apache.org.
Merge branch 'master' into wkwebview


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

Branch: refs/heads/4.0.x
Commit: e0dc7443be93978f8bead23fc3c968e95cffe4f7
Parents: 1d4ba97 0a2eac7
Author: Shazron Abdullah <sh...@gmail.com>
Authored: Tue Jan 6 16:44:17 2015 -0800
Committer: Shazron Abdullah <sh...@gmail.com>
Committed: Tue Jan 6 16:44:17 2015 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVUIWebViewDelegate.h       |    1 -
 CordovaLib/Classes/CDVUIWebViewDelegate.m       |    5 -
 CordovaLib/cordova.js                           |  122 +-
 bin/apple_ios_version                           |   47 +-
 bin/apple_ios_version.bat                       |   26 +
 bin/apple_osx_version                           |   47 +-
 bin/apple_osx_version.bat                       |   26 +
 bin/apple_xcode_version                         |   47 +-
 bin/apple_xcode_version.bat                     |   26 +
 bin/create                                      |  205 +-
 bin/create.bat                                  |   26 +
 bin/lib/create.js                               |  255 +++
 bin/lib/update.js                               |   72 +
 bin/lib/versions.js                             |  101 +
 bin/node_modules/q/CONTRIBUTING.md              |   40 +
 bin/node_modules/q/LICENSE                      |   18 +
 bin/node_modules/q/README.md                    |  820 ++++++++
 .../q/benchmark/compare-with-callbacks.js       |   71 +
 bin/node_modules/q/benchmark/scenarios.js       |   36 +
 bin/node_modules/q/package.json                 |  112 ++
 bin/node_modules/q/q.js                         | 1904 ++++++++++++++++++
 bin/node_modules/q/queue.js                     |   35 +
 bin/node_modules/which/LICENSE                  |   23 +
 bin/node_modules/which/README.md                |    5 +
 bin/node_modules/which/bin/which                |   14 +
 bin/node_modules/which/package.json             |   31 +
 bin/node_modules/which/which.js                 |  104 +
 bin/replaces                                    |   28 -
 bin/templates/scripts/cordova/build.xcconfig    |    2 +-
 bin/templates/scripts/cordova/run               |   53 +-
 bin/templates/scripts/cordova/version           |   51 +-
 bin/templates/scripts/cordova/version.bat       |   26 +
 bin/update                                      |   95 +-
 bin/update.bat                                  |   26 +
 bin/update_cordova_subproject                   |  137 +-
 bin/update_cordova_subproject.bat               |   26 +
 tests/spec/create.spec.js                       |   13 +-
 37 files changed, 4145 insertions(+), 531 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e0dc7443/CordovaLib/Classes/CDVUIWebViewDelegate.h
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVUIWebViewDelegate.h
index 05979ed,0000000..d77f191
mode 100644,000000..100644
--- a/CordovaLib/Classes/CDVUIWebViewDelegate.h
+++ b/CordovaLib/Classes/CDVUIWebViewDelegate.h
@@@ -1,42 -1,0 +1,41 @@@
 +/*
 + 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.
 + */
 +
 +#import <UIKit/UIKit.h>
 +#import "CDVAvailability.h"
 +
 +/**
 + * Distinguishes top-level navigations from sub-frame navigations.
 + * shouldStartLoadWithRequest is called for every request, but didStartLoad
 + * and didFinishLoad is called only for top-level navigations.
 + * Relevant bug: CB-2389
 + */
 +@interface CDVUIWebViewDelegate : NSObject <UIWebViewDelegate>{
 +    __weak NSObject <UIWebViewDelegate>* _delegate;
 +    NSInteger _loadCount;
 +    NSInteger _state;
 +    NSInteger _curLoadToken;
 +    NSInteger _loadStartPollCount;
 +}
 +
 +- (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate;
- - (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest CDV_DEPRECATED(3.5, "Use request:isEqualToRequestAfterStrippingFragments: instead.");
 +
 +- (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest;
 +
 +@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e0dc7443/CordovaLib/Classes/CDVUIWebViewDelegate.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVUIWebViewDelegate.m
index d880a4b,0000000..929138f
mode 100644,000000..100644
--- a/CordovaLib/Classes/CDVUIWebViewDelegate.m
+++ b/CordovaLib/Classes/CDVUIWebViewDelegate.m
@@@ -1,416 -1,0 +1,411 @@@
 +/*
 + 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.
 + */
 +
 +//
 +// Testing shows:
 +//
 +// In all cases, webView.request.URL is the previous page's URL (or empty) during the didStartLoad callback.
 +// When loading a page with a redirect:
 +// 1. shouldStartLoading (requestURL is target page)
 +// 2. didStartLoading
 +// 3. shouldStartLoading (requestURL is redirect target)
 +// 4. didFinishLoad (request.URL is redirect target)
 +//
 +// Note the lack of a second didStartLoading **
 +//
 +// When loading a page with iframes:
 +// 1. shouldStartLoading (requestURL is main page)
 +// 2. didStartLoading
 +// 3. shouldStartLoading (requestURL is one of the iframes)
 +// 4. didStartLoading
 +// 5. didFinishLoad
 +// 6. didFinishLoad
 +//
 +// Note there is no way to distinguish which didFinishLoad maps to which didStartLoad **
 +//
 +// Loading a page by calling window.history.go(-1):
 +// 1. didStartLoading
 +// 2. didFinishLoad
 +//
 +// Note the lack of a shouldStartLoading call **
 +// Actually - this is fixed on iOS6. iOS6 has a shouldStart. **
 +//
 +// Loading a page by calling location.reload()
 +// 1. shouldStartLoading
 +// 2. didStartLoading
 +// 3. didFinishLoad
 +//
 +// Loading a page with an iframe that fails to load:
 +// 1. shouldStart (main page)
 +// 2. didStart
 +// 3. shouldStart (iframe)
 +// 4. didStart
 +// 5. didFailWithError
 +// 6. didFinish
 +//
 +// Loading a page with an iframe that fails to load due to an invalid URL:
 +// 1. shouldStart (main page)
 +// 2. didStart
 +// 3. shouldStart (iframe)
 +// 5. didFailWithError
 +// 6. didFinish
 +//
 +// This case breaks our logic since there is a missing didStart. To prevent this,
 +// we check URLs in shouldStart and return NO if they are invalid.
 +//
 +// Loading a page with an invalid URL
 +// 1. shouldStart (main page)
 +// 2. didFailWithError
 +//
 +// TODO: Record order when page is re-navigated before the first navigation finishes.
 +//
 +
 +#import "CDVUIWebViewDelegate.h"
 +
 +// #define VerboseLog NSLog
 +#define VerboseLog(...) do {} while (0)
 +
 +typedef enum {
 +    STATE_IDLE = 0,
 +    STATE_WAITING_FOR_LOAD_START = 1,
 +    STATE_WAITING_FOR_LOAD_FINISH = 2,
 +    STATE_IOS5_POLLING_FOR_LOAD_START = 3,
 +    STATE_IOS5_POLLING_FOR_LOAD_FINISH = 4,
 +    STATE_CANCELLED = 5
 +} State;
 +
 +static NSString *stripFragment(NSString* url)
 +{
 +    NSRange r = [url rangeOfString:@"#"];
 +
 +    if (r.location == NSNotFound) {
 +        return url;
 +    }
 +    return [url substringToIndex:r.location];
 +}
 +
 +@implementation CDVUIWebViewDelegate
 +
 +- (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate
 +{
 +    self = [super init];
 +    if (self != nil) {
 +        _delegate = delegate;
 +        _loadCount = -1;
 +        _state = STATE_IDLE;
 +    }
 +    return self;
 +}
 +
- - (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest
- {
-     return [self request:newRequest isEqualToRequestAfterStrippingFragments:originalRequest];
- }
- 
 +- (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest
 +{
 +    if (originalRequest.URL && newRequest.URL) {
 +        NSString* originalRequestUrl = [originalRequest.URL absoluteString];
 +        NSString* newRequestUrl = [newRequest.URL absoluteString];
 +
 +        NSString* baseOriginalRequestUrl = stripFragment(originalRequestUrl);
 +        NSString* baseNewRequestUrl = stripFragment(newRequestUrl);
 +        return [baseOriginalRequestUrl isEqualToString:baseNewRequestUrl];
 +    }
 +
 +    return NO;
 +}
 +
 +- (BOOL)isPageLoaded:(UIWebView*)webView
 +{
 +    NSString* readyState = [webView stringByEvaluatingJavaScriptFromString:@"document.readyState"];
 +
 +    return [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
 +}
 +
 +- (BOOL)isJsLoadTokenSet:(UIWebView*)webView
 +{
 +    NSString* loadToken = [webView stringByEvaluatingJavaScriptFromString:@"window.__cordovaLoadToken"];
 +
 +    return [[NSString stringWithFormat:@"%ld", (long)_curLoadToken] isEqualToString:loadToken];
 +}
 +
 +- (void)setLoadToken:(UIWebView*)webView
 +{
 +    _curLoadToken += 1;
 +    [webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"window.__cordovaLoadToken=%ld", (long)_curLoadToken]];
 +}
 +
 +- (NSString*)evalForCurrentURL:(UIWebView*)webView
 +{
 +    return [webView stringByEvaluatingJavaScriptFromString:@"location.href"];
 +}
 +
 +- (void)pollForPageLoadStart:(UIWebView*)webView
 +{
 +    if (_state != STATE_IOS5_POLLING_FOR_LOAD_START) {
 +        return;
 +    }
 +    if (![self isJsLoadTokenSet:webView]) {
 +        VerboseLog(@"Polled for page load start. result = YES!");
 +        _state = STATE_IOS5_POLLING_FOR_LOAD_FINISH;
 +        [self setLoadToken:webView];
 +        if ([_delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
 +            [_delegate webViewDidStartLoad:webView];
 +        }
 +        [self pollForPageLoadFinish:webView];
 +    } else {
 +        VerboseLog(@"Polled for page load start. result = NO");
 +        // Poll only for 1 second, and then fall back on checking only when delegate methods are called.
 +        ++_loadStartPollCount;
 +        if (_loadStartPollCount < (1000 * .05)) {
 +            [self performSelector:@selector(pollForPageLoadStart:) withObject:webView afterDelay:.05];
 +        }
 +    }
 +}
 +
 +- (void)pollForPageLoadFinish:(UIWebView*)webView
 +{
 +    if (_state != STATE_IOS5_POLLING_FOR_LOAD_FINISH) {
 +        return;
 +    }
 +    if ([self isPageLoaded:webView]) {
 +        VerboseLog(@"Polled for page load finish. result = YES!");
 +        _state = STATE_IDLE;
 +        if ([_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
 +            [_delegate webViewDidFinishLoad:webView];
 +        }
 +    } else {
 +        VerboseLog(@"Polled for page load finish. result = NO");
 +        [self performSelector:@selector(pollForPageLoadFinish:) withObject:webView afterDelay:.05];
 +    }
 +}
 +
 +- (BOOL)shouldLoadRequest:(NSURLRequest*)request
 +{
 +    NSString* scheme = [[request URL] scheme];
 +
 +    if ([scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"tel"]) {
 +        return YES;
 +    }
 +
 +    return [NSURLConnection canHandleRequest:request];
 +}
 +
 +- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
 +{
 +    BOOL shouldLoad = YES;
 +
 +    if ([_delegate respondsToSelector:@selector(webView:shouldStartLoadWithRequest:navigationType:)]) {
 +        shouldLoad = [_delegate webView:webView shouldStartLoadWithRequest:request navigationType:navigationType];
 +    }
 +
 +    VerboseLog(@"webView shouldLoad=%d (before) state=%d loadCount=%d URL=%@", shouldLoad, _state, _loadCount, request.URL);
 +
 +    if (shouldLoad) {
 +        // When devtools refresh occurs, it blindly uses the same request object. If a history.replaceState() has occured, then
 +        // mainDocumentURL != URL even though it's a top-level navigation.
 +        BOOL isDevToolsRefresh = (request == webView.request);
 +        BOOL isTopLevelNavigation = isDevToolsRefresh || [request.URL isEqual:[request mainDocumentURL]];
 +        if (isTopLevelNavigation) {
 +            // Ignore hash changes that don't navigate to a different page.
 +            // webView.request does actually update when history.replaceState() gets called.
 +            if ([self request:request isEqualToRequestAfterStrippingFragments:webView.request]) {
 +                NSString* prevURL = [self evalForCurrentURL:webView];
 +                if ([prevURL isEqualToString:[request.URL absoluteString]]) {
 +                    VerboseLog(@"Page reload detected.");
 +                } else {
 +                    VerboseLog(@"Detected hash change shouldLoad");
 +                    return shouldLoad;
 +                }
 +            }
 +
 +            switch (_state) {
 +                case STATE_WAITING_FOR_LOAD_FINISH:
 +                    // Redirect case.
 +                    // We expect loadCount == 1.
 +                    if (_loadCount != 1) {
 +                        NSLog(@"CDVWebViewDelegate: Detected redirect when loadCount=%ld", (long)_loadCount);
 +                    }
 +                    break;
 +
 +                case STATE_IDLE:
 +                case STATE_IOS5_POLLING_FOR_LOAD_START:
 +                case STATE_CANCELLED:
 +                    // Page navigation start.
 +                    _loadCount = 0;
 +                    _state = STATE_WAITING_FOR_LOAD_START;
 +                    break;
 +
 +                default:
 +                    {
 +                        _loadCount = 0;
 +                        _state = STATE_WAITING_FOR_LOAD_START;
 +                        NSString* description = [NSString stringWithFormat:@"CDVWebViewDelegate: Navigation started when state=%ld", (long)_state];
 +                        NSLog(@"%@", description);
 +                        if ([_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
 +                            NSDictionary* errorDictionary = @{NSLocalizedDescriptionKey : description};
 +                            NSError* error = [[NSError alloc] initWithDomain:@"CDVUIWebViewDelegate" code:1 userInfo:errorDictionary];
 +                            [_delegate webView:webView didFailLoadWithError:error];
 +                        }
 +                    }
 +            }
 +        } else {
 +            // Deny invalid URLs so that we don't get the case where we go straight from
 +            // webViewShouldLoad -> webViewDidFailLoad (messes up _loadCount).
 +            shouldLoad = shouldLoad && [self shouldLoadRequest:request];
 +        }
 +        VerboseLog(@"webView shouldLoad=%d (after) isTopLevelNavigation=%d state=%d loadCount=%d", shouldLoad, isTopLevelNavigation, _state, _loadCount);
 +    }
 +    return shouldLoad;
 +}
 +
 +- (void)webViewDidStartLoad:(UIWebView*)webView
 +{
 +    VerboseLog(@"webView didStartLoad (before). state=%d loadCount=%d", _state, _loadCount);
 +    BOOL fireCallback = NO;
 +    switch (_state) {
 +        case STATE_IDLE:
 +            if (IsAtLeastiOSVersion(@"6.0")) {
 +                break;
 +            }
 +            // If history.go(-1) is used pre-iOS6, the shouldStartLoadWithRequest function is not called.
 +            // Without shouldLoad, we can't distinguish an iframe from a top-level navigation.
 +            // We could try to distinguish using [UIWebView canGoForward], but that's too much complexity,
 +            // and would work only on the first time it was used.
 +
 +            // Our work-around is to set a JS variable and poll until it disappears (from a navigation).
 +            _state = STATE_IOS5_POLLING_FOR_LOAD_START;
 +            _loadStartPollCount = 0;
 +            [self setLoadToken:webView];
 +            [self pollForPageLoadStart:webView];
 +            break;
 +
 +        case STATE_CANCELLED:
 +            fireCallback = YES;
 +            _state = STATE_WAITING_FOR_LOAD_FINISH;
 +            _loadCount += 1;
 +            break;
 +
 +        case STATE_WAITING_FOR_LOAD_START:
 +            if (_loadCount != 0) {
 +                NSLog(@"CDVWebViewDelegate: Unexpected loadCount in didStart. count=%ld", (long)_loadCount);
 +            }
 +            fireCallback = YES;
 +            _state = STATE_WAITING_FOR_LOAD_FINISH;
 +            _loadCount = 1;
 +            break;
 +
 +        case STATE_WAITING_FOR_LOAD_FINISH:
 +            _loadCount += 1;
 +            break;
 +
 +        case STATE_IOS5_POLLING_FOR_LOAD_START:
 +            [self pollForPageLoadStart:webView];
 +            break;
 +
 +        case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
 +            [self pollForPageLoadFinish:webView];
 +            break;
 +
 +        default:
 +            NSLog(@"CDVWebViewDelegate: Unexpected didStart with state=%ld loadCount=%ld", (long)_state, (long)_loadCount);
 +    }
 +    VerboseLog(@"webView didStartLoad (after). state=%d loadCount=%d fireCallback=%d", _state, _loadCount, fireCallback);
 +    if (fireCallback && [_delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
 +        [_delegate webViewDidStartLoad:webView];
 +    }
 +}
 +
 +- (void)webViewDidFinishLoad:(UIWebView*)webView
 +{
 +    VerboseLog(@"webView didFinishLoad (before). state=%d loadCount=%d", _state, _loadCount);
 +    BOOL fireCallback = NO;
 +    switch (_state) {
 +        case STATE_IDLE:
 +            break;
 +
 +        case STATE_WAITING_FOR_LOAD_START:
 +            NSLog(@"CDVWebViewDelegate: Unexpected didFinish while waiting for load start.");
 +            break;
 +
 +        case STATE_WAITING_FOR_LOAD_FINISH:
 +            if (_loadCount == 1) {
 +                fireCallback = YES;
 +                _state = STATE_IDLE;
 +            }
 +            _loadCount -= 1;
 +            break;
 +
 +        case STATE_IOS5_POLLING_FOR_LOAD_START:
 +            [self pollForPageLoadStart:webView];
 +            break;
 +
 +        case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
 +            [self pollForPageLoadFinish:webView];
 +            break;
 +    }
 +    VerboseLog(@"webView didFinishLoad (after). state=%d loadCount=%d fireCallback=%d", _state, _loadCount, fireCallback);
 +    if (fireCallback && [_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
 +        [_delegate webViewDidFinishLoad:webView];
 +    }
 +}
 +
 +- (void)webView:(UIWebView*)webView didFailLoadWithError:(NSError*)error
 +{
 +    VerboseLog(@"webView didFailLoad (before). state=%d loadCount=%d", _state, _loadCount);
 +    BOOL fireCallback = NO;
 +
 +    switch (_state) {
 +        case STATE_IDLE:
 +            break;
 +
 +        case STATE_WAITING_FOR_LOAD_START:
 +            if ([error code] == NSURLErrorCancelled) {
 +                _state = STATE_CANCELLED;
 +            } else {
 +                _state = STATE_IDLE;
 +            }
 +            fireCallback = YES;
 +            break;
 +
 +        case STATE_WAITING_FOR_LOAD_FINISH:
 +            if ([error code] != NSURLErrorCancelled) {
 +                if (_loadCount == 1) {
 +                    _state = STATE_IDLE;
 +                    fireCallback = YES;
 +                }
 +                _loadCount = -1;
 +            } else {
 +                fireCallback = YES;
 +                _state = STATE_CANCELLED;
 +                _loadCount -= 1;
 +            }
 +            break;
 +
 +        case STATE_IOS5_POLLING_FOR_LOAD_START:
 +            [self pollForPageLoadStart:webView];
 +            break;
 +
 +        case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
 +            [self pollForPageLoadFinish:webView];
 +            break;
 +    }
 +    VerboseLog(@"webView didFailLoad (after). state=%d loadCount=%d, fireCallback=%d", _state, _loadCount, fireCallback);
 +    if (fireCallback && [_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
 +        [_delegate webView:webView didFailLoadWithError:error];
 +    }
 +}
 +
 +@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e0dc7443/CordovaLib/cordova.js
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[16/43] ios commit: Moved CDVWebViewUIDelegate into Classes folder

Posted by sh...@apache.org.
Moved CDVWebViewUIDelegate into Classes folder


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

Branch: refs/heads/4.0.x
Commit: 4c0556bd611d3f93fa119592e2d16f37163b6925
Parents: 1a759ac
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Jul 17 16:48:13 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 15:37:43 2014 -0700

----------------------------------------------------------------------
 CordovaLib/CDVWebViewUIDelegate.h               |  35 ------
 CordovaLib/CDVWebViewUIDelegate.m               | 126 -------------------
 CordovaLib/Classes/CDVWebViewUIDelegate.h       |  35 ++++++
 CordovaLib/Classes/CDVWebViewUIDelegate.m       | 126 +++++++++++++++++++
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |   4 +-
 5 files changed, 163 insertions(+), 163 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c0556bd/CordovaLib/CDVWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/CDVWebViewUIDelegate.h b/CordovaLib/CDVWebViewUIDelegate.h
deleted file mode 100644
index 9ff2ac1..0000000
--- a/CordovaLib/CDVWebViewUIDelegate.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- 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.
- */
-
-#import <Foundation/Foundation.h>
-
-#ifdef __IPHONE_8_0
-    #import <WebKit/WebKit.h>
-#endif
-
-@interface CDVWebViewUIDelegate : NSObject
-#ifdef __IPHONE_8_0
-                                      <WKUIDelegate>
-#endif
-
-@property (nonatomic, copy) NSString* title;
-
-- (instancetype)initWithTitle:(NSString*)title;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c0556bd/CordovaLib/CDVWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CDVWebViewUIDelegate.m b/CordovaLib/CDVWebViewUIDelegate.m
deleted file mode 100644
index 6f98327..0000000
--- a/CordovaLib/CDVWebViewUIDelegate.m
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- 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.
- */
-
-#ifdef __IPHONE_8_0
-
-#import "CDVWebViewUIDelegate.h"
-
-    @implementation CDVWebViewUIDelegate
-
-    - (instancetype)initWithTitle:(NSString*)title
-    {
-        self = [super init];
-        if (self) {
-            self.title = title;
-        }
-
-        return self;
-    }
-
-    - (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
-        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:message
-                                                                preferredStyle:UIAlertControllerStyleAlert];
-
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-            {
-                completionHandler();
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
-
-    - (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
-        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:message
-                                                                preferredStyle:UIAlertControllerStyleAlert];
-
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-            {
-                completionHandler(YES);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                                                         style:UIAlertActionStyleDefault
-                                                       handler:^(UIAlertAction* action)
-            {
-                completionHandler(NO);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-        [alert addAction:cancel];
-
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
-
-    - (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
-              defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
-        completionHandler:(void (^)(NSString* result))completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:prompt
-                                                                preferredStyle:UIAlertControllerStyleAlert];
-
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-            {
-                completionHandler(((UITextField*)alert.textFields[0]).text);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                                                         style:UIAlertActionStyleDefault
-                                                       handler:^(UIAlertAction* action)
-            {
-                completionHandler(nil);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-        [alert addAction:cancel];
-
-        [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
-            textField.text = defaultText;
-        }];
-
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
-
-    @end
-#endif /* ifdef __IPHONE_8_0 */

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c0556bd/CordovaLib/Classes/CDVWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewUIDelegate.h b/CordovaLib/Classes/CDVWebViewUIDelegate.h
new file mode 100644
index 0000000..9ff2ac1
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewUIDelegate.h
@@ -0,0 +1,35 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+
+#ifdef __IPHONE_8_0
+    #import <WebKit/WebKit.h>
+#endif
+
+@interface CDVWebViewUIDelegate : NSObject
+#ifdef __IPHONE_8_0
+                                      <WKUIDelegate>
+#endif
+
+@property (nonatomic, copy) NSString* title;
+
+- (instancetype)initWithTitle:(NSString*)title;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c0556bd/CordovaLib/Classes/CDVWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewUIDelegate.m b/CordovaLib/Classes/CDVWebViewUIDelegate.m
new file mode 100644
index 0000000..6f98327
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewUIDelegate.m
@@ -0,0 +1,126 @@
+/*
+ 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.
+ */
+
+#ifdef __IPHONE_8_0
+
+#import "CDVWebViewUIDelegate.h"
+
+    @implementation CDVWebViewUIDelegate
+
+    - (instancetype)initWithTitle:(NSString*)title
+    {
+        self = [super init];
+        if (self) {
+            self.title = title;
+        }
+
+        return self;
+    }
+
+    - (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
+        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:message
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler();
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    - (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
+        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:message
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler(YES);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                                                         style:UIAlertActionStyleDefault
+                                                       handler:^(UIAlertAction* action)
+            {
+                completionHandler(NO);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+        [alert addAction:cancel];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    - (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
+              defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
+        completionHandler:(void (^)(NSString* result))completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:prompt
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler(((UITextField*)alert.textFields[0]).text);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                                                         style:UIAlertActionStyleDefault
+                                                       handler:^(UIAlertAction* action)
+            {
+                completionHandler(nil);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+        [alert addAction:cancel];
+
+        [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
+            textField.text = defaultText;
+        }];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    @end
+#endif /* ifdef __IPHONE_8_0 */

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c0556bd/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 941fa15..8d43b0b 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -100,8 +100,8 @@
 		68A32D7414103017006B237C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
 		7E14B5A61705050A0032169E /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVTimer.h; path = Classes/CDVTimer.h; sourceTree = "<group>"; };
 		7E14B5A71705050A0032169E /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVTimer.m; path = Classes/CDVTimer.m; sourceTree = "<group>"; };
-		7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVWebViewUIDelegate.h; sourceTree = "<group>"; };
-		7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWebViewUIDelegate.m; sourceTree = "<group>"; };
+		7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewUIDelegate.h; path = Classes/CDVWebViewUIDelegate.h; sourceTree = "<group>"; };
+		7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewUIDelegate.m; path = Classes/CDVWebViewUIDelegate.m; sourceTree = "<group>"; };
 		7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewPreferences.h; path = Classes/CDVWebViewPreferences.h; sourceTree = "<group>"; };
 		7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailabilityDeprecated.h; path = Classes/CDVAvailabilityDeprecated.h; sourceTree = "<group>"; };
 		7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewPreferences.m; path = Classes/CDVWebViewPreferences.m; sourceTree = "<group>"; };


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[02/43] ios commit: Moved CDVWebViewUIDelegate into Classes folder

Posted by sh...@apache.org.
Moved CDVWebViewUIDelegate into Classes folder


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

Branch: refs/heads/4.0.x
Commit: 28b4475070cd61587c8e7ac8e7f0102d8101367f
Parents: aa5d0e9
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Jul 17 16:48:13 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Jul 17 16:48:13 2014 -0700

----------------------------------------------------------------------
 CordovaLib/CDVWebViewUIDelegate.h               |  35 ------
 CordovaLib/CDVWebViewUIDelegate.m               | 126 -------------------
 CordovaLib/Classes/CDVWebViewUIDelegate.h       |  35 ++++++
 CordovaLib/Classes/CDVWebViewUIDelegate.m       | 126 +++++++++++++++++++
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |   4 +-
 5 files changed, 163 insertions(+), 163 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/28b44750/CordovaLib/CDVWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/CDVWebViewUIDelegate.h b/CordovaLib/CDVWebViewUIDelegate.h
deleted file mode 100644
index 9ff2ac1..0000000
--- a/CordovaLib/CDVWebViewUIDelegate.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- 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.
- */
-
-#import <Foundation/Foundation.h>
-
-#ifdef __IPHONE_8_0
-    #import <WebKit/WebKit.h>
-#endif
-
-@interface CDVWebViewUIDelegate : NSObject
-#ifdef __IPHONE_8_0
-                                      <WKUIDelegate>
-#endif
-
-@property (nonatomic, copy) NSString* title;
-
-- (instancetype)initWithTitle:(NSString*)title;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/28b44750/CordovaLib/CDVWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CDVWebViewUIDelegate.m b/CordovaLib/CDVWebViewUIDelegate.m
deleted file mode 100644
index 6f98327..0000000
--- a/CordovaLib/CDVWebViewUIDelegate.m
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- 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.
- */
-
-#ifdef __IPHONE_8_0
-
-#import "CDVWebViewUIDelegate.h"
-
-    @implementation CDVWebViewUIDelegate
-
-    - (instancetype)initWithTitle:(NSString*)title
-    {
-        self = [super init];
-        if (self) {
-            self.title = title;
-        }
-
-        return self;
-    }
-
-    - (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
-        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:message
-                                                                preferredStyle:UIAlertControllerStyleAlert];
-
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-            {
-                completionHandler();
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
-
-    - (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
-        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:message
-                                                                preferredStyle:UIAlertControllerStyleAlert];
-
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-            {
-                completionHandler(YES);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                                                         style:UIAlertActionStyleDefault
-                                                       handler:^(UIAlertAction* action)
-            {
-                completionHandler(NO);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-        [alert addAction:cancel];
-
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
-
-    - (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
-              defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
-        completionHandler:(void (^)(NSString* result))completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:prompt
-                                                                preferredStyle:UIAlertControllerStyleAlert];
-
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-            {
-                completionHandler(((UITextField*)alert.textFields[0]).text);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                                                         style:UIAlertActionStyleDefault
-                                                       handler:^(UIAlertAction* action)
-            {
-                completionHandler(nil);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-        [alert addAction:cancel];
-
-        [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
-            textField.text = defaultText;
-        }];
-
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
-
-    @end
-#endif /* ifdef __IPHONE_8_0 */

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/28b44750/CordovaLib/Classes/CDVWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewUIDelegate.h b/CordovaLib/Classes/CDVWebViewUIDelegate.h
new file mode 100644
index 0000000..9ff2ac1
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewUIDelegate.h
@@ -0,0 +1,35 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+
+#ifdef __IPHONE_8_0
+    #import <WebKit/WebKit.h>
+#endif
+
+@interface CDVWebViewUIDelegate : NSObject
+#ifdef __IPHONE_8_0
+                                      <WKUIDelegate>
+#endif
+
+@property (nonatomic, copy) NSString* title;
+
+- (instancetype)initWithTitle:(NSString*)title;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/28b44750/CordovaLib/Classes/CDVWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewUIDelegate.m b/CordovaLib/Classes/CDVWebViewUIDelegate.m
new file mode 100644
index 0000000..6f98327
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewUIDelegate.m
@@ -0,0 +1,126 @@
+/*
+ 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.
+ */
+
+#ifdef __IPHONE_8_0
+
+#import "CDVWebViewUIDelegate.h"
+
+    @implementation CDVWebViewUIDelegate
+
+    - (instancetype)initWithTitle:(NSString*)title
+    {
+        self = [super init];
+        if (self) {
+            self.title = title;
+        }
+
+        return self;
+    }
+
+    - (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
+        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:message
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler();
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    - (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
+        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:message
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler(YES);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                                                         style:UIAlertActionStyleDefault
+                                                       handler:^(UIAlertAction* action)
+            {
+                completionHandler(NO);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+        [alert addAction:cancel];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    - (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
+              defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
+        completionHandler:(void (^)(NSString* result))completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:prompt
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler(((UITextField*)alert.textFields[0]).text);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                                                         style:UIAlertActionStyleDefault
+                                                       handler:^(UIAlertAction* action)
+            {
+                completionHandler(nil);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+        [alert addAction:cancel];
+
+        [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
+            textField.text = defaultText;
+        }];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    @end
+#endif /* ifdef __IPHONE_8_0 */

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/28b44750/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index a2d5cc4..844db7b 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -101,8 +101,8 @@
 		68A32D7414103017006B237C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
 		7E14B5A61705050A0032169E /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVTimer.h; path = Classes/CDVTimer.h; sourceTree = "<group>"; };
 		7E14B5A71705050A0032169E /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVTimer.m; path = Classes/CDVTimer.m; sourceTree = "<group>"; };
-		7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVWebViewUIDelegate.h; sourceTree = "<group>"; };
-		7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWebViewUIDelegate.m; sourceTree = "<group>"; };
+		7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewUIDelegate.h; path = Classes/CDVWebViewUIDelegate.h; sourceTree = "<group>"; };
+		7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewUIDelegate.m; path = Classes/CDVWebViewUIDelegate.m; sourceTree = "<group>"; };
 		7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewPreferences.h; path = Classes/CDVWebViewPreferences.h; sourceTree = "<group>"; };
 		7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewPreferences.m; path = Classes/CDVWebViewPreferences.m; sourceTree = "<group>"; };
 		8220B5C316D5427E00EC3921 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[39/43] ios commit: CB-8621 Fix Q require in list-devices (Q -> q)

Posted by sh...@apache.org.
CB-8621 Fix Q require in list-devices (Q -> q)


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

Branch: refs/heads/4.0.x
Commit: ed272032878959c90eb28ccc1490e96fb7b69287
Parents: 4f02fca
Author: Marco Evangelista <ma...@gmail.com>
Authored: Fri Mar 6 12:59:27 2015 +0000
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Mar 6 09:10:15 2015 -0500

----------------------------------------------------------------------
 bin/templates/scripts/cordova/lib/list-devices | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ed272032/bin/templates/scripts/cordova/lib/list-devices
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/list-devices b/bin/templates/scripts/cordova/lib/list-devices
index a12abd7..ddeb0b5 100755
--- a/bin/templates/scripts/cordova/lib/list-devices
+++ b/bin/templates/scripts/cordova/lib/list-devices
@@ -21,7 +21,7 @@
 
 /*jshint node: true*/
 
-var Q = require('Q'),
+var Q = require('q'),
     exec = require('child_process').exec;
 
 /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[22/43] ios commit: Modularized CDVWebViewPreferences.

Posted by sh...@apache.org.
Modularized CDVWebViewPreferences.


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

Branch: refs/heads/4.0.x
Commit: 9ec77c098156d10b91771472b89cd6bc7f16fb4a
Parents: 4691066
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Nov 3 00:40:48 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Nov 3 00:40:48 2014 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVUIWebViewPreferences.h    |  29 ++
 CordovaLib/Classes/CDVUIWebViewPreferences.m    | 103 +++++++
 CordovaLib/Classes/CDVViewController.m          |   4 +-
 CordovaLib/Classes/CDVWKWebViewPreferences.h    |  29 ++
 CordovaLib/Classes/CDVWKWebViewPreferences.m    |  48 ++++
 CordovaLib/Classes/CDVWebViewPreferences.h      |  16 +-
 CordovaLib/Classes/CDVWebViewPreferences.m      | 276 +++----------------
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |  28 +-
 8 files changed, 280 insertions(+), 253 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9ec77c09/CordovaLib/Classes/CDVUIWebViewPreferences.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewPreferences.h b/CordovaLib/Classes/CDVUIWebViewPreferences.h
new file mode 100644
index 0000000..dd5caf9
--- /dev/null
+++ b/CordovaLib/Classes/CDVUIWebViewPreferences.h
@@ -0,0 +1,29 @@
+/*
+ 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.
+ */
+
+#import "CDVWebViewPreferences.h"
+#import <UIKit/UIKit.h>
+
+@interface CDVUIWebViewPreferences : CDVWebViewPreferences
+
+@property (nonatomic, weak) UIWebView* webView;
+
+- (instancetype)initWithWebView:(UIWebView*)webView settings:(NSDictionary*)settings;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9ec77c09/CordovaLib/Classes/CDVUIWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewPreferences.m b/CordovaLib/Classes/CDVUIWebViewPreferences.m
new file mode 100644
index 0000000..5eae9b1
--- /dev/null
+++ b/CordovaLib/Classes/CDVUIWebViewPreferences.m
@@ -0,0 +1,103 @@
+/*
+ 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.
+ */
+
+#import "CDVUIWebViewPreferences.h"
+
+@implementation CDVUIWebViewPreferences
+
+- (instancetype)initWithWebView:(UIWebView*)webView settings:(NSDictionary*)settings
+{
+    self = [super initWithSettings:settings];
+    if (self) {
+        self.webView = webView;
+    }
+
+    return self;
+}
+
+- (void)update
+{
+    self.webView.scalesPageToFit = [self boolSettingForKey:@"EnableViewportScale" defaultValue:NO];
+    self.webView.allowsInlineMediaPlayback = [self boolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:NO];
+    self.webView.mediaPlaybackRequiresUserAction = [self boolSettingForKey:@"MediaPlaybackRequiresUserAction" defaultValue:YES];
+    self.webView.mediaPlaybackAllowsAirPlay = [self boolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES];
+    self.webView.keyboardDisplayRequiresUserAction = [self boolSettingForKey:@"KeyboardDisplayRequiresUserAction" defaultValue:YES];
+    self.webView.suppressesIncrementalRendering = [self boolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO];
+    self.webView.gapBetweenPages = [self floatSettingForKey:@"GapBetweenPages" defaultValue:0.0];
+    self.webView.pageLength = [self floatSettingForKey:@"PageLength" defaultValue:0.0];
+
+    id prefObj = nil;
+
+    // By default, DisallowOverscroll is false (thus bounce is allowed)
+    BOOL bounceAllowed = !([self boolSettingForKey:@"DisallowOverscroll" defaultValue:NO]);
+
+    // prevent webView from bouncing
+    if (!bounceAllowed) {
+        if ([self.webView respondsToSelector:@selector(scrollView)]) {
+            ((UIScrollView*)[self.webView scrollView]).bounces = NO;
+        } else {
+            for (id subview in self.webView.subviews) {
+                if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
+                    ((UIScrollView*)subview).bounces = NO;
+                }
+            }
+        }
+    }
+
+    NSString* decelerationSetting = [self settingForKey:@"UIWebViewDecelerationSpeed"];
+    if (![@"fast" isEqualToString : decelerationSetting]) {
+        [self.webView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
+    }
+
+    NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage
+    prefObj = [self settingForKey:@"PaginationBreakingMode"];
+    if (prefObj != nil) {
+        NSArray* validValues = @[@"page", @"column"];
+        NSString* prefValue = [validValues objectAtIndex:0];
+
+        if ([prefObj isKindOfClass:[NSString class]]) {
+            prefValue = prefObj;
+        }
+
+        paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]];
+        if (paginationBreakingMode == NSNotFound) {
+            paginationBreakingMode = 0;
+        }
+    }
+    self.webView.paginationBreakingMode = paginationBreakingMode;
+
+    NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated
+    prefObj = [self settingForKey:@"PaginationMode"];
+    if (prefObj != nil) {
+        NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"];
+        NSString* prefValue = [validValues objectAtIndex:0];
+
+        if ([prefObj isKindOfClass:[NSString class]]) {
+            prefValue = prefObj;
+        }
+
+        paginationMode = [validValues indexOfObject:[prefValue lowercaseString]];
+        if (paginationMode == NSNotFound) {
+            paginationMode = 0;
+        }
+    }
+    self.webView.paginationMode = paginationMode;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9ec77c09/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 3456c17..be31591 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -299,8 +299,8 @@
         [self registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])];
     }
 
-    CDVWebViewPreferences* prefs = [[CDVWebViewPreferences alloc] initWithWebView:webView];
-    [prefs updateSettings:self.settings];
+    CDVWebViewPreferences* prefs = [[CDVWebViewPreferences alloc] initWithWebView:webView settings:self.settings];
+    [prefs update];
 
     if ([self.startupPluginNames count] > 0) {
         [CDVTimer start:@"TotalPluginStartup"];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9ec77c09/CordovaLib/Classes/CDVWKWebViewPreferences.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewPreferences.h b/CordovaLib/Classes/CDVWKWebViewPreferences.h
new file mode 100644
index 0000000..ffa357a
--- /dev/null
+++ b/CordovaLib/Classes/CDVWKWebViewPreferences.h
@@ -0,0 +1,29 @@
+/*
+ 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.
+ */
+
+#import "CDVWebViewPreferences.h"
+#import <WebKit/WebKit.h>
+
+@interface CDVWKWebViewPreferences : CDVWebViewPreferences
+
+@property (nonatomic, weak) WKWebView* webView;
+
+- (instancetype)initWithWebView:(WKWebView*)webView settings:(NSDictionary*)settings;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9ec77c09/CordovaLib/Classes/CDVWKWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewPreferences.m b/CordovaLib/Classes/CDVWKWebViewPreferences.m
new file mode 100644
index 0000000..6cf1a78
--- /dev/null
+++ b/CordovaLib/Classes/CDVWKWebViewPreferences.m
@@ -0,0 +1,48 @@
+/*
+ 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.
+ */
+
+#import "CDVWKWebViewPreferences.h"
+
+@implementation CDVWKWebViewPreferences
+
+- (instancetype)initWithWebView:(WKWebView*)webView settings:(NSDictionary*)settings
+{
+    self = [super initWithSettings:settings];
+    if (self) {
+        self.webView = webView;
+    }
+
+    return self;
+}
+
+- (void)update
+{
+    self.webView.configuration.preferences.minimumFontSize = [self floatSettingForKey:@"MinimumFontSize" defaultValue:0.0];
+    self.webView.configuration.allowsInlineMediaPlayback = [self boolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:NO];
+    self.webView.configuration.mediaPlaybackRequiresUserAction = [self boolSettingForKey:@"MediaPlaybackRequiresUserAction" defaultValue:YES];
+    self.webView.configuration.suppressesIncrementalRendering = [self boolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO];
+    self.webView.configuration.mediaPlaybackAllowsAirPlay = [self boolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES];
+
+    /*
+     self.webView.configuration.preferences.javaScriptEnabled = [self boolSettingForKey:@"JavaScriptEnabled" default:YES];
+     self.webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = [self boolSettingForKey:@"JavaScriptCanOpenWindowsAutomatically" default:NO];
+     */
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9ec77c09/CordovaLib/Classes/CDVWebViewPreferences.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.h b/CordovaLib/Classes/CDVWebViewPreferences.h
index 5058eef..a57748e 100644
--- a/CordovaLib/Classes/CDVWebViewPreferences.h
+++ b/CordovaLib/Classes/CDVWebViewPreferences.h
@@ -20,13 +20,17 @@
 #import <Foundation/Foundation.h>
 #import <UIKit/UIKit.h>
 
-@interface CDVWebViewPreferences: NSObject {
-    @private
-    __weak UIView* _webView;
-}
+@interface CDVWebViewPreferences : NSObject
 
-- (instancetype) initWithWebView:(UIView*)webView;
-- (void) updateSettings:(NSDictionary*)settings;
+@property (nonatomic, strong) NSDictionary* settings;
 
+- (instancetype)initWithWebView:(UIView*)webView settings:(NSDictionary*)settings;
+- (instancetype)initWithSettings:(NSDictionary*)settings;
+
+- (void)update;
+
+- (id)settingForKey:(NSString*)key;
+- (BOOL)boolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue;
+- (CGFloat)floatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue;
 
 @end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9ec77c09/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
index eb55c9d..4ca67cd 100644
--- a/CordovaLib/Classes/CDVWebViewPreferences.m
+++ b/CordovaLib/Classes/CDVWebViewPreferences.m
@@ -17,282 +17,72 @@
  under the License.
  */
 #import "CDVWebViewPreferences.h"
+#import "CDVWKWebViewPreferences.h"
+#import "CDVUIWebViewPreferences.h"
 #import "CDVAvailability.h"
 #import <objc/message.h>
-
-#ifdef __IPHONE_8_0
-    #import <WebKit/WebKit.h>
-#endif /* ifdef __IPHONE_8_0 */
+#import <WebKit/WebKit.h>
 
 @implementation CDVWebViewPreferences
 
-- (instancetype)initWithWebView:(UIView*)webView
+- (instancetype)initWithWebView:(UIView*)webView settings:(NSDictionary*)settings
 {
     self = [super init];
     if (self) {
-        Class wk_class = NSClassFromString(@"WKWebView");
-        if (!([webView isKindOfClass:wk_class] || [webView isKindOfClass:[UIWebView class]])) {
+        if ([webView isKindOfClass:[WKWebView class]]) {
+            return [[CDVWKWebViewPreferences alloc] initWithWebView:(WKWebView*)webView settings:settings];
+        } else if ([webView isKindOfClass:[UIWebView class]]) {
+            return [[CDVUIWebViewPreferences alloc] initWithWebView:(UIWebView*)webView settings:settings];
+        } else {
             return nil;
         }
-        _webView = webView;
     }
 
     return self;
 }
 
-- (void)updateSettings:(NSDictionary*)settings
+- (instancetype)initWithSettings:(NSDictionary*)settings
 {
-    Class wk_class = NSClassFromString(@"WKWebView");
-    SEL ui_sel = NSSelectorFromString(@"updateUIWebView:settings:");
-    SEL wk_sel = NSSelectorFromString(@"updateWKWebView:settings:");
-
-    __weak id weakSelf = self;
+    self = [super init];
+    if (self) {
+        self.settings = settings;
+    }
 
-    dispatch_block_t invoke = ^(void) {
-        if ([_webView isKindOfClass:[UIWebView class]] && [weakSelf respondsToSelector:ui_sel]) {
-            ((void (*)(id, SEL, id, id))objc_msgSend)(weakSelf, ui_sel, _webView, settings);
-        } else if ([_webView isKindOfClass:wk_class] && [weakSelf respondsToSelector:wk_sel]) {
-            ((void (*)(id, SEL, id, id))objc_msgSend)(weakSelf, wk_sel, _webView, settings);
-        }
-    };
+    return self;
+}
 
-    // UIKit operations have to be on the main thread.
-    // perform a synchronous invoke on the main thread without deadlocking
-    if ([NSThread isMainThread]) {
-        invoke();
-    } else {
-        dispatch_sync(dispatch_get_main_queue(), invoke);
-    }
+- (void)update
+{
+    [NSException raise:@"Invoked abstract method" format:@"Invoked abstract method"];
 }
 
-- (id)cordovaSettings:(NSDictionary*)settings forKey:(NSString*)key
+- (id)settingForKey:(NSString*)key
 {
-    return [settings objectForKey:[key lowercaseString]];
+    return [self.settings objectForKey:[key lowercaseString]];
 }
 
-- (void)updateUIWebView:(UIWebView*)theWebView settings:(NSDictionary*)settings
+- (BOOL)boolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue
 {
-    BOOL scalesPageToFit = NO; // default
-    id prefObj = [self cordovaSettings:settings forKey:@"EnableViewportScale"];
+    BOOL value = defaultValue;
+    id prefObj = [self settingForKey:key];
 
     if (prefObj != nil) {
-        scalesPageToFit = [(NSNumber*)prefObj boolValue];
+        value = [(NSNumber*)prefObj boolValue];
     }
-    theWebView.scalesPageToFit = scalesPageToFit;
 
-    BOOL allowInlineMediaPlayback = NO; // default
-    prefObj = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
-    if (prefObj != nil) {
-        allowInlineMediaPlayback = [(NSNumber*)prefObj boolValue];
-    }
-    theWebView.allowsInlineMediaPlayback = allowInlineMediaPlayback;
+    return value;
+}
 
-    BOOL mediaPlaybackRequiresUserAction = YES;  // default
-    prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
-    if (prefObj != nil) {
-        mediaPlaybackRequiresUserAction = [(NSNumber*)prefObj boolValue];
-    }
-    theWebView.mediaPlaybackRequiresUserAction = mediaPlaybackRequiresUserAction;
+- (CGFloat)floatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue
+{
+    CGFloat value = defaultValue;
+    id prefObj = [self settingForKey:key];
 
-    BOOL mediaPlaybackAllowsAirPlay = YES;  // default
-    prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackAllowsAirPlay"];
     if (prefObj != nil) {
-        mediaPlaybackAllowsAirPlay = [(NSNumber*)prefObj boolValue];
-    }
-    theWebView.mediaPlaybackAllowsAirPlay = mediaPlaybackAllowsAirPlay;
-
-    // By default, overscroll bouncing is allowed.
-    // UIWebViewBounce has been renamed to DisallowOverscroll, but both are checked.
-    BOOL bounceAllowed = YES;
-    NSNumber* disallowOverscroll = [self cordovaSettings:settings forKey:@"DisallowOverscroll"];
-    if (disallowOverscroll == nil) {
-        NSNumber* bouncePreference = [self cordovaSettings:settings forKey:@"UIWebViewBounce"];
-        bounceAllowed = (bouncePreference == nil || [bouncePreference boolValue]);
-    } else {
-        bounceAllowed = ![disallowOverscroll boolValue];
+        value = [prefObj floatValue];
     }
 
-    // prevent webView from bouncing
-    // based on the DisallowOverscroll/UIWebViewBounce key in config.xml
-    if (!bounceAllowed) {
-        if ([theWebView respondsToSelector:@selector(scrollView)]) {
-            ((UIScrollView*)[theWebView scrollView]).bounces = NO;
-        } else {
-            for (id subview in theWebView.subviews) {
-                if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
-                    ((UIScrollView*)subview).bounces = NO;
-                }
-            }
-        }
-    }
-
-    NSString* decelerationSetting = [self cordovaSettings:settings forKey:@"UIWebViewDecelerationSpeed"];
-    if (![@"fast" isEqualToString : decelerationSetting]) {
-        [theWebView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
-    }
-
-    /*
-     * iOS 6.0 UIWebView properties
-     */
-    if (IsAtLeastiOSVersion(@"6.0")) {
-        BOOL keyboardDisplayRequiresUserAction = YES; // KeyboardDisplayRequiresUserAction - defaults to YES
-        if ([self cordovaSettings:settings forKey:@"KeyboardDisplayRequiresUserAction"] != nil) {
-            if ([self cordovaSettings:settings forKey:@"KeyboardDisplayRequiresUserAction"]) {
-                keyboardDisplayRequiresUserAction = [(NSNumber*)[self cordovaSettings:settings forKey:@"KeyboardDisplayRequiresUserAction"] boolValue];
-            }
-        }
-
-        // property check for compiling under iOS < 6
-        if ([theWebView respondsToSelector:@selector(setKeyboardDisplayRequiresUserAction:)]) {
-            [theWebView setValue:[NSNumber numberWithBool:keyboardDisplayRequiresUserAction] forKey:@"keyboardDisplayRequiresUserAction"];
-        }
-
-        BOOL suppressesIncrementalRendering = NO; // SuppressesIncrementalRendering - defaults to NO
-        if ([self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"] != nil) {
-            if ([self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"]) {
-                suppressesIncrementalRendering = [(NSNumber*)[self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"] boolValue];
-            }
-        }
-
-        // property check for compiling under iOS < 6
-        if ([theWebView respondsToSelector:@selector(setSuppressesIncrementalRendering:)]) {
-            [theWebView setValue:[NSNumber numberWithBool:suppressesIncrementalRendering] forKey:@"suppressesIncrementalRendering"];
-        }
-    }
-
-    /*
-     * iOS 7.0 UIWebView properties
-     */
-    if (IsAtLeastiOSVersion(@"7.0")) {
-        SEL ios7sel = nil;
-        id prefObj = nil;
-
-        CGFloat gapBetweenPages = 0.0; // default
-        prefObj = [self cordovaSettings:settings forKey:@"GapBetweenPages"];
-        if (prefObj != nil) {
-            gapBetweenPages = [prefObj floatValue];
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setGapBetweenPages:");
-        if ([theWebView respondsToSelector:ios7sel]) {
-            [theWebView setValue:[NSNumber numberWithFloat:gapBetweenPages] forKey:@"gapBetweenPages"];
-        }
-
-        CGFloat pageLength = 0.0; // default
-        prefObj = [self cordovaSettings:settings forKey:@"PageLength"];
-        if (prefObj != nil) {
-            pageLength = [[self cordovaSettings:settings forKey:@"PageLength"] floatValue];
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setPageLength:");
-        if ([theWebView respondsToSelector:ios7sel]) {
-            [theWebView setValue:[NSNumber numberWithBool:pageLength] forKey:@"pageLength"];
-        }
-
-        NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage
-        prefObj = [self cordovaSettings:settings forKey:@"PaginationBreakingMode"];
-        if (prefObj != nil) {
-            NSArray* validValues = @[@"page", @"column"];
-            NSString* prefValue = [validValues objectAtIndex:0];
-
-            if ([prefObj isKindOfClass:[NSString class]]) {
-                prefValue = prefObj;
-            }
-
-            paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]];
-            if (paginationBreakingMode == NSNotFound) {
-                paginationBreakingMode = 0;
-            }
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setPaginationBreakingMode:");
-        if ([theWebView respondsToSelector:ios7sel]) {
-            [theWebView setValue:[NSNumber numberWithInteger:paginationBreakingMode] forKey:@"paginationBreakingMode"];
-        }
-
-        NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated
-        prefObj = [self cordovaSettings:settings forKey:@"PaginationMode"];
-        if (prefObj != nil) {
-            NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"];
-            NSString* prefValue = [validValues objectAtIndex:0];
-
-            if ([prefObj isKindOfClass:[NSString class]]) {
-                prefValue = prefObj;
-            }
-
-            paginationMode = [validValues indexOfObject:[prefValue lowercaseString]];
-            if (paginationMode == NSNotFound) {
-                paginationMode = 0;
-            }
-        }
-
-        // property check for compiling under iOS < 7
-        ios7sel = NSSelectorFromString(@"setPaginationMode:");
-        if ([theWebView respondsToSelector:ios7sel]) {
-            [theWebView setValue:[NSNumber numberWithInteger:paginationMode] forKey:@"paginationMode"];
-        }
-    }
+    return value;
 }
 
-#ifdef __IPHONE_8_0
-
-    - (void)updateWKWebView:(WKWebView*)theWebView settings:(NSDictionary*)settings
-    {
-        id prefObj = nil;
-
-        CGFloat minimumFontSize = 0.0; // default
-
-        prefObj = [self cordovaSettings:settings forKey:@"MinimumFontSize"];
-        if (prefObj != nil) {
-            minimumFontSize = [[self cordovaSettings:settings forKey:@"MinimumFontSize"] floatValue];
-        }
-        theWebView.configuration.preferences.minimumFontSize = minimumFontSize;
-
-        BOOL allowInlineMediaPlayback = NO; // default
-        prefObj = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
-        if (prefObj != nil) {
-            allowInlineMediaPlayback = [(NSNumber*)prefObj boolValue];
-        }
-        theWebView.configuration.allowsInlineMediaPlayback = allowInlineMediaPlayback;
-
-        BOOL mediaPlaybackRequiresUserAction = YES;  // default
-        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
-        if (prefObj != nil) {
-            mediaPlaybackRequiresUserAction = [(NSNumber*)prefObj boolValue];
-        }
-        theWebView.configuration.mediaPlaybackRequiresUserAction = mediaPlaybackRequiresUserAction;
-
-        BOOL suppressesIncrementalRendering = NO; // default
-        prefObj = [self cordovaSettings:settings forKey:@"SuppressesIncrementalRendering"];
-        if (prefObj != nil) {
-            suppressesIncrementalRendering = [(NSNumber*)prefObj boolValue];
-        }
-        theWebView.configuration.suppressesIncrementalRendering = suppressesIncrementalRendering;
-
-        BOOL mediaPlaybackAllowsAirPlay = YES;  // default
-        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackAllowsAirPlay"];
-        if (prefObj != nil) {
-            mediaPlaybackAllowsAirPlay = [(NSNumber*)prefObj boolValue];
-        }
-        theWebView.configuration.mediaPlaybackAllowsAirPlay = mediaPlaybackAllowsAirPlay;
-
-        /*
-        BOOL javaScriptEnabled = YES;  // default value
-        if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {
-            javaScriptEnabled = [(NSNumber*)[self cordovaSettings:settings forKey:@"JavaScriptEnabled"] boolValue];
-        }
-        theWebView.configuration.preferences.javaScriptEnabled = javaScriptEnabled;
-
-        BOOL javaScriptCanOpenWindowsAutomatically = NO;  // default value
-        if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {
-            javaScriptCanOpenWindowsAutomatically = [(NSNumber*)[self cordovaSettings:settings forKey:@"JavaScriptEnabled"] boolValue];
-        }
-        theWebView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = javaScriptCanOpenWindowsAutomatically;
-         */
-    }
-#endif /* ifdef __IPHONE_8_0 */
-
 @end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9ec77c09/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 8e3c7a6..9ce87d3 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -24,6 +24,10 @@
 		30C684821406CB38004C1A8E /* CDVWhitelist.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C6847F1406CB38004C1A8E /* CDVWhitelist.m */; };
 		30C684941407044B004C1A8E /* CDVURLProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 30C684921407044A004C1A8E /* CDVURLProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		30C684961407044B004C1A8E /* CDVURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C684931407044A004C1A8E /* CDVURLProtocol.m */; };
+		30CD6C631A07681E00522A22 /* CDVUIWebViewPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 30CD6C611A07681E00522A22 /* CDVUIWebViewPreferences.h */; };
+		30CD6C641A07681E00522A22 /* CDVUIWebViewPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CD6C621A07681E00522A22 /* CDVUIWebViewPreferences.m */; };
+		30CD6C681A0769F900522A22 /* CDVWKWebViewPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CD6C661A0769F900522A22 /* CDVWKWebViewPreferences.m */; };
+		30CD6C691A0769F900522A22 /* CDVWKWebViewPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 30CD6C671A0769F900522A22 /* CDVWKWebViewPreferences.h */; };
 		30E33AF213A7E24B00594D64 /* CDVPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E33AF013A7E24B00594D64 /* CDVPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E33AF113A7E24B00594D64 /* CDVPlugin.m */; };
 		30E563CF13E217EC00C949AA /* NSMutableArray+QueueAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -79,6 +83,10 @@
 		30C6847F1406CB38004C1A8E /* CDVWhitelist.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWhitelist.m; path = Classes/CDVWhitelist.m; sourceTree = "<group>"; };
 		30C684921407044A004C1A8E /* CDVURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVURLProtocol.h; path = Classes/CDVURLProtocol.h; sourceTree = "<group>"; };
 		30C684931407044A004C1A8E /* CDVURLProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVURLProtocol.m; path = Classes/CDVURLProtocol.m; sourceTree = "<group>"; };
+		30CD6C611A07681E00522A22 /* CDVUIWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVUIWebViewPreferences.h; path = Classes/CDVUIWebViewPreferences.h; sourceTree = "<group>"; };
+		30CD6C621A07681E00522A22 /* CDVUIWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUIWebViewPreferences.m; path = Classes/CDVUIWebViewPreferences.m; sourceTree = "<group>"; };
+		30CD6C661A0769F900522A22 /* CDVWKWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWKWebViewPreferences.m; path = Classes/CDVWKWebViewPreferences.m; sourceTree = "<group>"; };
+		30CD6C671A0769F900522A22 /* CDVWKWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWKWebViewPreferences.h; path = Classes/CDVWKWebViewPreferences.h; sourceTree = "<group>"; };
 		30E33AF013A7E24B00594D64 /* CDVPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVPlugin.h; path = Classes/CDVPlugin.h; sourceTree = "<group>"; };
 		30E33AF113A7E24B00594D64 /* CDVPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVPlugin.m; path = Classes/CDVPlugin.m; sourceTree = "<group>"; };
 		30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSMutableArray+QueueAdditions.h"; path = "Classes/NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; };
@@ -182,14 +190,13 @@
 		3054098714B77FF3009841CA /* Cleaver */ = {
 			isa = PBXGroup;
 			children = (
+				30CD6C651A0768DA00522A22 /* Preferences */,
 				F858FBC4166009A8007DA594 /* CDVConfigParser.h */,
 				F858FBC5166009A8007DA594 /* CDVConfigParser.m */,
 				8852C43614B65FD800F0E735 /* CDVViewController.h */,
 				8852C43714B65FD800F0E735 /* CDVViewController.m */,
 				EB3B3545161CB44D003DBE7D /* CDVCommandQueue.h */,
 				EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */,
-				7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */,
-				7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */,
 				302D72F919554BFC0028C99F /* CDVWebViewProxy.h */,
 				302D72FA19554BFC0028C99F /* CDVWebViewProxy.m */,
 				7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */,
@@ -198,6 +205,19 @@
 			name = Cleaver;
 			sourceTree = "<group>";
 		};
+		30CD6C651A0768DA00522A22 /* Preferences */ = {
+			isa = PBXGroup;
+			children = (
+				30CD6C671A0769F900522A22 /* CDVWKWebViewPreferences.h */,
+				30CD6C661A0769F900522A22 /* CDVWKWebViewPreferences.m */,
+				30CD6C611A07681E00522A22 /* CDVUIWebViewPreferences.h */,
+				30CD6C621A07681E00522A22 /* CDVUIWebViewPreferences.m */,
+				7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */,
+				7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */,
+			);
+			name = Preferences;
+			sourceTree = "<group>";
+		};
 		32C88DFF0371C24200C91783 /* Other Sources */ = {
 			isa = PBXGroup;
 			children = (
@@ -292,7 +312,9 @@
 				7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */,
 				3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */,
 				3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */,
+				30CD6C691A0769F900522A22 /* CDVWKWebViewPreferences.h in Headers */,
 				EBA3557315ABD38C00F4DE24 /* NSArray+Comparisons.h in Headers */,
+				30CD6C631A07681E00522A22 /* CDVUIWebViewPreferences.h in Headers */,
 				EB3B3547161CB44D003DBE7D /* CDVCommandQueue.h in Headers */,
 				EB3B357C161F2A45003DBE7D /* CDVCommandDelegateImpl.h in Headers */,
 				1B701028177A61CF00AE11F4 /* CDVShared.h in Headers */,
@@ -376,7 +398,9 @@
 				3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */,
 				EBA3557515ABD38C00F4DE24 /* NSArray+Comparisons.m in Sources */,
 				EB3B3548161CB44D003DBE7D /* CDVCommandQueue.m in Sources */,
+				30CD6C681A0769F900522A22 /* CDVWKWebViewPreferences.m in Sources */,
 				EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */,
+				30CD6C641A07681E00522A22 /* CDVUIWebViewPreferences.m in Sources */,
 				F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */,
 				30F3930C169F839700B22307 /* CDVJSON.m in Sources */,
 				7E785B9B196F508900ABBDC8 /* CDVWebViewUIDelegate.m in Sources */,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[43/43] ios commit: Merge branch 'wkwebview' into 4.0.x

Posted by sh...@apache.org.
Merge branch 'wkwebview' into 4.0.x


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

Branch: refs/heads/4.0.x
Commit: ef66b33cb4f320bcc071ef233c7a96d874fbe05c
Parents: c0085a8 270002c
Author: Shazron Abdullah <sh...@gmail.com>
Authored: Fri Mar 6 16:11:37 2015 -0800
Committer: Shazron Abdullah <sh...@gmail.com>
Committed: Fri Mar 6 16:11:37 2015 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDV.h                        |   3 +-
 CordovaLib/Classes/CDVAvailability.h            |   3 +-
 CordovaLib/Classes/CDVCommandDelegate.h         |   3 +
 CordovaLib/Classes/CDVCommandDelegateImpl.m     |  23 +-
 CordovaLib/Classes/CDVCommandQueue.m            |  33 +-
 CordovaLib/Classes/CDVHandleOpenURL.m           |  30 +-
 CordovaLib/Classes/CDVPlugin.h                  |  17 +-
 CordovaLib/Classes/CDVPlugin.m                  |  48 ++-
 CordovaLib/Classes/CDVPluginResult.m            |   2 +-
 CordovaLib/Classes/CDVUIWebViewDelegate.h       |  41 ++
 CordovaLib/Classes/CDVUIWebViewDelegate.m       | 412 +++++++++++++++++++
 CordovaLib/Classes/CDVUIWebViewEngine.h         |  27 ++
 CordovaLib/Classes/CDVUIWebViewEngine.m         | 181 ++++++++
 CordovaLib/Classes/CDVViewController.h          |   8 +-
 CordovaLib/Classes/CDVViewController.m          | 309 +++++---------
 CordovaLib/Classes/CDVWebViewDelegate.h         |  41 --
 CordovaLib/Classes/CDVWebViewDelegate.m         | 412 -------------------
 CordovaLib/Classes/CDVWebViewEngineProtocol.h   |  39 ++
 .../Classes/NSDictionary+CordovaPreferences.h   |  35 ++
 .../Classes/NSDictionary+CordovaPreferences.m   |  63 +++
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |  57 ++-
 CordovaLib/cordova.js                           |  10 +-
 .../project/__CLI__.xcodeproj/project.pbxproj   |   4 +
 .../__NON-CLI__.xcodeproj/project.pbxproj       |   4 +
 bin/templates/project/www/index.html            |   2 +-
 bin/templates/scripts/cordova/lib/list-devices  |   2 +-
 tests/CordovaLibTests/CDVStartPageTests.m       |  14 +-
 tests/CordovaLibTests/CDVUserAgentTest.m        |  52 ++-
 tests/CordovaLibTests/CDVWebViewDelegateTests.m |  10 +-
 tests/CordovaLibTests/CDVWebViewTest.m          |   6 +-
 30 files changed, 1132 insertions(+), 759 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ef66b33c/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDV.h
index fa61a72,146e57b..7d5ec3f
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@@ -19,16 -19,29 +19,17 @@@
  
  #import "CDVAvailability.h"
  #import "CDVAvailabilityDeprecated.h"
 +#import "CDVPlugin.h"
 +#import "CDVPluginResult.h"
 +#import "CDVViewController.h"
  #import "CDVCommandDelegate.h"
 -#import "CDVCommandDelegateImpl.h"
 -#import "CDVCommandQueue.h"
 -#import "CDVConfigParser.h"
 -#import "CDVDebug.h"
 +#import "CDVURLProtocol.h"
  #import "CDVInvokedUrlCommand.h"
 -#import "CDVJSON.h"
 +#import "CDVWhitelist.h"
  #import "CDVLocalStorage.h"
+ #import "CDVPlugin.h"
+ #import "CDVPluginResult.h"
  #import "CDVScreenOrientationDelegate.h"
 -#import "CDVShared.h"
  #import "CDVTimer.h"
 -#import "CDVUIWebViewDelegate.h"
 -#import "CDVUIWebViewEngine.h"
 -#import "CDVURLProtocol.h"
  #import "CDVUserAgentUtil.h"
- #import "CDVWebViewDelegate.h"
 -#import "CDVViewController.h"
 -#import "CDVWebViewEngineProtocol.h"
 -#import "CDVWhitelist.h"
 -#import "NSArray+Comparisons.h"
  #import "NSData+Base64.h"
 -#import "NSDictionary+CordovaPreferences.h"
 -#import "NSDictionary+Extensions.h"
 -#import "NSMutableArray+QueueAdditions.h"
 -#import "UIDevice+Extensions.h"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ef66b33c/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ef66b33c/CordovaLib/Classes/CDVUIWebViewDelegate.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVUIWebViewDelegate.m
index 0000000,929138f..a248245
mode 000000,100644..100644
--- a/CordovaLib/Classes/CDVUIWebViewDelegate.m
+++ b/CordovaLib/Classes/CDVUIWebViewDelegate.m
@@@ -1,0 -1,411 +1,412 @@@
+ /*
+  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.
+  */
+ 
+ //
+ // Testing shows:
+ //
+ // In all cases, webView.request.URL is the previous page's URL (or empty) during the didStartLoad callback.
+ // When loading a page with a redirect:
+ // 1. shouldStartLoading (requestURL is target page)
+ // 2. didStartLoading
+ // 3. shouldStartLoading (requestURL is redirect target)
+ // 4. didFinishLoad (request.URL is redirect target)
+ //
+ // Note the lack of a second didStartLoading **
+ //
+ // When loading a page with iframes:
+ // 1. shouldStartLoading (requestURL is main page)
+ // 2. didStartLoading
+ // 3. shouldStartLoading (requestURL is one of the iframes)
+ // 4. didStartLoading
+ // 5. didFinishLoad
+ // 6. didFinishLoad
+ //
+ // Note there is no way to distinguish which didFinishLoad maps to which didStartLoad **
+ //
+ // Loading a page by calling window.history.go(-1):
+ // 1. didStartLoading
+ // 2. didFinishLoad
+ //
+ // Note the lack of a shouldStartLoading call **
+ // Actually - this is fixed on iOS6. iOS6 has a shouldStart. **
+ //
+ // Loading a page by calling location.reload()
+ // 1. shouldStartLoading
+ // 2. didStartLoading
+ // 3. didFinishLoad
+ //
+ // Loading a page with an iframe that fails to load:
+ // 1. shouldStart (main page)
+ // 2. didStart
+ // 3. shouldStart (iframe)
+ // 4. didStart
+ // 5. didFailWithError
+ // 6. didFinish
+ //
+ // Loading a page with an iframe that fails to load due to an invalid URL:
+ // 1. shouldStart (main page)
+ // 2. didStart
+ // 3. shouldStart (iframe)
+ // 5. didFailWithError
+ // 6. didFinish
+ //
+ // This case breaks our logic since there is a missing didStart. To prevent this,
+ // we check URLs in shouldStart and return NO if they are invalid.
+ //
+ // Loading a page with an invalid URL
+ // 1. shouldStart (main page)
+ // 2. didFailWithError
+ //
+ // TODO: Record order when page is re-navigated before the first navigation finishes.
+ //
+ 
+ #import "CDVUIWebViewDelegate.h"
+ 
+ // #define VerboseLog NSLog
 -#define VerboseLog(...) do {} while (0)
++#define VerboseLog(...) do { \
++} while (0)
+ 
+ typedef enum {
+     STATE_IDLE = 0,
+     STATE_WAITING_FOR_LOAD_START = 1,
+     STATE_WAITING_FOR_LOAD_FINISH = 2,
+     STATE_IOS5_POLLING_FOR_LOAD_START = 3,
+     STATE_IOS5_POLLING_FOR_LOAD_FINISH = 4,
+     STATE_CANCELLED = 5
+ } State;
+ 
+ static NSString *stripFragment(NSString* url)
+ {
+     NSRange r = [url rangeOfString:@"#"];
+ 
+     if (r.location == NSNotFound) {
+         return url;
+     }
+     return [url substringToIndex:r.location];
+ }
+ 
+ @implementation CDVUIWebViewDelegate
+ 
+ - (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate
+ {
+     self = [super init];
+     if (self != nil) {
+         _delegate = delegate;
+         _loadCount = -1;
+         _state = STATE_IDLE;
+     }
+     return self;
+ }
+ 
+ - (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest
+ {
+     if (originalRequest.URL && newRequest.URL) {
+         NSString* originalRequestUrl = [originalRequest.URL absoluteString];
+         NSString* newRequestUrl = [newRequest.URL absoluteString];
+ 
+         NSString* baseOriginalRequestUrl = stripFragment(originalRequestUrl);
+         NSString* baseNewRequestUrl = stripFragment(newRequestUrl);
+         return [baseOriginalRequestUrl isEqualToString:baseNewRequestUrl];
+     }
+ 
+     return NO;
+ }
+ 
+ - (BOOL)isPageLoaded:(UIWebView*)webView
+ {
+     NSString* readyState = [webView stringByEvaluatingJavaScriptFromString:@"document.readyState"];
+ 
+     return [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
+ }
+ 
+ - (BOOL)isJsLoadTokenSet:(UIWebView*)webView
+ {
+     NSString* loadToken = [webView stringByEvaluatingJavaScriptFromString:@"window.__cordovaLoadToken"];
+ 
+     return [[NSString stringWithFormat:@"%ld", (long)_curLoadToken] isEqualToString:loadToken];
+ }
+ 
+ - (void)setLoadToken:(UIWebView*)webView
+ {
+     _curLoadToken += 1;
+     [webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"window.__cordovaLoadToken=%ld", (long)_curLoadToken]];
+ }
+ 
+ - (NSString*)evalForCurrentURL:(UIWebView*)webView
+ {
+     return [webView stringByEvaluatingJavaScriptFromString:@"location.href"];
+ }
+ 
+ - (void)pollForPageLoadStart:(UIWebView*)webView
+ {
+     if (_state != STATE_IOS5_POLLING_FOR_LOAD_START) {
+         return;
+     }
+     if (![self isJsLoadTokenSet:webView]) {
+         VerboseLog(@"Polled for page load start. result = YES!");
+         _state = STATE_IOS5_POLLING_FOR_LOAD_FINISH;
+         [self setLoadToken:webView];
+         if ([_delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
+             [_delegate webViewDidStartLoad:webView];
+         }
+         [self pollForPageLoadFinish:webView];
+     } else {
+         VerboseLog(@"Polled for page load start. result = NO");
+         // Poll only for 1 second, and then fall back on checking only when delegate methods are called.
+         ++_loadStartPollCount;
+         if (_loadStartPollCount < (1000 * .05)) {
+             [self performSelector:@selector(pollForPageLoadStart:) withObject:webView afterDelay:.05];
+         }
+     }
+ }
+ 
+ - (void)pollForPageLoadFinish:(UIWebView*)webView
+ {
+     if (_state != STATE_IOS5_POLLING_FOR_LOAD_FINISH) {
+         return;
+     }
+     if ([self isPageLoaded:webView]) {
+         VerboseLog(@"Polled for page load finish. result = YES!");
+         _state = STATE_IDLE;
+         if ([_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
+             [_delegate webViewDidFinishLoad:webView];
+         }
+     } else {
+         VerboseLog(@"Polled for page load finish. result = NO");
+         [self performSelector:@selector(pollForPageLoadFinish:) withObject:webView afterDelay:.05];
+     }
+ }
+ 
+ - (BOOL)shouldLoadRequest:(NSURLRequest*)request
+ {
+     NSString* scheme = [[request URL] scheme];
+ 
+     if ([scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"tel"]) {
+         return YES;
+     }
+ 
+     return [NSURLConnection canHandleRequest:request];
+ }
+ 
+ - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
+ {
+     BOOL shouldLoad = YES;
+ 
+     if ([_delegate respondsToSelector:@selector(webView:shouldStartLoadWithRequest:navigationType:)]) {
+         shouldLoad = [_delegate webView:webView shouldStartLoadWithRequest:request navigationType:navigationType];
+     }
+ 
+     VerboseLog(@"webView shouldLoad=%d (before) state=%d loadCount=%d URL=%@", shouldLoad, _state, _loadCount, request.URL);
+ 
+     if (shouldLoad) {
+         // When devtools refresh occurs, it blindly uses the same request object. If a history.replaceState() has occured, then
+         // mainDocumentURL != URL even though it's a top-level navigation.
+         BOOL isDevToolsRefresh = (request == webView.request);
+         BOOL isTopLevelNavigation = isDevToolsRefresh || [request.URL isEqual:[request mainDocumentURL]];
+         if (isTopLevelNavigation) {
+             // Ignore hash changes that don't navigate to a different page.
+             // webView.request does actually update when history.replaceState() gets called.
+             if ([self request:request isEqualToRequestAfterStrippingFragments:webView.request]) {
+                 NSString* prevURL = [self evalForCurrentURL:webView];
+                 if ([prevURL isEqualToString:[request.URL absoluteString]]) {
+                     VerboseLog(@"Page reload detected.");
+                 } else {
+                     VerboseLog(@"Detected hash change shouldLoad");
+                     return shouldLoad;
+                 }
+             }
+ 
+             switch (_state) {
+                 case STATE_WAITING_FOR_LOAD_FINISH:
+                     // Redirect case.
+                     // We expect loadCount == 1.
+                     if (_loadCount != 1) {
+                         NSLog(@"CDVWebViewDelegate: Detected redirect when loadCount=%ld", (long)_loadCount);
+                     }
+                     break;
+ 
+                 case STATE_IDLE:
+                 case STATE_IOS5_POLLING_FOR_LOAD_START:
+                 case STATE_CANCELLED:
+                     // Page navigation start.
+                     _loadCount = 0;
+                     _state = STATE_WAITING_FOR_LOAD_START;
+                     break;
+ 
+                 default:
+                     {
+                         _loadCount = 0;
+                         _state = STATE_WAITING_FOR_LOAD_START;
+                         NSString* description = [NSString stringWithFormat:@"CDVWebViewDelegate: Navigation started when state=%ld", (long)_state];
+                         NSLog(@"%@", description);
+                         if ([_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
+                             NSDictionary* errorDictionary = @{NSLocalizedDescriptionKey : description};
+                             NSError* error = [[NSError alloc] initWithDomain:@"CDVUIWebViewDelegate" code:1 userInfo:errorDictionary];
+                             [_delegate webView:webView didFailLoadWithError:error];
+                         }
+                     }
+             }
+         } else {
+             // Deny invalid URLs so that we don't get the case where we go straight from
+             // webViewShouldLoad -> webViewDidFailLoad (messes up _loadCount).
+             shouldLoad = shouldLoad && [self shouldLoadRequest:request];
+         }
+         VerboseLog(@"webView shouldLoad=%d (after) isTopLevelNavigation=%d state=%d loadCount=%d", shouldLoad, isTopLevelNavigation, _state, _loadCount);
+     }
+     return shouldLoad;
+ }
+ 
+ - (void)webViewDidStartLoad:(UIWebView*)webView
+ {
+     VerboseLog(@"webView didStartLoad (before). state=%d loadCount=%d", _state, _loadCount);
+     BOOL fireCallback = NO;
+     switch (_state) {
+         case STATE_IDLE:
+             if (IsAtLeastiOSVersion(@"6.0")) {
+                 break;
+             }
+             // If history.go(-1) is used pre-iOS6, the shouldStartLoadWithRequest function is not called.
+             // Without shouldLoad, we can't distinguish an iframe from a top-level navigation.
+             // We could try to distinguish using [UIWebView canGoForward], but that's too much complexity,
+             // and would work only on the first time it was used.
+ 
+             // Our work-around is to set a JS variable and poll until it disappears (from a navigation).
+             _state = STATE_IOS5_POLLING_FOR_LOAD_START;
+             _loadStartPollCount = 0;
+             [self setLoadToken:webView];
+             [self pollForPageLoadStart:webView];
+             break;
+ 
+         case STATE_CANCELLED:
+             fireCallback = YES;
+             _state = STATE_WAITING_FOR_LOAD_FINISH;
+             _loadCount += 1;
+             break;
+ 
+         case STATE_WAITING_FOR_LOAD_START:
+             if (_loadCount != 0) {
+                 NSLog(@"CDVWebViewDelegate: Unexpected loadCount in didStart. count=%ld", (long)_loadCount);
+             }
+             fireCallback = YES;
+             _state = STATE_WAITING_FOR_LOAD_FINISH;
+             _loadCount = 1;
+             break;
+ 
+         case STATE_WAITING_FOR_LOAD_FINISH:
+             _loadCount += 1;
+             break;
+ 
+         case STATE_IOS5_POLLING_FOR_LOAD_START:
+             [self pollForPageLoadStart:webView];
+             break;
+ 
+         case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
+             [self pollForPageLoadFinish:webView];
+             break;
+ 
+         default:
+             NSLog(@"CDVWebViewDelegate: Unexpected didStart with state=%ld loadCount=%ld", (long)_state, (long)_loadCount);
+     }
+     VerboseLog(@"webView didStartLoad (after). state=%d loadCount=%d fireCallback=%d", _state, _loadCount, fireCallback);
+     if (fireCallback && [_delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
+         [_delegate webViewDidStartLoad:webView];
+     }
+ }
+ 
+ - (void)webViewDidFinishLoad:(UIWebView*)webView
+ {
+     VerboseLog(@"webView didFinishLoad (before). state=%d loadCount=%d", _state, _loadCount);
+     BOOL fireCallback = NO;
+     switch (_state) {
+         case STATE_IDLE:
+             break;
+ 
+         case STATE_WAITING_FOR_LOAD_START:
+             NSLog(@"CDVWebViewDelegate: Unexpected didFinish while waiting for load start.");
+             break;
+ 
+         case STATE_WAITING_FOR_LOAD_FINISH:
+             if (_loadCount == 1) {
+                 fireCallback = YES;
+                 _state = STATE_IDLE;
+             }
+             _loadCount -= 1;
+             break;
+ 
+         case STATE_IOS5_POLLING_FOR_LOAD_START:
+             [self pollForPageLoadStart:webView];
+             break;
+ 
+         case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
+             [self pollForPageLoadFinish:webView];
+             break;
+     }
+     VerboseLog(@"webView didFinishLoad (after). state=%d loadCount=%d fireCallback=%d", _state, _loadCount, fireCallback);
+     if (fireCallback && [_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
+         [_delegate webViewDidFinishLoad:webView];
+     }
+ }
+ 
+ - (void)webView:(UIWebView*)webView didFailLoadWithError:(NSError*)error
+ {
+     VerboseLog(@"webView didFailLoad (before). state=%d loadCount=%d", _state, _loadCount);
+     BOOL fireCallback = NO;
+ 
+     switch (_state) {
+         case STATE_IDLE:
+             break;
+ 
+         case STATE_WAITING_FOR_LOAD_START:
+             if ([error code] == NSURLErrorCancelled) {
+                 _state = STATE_CANCELLED;
+             } else {
+                 _state = STATE_IDLE;
+             }
+             fireCallback = YES;
+             break;
+ 
+         case STATE_WAITING_FOR_LOAD_FINISH:
+             if ([error code] != NSURLErrorCancelled) {
+                 if (_loadCount == 1) {
+                     _state = STATE_IDLE;
+                     fireCallback = YES;
+                 }
+                 _loadCount = -1;
+             } else {
+                 fireCallback = YES;
+                 _state = STATE_CANCELLED;
+                 _loadCount -= 1;
+             }
+             break;
+ 
+         case STATE_IOS5_POLLING_FOR_LOAD_START:
+             [self pollForPageLoadStart:webView];
+             break;
+ 
+         case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
+             [self pollForPageLoadFinish:webView];
+             break;
+     }
+     VerboseLog(@"webView didFailLoad (after). state=%d loadCount=%d, fireCallback=%d", _state, _loadCount, fireCallback);
+     if (fireCallback && [_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
+         [_delegate webView:webView didFailLoadWithError:error];
+     }
+ }
+ 
+ @end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ef66b33c/CordovaLib/Classes/CDVUIWebViewEngine.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVUIWebViewEngine.m
index 0000000,cc15d52..c222e15
mode 000000,100644..100644
--- a/CordovaLib/Classes/CDVUIWebViewEngine.m
+++ b/CordovaLib/Classes/CDVUIWebViewEngine.m
@@@ -1,0 -1,181 +1,181 @@@
+ /*
+  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.
+  */
+ 
+ #import "CDVUIWebViewEngine.h"
+ #import "CDVUIWebViewDelegate.h"
+ #import "NSDictionary+CordovaPreferences.h"
+ 
+ #import <objc/message.h>
+ 
+ @interface CDVUIWebViewEngine ()
+ 
+ @property (nonatomic, strong, readwrite) UIView* engineWebView;
+ @property (nonatomic, strong, readwrite) id <UIWebViewDelegate> uiWebViewDelegate;
+ 
+ @end
+ 
+ @implementation CDVUIWebViewEngine
+ 
+ @synthesize engineWebView = _engineWebView;
+ 
+ - (instancetype)initWithFrame:(CGRect)frame
+ {
+     self = [super init];
+     if (self) {
+         self.engineWebView = [[UIWebView alloc] initWithFrame:frame];
+         NSLog(@"Using UIWebView");
+     }
+ 
+     return self;
+ }
+ 
+ - (void)pluginInitialize
+ {
+     // viewController would be available now. we attempt to set all possible delegates to it, by default
+ 
+     UIWebView* uiWebView = (UIWebView*)_engineWebView;
+ 
+     if ([self.viewController conformsToProtocol:@protocol(UIWebViewDelegate)]) {
+         self.uiWebViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:(id <UIWebViewDelegate>)self.viewController];
+         uiWebView.delegate = self.uiWebViewDelegate;
+     }
+ 
+     [self updateSettings:self.commandDelegate.settings];
+ }
+ 
+ - (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
+ {
 -    NSString* ret = [(UIWebView*)_engineWebView stringByEvaluatingJavaScriptFromString : javaScriptString];
++    NSString* ret = [(UIWebView*)_engineWebView stringByEvaluatingJavaScriptFromString:javaScriptString];
+ 
+     if (completionHandler) {
+         completionHandler(ret, nil);
+     }
+ }
+ 
+ - (id)loadRequest:(NSURLRequest*)request
+ {
 -    [(UIWebView*)_engineWebView loadRequest : request];
++    [(UIWebView*)_engineWebView loadRequest:request];
+     return nil;
+ }
+ 
+ - (id)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL
+ {
 -    [(UIWebView*)_engineWebView loadHTMLString : string baseURL : baseURL];
++    [(UIWebView*)_engineWebView loadHTMLString:string baseURL:baseURL];
+     return nil;
+ }
+ 
+ - (void)updateSettings:(NSDictionary*)settings
+ {
+     UIWebView* uiWebView = (UIWebView*)_engineWebView;
+ 
+     uiWebView.scalesPageToFit = [settings cordovaBoolSettingForKey:@"EnableViewportScale" defaultValue:NO];
+     uiWebView.allowsInlineMediaPlayback = [settings cordovaBoolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:NO];
+     uiWebView.mediaPlaybackRequiresUserAction = [settings cordovaBoolSettingForKey:@"MediaPlaybackRequiresUserAction" defaultValue:YES];
+     uiWebView.mediaPlaybackAllowsAirPlay = [settings cordovaBoolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES];
+     uiWebView.keyboardDisplayRequiresUserAction = [settings cordovaBoolSettingForKey:@"KeyboardDisplayRequiresUserAction" defaultValue:YES];
+     uiWebView.suppressesIncrementalRendering = [settings cordovaBoolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO];
+     uiWebView.gapBetweenPages = [settings cordovaFloatSettingForKey:@"GapBetweenPages" defaultValue:0.0];
+     uiWebView.pageLength = [settings cordovaFloatSettingForKey:@"PageLength" defaultValue:0.0];
+ 
+     id prefObj = nil;
+ 
+     // By default, DisallowOverscroll is false (thus bounce is allowed)
+     BOOL bounceAllowed = !([settings cordovaBoolSettingForKey:@"DisallowOverscroll" defaultValue:NO]);
+ 
+     // prevent webView from bouncing
+     if (!bounceAllowed) {
+         if ([self.webView respondsToSelector:@selector(scrollView)]) {
+             ((UIScrollView*)[uiWebView scrollView]).bounces = NO;
+         } else {
+             for (id subview in self.webView.subviews) {
+                 if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
+                     ((UIScrollView*)subview).bounces = NO;
+                 }
+             }
+         }
+     }
+ 
+     NSString* decelerationSetting = [settings cordovaSettingForKey:@"UIWebViewDecelerationSpeed"];
 -    if (![@"fast" isEqualToString : decelerationSetting]) {
++    if (![@"fast" isEqualToString:decelerationSetting]) {
+         [uiWebView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
+     }
+ 
+     NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage
+     prefObj = [settings cordovaSettingForKey:@"PaginationBreakingMode"];
+     if (prefObj != nil) {
+         NSArray* validValues = @[@"page", @"column"];
+         NSString* prefValue = [validValues objectAtIndex:0];
+ 
+         if ([prefObj isKindOfClass:[NSString class]]) {
+             prefValue = prefObj;
+         }
+ 
+         paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]];
+         if (paginationBreakingMode == NSNotFound) {
+             paginationBreakingMode = 0;
+         }
+     }
+     uiWebView.paginationBreakingMode = paginationBreakingMode;
+ 
+     NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated
+     prefObj = [settings cordovaSettingForKey:@"PaginationMode"];
+     if (prefObj != nil) {
+         NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"];
+         NSString* prefValue = [validValues objectAtIndex:0];
+ 
+         if ([prefObj isKindOfClass:[NSString class]]) {
+             prefValue = prefObj;
+         }
+ 
+         paginationMode = [validValues indexOfObject:[prefValue lowercaseString]];
+         if (paginationMode == NSNotFound) {
+             paginationMode = 0;
+         }
+     }
+     uiWebView.paginationMode = paginationMode;
+ }
+ 
+ - (void)updateWithInfo:(NSDictionary*)info
+ {
+     UIWebView* uiWebView = (UIWebView*)_engineWebView;
+ 
+     id <UIWebViewDelegate> uiWebViewDelegate = [info objectForKey:kCDVWebViewEngineUIWebViewDelegate];
+     NSDictionary* settings = [info objectForKey:kCDVWebViewEngineWebViewPreferences];
+ 
+     if (uiWebViewDelegate &&
+         [uiWebViewDelegate conformsToProtocol:@protocol(UIWebViewDelegate)]) {
+         self.uiWebViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:(id <UIWebViewDelegate>)self.viewController];
+         uiWebView.delegate = self.uiWebViewDelegate;
+     }
+ 
+     if (settings && [settings isKindOfClass:[NSDictionary class]]) {
+         [self updateSettings:settings];
+     }
+ }
+ 
+ // This forwards the methods that are in the header that are not implemented here.
+ // Both WKWebView and UIWebView implement the below:
+ //     loadHTMLString:baseURL:
+ //     loadRequest:
+ - (id)forwardingTargetForSelector:(SEL)aSelector
+ {
+     return _engineWebView;
+ }
+ 
+ @end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ef66b33c/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVViewController.m
index f368ceb,946c723..6ce262c
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@@ -19,12 -19,12 +19,13 @@@
  
  #import <objc/message.h>
  #import "CDV.h"
- #import "CDVCommandDelegateImpl.h"
+ #import "CDVUIWebViewDelegate.h"
  #import "CDVConfigParser.h"
  #import "CDVUserAgentUtil.h"
- #import "CDVWebViewDelegate.h"
  #import <AVFoundation/AVFoundation.h>
+ #import "NSDictionary+CordovaPreferences.h"
  #import "CDVHandleOpenURL.h"
++#import "CDVCommandDelegateImpl.h"
  
  #define degreesToRadian(x) (M_PI * (x) / 180.0)
  

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ef66b33c/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --cc CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index e91ade2,a1677ef..45cc66b
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@@ -13,33 -14,50 +13,41 @@@
  		3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 3034979A1513D56A0090E688 /* CDVLocalStorage.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		3034979E1513D56A0090E688 /* CDVLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 3034979B1513D56A0090E688 /* CDVLocalStorage.m */; };
  		30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; };
 -		3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
 -		3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */; };
++		306ADADD1AAA739800CAC885 /* CDVHandleOpenURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 306ADADC1AAA739800CAC885 /* CDVHandleOpenURL.h */; };
++		306ADAE01AAA73BA00CAC885 /* CDVHandleOpenURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 306ADADE1AAA73A800CAC885 /* CDVHandleOpenURL.m */; };
++		306ADAE51AAA73E100CAC885 /* CDVUIWebViewEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 306ADAE11AAA73E100CAC885 /* CDVUIWebViewEngine.m */; };
++		306ADAE61AAA73E100CAC885 /* CDVWebViewEngineProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 306ADAE21AAA73E100CAC885 /* CDVWebViewEngineProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
++		306ADAE71AAA73E100CAC885 /* NSDictionary+CordovaPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 306ADAE31AAA73E100CAC885 /* NSDictionary+CordovaPreferences.h */; };
++		306ADAE81AAA73E100CAC885 /* NSDictionary+CordovaPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 306ADAE41AAA73E100CAC885 /* NSDictionary+CordovaPreferences.m */; };
++		306ADAEA1AAA745400CAC885 /* CDVCommandQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = EB3B3545161CB44D003DBE7D /* CDVCommandQueue.h */; settings = {ATTRIBUTES = (Public, ); }; };
++		306ADAEB1AAA747100CAC885 /* NSMutableArray+QueueAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
++		306ADAEC1AAA753300CAC885 /* CDVCommandDelegateImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = EB3B357A161F2A44003DBE7D /* CDVCommandDelegateImpl.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		3073E9ED1656D51200957977 /* CDVScreenOrientationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
 -		3083EB981A0AF23A00548672 /* CDVUIWebViewEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 3083EB961A0AF23A00548672 /* CDVUIWebViewEngine.h */; settings = {ATTRIBUTES = (Public, ); }; };
 -		3083EB991A0AF23A00548672 /* CDVUIWebViewEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 3083EB971A0AF23A00548672 /* CDVUIWebViewEngine.m */; };
 -		30B7A65C1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 30B7A65A1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 		30B7A65D1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 30B7A65B1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.m */; };
  		30C684801406CB38004C1A8E /* CDVWhitelist.h in Headers */ = {isa = PBXBuildFile; fileRef = 30C6847E1406CB38004C1A8E /* CDVWhitelist.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		30C684821406CB38004C1A8E /* CDVWhitelist.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C6847F1406CB38004C1A8E /* CDVWhitelist.m */; };
  		30C684941407044B004C1A8E /* CDVURLProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 30C684921407044A004C1A8E /* CDVURLProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		30C684961407044B004C1A8E /* CDVURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C684931407044A004C1A8E /* CDVURLProtocol.m */; };
 -		30D552E11A0AB1F5002007BB /* CDVWebViewEngineProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 30D552E01A0AB1F5002007BB /* CDVWebViewEngineProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		30E33AF213A7E24B00594D64 /* CDVPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E33AF013A7E24B00594D64 /* CDVPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E33AF113A7E24B00594D64 /* CDVPlugin.m */; };
 -		30E563CF13E217EC00C949AA /* NSMutableArray+QueueAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		30E563D013E217EC00C949AA /* NSMutableArray+QueueAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E563CE13E217EC00C949AA /* NSMutableArray+QueueAdditions.m */; };
--		30E6B8CD1A8ADD900025B9EE /* CDVHandleOpenURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E6B8CB1A8ADD900025B9EE /* CDVHandleOpenURL.h */; };
--		30E6B8CE1A8ADD900025B9EE /* CDVHandleOpenURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E6B8CC1A8ADD900025B9EE /* CDVHandleOpenURL.m */; };
 -		30F3930B169F839700B22307 /* CDVJSON.h in Headers */ = {isa = PBXBuildFile; fileRef = 30F39309169F839700B22307 /* CDVJSON.h */; settings = {ATTRIBUTES = (Public, ); }; };
 -		30F3930C169F839700B22307 /* CDVJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F3930A169F839700B22307 /* CDVJSON.m */; };
  		30F5EBAB14CA26E700987760 /* CDVCommandDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		7E14B5A81705050A0032169E /* CDVTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E14B5A61705050A0032169E /* CDVTimer.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		7E14B5A91705050A0032169E /* CDVTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E14B5A71705050A0032169E /* CDVTimer.m */; };
 -		7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		8852C43A14B65FD800F0E735 /* CDVViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 8852C43614B65FD800F0E735 /* CDVViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		8852C43C14B65FD800F0E735 /* CDVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8852C43714B65FD800F0E735 /* CDVViewController.m */; };
 -		8887FD681090FBE7009987E8 /* NSDictionary+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
 -		8887FD691090FBE7009987E8 /* NSDictionary+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD291090FBE7009987E8 /* NSDictionary+Extensions.m */; };
  		8887FD741090FBE7009987E8 /* CDVInvokedUrlCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD341090FBE7009987E8 /* CDVInvokedUrlCommand.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */; };
 -		8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD501090FBE7009987E8 /* NSData+Base64.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD511090FBE7009987E8 /* NSData+Base64.m */; };
 -		EB3B3547161CB44D003DBE7D /* CDVCommandQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = EB3B3545161CB44D003DBE7D /* CDVCommandQueue.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		EB3B3548161CB44D003DBE7D /* CDVCommandQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */; };
 -		EB3B357C161F2A45003DBE7D /* CDVCommandDelegateImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = EB3B357A161F2A44003DBE7D /* CDVCommandDelegateImpl.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = EB3B357B161F2A45003DBE7D /* CDVCommandDelegateImpl.m */; };
 +		EB6A98401A729CD70013FCDB /* CDVAvailabilityDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = EB6A983F1A729CD70013FCDB /* CDVAvailabilityDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		EB6A98541A77EE470013FCDB /* CDVJSON_private.m in Sources */ = {isa = PBXBuildFile; fileRef = EB6A98521A77EE470013FCDB /* CDVJSON_private.m */; };
 +		EB6A98571A77FA430013FCDB /* NSData+Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD501090FBE7009987E8 /* NSData+Base64.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		EB96673B16A8970A00D86CDF /* CDVUserAgentUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = EB96673916A8970900D86CDF /* CDVUserAgentUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */; };
- 		EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */; };
- 		EBFF4DBD16D3FE2E008F452B /* CDVWebViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
 -		EBA3557315ABD38C00F4DE24 /* NSArray+Comparisons.h in Headers */ = {isa = PBXBuildFile; fileRef = EBA3557115ABD38C00F4DE24 /* NSArray+Comparisons.h */; settings = {ATTRIBUTES = (Public, ); }; };
 -		EBA3557515ABD38C00F4DE24 /* NSArray+Comparisons.m in Sources */ = {isa = PBXBuildFile; fileRef = EBA3557215ABD38C00F4DE24 /* NSArray+Comparisons.m */; };
+ 		EBFF4DBC16D3FE2E008F452B /* CDVUIWebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EBFF4DBA16D3FE2E008F452B /* CDVUIWebViewDelegate.m */; };
 -		EBFF4DBD16D3FE2E008F452B /* CDVUIWebViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = EBFF4DBB16D3FE2E008F452B /* CDVUIWebViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
++		EBFF4DBD16D3FE2E008F452B /* CDVUIWebViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = EBFF4DBB16D3FE2E008F452B /* CDVUIWebViewDelegate.h */; };
  		F858FBC6166009A8007DA594 /* CDVConfigParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F858FBC4166009A8007DA594 /* CDVConfigParser.h */; settings = {ATTRIBUTES = (Public, ); }; };
  		F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F858FBC5166009A8007DA594 /* CDVConfigParser.m */; };
  /* End PBXBuildFile section */
@@@ -53,7 -72,13 +61,14 @@@
  		3034979A1513D56A0090E688 /* CDVLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVLocalStorage.h; path = Classes/CDVLocalStorage.h; sourceTree = "<group>"; };
  		3034979B1513D56A0090E688 /* CDVLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVLocalStorage.m; path = Classes/CDVLocalStorage.m; sourceTree = "<group>"; };
  		30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailability.h; path = Classes/CDVAvailability.h; sourceTree = "<group>"; };
 -		3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIDevice+Extensions.h"; path = "Classes/UIDevice+Extensions.h"; sourceTree = "<group>"; };
 -		3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIDevice+Extensions.m"; path = "Classes/UIDevice+Extensions.m"; sourceTree = "<group>"; };
++		306ADADC1AAA739800CAC885 /* CDVHandleOpenURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVHandleOpenURL.h; path = Classes/CDVHandleOpenURL.h; sourceTree = "<group>"; };
++		306ADADE1AAA73A800CAC885 /* CDVHandleOpenURL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVHandleOpenURL.m; path = Classes/CDVHandleOpenURL.m; sourceTree = "<group>"; };
++		306ADAE11AAA73E100CAC885 /* CDVUIWebViewEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUIWebViewEngine.m; path = Classes/CDVUIWebViewEngine.m; sourceTree = "<group>"; };
++		306ADAE21AAA73E100CAC885 /* CDVWebViewEngineProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewEngineProtocol.h; path = Classes/CDVWebViewEngineProtocol.h; sourceTree = "<group>"; };
++		306ADAE31AAA73E100CAC885 /* NSDictionary+CordovaPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+CordovaPreferences.h"; path = "Classes/NSDictionary+CordovaPreferences.h"; sourceTree = "<group>"; };
++		306ADAE41AAA73E100CAC885 /* NSDictionary+CordovaPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+CordovaPreferences.m"; path = "Classes/NSDictionary+CordovaPreferences.m"; sourceTree = "<group>"; };
  		3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVScreenOrientationDelegate.h; path = Classes/CDVScreenOrientationDelegate.h; sourceTree = "<group>"; };
 -		3083EB961A0AF23A00548672 /* CDVUIWebViewEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVUIWebViewEngine.h; path = Classes/CDVUIWebViewEngine.h; sourceTree = "<group>"; };
 -		3083EB971A0AF23A00548672 /* CDVUIWebViewEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUIWebViewEngine.m; path = Classes/CDVUIWebViewEngine.m; sourceTree = "<group>"; };
 -		30B7A65A1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+CordovaPreferences.h"; path = "Classes/NSDictionary+CordovaPreferences.h"; sourceTree = "<group>"; };
+ 		30B7A65B1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+CordovaPreferences.m"; path = "Classes/NSDictionary+CordovaPreferences.m"; sourceTree = "<group>"; };
  		30C6847E1406CB38004C1A8E /* CDVWhitelist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWhitelist.h; path = Classes/CDVWhitelist.h; sourceTree = "<group>"; };
  		30C6847F1406CB38004C1A8E /* CDVWhitelist.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWhitelist.m; path = Classes/CDVWhitelist.m; sourceTree = "<group>"; };
  		30C684921407044A004C1A8E /* CDVURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVURLProtocol.h; path = Classes/CDVURLProtocol.h; sourceTree = "<group>"; };
@@@ -62,14 -88,31 +77,12 @@@
  		30E33AF113A7E24B00594D64 /* CDVPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVPlugin.m; path = Classes/CDVPlugin.m; sourceTree = "<group>"; };
  		30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSMutableArray+QueueAdditions.h"; path = "Classes/NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; };
  		30E563CE13E217EC00C949AA /* NSMutableArray+QueueAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSMutableArray+QueueAdditions.m"; path = "Classes/NSMutableArray+QueueAdditions.m"; sourceTree = "<group>"; };
--		30E6B8CB1A8ADD900025B9EE /* CDVHandleOpenURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVHandleOpenURL.h; path = Classes/CDVHandleOpenURL.h; sourceTree = "<group>"; };
--		30E6B8CC1A8ADD900025B9EE /* CDVHandleOpenURL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVHandleOpenURL.m; path = Classes/CDVHandleOpenURL.m; sourceTree = "<group>"; };
 -		30F39309169F839700B22307 /* CDVJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVJSON.h; path = Classes/CDVJSON.h; sourceTree = "<group>"; };
 -		30F3930A169F839700B22307 /* CDVJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVJSON.m; path = Classes/CDVJSON.m; sourceTree = "<group>"; };
  		30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVCommandDelegate.h; path = Classes/CDVCommandDelegate.h; sourceTree = "<group>"; };
 -		686357AA141002F100DF4CF2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
 -		686357AC141002F100DF4CF2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
 -		686357AE141002F100DF4CF2 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
 -		686357CC14100AAD00DF4CF2 /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; };
 -		686357CE14100ADA00DF4CF2 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
 -		686357CF14100ADB00DF4CF2 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
 -		686357D014100ADE00DF4CF2 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
 -		686357D214100AE700DF4CF2 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
 -		686357D414100AF200DF4CF2 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
 -		686357DC14100B1600DF4CF2 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
  		68A32D7114102E1C006B237C /* libCordova.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCordova.a; sourceTree = BUILT_PRODUCTS_DIR; };
 -		68A32D7414103017006B237C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
  		7E14B5A61705050A0032169E /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVTimer.h; path = Classes/CDVTimer.h; sourceTree = "<group>"; };
  		7E14B5A71705050A0032169E /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVTimer.m; path = Classes/CDVTimer.m; sourceTree = "<group>"; };
 -		7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailabilityDeprecated.h; path = Classes/CDVAvailabilityDeprecated.h; sourceTree = "<group>"; };
 -		8220B5C316D5427E00EC3921 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
  		8852C43614B65FD800F0E735 /* CDVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVViewController.h; path = Classes/CDVViewController.h; sourceTree = "<group>"; };
  		8852C43714B65FD800F0E735 /* CDVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVViewController.m; path = Classes/CDVViewController.m; sourceTree = "<group>"; };
 -		8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+Extensions.h"; path = "Classes/NSDictionary+Extensions.h"; sourceTree = "<group>"; };
 -		8887FD291090FBE7009987E8 /* NSDictionary+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+Extensions.m"; path = "Classes/NSDictionary+Extensions.m"; sourceTree = "<group>"; };
  		8887FD341090FBE7009987E8 /* CDVInvokedUrlCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVInvokedUrlCommand.h; path = Classes/CDVInvokedUrlCommand.h; sourceTree = "<group>"; };
  		8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVInvokedUrlCommand.m; path = Classes/CDVInvokedUrlCommand.m; sourceTree = "<group>"; };
  		8887FD501090FBE7009987E8 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSData+Base64.h"; path = "Classes/NSData+Base64.h"; sourceTree = "<group>"; };
@@@ -84,8 -126,10 +97,8 @@@
  		EB6A98531A77EE470013FCDB /* CDVJSON_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVJSON_private.h; path = Classes/CDVJSON_private.h; sourceTree = "<group>"; };
  		EB96673916A8970900D86CDF /* CDVUserAgentUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVUserAgentUtil.h; path = Classes/CDVUserAgentUtil.h; sourceTree = "<group>"; };
  		EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUserAgentUtil.m; path = Classes/CDVUserAgentUtil.m; sourceTree = "<group>"; };
- 		EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewDelegate.m; path = Classes/CDVWebViewDelegate.m; sourceTree = "<group>"; };
- 		EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewDelegate.h; path = Classes/CDVWebViewDelegate.h; sourceTree = "<group>"; };
 -		EBA3557115ABD38C00F4DE24 /* NSArray+Comparisons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSArray+Comparisons.h"; path = "Classes/NSArray+Comparisons.h"; sourceTree = "<group>"; };
 -		EBA3557215ABD38C00F4DE24 /* NSArray+Comparisons.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSArray+Comparisons.m"; path = "Classes/NSArray+Comparisons.m"; sourceTree = "<group>"; };
+ 		EBFF4DBA16D3FE2E008F452B /* CDVUIWebViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUIWebViewDelegate.m; path = Classes/CDVUIWebViewDelegate.m; sourceTree = "<group>"; };
+ 		EBFF4DBB16D3FE2E008F452B /* CDVUIWebViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVUIWebViewDelegate.h; path = Classes/CDVUIWebViewDelegate.h; sourceTree = "<group>"; };
  		F858FBC4166009A8007DA594 /* CDVConfigParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVConfigParser.h; path = Classes/CDVConfigParser.h; sourceTree = "<group>"; };
  		F858FBC5166009A8007DA594 /* CDVConfigParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVConfigParser.m; path = Classes/CDVConfigParser.m; sourceTree = "<group>"; };
  /* End PBXFileReference section */
@@@ -130,35 -240,28 +143,41 @@@
  				30E33AF113A7E24B00594D64 /* CDVPlugin.m */,
  				1F92F49E1314023E0046367C /* CDVPluginResult.h */,
  				1F92F49F1314023E0046367C /* CDVPluginResult.m */,
 +				8852C43614B65FD800F0E735 /* CDVViewController.h */,
 +				8852C43714B65FD800F0E735 /* CDVViewController.m */,
 +				30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */,
 +				30C684921407044A004C1A8E /* CDVURLProtocol.h */,
 +				30C684931407044A004C1A8E /* CDVURLProtocol.m */,
  				8887FD341090FBE7009987E8 /* CDVInvokedUrlCommand.h */,
  				8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */,
 +				30C6847E1406CB38004C1A8E /* CDVWhitelist.h */,
 +				30C6847F1406CB38004C1A8E /* CDVWhitelist.m */,
 +				3034979A1513D56A0090E688 /* CDVLocalStorage.h */,
 +				3034979B1513D56A0090E688 /* CDVLocalStorage.m */,
  				3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */,
 -				30F39309169F839700B22307 /* CDVJSON.h */,
 -				30F3930A169F839700B22307 /* CDVJSON.m */,
 -				EB6A98521A77EE470013FCDB /* CDVJSON_private.m */,
 -				EB6A98531A77EE470013FCDB /* CDVJSON_private.h */,
 +				7E14B5A61705050A0032169E /* CDVTimer.h */,
 +				7E14B5A71705050A0032169E /* CDVTimer.m */,
 +				F858FBC4166009A8007DA594 /* CDVConfigParser.h */,
 +				F858FBC5166009A8007DA594 /* CDVConfigParser.m */,
  				EB96673916A8970900D86CDF /* CDVUserAgentUtil.h */,
  				EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */,
- 				EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */,
- 				EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */,
++				EBFF4DBA16D3FE2E008F452B /* CDVUIWebViewDelegate.m */,
++				EBFF4DBB16D3FE2E008F452B /* CDVUIWebViewDelegate.h */,
 +				8887FD501090FBE7009987E8 /* NSData+Base64.h */,
 +				8887FD511090FBE7009987E8 /* NSData+Base64.m */,
++				306ADAE21AAA73E100CAC885 /* CDVWebViewEngineProtocol.h */,
  			);
 -			name = Commands;
 +			name = Public;
  			sourceTree = "<group>";
  		};
 -		888700D910923009009987E8 /* Util */ = {
 +		888700D910923009009987E8 /* Private */ = {
  			isa = PBXGroup;
  			children = (
 -				3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */,
 -				3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */,
 -				EBA3557115ABD38C00F4DE24 /* NSArray+Comparisons.h */,
 -				EBA3557215ABD38C00F4DE24 /* NSArray+Comparisons.m */,
 -				8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */,
 -				8887FD291090FBE7009987E8 /* NSDictionary+Extensions.m */,
++				306ADAE31AAA73E100CAC885 /* NSDictionary+CordovaPreferences.h */,
++				306ADAE11AAA73E100CAC885 /* CDVUIWebViewEngine.m */,
++				306ADAE41AAA73E100CAC885 /* NSDictionary+CordovaPreferences.m */,
++				306ADADE1AAA73A800CAC885 /* CDVHandleOpenURL.m */,
++				306ADADC1AAA739800CAC885 /* CDVHandleOpenURL.h */,
  				302965BB13A94E9D007046C5 /* CDVDebug.h */,
  				30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */,
  				30E563CE13E217EC00C949AA /* NSMutableArray+QueueAdditions.m */,
@@@ -180,24 -292,36 +199,29 @@@
  			isa = PBXHeadersBuildPhase;
  			buildActionMask = 2147483647;
  			files = (
 -				8887FD681090FBE7009987E8 /* NSDictionary+Extensions.h in Headers */,
 -				8887FD741090FBE7009987E8 /* CDVInvokedUrlCommand.h in Headers */,
 -				8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */,
 -				1F92F4A01314023E0046367C /* CDVPluginResult.h in Headers */,
 +				301F2F2A14F3C9CA003FE9FC /* CDV.h in Headers */,
 +				30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */,
 +				EB6A98401A729CD70013FCDB /* CDVAvailabilityDeprecated.h in Headers */,
  				30E33AF213A7E24B00594D64 /* CDVPlugin.h in Headers */,
 -				30E6B8CD1A8ADD900025B9EE /* CDVHandleOpenURL.h in Headers */,
 -				302965BC13A94E9D007046C5 /* CDVDebug.h in Headers */,
 -				30E563CF13E217EC00C949AA /* NSMutableArray+QueueAdditions.h in Headers */,
 -				30C684801406CB38004C1A8E /* CDVWhitelist.h in Headers */,
 -				30C684941407044B004C1A8E /* CDVURLProtocol.h in Headers */,
 +				1F92F4A01314023E0046367C /* CDVPluginResult.h in Headers */,
- 				30E6B8CD1A8ADD900025B9EE /* CDVHandleOpenURL.h in Headers */,
++				306ADAE71AAA73E100CAC885 /* NSDictionary+CordovaPreferences.h in Headers */,
  				8852C43A14B65FD800F0E735 /* CDVViewController.h in Headers */,
  				30F5EBAB14CA26E700987760 /* CDVCommandDelegate.h in Headers */,
 -				301F2F2A14F3C9CA003FE9FC /* CDV.h in Headers */,
 -				30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */,
 -				7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */,
 +				30C684941407044B004C1A8E /* CDVURLProtocol.h in Headers */,
 +				8887FD741090FBE7009987E8 /* CDVInvokedUrlCommand.h in Headers */,
 +				30C684801406CB38004C1A8E /* CDVWhitelist.h in Headers */,
  				3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */,
 -				3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */,
 -				EBA3557315ABD38C00F4DE24 /* NSArray+Comparisons.h in Headers */,
 -				EB3B3547161CB44D003DBE7D /* CDVCommandQueue.h in Headers */,
 -				EB3B357C161F2A45003DBE7D /* CDVCommandDelegateImpl.h in Headers */,
 -				1B701028177A61CF00AE11F4 /* CDVShared.h in Headers */,
++				306ADADD1AAA739800CAC885 /* CDVHandleOpenURL.h in Headers */,
  				3073E9ED1656D51200957977 /* CDVScreenOrientationDelegate.h in Headers */,
 +				7E14B5A81705050A0032169E /* CDVTimer.h in Headers */,
  				F858FBC6166009A8007DA594 /* CDVConfigParser.h in Headers */,
 -				30F3930B169F839700B22307 /* CDVJSON.h in Headers */,
 -				EBFF4DBD16D3FE2E008F452B /* CDVUIWebViewDelegate.h in Headers */,
 -				30B7A65C1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h in Headers */,
 -				3083EB981A0AF23A00548672 /* CDVUIWebViewEngine.h in Headers */,
 -				30D552E11A0AB1F5002007BB /* CDVWebViewEngineProtocol.h in Headers */,
++				306ADAE61AAA73E100CAC885 /* CDVWebViewEngineProtocol.h in Headers */,
  				EB96673B16A8970A00D86CDF /* CDVUserAgentUtil.h in Headers */,
- 				EBFF4DBD16D3FE2E008F452B /* CDVWebViewDelegate.h in Headers */,
 -				7E14B5A81705050A0032169E /* CDVTimer.h in Headers */,
++				306ADAEA1AAA745400CAC885 /* CDVCommandQueue.h in Headers */,
 +				EB6A98571A77FA430013FCDB /* NSData+Base64.h in Headers */,
++				306ADAEB1AAA747100CAC885 /* NSMutableArray+QueueAdditions.h in Headers */,
++				306ADAEC1AAA753300CAC885 /* CDVCommandDelegateImpl.h in Headers */,
++				EBFF4DBD16D3FE2E008F452B /* CDVUIWebViewDelegate.h in Headers */,
  			);
  			runOnlyForDeploymentPostprocessing = 0;
  		};
@@@ -255,22 -379,28 +279,25 @@@
  			isa = PBXSourcesBuildPhase;
  			buildActionMask = 2147483647;
  			files = (
 -				8887FD691090FBE7009987E8 /* NSDictionary+Extensions.m in Sources */,
  				8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */,
  				8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */,
++				306ADAE81AAA73E100CAC885 /* NSDictionary+CordovaPreferences.m in Sources */,
  				1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */,
+ 				30B7A65D1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.m in Sources */,
  				30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */,
  				30E563D013E217EC00C949AA /* NSMutableArray+QueueAdditions.m in Sources */,
  				30C684821406CB38004C1A8E /* CDVWhitelist.m in Sources */,
  				30C684961407044B004C1A8E /* CDVURLProtocol.m in Sources */,
  				8852C43C14B65FD800F0E735 /* CDVViewController.m in Sources */,
  				3034979E1513D56A0090E688 /* CDVLocalStorage.m in Sources */,
 -				3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */,
 -				EBA3557515ABD38C00F4DE24 /* NSArray+Comparisons.m in Sources */,
++				306ADAE51AAA73E100CAC885 /* CDVUIWebViewEngine.m in Sources */,
  				EB3B3548161CB44D003DBE7D /* CDVCommandQueue.m in Sources */,
  				EB6A98541A77EE470013FCDB /* CDVJSON_private.m in Sources */,
  				EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */,
  				F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */,
 -				30F3930C169F839700B22307 /* CDVJSON.m in Sources */,
 -				3083EB991A0AF23A00548672 /* CDVUIWebViewEngine.m in Sources */,
  				EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */,
--				30E6B8CE1A8ADD900025B9EE /* CDVHandleOpenURL.m in Sources */,
- 				EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */,
++				306ADAE01AAA73BA00CAC885 /* CDVHandleOpenURL.m in Sources */,
+ 				EBFF4DBC16D3FE2E008F452B /* CDVUIWebViewDelegate.m in Sources */,
  				7E14B5A91705050A0032169E /* CDVTimer.m in Sources */,
  			);
  			runOnlyForDeploymentPostprocessing = 0;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[04/43] ios commit: CB-7047 - Support config.xml preferences for WKWebView

Posted by sh...@apache.org.
CB-7047 - Support config.xml preferences for WKWebView


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

Branch: refs/heads/4.0.x
Commit: 641992c4860ea107cefb0aae7c3dad2d04b156ca
Parents: 6d6ab0a
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 21 14:34:05 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Jul 21 14:34:05 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewPreferences.m | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/641992c4/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
index a42b3aa..55f447b 100644
--- a/CordovaLib/Classes/CDVWebViewPreferences.m
+++ b/CordovaLib/Classes/CDVWebViewPreferences.m
@@ -242,6 +242,27 @@
         }
         theWebView.configuration.preferences.minimumFontSize = minimumFontSize;
 
+        BOOL allowInlineMediaPlayback = NO; // default
+        prefObj = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
+        if (prefObj != nil) {
+            allowInlineMediaPlayback = [(NSNumber*)prefObj boolValue];
+        }
+        theWebView.configuration.allowsInlineMediaPlayback = allowInlineMediaPlayback;
+
+        BOOL mediaPlaybackRequiresUserAction = YES;  // default
+        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
+        if (prefObj != nil) {
+            mediaPlaybackRequiresUserAction = [(NSNumber*)prefObj boolValue];
+        }
+        theWebView.configuration.mediaPlaybackRequiresUserAction = mediaPlaybackRequiresUserAction;
+
+        BOOL suppressesIncrementalRendering = NO; // default
+        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
+        if (prefObj != nil) {
+            suppressesIncrementalRendering = [(NSNumber*)prefObj boolValue];
+        }
+        theWebView.configuration.suppressesIncrementalRendering = suppressesIncrementalRendering;
+
         /*
         BOOL javaScriptEnabled = YES;  // default value
         if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[08/43] ios commit: Added logs to show if you are using a WKWebView or UIWebView.

Posted by sh...@apache.org.
Added logs to show if you are using a WKWebView or UIWebView.


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

Branch: refs/heads/4.0.x
Commit: 89555725cedd25b45e2d69953203cb23ead05fd6
Parents: 1e84e30
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Aug 13 23:29:25 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed Aug 13 23:29:25 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89555725/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index d5aeb89..0bde78e 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -433,11 +433,13 @@
             configuration.userContentController = userContentController;
 
             cordovaView = [[WKWebView alloc] initWithFrame:bounds configuration:configuration];
+            NSLog(@"Using a WKWebView");
             _webViewUIDelegate = [[CDVWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
             ((WKWebView*)cordovaView).UIDelegate = _webViewUIDelegate;
 #endif
     } else {
         cordovaView = [[UIWebView alloc] initWithFrame:bounds];
+        NSLog(@"Using a UIWebView");
     }
 
     return cordovaView;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[24/43] ios commit: Separate the WebViews into plugins, prep for plugin breakout (plus style mixups)

Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWebViewEngineProtocol.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewEngineProtocol.h b/CordovaLib/Classes/CDVWebViewEngineProtocol.h
new file mode 100644
index 0000000..0c15c63
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewEngineProtocol.h
@@ -0,0 +1,41 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+#define kCDVWebViewEngineScriptMessageHandlers @"kCDVWebViewEngineScriptMessageHandlers"
+#define kCDVWebViewEngineUIWebViewDelegate @"kCDVWebViewEngineUIWebViewDelegate"
+#define kCDVWebViewEngineWKNavigationDelegate @"kCDVWebViewEngineWKNavigationDelegate"
+#define kCDVWebViewEngineWKUIDelegate @"kCDVWebViewEngineWKUIDelegate"
+#define kCDVWebViewEngineWebViewPreferences @"kCDVWebViewEngineWebViewPreferences"
+
+@protocol CDVWebViewEngineProtocol
+
+@property (nonatomic, strong, readonly) UIView* engineWebView;
+
+- (void)loadRequest:(NSURLRequest*)request;
+- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL;
+- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler;
+- (void)loadFileURL:(NSURL*)URL allowingReadAccessToURL:(NSURL*)readAccessURL;
+
+- (instancetype)initWithFrame:(CGRect)frame;
+- (void)updateWithInfo:(NSDictionary*)info;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWebViewPreferences.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.h b/CordovaLib/Classes/CDVWebViewPreferences.h
deleted file mode 100644
index a57748e..0000000
--- a/CordovaLib/Classes/CDVWebViewPreferences.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- 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.
- */
-
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-
-@interface CDVWebViewPreferences : NSObject
-
-@property (nonatomic, strong) NSDictionary* settings;
-
-- (instancetype)initWithWebView:(UIView*)webView settings:(NSDictionary*)settings;
-- (instancetype)initWithSettings:(NSDictionary*)settings;
-
-- (void)update;
-
-- (id)settingForKey:(NSString*)key;
-- (BOOL)boolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue;
-- (CGFloat)floatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
deleted file mode 100644
index 4ca67cd..0000000
--- a/CordovaLib/Classes/CDVWebViewPreferences.m
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- 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.
- */
-#import "CDVWebViewPreferences.h"
-#import "CDVWKWebViewPreferences.h"
-#import "CDVUIWebViewPreferences.h"
-#import "CDVAvailability.h"
-#import <objc/message.h>
-#import <WebKit/WebKit.h>
-
-@implementation CDVWebViewPreferences
-
-- (instancetype)initWithWebView:(UIView*)webView settings:(NSDictionary*)settings
-{
-    self = [super init];
-    if (self) {
-        if ([webView isKindOfClass:[WKWebView class]]) {
-            return [[CDVWKWebViewPreferences alloc] initWithWebView:(WKWebView*)webView settings:settings];
-        } else if ([webView isKindOfClass:[UIWebView class]]) {
-            return [[CDVUIWebViewPreferences alloc] initWithWebView:(UIWebView*)webView settings:settings];
-        } else {
-            return nil;
-        }
-    }
-
-    return self;
-}
-
-- (instancetype)initWithSettings:(NSDictionary*)settings
-{
-    self = [super init];
-    if (self) {
-        self.settings = settings;
-    }
-
-    return self;
-}
-
-- (void)update
-{
-    [NSException raise:@"Invoked abstract method" format:@"Invoked abstract method"];
-}
-
-- (id)settingForKey:(NSString*)key
-{
-    return [self.settings objectForKey:[key lowercaseString]];
-}
-
-- (BOOL)boolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue
-{
-    BOOL value = defaultValue;
-    id prefObj = [self settingForKey:key];
-
-    if (prefObj != nil) {
-        value = [(NSNumber*)prefObj boolValue];
-    }
-
-    return value;
-}
-
-- (CGFloat)floatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue
-{
-    CGFloat value = defaultValue;
-    id prefObj = [self settingForKey:key];
-
-    if (prefObj != nil) {
-        value = [prefObj floatValue];
-    }
-
-    return value;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWebViewProxy.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewProxy.h b/CordovaLib/Classes/CDVWebViewProxy.h
deleted file mode 100644
index 32b9839..0000000
--- a/CordovaLib/Classes/CDVWebViewProxy.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- 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.
- */
-
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-
-#ifdef __IPHONE_8_0
-    #pragma message("For iOS 8 - Please add WebKit.framework into your 'Link Binary with Libraries' Build Phase Project Setting. This will be baked in once Xcode 6 is required.")
-#endif /* ifdef __IPHONE_8_0 */
-
-@interface CDVWebViewProxy : NSObject {
-    @private
-    __weak UIView* _webView;
-}
-
-- (instancetype)initWithWebView:(UIView*)webView;
-
-- (void)loadRequest:(NSURLRequest*)request;
-- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL;
-- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler;
-- (void)loadFileURL:(NSURL*)URL allowingReadAccessToURL:(NSURL*)readAccessURL;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWebViewProxy.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewProxy.m b/CordovaLib/Classes/CDVWebViewProxy.m
deleted file mode 100644
index 03b8049..0000000
--- a/CordovaLib/Classes/CDVWebViewProxy.m
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- 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.
- */
-
-#import <objc/message.h>
-#import <WebKit/WebKit.h>
-#import "CDVWebViewProxy.h"
-
-@interface UIWebView (Extensions)
-
-- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler;
-
-@end
-
-@implementation UIWebView (Extensions)
-
-- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
-{
-    NSString* ret = [self stringByEvaluatingJavaScriptFromString:javaScriptString];
-
-    completionHandler(ret, nil);
-}
-
-@end
-
-// see forwardingTargetForSelector: selector comment for the reason for this pragma
-#pragma clang diagnostic ignored "-Wincomplete-implementation"
-
-@implementation CDVWebViewProxy
-
-- (instancetype)initWithWebView:(UIView*)webView
-{
-    self = [super init];
-    if (self) {
-        if (!([webView isKindOfClass:[WKWebView class]] || [webView isKindOfClass:[UIWebView class]])) {
-            return nil;
-        }
-        _webView = webView;
-    }
-
-    return self;
-}
-
-// We implement this here because certain versions of iOS 8 do not implement this
-// in WKWebView, so we need to test for this during runtime.
-// It is speculated that this selector will be available in iOS 8.2 for WKWebView
-- (void)loadFileURL:(NSURL*)url allowingReadAccessToURL:(NSURL*)readAccessURL
-{
-    SEL wk_sel = @selector(loadFileURL:allowingReadAccessToURL:);
-    __weak CDVWebViewProxy* weakSelf = self;
-
-    // UIKit operations have to be on the main thread. This method does not need to be synchronous
-    dispatch_async(dispatch_get_main_queue(), ^{
-            if ([_webView respondsToSelector:wk_sel] && [[url scheme] isEqualToString:@"file"]) {
-                ((id (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, url, readAccessURL);
-            } else {
-                [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
-            }
-        });
-}
-
-// This forwards the methods that are in the header that are not implemented here.
-// Both WKWebView and UIWebView implement the below:
-//     loadHTMLString:baseURL:
-//     loadRequest:
-//     evaluateJavaScript:completionHandler: (UIWebView implements in Category above)
-- (id)forwardingTargetForSelector:(SEL)aSelector
-{
-    return _webView;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewUIDelegate.h b/CordovaLib/Classes/CDVWebViewUIDelegate.h
deleted file mode 100644
index 9ff2ac1..0000000
--- a/CordovaLib/Classes/CDVWebViewUIDelegate.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- 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.
- */
-
-#import <Foundation/Foundation.h>
-
-#ifdef __IPHONE_8_0
-    #import <WebKit/WebKit.h>
-#endif
-
-@interface CDVWebViewUIDelegate : NSObject
-#ifdef __IPHONE_8_0
-                                      <WKUIDelegate>
-#endif
-
-@property (nonatomic, copy) NSString* title;
-
-- (instancetype)initWithTitle:(NSString*)title;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewUIDelegate.m b/CordovaLib/Classes/CDVWebViewUIDelegate.m
deleted file mode 100644
index 6f98327..0000000
--- a/CordovaLib/Classes/CDVWebViewUIDelegate.m
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- 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.
- */
-
-#ifdef __IPHONE_8_0
-
-#import "CDVWebViewUIDelegate.h"
-
-    @implementation CDVWebViewUIDelegate
-
-    - (instancetype)initWithTitle:(NSString*)title
-    {
-        self = [super init];
-        if (self) {
-            self.title = title;
-        }
-
-        return self;
-    }
-
-    - (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
-        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:message
-                                                                preferredStyle:UIAlertControllerStyleAlert];
-
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-            {
-                completionHandler();
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
-
-    - (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
-        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:message
-                                                                preferredStyle:UIAlertControllerStyleAlert];
-
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-            {
-                completionHandler(YES);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                                                         style:UIAlertActionStyleDefault
-                                                       handler:^(UIAlertAction* action)
-            {
-                completionHandler(NO);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-        [alert addAction:cancel];
-
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
-
-    - (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
-              defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
-        completionHandler:(void (^)(NSString* result))completionHandler
-    {
-        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                       message:prompt
-                                                                preferredStyle:UIAlertControllerStyleAlert];
-
-        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-            {
-                completionHandler(((UITextField*)alert.textFields[0]).text);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-
-        [alert addAction:ok];
-
-        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                                                         style:UIAlertActionStyleDefault
-                                                       handler:^(UIAlertAction* action)
-            {
-                completionHandler(nil);
-                [alert dismissViewControllerAnimated:YES completion:nil];
-            }];
-        [alert addAction:cancel];
-
-        [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
-            textField.text = defaultText;
-        }];
-
-        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-        [rootController presentViewController:alert animated:YES completion:nil];
-    }
-
-    @end
-#endif /* ifdef __IPHONE_8_0 */

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/NSDictionary+CordovaPreferences.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/NSDictionary+CordovaPreferences.h b/CordovaLib/Classes/NSDictionary+CordovaPreferences.h
new file mode 100644
index 0000000..9be2be2
--- /dev/null
+++ b/CordovaLib/Classes/NSDictionary+CordovaPreferences.h
@@ -0,0 +1,35 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+@interface NSDictionary (CordovaPreferences)
+
+- (id)cordovaSettingForKey:(NSString*)key;
+- (BOOL)cordovaBoolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue;
+- (CGFloat)cordovaFloatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue;
+
+@end
+
+@interface NSMutableDictionary (CordovaPreferences)
+
+- (void)setCordovaSetting:(id)value forKey:(NSString*)key;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/NSDictionary+CordovaPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/NSDictionary+CordovaPreferences.m b/CordovaLib/Classes/NSDictionary+CordovaPreferences.m
new file mode 100644
index 0000000..dcac40f
--- /dev/null
+++ b/CordovaLib/Classes/NSDictionary+CordovaPreferences.m
@@ -0,0 +1,63 @@
+/*
+ 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.
+ */
+
+#import "NSDictionary+CordovaPreferences.h"
+#import <Foundation/Foundation.h>
+
+@implementation NSDictionary (CordovaPreferences)
+
+- (id)cordovaSettingForKey:(NSString*)key
+{
+    return [self objectForKey:[key lowercaseString]];
+}
+
+- (BOOL)cordovaBoolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue
+{
+    BOOL value = defaultValue;
+    id prefObj = [self cordovaSettingForKey:key];
+
+    if (prefObj != nil) {
+        value = [(NSNumber*)prefObj boolValue];
+    }
+
+    return value;
+}
+
+- (CGFloat)cordovaFloatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue
+{
+    CGFloat value = defaultValue;
+    id prefObj = [self cordovaSettingForKey:key];
+
+    if (prefObj != nil) {
+        value = [prefObj floatValue];
+    }
+
+    return value;
+}
+
+@end
+
+@implementation NSMutableDictionary (CordovaPreferences)
+
+- (void)setCordovaSetting:(id)value forKey:(NSString*)key
+{
+    [self setObject:value forKey:[key lowercaseString]];
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 9ce87d3..678fbae 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -12,22 +12,23 @@
 		1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F92F49F1314023E0046367C /* CDVPluginResult.m */; };
 		301F2F2A14F3C9CA003FE9FC /* CDV.h in Headers */ = {isa = PBXBuildFile; fileRef = 301F2F2914F3C9CA003FE9FC /* CDV.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		302965BC13A94E9D007046C5 /* CDVDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 302965BB13A94E9D007046C5 /* CDVDebug.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		302D72FC19554BFC0028C99F /* CDVWebViewProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D72FA19554BFC0028C99F /* CDVWebViewProxy.m */; };
 		3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 3034979A1513D56A0090E688 /* CDVLocalStorage.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3034979E1513D56A0090E688 /* CDVLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 3034979B1513D56A0090E688 /* CDVLocalStorage.m */; };
-		303820731955603600C91592 /* CDVWebViewProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 302D72F919554BFC0028C99F /* CDVWebViewProxy.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */; };
 		3073E9ED1656D51200957977 /* CDVScreenOrientationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		3083EB941A0AF1E100548672 /* CDVWKWebViewEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 3083EB921A0AF1E100548672 /* CDVWKWebViewEngine.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		3083EB951A0AF1E100548672 /* CDVWKWebViewEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 3083EB931A0AF1E100548672 /* CDVWKWebViewEngine.m */; };
+		3083EB981A0AF23A00548672 /* CDVUIWebViewEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 3083EB961A0AF23A00548672 /* CDVUIWebViewEngine.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		3083EB991A0AF23A00548672 /* CDVUIWebViewEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 3083EB971A0AF23A00548672 /* CDVUIWebViewEngine.m */; };
+		30B7A65C1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 30B7A65A1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		30B7A65D1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 30B7A65B1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.m */; };
 		30C684801406CB38004C1A8E /* CDVWhitelist.h in Headers */ = {isa = PBXBuildFile; fileRef = 30C6847E1406CB38004C1A8E /* CDVWhitelist.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		30C684821406CB38004C1A8E /* CDVWhitelist.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C6847F1406CB38004C1A8E /* CDVWhitelist.m */; };
 		30C684941407044B004C1A8E /* CDVURLProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 30C684921407044A004C1A8E /* CDVURLProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		30C684961407044B004C1A8E /* CDVURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C684931407044A004C1A8E /* CDVURLProtocol.m */; };
-		30CD6C631A07681E00522A22 /* CDVUIWebViewPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 30CD6C611A07681E00522A22 /* CDVUIWebViewPreferences.h */; };
-		30CD6C641A07681E00522A22 /* CDVUIWebViewPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CD6C621A07681E00522A22 /* CDVUIWebViewPreferences.m */; };
-		30CD6C681A0769F900522A22 /* CDVWKWebViewPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CD6C661A0769F900522A22 /* CDVWKWebViewPreferences.m */; };
-		30CD6C691A0769F900522A22 /* CDVWKWebViewPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 30CD6C671A0769F900522A22 /* CDVWKWebViewPreferences.h */; };
+		30D552E11A0AB1F5002007BB /* CDVWebViewEngineProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 30D552E01A0AB1F5002007BB /* CDVWebViewEngineProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		30E33AF213A7E24B00594D64 /* CDVPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E33AF013A7E24B00594D64 /* CDVPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E33AF113A7E24B00594D64 /* CDVPlugin.m */; };
 		30E563CF13E217EC00C949AA /* NSMutableArray+QueueAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -38,10 +39,8 @@
 		7E14B5A81705050A0032169E /* CDVTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E14B5A61705050A0032169E /* CDVTimer.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E14B5A91705050A0032169E /* CDVTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E14B5A71705050A0032169E /* CDVTimer.m */; };
 		7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		7E785B9A196F508900ABBDC8 /* CDVWebViewUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		7E785B9B196F508900ABBDC8 /* CDVWebViewUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */; };
-		7EE9ECF819525D24004CA6B9 /* CDVWebViewPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		7EE9ECF919525D24004CA6B9 /* CDVWebViewPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */; };
+		7E785B9A196F508900ABBDC8 /* CDVWKWebViewUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E785B98196F508900ABBDC8 /* CDVWKWebViewUIDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		7E785B9B196F508900ABBDC8 /* CDVWKWebViewUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E785B99196F508900ABBDC8 /* CDVWKWebViewUIDelegate.m */; };
 		8852C43A14B65FD800F0E735 /* CDVViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 8852C43614B65FD800F0E735 /* CDVViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		8852C43C14B65FD800F0E735 /* CDVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8852C43714B65FD800F0E735 /* CDVViewController.m */; };
 		8887FD681090FBE7009987E8 /* NSDictionary+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -58,8 +57,8 @@
 		EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */; };
 		EBA3557315ABD38C00F4DE24 /* NSArray+Comparisons.h in Headers */ = {isa = PBXBuildFile; fileRef = EBA3557115ABD38C00F4DE24 /* NSArray+Comparisons.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		EBA3557515ABD38C00F4DE24 /* NSArray+Comparisons.m in Sources */ = {isa = PBXBuildFile; fileRef = EBA3557215ABD38C00F4DE24 /* NSArray+Comparisons.m */; };
-		EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */; };
-		EBFF4DBD16D3FE2E008F452B /* CDVWebViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		EBFF4DBC16D3FE2E008F452B /* CDVUIWebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EBFF4DBA16D3FE2E008F452B /* CDVUIWebViewDelegate.m */; };
+		EBFF4DBD16D3FE2E008F452B /* CDVUIWebViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = EBFF4DBB16D3FE2E008F452B /* CDVUIWebViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F858FBC6166009A8007DA594 /* CDVConfigParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F858FBC4166009A8007DA594 /* CDVConfigParser.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F858FBC5166009A8007DA594 /* CDVConfigParser.m */; };
 /* End PBXBuildFile section */
@@ -70,8 +69,6 @@
 		1F92F49F1314023E0046367C /* CDVPluginResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVPluginResult.m; path = Classes/CDVPluginResult.m; sourceTree = "<group>"; };
 		301F2F2914F3C9CA003FE9FC /* CDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDV.h; path = Classes/CDV.h; sourceTree = "<group>"; };
 		302965BB13A94E9D007046C5 /* CDVDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVDebug.h; path = Classes/CDVDebug.h; sourceTree = "<group>"; };
-		302D72F919554BFC0028C99F /* CDVWebViewProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewProxy.h; path = Classes/CDVWebViewProxy.h; sourceTree = "<group>"; };
-		302D72FA19554BFC0028C99F /* CDVWebViewProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewProxy.m; path = Classes/CDVWebViewProxy.m; sourceTree = "<group>"; };
 		30325A0B136B343700982B63 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
 		3034979A1513D56A0090E688 /* CDVLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVLocalStorage.h; path = Classes/CDVLocalStorage.h; sourceTree = "<group>"; };
 		3034979B1513D56A0090E688 /* CDVLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVLocalStorage.m; path = Classes/CDVLocalStorage.m; sourceTree = "<group>"; };
@@ -79,14 +76,17 @@
 		3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIDevice+Extensions.h"; path = "Classes/UIDevice+Extensions.h"; sourceTree = "<group>"; };
 		3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIDevice+Extensions.m"; path = "Classes/UIDevice+Extensions.m"; sourceTree = "<group>"; };
 		3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVScreenOrientationDelegate.h; path = Classes/CDVScreenOrientationDelegate.h; sourceTree = "<group>"; };
+		3083EB921A0AF1E100548672 /* CDVWKWebViewEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWKWebViewEngine.h; path = Classes/CDVWKWebViewEngine.h; sourceTree = "<group>"; };
+		3083EB931A0AF1E100548672 /* CDVWKWebViewEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWKWebViewEngine.m; path = Classes/CDVWKWebViewEngine.m; sourceTree = "<group>"; };
+		3083EB961A0AF23A00548672 /* CDVUIWebViewEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVUIWebViewEngine.h; path = Classes/CDVUIWebViewEngine.h; sourceTree = "<group>"; };
+		3083EB971A0AF23A00548672 /* CDVUIWebViewEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUIWebViewEngine.m; path = Classes/CDVUIWebViewEngine.m; sourceTree = "<group>"; };
+		30B7A65A1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+CordovaPreferences.h"; path = "Classes/NSDictionary+CordovaPreferences.h"; sourceTree = "<group>"; };
+		30B7A65B1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+CordovaPreferences.m"; path = "Classes/NSDictionary+CordovaPreferences.m"; sourceTree = "<group>"; };
 		30C6847E1406CB38004C1A8E /* CDVWhitelist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWhitelist.h; path = Classes/CDVWhitelist.h; sourceTree = "<group>"; };
 		30C6847F1406CB38004C1A8E /* CDVWhitelist.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWhitelist.m; path = Classes/CDVWhitelist.m; sourceTree = "<group>"; };
 		30C684921407044A004C1A8E /* CDVURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVURLProtocol.h; path = Classes/CDVURLProtocol.h; sourceTree = "<group>"; };
 		30C684931407044A004C1A8E /* CDVURLProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVURLProtocol.m; path = Classes/CDVURLProtocol.m; sourceTree = "<group>"; };
-		30CD6C611A07681E00522A22 /* CDVUIWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVUIWebViewPreferences.h; path = Classes/CDVUIWebViewPreferences.h; sourceTree = "<group>"; };
-		30CD6C621A07681E00522A22 /* CDVUIWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUIWebViewPreferences.m; path = Classes/CDVUIWebViewPreferences.m; sourceTree = "<group>"; };
-		30CD6C661A0769F900522A22 /* CDVWKWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWKWebViewPreferences.m; path = Classes/CDVWKWebViewPreferences.m; sourceTree = "<group>"; };
-		30CD6C671A0769F900522A22 /* CDVWKWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWKWebViewPreferences.h; path = Classes/CDVWKWebViewPreferences.h; sourceTree = "<group>"; };
+		30D552E01A0AB1F5002007BB /* CDVWebViewEngineProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewEngineProtocol.h; path = Classes/CDVWebViewEngineProtocol.h; sourceTree = "<group>"; };
 		30E33AF013A7E24B00594D64 /* CDVPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVPlugin.h; path = Classes/CDVPlugin.h; sourceTree = "<group>"; };
 		30E33AF113A7E24B00594D64 /* CDVPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVPlugin.m; path = Classes/CDVPlugin.m; sourceTree = "<group>"; };
 		30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSMutableArray+QueueAdditions.h"; path = "Classes/NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; };
@@ -109,10 +109,8 @@
 		7E14B5A61705050A0032169E /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVTimer.h; path = Classes/CDVTimer.h; sourceTree = "<group>"; };
 		7E14B5A71705050A0032169E /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVTimer.m; path = Classes/CDVTimer.m; sourceTree = "<group>"; };
 		7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailabilityDeprecated.h; path = Classes/CDVAvailabilityDeprecated.h; sourceTree = "<group>"; };
-		7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewUIDelegate.h; path = Classes/CDVWebViewUIDelegate.h; sourceTree = "<group>"; };
-		7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewUIDelegate.m; path = Classes/CDVWebViewUIDelegate.m; sourceTree = "<group>"; };
-		7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewPreferences.h; path = Classes/CDVWebViewPreferences.h; sourceTree = "<group>"; };
-		7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewPreferences.m; path = Classes/CDVWebViewPreferences.m; sourceTree = "<group>"; };
+		7E785B98196F508900ABBDC8 /* CDVWKWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWKWebViewUIDelegate.h; path = Classes/CDVWKWebViewUIDelegate.h; sourceTree = "<group>"; };
+		7E785B99196F508900ABBDC8 /* CDVWKWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWKWebViewUIDelegate.m; path = Classes/CDVWKWebViewUIDelegate.m; sourceTree = "<group>"; };
 		8220B5C316D5427E00EC3921 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
 		8852C43614B65FD800F0E735 /* CDVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVViewController.h; path = Classes/CDVViewController.h; sourceTree = "<group>"; };
 		8852C43714B65FD800F0E735 /* CDVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVViewController.m; path = Classes/CDVViewController.m; sourceTree = "<group>"; };
@@ -131,8 +129,8 @@
 		EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUserAgentUtil.m; path = Classes/CDVUserAgentUtil.m; sourceTree = "<group>"; };
 		EBA3557115ABD38C00F4DE24 /* NSArray+Comparisons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSArray+Comparisons.h"; path = "Classes/NSArray+Comparisons.h"; sourceTree = "<group>"; };
 		EBA3557215ABD38C00F4DE24 /* NSArray+Comparisons.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSArray+Comparisons.m"; path = "Classes/NSArray+Comparisons.m"; sourceTree = "<group>"; };
-		EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewDelegate.m; path = Classes/CDVWebViewDelegate.m; sourceTree = "<group>"; };
-		EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewDelegate.h; path = Classes/CDVWebViewDelegate.h; sourceTree = "<group>"; };
+		EBFF4DBA16D3FE2E008F452B /* CDVUIWebViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUIWebViewDelegate.m; path = Classes/CDVUIWebViewDelegate.m; sourceTree = "<group>"; };
+		EBFF4DBB16D3FE2E008F452B /* CDVUIWebViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVUIWebViewDelegate.h; path = Classes/CDVUIWebViewDelegate.h; sourceTree = "<group>"; };
 		F858FBC4166009A8007DA594 /* CDVConfigParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVConfigParser.h; path = Classes/CDVConfigParser.h; sourceTree = "<group>"; };
 		F858FBC5166009A8007DA594 /* CDVConfigParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVConfigParser.m; path = Classes/CDVConfigParser.m; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -190,32 +188,39 @@
 		3054098714B77FF3009841CA /* Cleaver */ = {
 			isa = PBXGroup;
 			children = (
-				30CD6C651A0768DA00522A22 /* Preferences */,
+				30D552DF1A0AB176002007BB /* WKWebView */,
+				30CD6C651A0768DA00522A22 /* UIWebView */,
+				30D552E01A0AB1F5002007BB /* CDVWebViewEngineProtocol.h */,
 				F858FBC4166009A8007DA594 /* CDVConfigParser.h */,
 				F858FBC5166009A8007DA594 /* CDVConfigParser.m */,
 				8852C43614B65FD800F0E735 /* CDVViewController.h */,
 				8852C43714B65FD800F0E735 /* CDVViewController.m */,
 				EB3B3545161CB44D003DBE7D /* CDVCommandQueue.h */,
 				EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */,
-				302D72F919554BFC0028C99F /* CDVWebViewProxy.h */,
-				302D72FA19554BFC0028C99F /* CDVWebViewProxy.m */,
-				7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */,
-				7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */,
 			);
 			name = Cleaver;
 			sourceTree = "<group>";
 		};
-		30CD6C651A0768DA00522A22 /* Preferences */ = {
+		30CD6C651A0768DA00522A22 /* UIWebView */ = {
 			isa = PBXGroup;
 			children = (
-				30CD6C671A0769F900522A22 /* CDVWKWebViewPreferences.h */,
-				30CD6C661A0769F900522A22 /* CDVWKWebViewPreferences.m */,
-				30CD6C611A07681E00522A22 /* CDVUIWebViewPreferences.h */,
-				30CD6C621A07681E00522A22 /* CDVUIWebViewPreferences.m */,
-				7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */,
-				7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */,
+				EBFF4DBA16D3FE2E008F452B /* CDVUIWebViewDelegate.m */,
+				EBFF4DBB16D3FE2E008F452B /* CDVUIWebViewDelegate.h */,
+				3083EB961A0AF23A00548672 /* CDVUIWebViewEngine.h */,
+				3083EB971A0AF23A00548672 /* CDVUIWebViewEngine.m */,
 			);
-			name = Preferences;
+			name = UIWebView;
+			sourceTree = "<group>";
+		};
+		30D552DF1A0AB176002007BB /* WKWebView */ = {
+			isa = PBXGroup;
+			children = (
+				7E785B98196F508900ABBDC8 /* CDVWKWebViewUIDelegate.h */,
+				7E785B99196F508900ABBDC8 /* CDVWKWebViewUIDelegate.m */,
+				3083EB921A0AF1E100548672 /* CDVWKWebViewEngine.h */,
+				3083EB931A0AF1E100548672 /* CDVWKWebViewEngine.m */,
+			);
+			name = WKWebView;
 			sourceTree = "<group>";
 		};
 		32C88DFF0371C24200C91783 /* Other Sources */ = {
@@ -230,8 +235,6 @@
 			isa = PBXGroup;
 			children = (
 				7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */,
-				EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */,
-				EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */,
 				301F2F2914F3C9CA003FE9FC /* CDV.h */,
 				3034979A1513D56A0090E688 /* CDVLocalStorage.h */,
 				3034979B1513D56A0090E688 /* CDVLocalStorage.m */,
@@ -275,6 +278,8 @@
 				8887FD511090FBE7009987E8 /* NSData+Base64.m */,
 				7E14B5A61705050A0032169E /* CDVTimer.h */,
 				7E14B5A71705050A0032169E /* CDVTimer.m */,
+				30B7A65A1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h */,
+				30B7A65B1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.m */,
 			);
 			name = Util;
 			sourceTree = "<group>";
@@ -312,21 +317,21 @@
 				7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */,
 				3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */,
 				3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */,
-				30CD6C691A0769F900522A22 /* CDVWKWebViewPreferences.h in Headers */,
 				EBA3557315ABD38C00F4DE24 /* NSArray+Comparisons.h in Headers */,
-				30CD6C631A07681E00522A22 /* CDVUIWebViewPreferences.h in Headers */,
 				EB3B3547161CB44D003DBE7D /* CDVCommandQueue.h in Headers */,
 				EB3B357C161F2A45003DBE7D /* CDVCommandDelegateImpl.h in Headers */,
 				1B701028177A61CF00AE11F4 /* CDVShared.h in Headers */,
 				3073E9ED1656D51200957977 /* CDVScreenOrientationDelegate.h in Headers */,
 				F858FBC6166009A8007DA594 /* CDVConfigParser.h in Headers */,
 				30F3930B169F839700B22307 /* CDVJSON.h in Headers */,
-				EBFF4DBD16D3FE2E008F452B /* CDVWebViewDelegate.h in Headers */,
-				7EE9ECF819525D24004CA6B9 /* CDVWebViewPreferences.h in Headers */,
+				EBFF4DBD16D3FE2E008F452B /* CDVUIWebViewDelegate.h in Headers */,
+				30B7A65C1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h in Headers */,
+				3083EB981A0AF23A00548672 /* CDVUIWebViewEngine.h in Headers */,
+				30D552E11A0AB1F5002007BB /* CDVWebViewEngineProtocol.h in Headers */,
+				3083EB941A0AF1E100548672 /* CDVWKWebViewEngine.h in Headers */,
 				EB96673B16A8970A00D86CDF /* CDVUserAgentUtil.h in Headers */,
 				7E14B5A81705050A0032169E /* CDVTimer.h in Headers */,
-				7E785B9A196F508900ABBDC8 /* CDVWebViewUIDelegate.h in Headers */,
-				303820731955603600C91592 /* CDVWebViewProxy.h in Headers */,
+				7E785B9A196F508900ABBDC8 /* CDVWKWebViewUIDelegate.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -387,8 +392,9 @@
 				8887FD691090FBE7009987E8 /* NSDictionary+Extensions.m in Sources */,
 				8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */,
 				8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */,
+				3083EB951A0AF1E100548672 /* CDVWKWebViewEngine.m in Sources */,
 				1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */,
-				7EE9ECF919525D24004CA6B9 /* CDVWebViewPreferences.m in Sources */,
+				30B7A65D1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.m in Sources */,
 				30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */,
 				30E563D013E217EC00C949AA /* NSMutableArray+QueueAdditions.m in Sources */,
 				30C684821406CB38004C1A8E /* CDVWhitelist.m in Sources */,
@@ -398,16 +404,14 @@
 				3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */,
 				EBA3557515ABD38C00F4DE24 /* NSArray+Comparisons.m in Sources */,
 				EB3B3548161CB44D003DBE7D /* CDVCommandQueue.m in Sources */,
-				30CD6C681A0769F900522A22 /* CDVWKWebViewPreferences.m in Sources */,
 				EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */,
-				30CD6C641A07681E00522A22 /* CDVUIWebViewPreferences.m in Sources */,
 				F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */,
 				30F3930C169F839700B22307 /* CDVJSON.m in Sources */,
-				7E785B9B196F508900ABBDC8 /* CDVWebViewUIDelegate.m in Sources */,
+				7E785B9B196F508900ABBDC8 /* CDVWKWebViewUIDelegate.m in Sources */,
+				3083EB991A0AF23A00548672 /* CDVUIWebViewEngine.m in Sources */,
 				EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */,
-				EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */,
+				EBFF4DBC16D3FE2E008F452B /* CDVUIWebViewDelegate.m in Sources */,
 				7E14B5A91705050A0032169E /* CDVTimer.m in Sources */,
-				302D72FC19554BFC0028C99F /* CDVWebViewProxy.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/bin/templates/project/__PROJECT_NAME__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__PROJECT_NAME__/config.xml b/bin/templates/project/__PROJECT_NAME__/config.xml
index da6c067..c6830d9 100644
--- a/bin/templates/project/__PROJECT_NAME__/config.xml
+++ b/bin/templates/project/__PROJECT_NAME__/config.xml
@@ -36,7 +36,7 @@
     <content src="index.html" />
 
     <!-- Preferences for iOS -->
-    <preference name="UseWKWebView" value="false" />
+    <preference name="CordovaWebViewEngine" value="CDVUIWebViewEngine" />
     <preference name="AllowInlineMediaPlayback" value="false" />
     <preference name="BackupWebStorage" value="cloud" />
     <preference name="DisallowOverscroll" value="false" />


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[10/43] ios commit: Added logs to show if you are using a WKWebView or UIWebView.

Posted by sh...@apache.org.
Added logs to show if you are using a WKWebView or UIWebView.


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

Branch: refs/heads/4.0.x
Commit: 1c1e9c30d7bed52d8d9dce93717e03f587df26c4
Parents: b3fbd85
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Aug 13 23:29:25 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 15:37:43 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1c1e9c30/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 6730239..4f81e92 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -470,11 +470,13 @@
             configuration.userContentController = userContentController;
 
             cordovaView = [[WKWebView alloc] initWithFrame:bounds configuration:configuration];
+            NSLog(@"Using a WKWebView");
             _webViewUIDelegate = [[CDVWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
             ((WKWebView*)cordovaView).UIDelegate = _webViewUIDelegate;
 #endif
     } else {
         cordovaView = [[UIWebView alloc] initWithFrame:bounds];
+        NSLog(@"Using a UIWebView");
     }
 
     return cordovaView;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[15/43] ios commit: CB-6884 - Support new Cordova bridge under iOS 8 WKWebView (typo fix)

Posted by sh...@apache.org.
CB-6884 - Support new Cordova bridge under iOS 8 WKWebView (typo fix)


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

Branch: refs/heads/4.0.x
Commit: f6d89c6a9474c194ce9f9d8b86fda652f1c7503f
Parents: 1c1e9c3
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Aug 13 23:33:44 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 15:37:43 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/f6d89c6a/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 4f81e92..79d16b8 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -462,7 +462,7 @@
 
             // scriptMessageHandler is the object that conforms to the WKScriptMessageHandler protocol
             // see https://developer.apple.com/library/prerelease/ios/documentation/WebKit/Reference/WKScriptMessageHandler_Ref/index.html#//apple_ref/swift/intf/WKScriptMessageHandler
-            if ([_commandDelegate conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
+            if ([self conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
                 [userContentController addScriptMessageHandler:self name:@"cordova"];
             }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[25/43] ios commit: Separate the WebViews into plugins, prep for plugin breakout (plus style mixups)

Posted by sh...@apache.org.
Separate the WebViews into plugins, prep for plugin breakout (plus style mixups)


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

Branch: refs/heads/4.0.x
Commit: ce6604dbf1f2e0ecc5f80a94da9da88eac287561
Parents: 5bb4245
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Nov 6 02:07:05 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Nov 6 02:07:05 2014 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDV.h                        |  32 +-
 CordovaLib/Classes/CDVCommandDelegateImpl.m     |   2 +-
 CordovaLib/Classes/CDVCommandQueue.m            |   4 +-
 CordovaLib/Classes/CDVPlugin.m                  |   2 +-
 CordovaLib/Classes/CDVUIWebViewDelegate.h       |  42 ++
 CordovaLib/Classes/CDVUIWebViewDelegate.m       | 417 +++++++++++++++++++
 CordovaLib/Classes/CDVUIWebViewEngine.h         |  26 ++
 CordovaLib/Classes/CDVUIWebViewEngine.m         | 164 ++++++++
 CordovaLib/Classes/CDVUIWebViewPreferences.h    |  29 --
 CordovaLib/Classes/CDVUIWebViewPreferences.m    | 103 -----
 CordovaLib/Classes/CDVViewController.h          |   7 +-
 CordovaLib/Classes/CDVViewController.m          | 114 ++---
 CordovaLib/Classes/CDVWKWebViewEngine.h         |  28 ++
 CordovaLib/Classes/CDVWKWebViewEngine.m         | 139 +++++++
 CordovaLib/Classes/CDVWKWebViewPreferences.h    |  29 --
 CordovaLib/Classes/CDVWKWebViewPreferences.m    |  48 ---
 CordovaLib/Classes/CDVWKWebViewUIDelegate.h     |  29 ++
 CordovaLib/Classes/CDVWKWebViewUIDelegate.m     | 126 ++++++
 CordovaLib/Classes/CDVWebViewDelegate.h         |  42 --
 CordovaLib/Classes/CDVWebViewDelegate.m         | 417 -------------------
 CordovaLib/Classes/CDVWebViewEngineProtocol.h   |  41 ++
 CordovaLib/Classes/CDVWebViewPreferences.h      |  36 --
 CordovaLib/Classes/CDVWebViewPreferences.m      |  88 ----
 CordovaLib/Classes/CDVWebViewProxy.h            |  39 --
 CordovaLib/Classes/CDVWebViewProxy.m            |  87 ----
 CordovaLib/Classes/CDVWebViewUIDelegate.h       |  35 --
 CordovaLib/Classes/CDVWebViewUIDelegate.m       | 126 ------
 .../Classes/NSDictionary+CordovaPreferences.h   |  35 ++
 .../Classes/NSDictionary+CordovaPreferences.m   |  63 +++
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj | 106 ++---
 .../project/__PROJECT_NAME__/config.xml         |   2 +-
 31 files changed, 1234 insertions(+), 1224 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index 771bdc5..2d14fc3 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -18,26 +18,32 @@
  */
 
 #import "CDVAvailability.h"
-
-#import "CDVPlugin.h"
-#import "CDVViewController.h"
+#import "CDVAvailabilityDeprecated.h"
 #import "CDVCommandDelegate.h"
-#import "CDVURLProtocol.h"
-#import "CDVInvokedUrlCommand.h"
-
+#import "CDVCommandDelegateImpl.h"
+#import "CDVCommandQueue.h"
+#import "CDVConfigParser.h"
 #import "CDVDebug.h"
-#import "CDVPluginResult.h"
-#import "CDVWhitelist.h"
+#import "CDVInvokedUrlCommand.h"
+#import "CDVJSON.h"
 #import "CDVLocalStorage.h"
+#import "CDVPlugin.h"
+#import "CDVPluginResult.h"
 #import "CDVScreenOrientationDelegate.h"
+#import "CDVShared.h"
 #import "CDVTimer.h"
-#import "CDVWebViewPreferences.h"
-#import "CDVWebViewProxy.h"
-
+#import "CDVUIWebViewDelegate.h"
+#import "CDVUIWebViewEngine.h"
+#import "CDVURLProtocol.h"
+#import "CDVUserAgentUtil.h"
+#import "CDVViewController.h"
+#import "CDVWKWebViewEngine.h"
+#import "CDVWKWebViewUIDelegate.h"
+#import "CDVWebViewEngineProtocol.h"
+#import "CDVWhitelist.h"
 #import "NSArray+Comparisons.h"
 #import "NSData+Base64.h"
+#import "NSDictionary+CordovaPreferences.h"
 #import "NSDictionary+Extensions.h"
 #import "NSMutableArray+QueueAdditions.h"
 #import "UIDevice+Extensions.h"
-
-#import "CDVJSON.h"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandDelegateImpl.m b/CordovaLib/Classes/CDVCommandDelegateImpl.m
index 9a5f2aa..7f4254a 100644
--- a/CordovaLib/Classes/CDVCommandDelegateImpl.m
+++ b/CordovaLib/Classes/CDVCommandDelegateImpl.m
@@ -71,7 +71,7 @@
 - (void)evalJsHelper2:(NSString*)js
 {
     CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
-    [_viewController.webViewProxy evaluateJavaScript:js completionHandler:^(id obj, NSError* error) {
+    [_viewController.webViewEngine evaluateJavaScript:js completionHandler:^(id obj, NSError* error) {
         // TODO: obj can be something other than string
         if ([obj isKindOfClass:[NSString class]]) {
             NSString* commandsJSON = (NSString*)obj;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index 21a6489..efaf640 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -112,8 +112,8 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame.
     __weak CDVCommandQueue* weakSelf = self;
     NSString* js = @"cordova.require('cordova/exec').nativeFetchMessages()";
 
-    [_viewController.webViewProxy evaluateJavaScript:js
-                                   completionHandler:^(id obj, NSError* error) {
+    [_viewController.webViewEngine evaluateJavaScript:js
+                                    completionHandler:^(id obj, NSError* error) {
         if ((error == nil) && [obj isKindOfClass:[NSString class]]) {
             NSString* queuedCommandsJSON = (NSString*)obj;
             CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVPlugin.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPlugin.m b/CordovaLib/Classes/CDVPlugin.m
index bae6926..ac1ac4d 100644
--- a/CordovaLib/Classes/CDVPlugin.m
+++ b/CordovaLib/Classes/CDVPlugin.m
@@ -132,7 +132,7 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
 - (NSString*)writeJavascript:(NSString*)javascript
 {
     // TODO: although deprecated, should have some solution here instead of removing it
-    [((CDVViewController*)self.viewController).webViewProxy evaluateJavaScript : javascript completionHandler : nil]; // bad cast, but ok for now
+    [((CDVViewController*)self.viewController).webViewEngine evaluateJavaScript : javascript completionHandler : nil]; // bad cast, but ok for now
     return @"";
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVUIWebViewDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewDelegate.h b/CordovaLib/Classes/CDVUIWebViewDelegate.h
new file mode 100644
index 0000000..05979ed
--- /dev/null
+++ b/CordovaLib/Classes/CDVUIWebViewDelegate.h
@@ -0,0 +1,42 @@
+/*
+ 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.
+ */
+
+#import <UIKit/UIKit.h>
+#import "CDVAvailability.h"
+
+/**
+ * Distinguishes top-level navigations from sub-frame navigations.
+ * shouldStartLoadWithRequest is called for every request, but didStartLoad
+ * and didFinishLoad is called only for top-level navigations.
+ * Relevant bug: CB-2389
+ */
+@interface CDVUIWebViewDelegate : NSObject <UIWebViewDelegate>{
+    __weak NSObject <UIWebViewDelegate>* _delegate;
+    NSInteger _loadCount;
+    NSInteger _state;
+    NSInteger _curLoadToken;
+    NSInteger _loadStartPollCount;
+}
+
+- (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate;
+- (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest CDV_DEPRECATED(3.5, "Use request:isEqualToRequestAfterStrippingFragments: instead.");
+
+- (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVUIWebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewDelegate.m b/CordovaLib/Classes/CDVUIWebViewDelegate.m
new file mode 100644
index 0000000..230a7fa
--- /dev/null
+++ b/CordovaLib/Classes/CDVUIWebViewDelegate.m
@@ -0,0 +1,417 @@
+/*
+ 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.
+ */
+
+//
+// Testing shows:
+//
+// In all cases, webView.request.URL is the previous page's URL (or empty) during the didStartLoad callback.
+// When loading a page with a redirect:
+// 1. shouldStartLoading (requestURL is target page)
+// 2. didStartLoading
+// 3. shouldStartLoading (requestURL is redirect target)
+// 4. didFinishLoad (request.URL is redirect target)
+//
+// Note the lack of a second didStartLoading **
+//
+// When loading a page with iframes:
+// 1. shouldStartLoading (requestURL is main page)
+// 2. didStartLoading
+// 3. shouldStartLoading (requestURL is one of the iframes)
+// 4. didStartLoading
+// 5. didFinishLoad
+// 6. didFinishLoad
+//
+// Note there is no way to distinguish which didFinishLoad maps to which didStartLoad **
+//
+// Loading a page by calling window.history.go(-1):
+// 1. didStartLoading
+// 2. didFinishLoad
+//
+// Note the lack of a shouldStartLoading call **
+// Actually - this is fixed on iOS6. iOS6 has a shouldStart. **
+//
+// Loading a page by calling location.reload()
+// 1. shouldStartLoading
+// 2. didStartLoading
+// 3. didFinishLoad
+//
+// Loading a page with an iframe that fails to load:
+// 1. shouldStart (main page)
+// 2. didStart
+// 3. shouldStart (iframe)
+// 4. didStart
+// 5. didFailWithError
+// 6. didFinish
+//
+// Loading a page with an iframe that fails to load due to an invalid URL:
+// 1. shouldStart (main page)
+// 2. didStart
+// 3. shouldStart (iframe)
+// 5. didFailWithError
+// 6. didFinish
+//
+// This case breaks our logic since there is a missing didStart. To prevent this,
+// we check URLs in shouldStart and return NO if they are invalid.
+//
+// Loading a page with an invalid URL
+// 1. shouldStart (main page)
+// 2. didFailWithError
+//
+// TODO: Record order when page is re-navigated before the first navigation finishes.
+//
+
+#import "CDVUIWebViewDelegate.h"
+#import "CDVAvailability.h"
+
+// #define VerboseLog NSLog
+#define VerboseLog(...) do {} while (0)
+
+typedef enum {
+    STATE_IDLE = 0,
+    STATE_WAITING_FOR_LOAD_START = 1,
+    STATE_WAITING_FOR_LOAD_FINISH = 2,
+    STATE_IOS5_POLLING_FOR_LOAD_START = 3,
+    STATE_IOS5_POLLING_FOR_LOAD_FINISH = 4,
+    STATE_CANCELLED = 5
+} State;
+
+static NSString *stripFragment(NSString* url)
+{
+    NSRange r = [url rangeOfString:@"#"];
+
+    if (r.location == NSNotFound) {
+        return url;
+    }
+    return [url substringToIndex:r.location];
+}
+
+@implementation CDVUIWebViewDelegate
+
+- (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate
+{
+    self = [super init];
+    if (self != nil) {
+        _delegate = delegate;
+        _loadCount = -1;
+        _state = STATE_IDLE;
+    }
+    return self;
+}
+
+- (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest
+{
+    return [self request:newRequest isEqualToRequestAfterStrippingFragments:originalRequest];
+}
+
+- (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest
+{
+    if (originalRequest.URL && newRequest.URL) {
+        NSString* originalRequestUrl = [originalRequest.URL absoluteString];
+        NSString* newRequestUrl = [newRequest.URL absoluteString];
+
+        NSString* baseOriginalRequestUrl = stripFragment(originalRequestUrl);
+        NSString* baseNewRequestUrl = stripFragment(newRequestUrl);
+        return [baseOriginalRequestUrl isEqualToString:baseNewRequestUrl];
+    }
+
+    return NO;
+}
+
+- (BOOL)isPageLoaded:(UIWebView*)webView
+{
+    NSString* readyState = [webView stringByEvaluatingJavaScriptFromString:@"document.readyState"];
+
+    return [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
+}
+
+- (BOOL)isJsLoadTokenSet:(UIWebView*)webView
+{
+    NSString* loadToken = [webView stringByEvaluatingJavaScriptFromString:@"window.__cordovaLoadToken"];
+
+    return [[NSString stringWithFormat:@"%ld", (long)_curLoadToken] isEqualToString:loadToken];
+}
+
+- (void)setLoadToken:(UIWebView*)webView
+{
+    _curLoadToken += 1;
+    [webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"window.__cordovaLoadToken=%ld", (long)_curLoadToken]];
+}
+
+- (NSString*)evalForCurrentURL:(UIWebView*)webView
+{
+    return [webView stringByEvaluatingJavaScriptFromString:@"location.href"];
+}
+
+- (void)pollForPageLoadStart:(UIWebView*)webView
+{
+    if (_state != STATE_IOS5_POLLING_FOR_LOAD_START) {
+        return;
+    }
+    if (![self isJsLoadTokenSet:webView]) {
+        VerboseLog(@"Polled for page load start. result = YES!");
+        _state = STATE_IOS5_POLLING_FOR_LOAD_FINISH;
+        [self setLoadToken:webView];
+        if ([_delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
+            [_delegate webViewDidStartLoad:webView];
+        }
+        [self pollForPageLoadFinish:webView];
+    } else {
+        VerboseLog(@"Polled for page load start. result = NO");
+        // Poll only for 1 second, and then fall back on checking only when delegate methods are called.
+        ++_loadStartPollCount;
+        if (_loadStartPollCount < (1000 * .05)) {
+            [self performSelector:@selector(pollForPageLoadStart:) withObject:webView afterDelay:.05];
+        }
+    }
+}
+
+- (void)pollForPageLoadFinish:(UIWebView*)webView
+{
+    if (_state != STATE_IOS5_POLLING_FOR_LOAD_FINISH) {
+        return;
+    }
+    if ([self isPageLoaded:webView]) {
+        VerboseLog(@"Polled for page load finish. result = YES!");
+        _state = STATE_IDLE;
+        if ([_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
+            [_delegate webViewDidFinishLoad:webView];
+        }
+    } else {
+        VerboseLog(@"Polled for page load finish. result = NO");
+        [self performSelector:@selector(pollForPageLoadFinish:) withObject:webView afterDelay:.05];
+    }
+}
+
+- (BOOL)shouldLoadRequest:(NSURLRequest*)request
+{
+    NSString* scheme = [[request URL] scheme];
+
+    if ([scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"tel"]) {
+        return YES;
+    }
+
+    return [NSURLConnection canHandleRequest:request];
+}
+
+- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
+{
+    BOOL shouldLoad = YES;
+
+    if ([_delegate respondsToSelector:@selector(webView:shouldStartLoadWithRequest:navigationType:)]) {
+        shouldLoad = [_delegate webView:webView shouldStartLoadWithRequest:request navigationType:navigationType];
+    }
+
+    VerboseLog(@"webView shouldLoad=%d (before) state=%d loadCount=%d URL=%@", shouldLoad, _state, _loadCount, request.URL);
+
+    if (shouldLoad) {
+        // When devtools refresh occurs, it blindly uses the same request object. If a history.replaceState() has occured, then
+        // mainDocumentURL != URL even though it's a top-level navigation.
+        BOOL isDevToolsRefresh = (request == webView.request);
+        BOOL isTopLevelNavigation = isDevToolsRefresh || [request.URL isEqual:[request mainDocumentURL]];
+        if (isTopLevelNavigation) {
+            // Ignore hash changes that don't navigate to a different page.
+            // webView.request does actually update when history.replaceState() gets called.
+            if ([self request:request isEqualToRequestAfterStrippingFragments:webView.request]) {
+                NSString* prevURL = [self evalForCurrentURL:webView];
+                if ([prevURL isEqualToString:[request.URL absoluteString]]) {
+                    VerboseLog(@"Page reload detected.");
+                } else {
+                    VerboseLog(@"Detected hash change shouldLoad");
+                    return shouldLoad;
+                }
+            }
+
+            switch (_state) {
+                case STATE_WAITING_FOR_LOAD_FINISH:
+                    // Redirect case.
+                    // We expect loadCount == 1.
+                    if (_loadCount != 1) {
+                        NSLog(@"CDVWebViewDelegate: Detected redirect when loadCount=%ld", (long)_loadCount);
+                    }
+                    break;
+
+                case STATE_IDLE:
+                case STATE_IOS5_POLLING_FOR_LOAD_START:
+                case STATE_CANCELLED:
+                    // Page navigation start.
+                    _loadCount = 0;
+                    _state = STATE_WAITING_FOR_LOAD_START;
+                    break;
+
+                default:
+                    {
+                        _loadCount = 0;
+                        _state = STATE_WAITING_FOR_LOAD_START;
+                        NSString* description = [NSString stringWithFormat:@"CDVWebViewDelegate: Navigation started when state=%ld", (long)_state];
+                        NSLog(@"%@", description);
+                        if ([_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
+                            NSDictionary* errorDictionary = @{NSLocalizedDescriptionKey : description};
+                            NSError* error = [[NSError alloc] initWithDomain:@"CDVUIWebViewDelegate" code:1 userInfo:errorDictionary];
+                            [_delegate webView:webView didFailLoadWithError:error];
+                        }
+                    }
+            }
+        } else {
+            // Deny invalid URLs so that we don't get the case where we go straight from
+            // webViewShouldLoad -> webViewDidFailLoad (messes up _loadCount).
+            shouldLoad = shouldLoad && [self shouldLoadRequest:request];
+        }
+        VerboseLog(@"webView shouldLoad=%d (after) isTopLevelNavigation=%d state=%d loadCount=%d", shouldLoad, isTopLevelNavigation, _state, _loadCount);
+    }
+    return shouldLoad;
+}
+
+- (void)webViewDidStartLoad:(UIWebView*)webView
+{
+    VerboseLog(@"webView didStartLoad (before). state=%d loadCount=%d", _state, _loadCount);
+    BOOL fireCallback = NO;
+    switch (_state) {
+        case STATE_IDLE:
+            if (IsAtLeastiOSVersion(@"6.0")) {
+                break;
+            }
+            // If history.go(-1) is used pre-iOS6, the shouldStartLoadWithRequest function is not called.
+            // Without shouldLoad, we can't distinguish an iframe from a top-level navigation.
+            // We could try to distinguish using [UIWebView canGoForward], but that's too much complexity,
+            // and would work only on the first time it was used.
+
+            // Our work-around is to set a JS variable and poll until it disappears (from a navigation).
+            _state = STATE_IOS5_POLLING_FOR_LOAD_START;
+            _loadStartPollCount = 0;
+            [self setLoadToken:webView];
+            [self pollForPageLoadStart:webView];
+            break;
+
+        case STATE_CANCELLED:
+            fireCallback = YES;
+            _state = STATE_WAITING_FOR_LOAD_FINISH;
+            _loadCount += 1;
+            break;
+
+        case STATE_WAITING_FOR_LOAD_START:
+            if (_loadCount != 0) {
+                NSLog(@"CDVWebViewDelegate: Unexpected loadCount in didStart. count=%ld", (long)_loadCount);
+            }
+            fireCallback = YES;
+            _state = STATE_WAITING_FOR_LOAD_FINISH;
+            _loadCount = 1;
+            break;
+
+        case STATE_WAITING_FOR_LOAD_FINISH:
+            _loadCount += 1;
+            break;
+
+        case STATE_IOS5_POLLING_FOR_LOAD_START:
+            [self pollForPageLoadStart:webView];
+            break;
+
+        case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
+            [self pollForPageLoadFinish:webView];
+            break;
+
+        default:
+            NSLog(@"CDVWebViewDelegate: Unexpected didStart with state=%ld loadCount=%ld", (long)_state, (long)_loadCount);
+    }
+    VerboseLog(@"webView didStartLoad (after). state=%d loadCount=%d fireCallback=%d", _state, _loadCount, fireCallback);
+    if (fireCallback && [_delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
+        [_delegate webViewDidStartLoad:webView];
+    }
+}
+
+- (void)webViewDidFinishLoad:(UIWebView*)webView
+{
+    VerboseLog(@"webView didFinishLoad (before). state=%d loadCount=%d", _state, _loadCount);
+    BOOL fireCallback = NO;
+    switch (_state) {
+        case STATE_IDLE:
+            break;
+
+        case STATE_WAITING_FOR_LOAD_START:
+            NSLog(@"CDVWebViewDelegate: Unexpected didFinish while waiting for load start.");
+            break;
+
+        case STATE_WAITING_FOR_LOAD_FINISH:
+            if (_loadCount == 1) {
+                fireCallback = YES;
+                _state = STATE_IDLE;
+            }
+            _loadCount -= 1;
+            break;
+
+        case STATE_IOS5_POLLING_FOR_LOAD_START:
+            [self pollForPageLoadStart:webView];
+            break;
+
+        case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
+            [self pollForPageLoadFinish:webView];
+            break;
+    }
+    VerboseLog(@"webView didFinishLoad (after). state=%d loadCount=%d fireCallback=%d", _state, _loadCount, fireCallback);
+    if (fireCallback && [_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
+        [_delegate webViewDidFinishLoad:webView];
+    }
+}
+
+- (void)webView:(UIWebView*)webView didFailLoadWithError:(NSError*)error
+{
+    VerboseLog(@"webView didFailLoad (before). state=%d loadCount=%d", _state, _loadCount);
+    BOOL fireCallback = NO;
+
+    switch (_state) {
+        case STATE_IDLE:
+            break;
+
+        case STATE_WAITING_FOR_LOAD_START:
+            if ([error code] == NSURLErrorCancelled) {
+                _state = STATE_CANCELLED;
+            } else {
+                _state = STATE_IDLE;
+            }
+            fireCallback = YES;
+            break;
+
+        case STATE_WAITING_FOR_LOAD_FINISH:
+            if ([error code] != NSURLErrorCancelled) {
+                if (_loadCount == 1) {
+                    _state = STATE_IDLE;
+                    fireCallback = YES;
+                }
+                _loadCount = -1;
+            } else {
+                fireCallback = YES;
+                _state = STATE_CANCELLED;
+                _loadCount -= 1;
+            }
+            break;
+
+        case STATE_IOS5_POLLING_FOR_LOAD_START:
+            [self pollForPageLoadStart:webView];
+            break;
+
+        case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
+            [self pollForPageLoadFinish:webView];
+            break;
+    }
+    VerboseLog(@"webView didFailLoad (after). state=%d loadCount=%d, fireCallback=%d", _state, _loadCount, fireCallback);
+    if (fireCallback && [_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
+        [_delegate webView:webView didFailLoadWithError:error];
+    }
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVUIWebViewEngine.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewEngine.h b/CordovaLib/Classes/CDVUIWebViewEngine.h
new file mode 100644
index 0000000..ea1d8f5
--- /dev/null
+++ b/CordovaLib/Classes/CDVUIWebViewEngine.h
@@ -0,0 +1,26 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import "CDVWebViewEngineProtocol.h"
+#import "CDVPlugin.h"
+
+@interface CDVUIWebViewEngine : CDVPlugin <CDVWebViewEngineProtocol>
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVUIWebViewEngine.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewEngine.m b/CordovaLib/Classes/CDVUIWebViewEngine.m
new file mode 100644
index 0000000..e81778f
--- /dev/null
+++ b/CordovaLib/Classes/CDVUIWebViewEngine.m
@@ -0,0 +1,164 @@
+/*
+ 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.
+ */
+
+#import "CDVUIWebViewEngine.h"
+#import "CDVUIWebViewDelegate.h"
+#import "NSDictionary+CordovaPreferences.h"
+
+#import <objc/message.h>
+
+@interface CDVUIWebViewEngine ()
+
+@property (nonatomic, strong, readwrite) UIView* engineWebView;
+
+@end
+
+// see forwardingTargetForSelector: selector comment for the reason for this pragma
+#pragma clang diagnostic ignored "-Wprotocol"
+
+@implementation CDVUIWebViewEngine
+
+@synthesize engineWebView = _engineWebView;
+
+- (instancetype)initWithFrame:(CGRect)frame
+{
+    self = [super init];
+    if (self) {
+        self.engineWebView = [[UIWebView alloc] initWithFrame:frame];
+        NSLog(@"Using UIWebView");
+    }
+
+    return self;
+}
+
+- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
+{
+    NSString* ret = [(UIWebView*)_engineWebView stringByEvaluatingJavaScriptFromString : javaScriptString];
+
+    if (completionHandler) {
+        completionHandler(ret, nil);
+    }
+}
+
+- (void)loadFileURL:(NSURL*)url allowingReadAccessToURL:(NSURL*)readAccessURL
+{
+    __weak CDVUIWebViewEngine* weakSelf = self;
+
+    // UIKit operations have to be on the main thread. This method does not need to be synchronous
+    dispatch_async(dispatch_get_main_queue(), ^{
+            [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
+        });
+}
+
+- (void)updateSettings:(NSDictionary*)settings
+{
+    UIWebView* uiWebView = (UIWebView*)_engineWebView;
+
+    uiWebView.scalesPageToFit = [settings cordovaBoolSettingForKey:@"EnableViewportScale" defaultValue:NO];
+    uiWebView.allowsInlineMediaPlayback = [settings cordovaBoolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:NO];
+    uiWebView.mediaPlaybackRequiresUserAction = [settings cordovaBoolSettingForKey:@"MediaPlaybackRequiresUserAction" defaultValue:YES];
+    uiWebView.mediaPlaybackAllowsAirPlay = [settings cordovaBoolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES];
+    uiWebView.keyboardDisplayRequiresUserAction = [settings cordovaBoolSettingForKey:@"KeyboardDisplayRequiresUserAction" defaultValue:YES];
+    uiWebView.suppressesIncrementalRendering = [settings cordovaBoolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO];
+    uiWebView.gapBetweenPages = [settings cordovaFloatSettingForKey:@"GapBetweenPages" defaultValue:0.0];
+    uiWebView.pageLength = [settings cordovaFloatSettingForKey:@"PageLength" defaultValue:0.0];
+
+    id prefObj = nil;
+
+    // By default, DisallowOverscroll is false (thus bounce is allowed)
+    BOOL bounceAllowed = !([settings cordovaBoolSettingForKey:@"DisallowOverscroll" defaultValue:NO]);
+
+    // prevent webView from bouncing
+    if (!bounceAllowed) {
+        if ([self.webView respondsToSelector:@selector(scrollView)]) {
+            ((UIScrollView*)[uiWebView scrollView]).bounces = NO;
+        } else {
+            for (id subview in self.webView.subviews) {
+                if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
+                    ((UIScrollView*)subview).bounces = NO;
+                }
+            }
+        }
+    }
+
+    NSString* decelerationSetting = [settings cordovaSettingForKey:@"UIWebViewDecelerationSpeed"];
+    if (![@"fast" isEqualToString : decelerationSetting]) {
+        [uiWebView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
+    }
+
+    NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage
+    prefObj = [settings cordovaSettingForKey:@"PaginationBreakingMode"];
+    if (prefObj != nil) {
+        NSArray* validValues = @[@"page", @"column"];
+        NSString* prefValue = [validValues objectAtIndex:0];
+
+        if ([prefObj isKindOfClass:[NSString class]]) {
+            prefValue = prefObj;
+        }
+
+        paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]];
+        if (paginationBreakingMode == NSNotFound) {
+            paginationBreakingMode = 0;
+        }
+    }
+    uiWebView.paginationBreakingMode = paginationBreakingMode;
+
+    NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated
+    prefObj = [settings cordovaSettingForKey:@"PaginationMode"];
+    if (prefObj != nil) {
+        NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"];
+        NSString* prefValue = [validValues objectAtIndex:0];
+
+        if ([prefObj isKindOfClass:[NSString class]]) {
+            prefValue = prefObj;
+        }
+
+        paginationMode = [validValues indexOfObject:[prefValue lowercaseString]];
+        if (paginationMode == NSNotFound) {
+            paginationMode = 0;
+        }
+    }
+    uiWebView.paginationMode = paginationMode;
+}
+
+- (void)updateWithInfo:(NSDictionary*)info
+{
+    id <UIWebViewDelegate> uiWebViewDelegate = [info objectForKey:kCDVWebViewEngineUIWebViewDelegate];
+    NSDictionary* settings = [info objectForKey:kCDVWebViewEngineWebViewPreferences];
+
+    if (uiWebViewDelegate &&
+        [uiWebViewDelegate conformsToProtocol:@protocol(UIWebViewDelegate)]) {
+        ((UIWebView*)_engineWebView).delegate = uiWebViewDelegate;
+    }
+
+    if (settings && [settings isKindOfClass:[NSDictionary class]]) {
+        [self updateSettings:settings];
+    }
+}
+
+// This forwards the methods that are in the header that are not implemented here.
+// Both WKWebView and UIWebView implement the below:
+//     loadHTMLString:baseURL:
+//     loadRequest:
+- (id)forwardingTargetForSelector:(SEL)aSelector
+{
+    return _engineWebView;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVUIWebViewPreferences.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewPreferences.h b/CordovaLib/Classes/CDVUIWebViewPreferences.h
deleted file mode 100644
index dd5caf9..0000000
--- a/CordovaLib/Classes/CDVUIWebViewPreferences.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- 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.
- */
-
-#import "CDVWebViewPreferences.h"
-#import <UIKit/UIKit.h>
-
-@interface CDVUIWebViewPreferences : CDVWebViewPreferences
-
-@property (nonatomic, weak) UIWebView* webView;
-
-- (instancetype)initWithWebView:(UIWebView*)webView settings:(NSDictionary*)settings;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVUIWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewPreferences.m b/CordovaLib/Classes/CDVUIWebViewPreferences.m
deleted file mode 100644
index 5eae9b1..0000000
--- a/CordovaLib/Classes/CDVUIWebViewPreferences.m
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- 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.
- */
-
-#import "CDVUIWebViewPreferences.h"
-
-@implementation CDVUIWebViewPreferences
-
-- (instancetype)initWithWebView:(UIWebView*)webView settings:(NSDictionary*)settings
-{
-    self = [super initWithSettings:settings];
-    if (self) {
-        self.webView = webView;
-    }
-
-    return self;
-}
-
-- (void)update
-{
-    self.webView.scalesPageToFit = [self boolSettingForKey:@"EnableViewportScale" defaultValue:NO];
-    self.webView.allowsInlineMediaPlayback = [self boolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:NO];
-    self.webView.mediaPlaybackRequiresUserAction = [self boolSettingForKey:@"MediaPlaybackRequiresUserAction" defaultValue:YES];
-    self.webView.mediaPlaybackAllowsAirPlay = [self boolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES];
-    self.webView.keyboardDisplayRequiresUserAction = [self boolSettingForKey:@"KeyboardDisplayRequiresUserAction" defaultValue:YES];
-    self.webView.suppressesIncrementalRendering = [self boolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO];
-    self.webView.gapBetweenPages = [self floatSettingForKey:@"GapBetweenPages" defaultValue:0.0];
-    self.webView.pageLength = [self floatSettingForKey:@"PageLength" defaultValue:0.0];
-
-    id prefObj = nil;
-
-    // By default, DisallowOverscroll is false (thus bounce is allowed)
-    BOOL bounceAllowed = !([self boolSettingForKey:@"DisallowOverscroll" defaultValue:NO]);
-
-    // prevent webView from bouncing
-    if (!bounceAllowed) {
-        if ([self.webView respondsToSelector:@selector(scrollView)]) {
-            ((UIScrollView*)[self.webView scrollView]).bounces = NO;
-        } else {
-            for (id subview in self.webView.subviews) {
-                if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
-                    ((UIScrollView*)subview).bounces = NO;
-                }
-            }
-        }
-    }
-
-    NSString* decelerationSetting = [self settingForKey:@"UIWebViewDecelerationSpeed"];
-    if (![@"fast" isEqualToString : decelerationSetting]) {
-        [self.webView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
-    }
-
-    NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage
-    prefObj = [self settingForKey:@"PaginationBreakingMode"];
-    if (prefObj != nil) {
-        NSArray* validValues = @[@"page", @"column"];
-        NSString* prefValue = [validValues objectAtIndex:0];
-
-        if ([prefObj isKindOfClass:[NSString class]]) {
-            prefValue = prefObj;
-        }
-
-        paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]];
-        if (paginationBreakingMode == NSNotFound) {
-            paginationBreakingMode = 0;
-        }
-    }
-    self.webView.paginationBreakingMode = paginationBreakingMode;
-
-    NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated
-    prefObj = [self settingForKey:@"PaginationMode"];
-    if (prefObj != nil) {
-        NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"];
-        NSString* prefValue = [validValues objectAtIndex:0];
-
-        if ([prefObj isKindOfClass:[NSString class]]) {
-            prefValue = prefObj;
-        }
-
-        paginationMode = [validValues indexOfObject:[prefValue lowercaseString]];
-        if (paginationMode == NSNotFound) {
-            paginationMode = 0;
-        }
-    }
-    self.webView.paginationMode = paginationMode;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index e5acc20..453ce30 100644
--- a/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/Classes/CDVViewController.h
@@ -26,7 +26,8 @@
 #import "CDVWhitelist.h"
 #import "CDVScreenOrientationDelegate.h"
 #import "CDVPlugin.h"
-#import "CDVWebViewProxy.h"
+#import "CDVWebViewEngineProtocol.h"
+
 #ifdef __IPHONE_8_0
     #import <WebKit/WebKit.h>
 #else
@@ -38,7 +39,7 @@
 
 @interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate, WKScriptMessageHandler>{
     @protected
-    CDVWebViewProxy* _webViewProxy;
+    id <CDVWebViewEngineProtocol> _webViewEngine;
     @protected
     id <CDVCommandDelegate> _commandDelegate;
     @protected
@@ -58,7 +59,7 @@
 @property (nonatomic, readwrite, copy) NSString* wwwFolderName;
 @property (nonatomic, readwrite, copy) NSString* startPage;
 @property (nonatomic, readonly, strong) CDVCommandQueue* commandQueue;
-@property (nonatomic, readonly, strong) CDVWebViewProxy* webViewProxy;
+@property (nonatomic, readonly, strong) id <CDVWebViewEngineProtocol> webViewEngine;
 @property (nonatomic, readonly, strong) id <CDVCommandDelegate> commandDelegate;
 
 /**

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index be31591..10c68ec 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -17,21 +17,20 @@
  under the License.
  */
 
-#import <objc/message.h>
 #import "CDV.h"
 #import "CDVCommandDelegateImpl.h"
 #import "CDVConfigParser.h"
 #import "CDVUserAgentUtil.h"
-#import "CDVWebViewDelegate.h"
-#import "CDVWebViewUIDelegate.h"
+#import "CDVUIWebViewDelegate.h"
+#import "NSDictionary+CordovaPreferences.h"
+
+#import <objc/message.h>
 #import <AVFoundation/AVFoundation.h>
 
 #define degreesToRadian(x) (M_PI * (x) / 180.0)
 
 @interface CDVViewController () {
     NSInteger _userAgentLockToken;
-    CDVWebViewDelegate* _webViewDelegate;
-    CDVWebViewUIDelegate* _webViewUIDelegate;
 }
 
 @property (nonatomic, readwrite, strong) NSXMLParser* configParser;
@@ -42,6 +41,7 @@
 @property (nonatomic, readwrite, strong) NSDictionary* pluginsMap;
 @property (nonatomic, readwrite, strong) NSArray* supportedOrientations;
 @property (nonatomic, readwrite, assign) BOOL loadFromString;
+@property (nonatomic, readwrite, strong) id <CDVWebViewEngineProtocol> webViewEngine;
 
 @property (readwrite, assign) BOOL initialized;
 
@@ -57,7 +57,7 @@
 @synthesize wwwFolderName, startPage, initialized, openURL, baseUserAgent;
 @synthesize commandDelegate = _commandDelegate;
 @synthesize commandQueue = _commandQueue;
-@synthesize webViewProxy = _webViewProxy;
+@synthesize webViewEngine = _webViewEngine;
 
 - (void)__init
 {
@@ -177,13 +177,13 @@
 
     NSURL* url = [NSURL fileURLWithPath:path];
 
-    configParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
-    if (configParser == nil) {
+    self.configParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
+    if (self.configParser == nil) {
         NSLog(@"Failed to initialize XML parser.");
         return;
     }
-    [configParser setDelegate:((id < NSXMLParserDelegate >)delegate)];
-    [configParser parse];
+    [self.configParser setDelegate:((id < NSXMLParserDelegate >)delegate)];
+    [self.configParser parse];
 
     // Get the plugin dictionary, whitelist and settings from the delegate.
     self.pluginsMap = delegate.pluginsDict;
@@ -237,7 +237,7 @@
 {
     NSURL* errorURL = nil;
 
-    id setting = [self settingForKey:@"ErrorUrl"];
+    id setting = [self.settings cordovaSettingForKey:@"ErrorUrl"];
 
     if (setting) {
         NSString* errorUrlString = (NSString*)setting;
@@ -264,11 +264,11 @@
 
     NSString* backupWebStorageType = @"cloud"; // default value
 
-    id backupWebStorage = [self settingForKey:@"BackupWebStorage"];
+    id backupWebStorage = [self.settings cordovaSettingForKey:@"BackupWebStorage"];
     if ([backupWebStorage isKindOfClass:[NSString class]]) {
         backupWebStorageType = backupWebStorage;
     }
-    [self setSetting:backupWebStorageType forKey:@"BackupWebStorage"];
+    [self.settings setCordovaSetting:backupWebStorageType forKey:@"BackupWebStorage"];
 
     if (IsAtLeastiOSVersion(@"5.1")) {
         [CDVLocalStorage __fixupDatabaseLocationsWithBackupType:backupWebStorageType];
@@ -280,12 +280,6 @@
         [self createGapView];
     }
 
-    // Configure WebView
-    _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self];
-    if ([webView respondsToSelector:@selector(setDelegate:)]) {
-        [webView setValue:_webViewDelegate forKey:@"delegate"];
-    }
-
     // register this viewcontroller with the NSURLProtocol, only after the User-Agent is set
     [CDVURLProtocol registerViewController:self];
 
@@ -299,8 +293,9 @@
         [self registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])];
     }
 
-    CDVWebViewPreferences* prefs = [[CDVWebViewPreferences alloc] initWithWebView:webView settings:self.settings];
-    [prefs update];
+    // TODO:
+    //    CDVWebViewPreferences* prefs = [[CDVWebViewPreferences alloc] initWithWebView:webView settings:self.settings];
+    //    [prefs update];
 
     if ([self.startupPluginNames count] > 0) {
         [CDVTimer start:@"TotalPluginStartup"];
@@ -322,7 +317,7 @@
         [CDVUserAgentUtil setUserAgent:self.userAgent lockToken:lockToken];
         if (appURL) {
             NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
-            [_webViewProxy loadRequest:appReq];
+            [self.webViewEngine loadRequest:appReq];
         } else {
             NSString* loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.", self.wwwFolderName, self.startPage];
             NSLog(@"%@", loadErr);
@@ -331,25 +326,15 @@
             if (errorUrl) {
                 errorUrl = [NSURL URLWithString:[NSString stringWithFormat:@"?error=%@", [loadErr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] relativeToURL:errorUrl];
                 NSLog(@"%@", [errorUrl absoluteString]);
-                [_webViewProxy loadRequest:[NSURLRequest requestWithURL:errorUrl]];
+                [self.webViewEngine loadRequest:[NSURLRequest requestWithURL:errorUrl]];
             } else {
                 NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr];
-                [_webViewProxy loadHTMLString:html baseURL:nil];
+                [self.webViewEngine loadHTMLString:html baseURL:nil];
             }
         }
     }];
 }
 
-- (id)settingForKey:(NSString*)key
-{
-    return [[self settings] objectForKey:[key lowercaseString]];
-}
-
-- (void)setSetting:(id)setting forKey:(NSString*)key
-{
-    [[self settings] setObject:setting forKey:[key lowercaseString]];
-}
-
 - (NSArray*)parseInterfaceOrientations:(NSArray*)orientations
 {
     NSMutableArray* result = [[NSMutableArray alloc] init];
@@ -407,7 +392,7 @@
         , (long)[self mapIosOrientationToJsOrientation:interfaceOrientation]];
     __weak CDVViewController* weakSelf = self;
 
-    [_webViewProxy evaluateJavaScript:jsCall completionHandler:^(NSString* obj, NSError* error) {
+    [_webViewEngine evaluateJavaScript:jsCall completionHandler:^(NSString* obj, NSError* error) {
         if ([obj length] > 0) {
             completionHandler([obj boolValue]);
         } else {
@@ -449,37 +434,28 @@
 
 - (UIView*)newCordovaViewWithFrame:(CGRect)bounds
 {
-    UIView* cordovaView = nil;
-    BOOL useWKWebView = NO;  // default value
+    NSString* defaultWebViewEngineClass = @"CDVUIWebViewEngine";
+    NSString* webViewEngineClass = [self.settings cordovaSettingForKey:@"CordovaWebViewEngine"];
 
-    if ([self settingForKey:@"UseWKWebView"]) {
-        useWKWebView = [(NSNumber*)[self settingForKey:@"UseWKWebView"] boolValue];
+    if (!webViewEngineClass) {
+        webViewEngineClass = defaultWebViewEngineClass;
     }
 
-    if (NSClassFromString(@"WKWebView") && useWKWebView) {
-#ifdef __IPHONE_8_0
-            WKUserContentController* userContentController = [[WKUserContentController alloc] init];
-
-            // scriptMessageHandler is the object that conforms to the WKScriptMessageHandler protocol
-            // see https://developer.apple.com/library/prerelease/ios/documentation/WebKit/Reference/WKScriptMessageHandler_Ref/index.html#//apple_ref/swift/intf/WKScriptMessageHandler
-            if ([self conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
-                [userContentController addScriptMessageHandler:self name:@"cordova"];
-            }
-
-            WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];
-            configuration.userContentController = userContentController;
-
-            cordovaView = [[WKWebView alloc] initWithFrame:bounds configuration:configuration];
-            NSLog(@"Using a WKWebView");
-            _webViewUIDelegate = [[CDVWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
-            ((WKWebView*)cordovaView).UIDelegate = _webViewUIDelegate;
-#endif
+    // Find webViewEngine
+    if (NSClassFromString(webViewEngineClass)) {
+        self.webViewEngine = [[NSClassFromString(webViewEngineClass) alloc] initWithFrame:bounds];
     } else {
-        cordovaView = [[UIWebView alloc] initWithFrame:bounds];
-        NSLog(@"Using a UIWebView");
+        self.webViewEngine = [[NSClassFromString(defaultWebViewEngineClass) alloc] initWithFrame:bounds];
     }
 
-    return cordovaView;
+    NSMutableDictionary* info = [NSMutableDictionary dictionaryWithCapacity:1];
+    [info setValue:@{@"cordova" : self} forKey:kCDVWebViewEngineScriptMessageHandlers];
+    [info setValue:self forKey:kCDVWebViewEngineUIWebViewDelegate];
+    [info setValue:self.settings forKey:kCDVWebViewEngineWebViewPreferences];
+
+    [self.webViewEngine updateWithInfo:info];
+
+    return self.webViewEngine.engineWebView;
 }
 
 - (NSString*)userAgent
@@ -504,9 +480,8 @@
     webViewBounds.origin = self.view.bounds.origin;
 
     self.webView = [self newCordovaViewWithFrame:webViewBounds];
-    self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
-    _webViewProxy = [[CDVWebViewProxy alloc] initWithWebView:self.webView];
 
+    self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
     [self.view addSubview:self.webView];
     [self.view sendSubviewToBack:self.webView];
 }
@@ -541,9 +516,6 @@
     // Release any retained subviews of the main view.
     // e.g. self.myOutlet = nil;
 
-    if ([webView respondsToSelector:@selector(setDelegate:)]) {
-        [webView setValue:nil forKey:@"delegate"];
-    }
     self.webView = nil;
     [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
 
@@ -900,8 +872,8 @@
 
     dispatch_block_t handleOpenUrl = ^(void) {
         NSString* jsString = [NSString stringWithFormat:@"if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}", url];
-        [_webViewProxy evaluateJavaScript:jsString
-                        completionHandler:^(id object, NSError* error) {
+        [_webViewEngine evaluateJavaScript:jsString
+                         completionHandler:^(id object, NSError* error) {
             if (error == nil) {
                 weakSelf.openURL = nil;
             }
@@ -911,8 +883,8 @@
     if (!pageLoaded) {
         // query the webview for readystate
         NSString* jsString = @"document.readystate";
-        [_webViewProxy evaluateJavaScript:jsString
-                        completionHandler:^(id object, NSError* error) {
+        [_webViewEngine evaluateJavaScript:jsString
+                         completionHandler:^(id object, NSError* error) {
             if ((error == nil) && [object isKindOfClass:[NSString class]]) {
                 NSString* readyState = (NSString*)object;
                 BOOL ready = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
@@ -967,10 +939,6 @@
     [CDVURLProtocol unregisterViewController:self];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 
-    if ([webView respondsToSelector:@selector(setDelegate:)]) {
-        [webView setValue:nil forKey:@"delegate"];
-    }
-
     self.webView = nil;
     [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
     [_commandQueue dispose];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWKWebViewEngine.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewEngine.h b/CordovaLib/Classes/CDVWKWebViewEngine.h
new file mode 100644
index 0000000..fde1d11
--- /dev/null
+++ b/CordovaLib/Classes/CDVWKWebViewEngine.h
@@ -0,0 +1,28 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import "CDVWebViewEngineProtocol.h"
+#import "CDVPlugin.h"
+
+@interface CDVWKWebViewEngine : CDVPlugin <CDVWebViewEngineProtocol>
+
+@property (nonatomic, strong, readonly) id <WKUIDelegate> uiDelegate;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWKWebViewEngine.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewEngine.m b/CordovaLib/Classes/CDVWKWebViewEngine.m
new file mode 100644
index 0000000..4907572
--- /dev/null
+++ b/CordovaLib/Classes/CDVWKWebViewEngine.m
@@ -0,0 +1,139 @@
+/*
+ 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.
+ */
+
+#import "CDVWKWebViewEngine.h"
+#import "CDVWKWebViewUIDelegate.h"
+#import "NSDictionary+CordovaPreferences.h"
+
+#import <objc/message.h>
+#import <WebKit/WebKit.h>
+
+@interface CDVWKWebViewEngine ()
+
+@property (nonatomic, strong, readwrite) UIView* engineWebView;
+@property (nonatomic, strong, readwrite) id <WKUIDelegate> uiDelegate;
+
+@end
+
+// see forwardingTargetForSelector: selector comment for the reason for this pragma
+#pragma clang diagnostic ignored "-Wprotocol"
+
+@implementation CDVWKWebViewEngine
+
+@synthesize engineWebView = _engineWebView;
+
+- (instancetype)initWithFrame:(CGRect)frame
+{
+    self = [super init];
+    if (self) {
+        self.uiDelegate = [[CDVWKWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
+
+        WKUserContentController* userContentController = [[WKUserContentController alloc] init];
+
+        WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];
+        configuration.userContentController = userContentController;
+
+        WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:frame configuration:configuration];
+
+        wkWebView.UIDelegate = self.uiDelegate;
+        self.engineWebView = wkWebView;
+
+        NSLog(@"Using WKWebView");
+    }
+
+    return self;
+}
+
+// We implement this here because certain versions of iOS 8 do not implement this
+// in WKWebView, so we need to test for this during runtime.
+// It is speculated that this selector will be available in iOS 8.2 for WKWebView
+- (void)loadFileURL:(NSURL*)url allowingReadAccessToURL:(NSURL*)readAccessURL
+{
+    SEL wk_sel = @selector(loadFileURL:allowingReadAccessToURL:);
+    __weak CDVWKWebViewEngine* weakSelf = self;
+
+    // UIKit operations have to be on the main thread. This method does not need to be synchronous
+    dispatch_async(dispatch_get_main_queue(), ^{
+            if ([_engineWebView respondsToSelector:wk_sel] && [[url scheme] isEqualToString:@"file"]) {
+                ((id (*)(id, SEL, id, id))objc_msgSend)(_engineWebView, wk_sel, url, readAccessURL);
+            } else {
+                [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
+            }
+        });
+}
+
+- (void)updateSettings:(NSDictionary*)settings
+{
+    WKWebView* wkWebView = (WKWebView*)_engineWebView;
+
+    wkWebView.configuration.preferences.minimumFontSize = [settings cordovaFloatSettingForKey:@"MinimumFontSize" defaultValue:0.0];
+    wkWebView.configuration.allowsInlineMediaPlayback = [settings cordovaBoolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:NO];
+    wkWebView.configuration.mediaPlaybackRequiresUserAction = [settings cordovaBoolSettingForKey:@"MediaPlaybackRequiresUserAction" defaultValue:YES];
+    wkWebView.configuration.suppressesIncrementalRendering = [settings cordovaBoolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO];
+    wkWebView.configuration.mediaPlaybackAllowsAirPlay = [settings cordovaBoolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES];
+
+    /*
+     wkWebView.configuration.preferences.javaScriptEnabled = [settings cordovaBoolSettingForKey:@"JavaScriptEnabled" default:YES];
+     wkWebView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = [settings cordovaBoolSettingForKey:@"JavaScriptCanOpenWindowsAutomatically" default:NO];
+     */
+}
+
+- (void)updateWithInfo:(NSDictionary*)info
+{
+    NSDictionary* scriptMessageHandlers = [info objectForKey:kCDVWebViewEngineScriptMessageHandlers];
+    NSDictionary* settings = [info objectForKey:kCDVWebViewEngineWebViewPreferences];
+    id navigationDelegate = [info objectForKey:kCDVWebViewEngineWKNavigationDelegate];
+    id uiDelegate = [info objectForKey:kCDVWebViewEngineWKUIDelegate];
+
+    WKWebView* wkWebView = (WKWebView*)_engineWebView;
+
+    if (scriptMessageHandlers && [scriptMessageHandlers isKindOfClass:[NSDictionary class]]) {
+        NSArray* allKeys = [scriptMessageHandlers allKeys];
+
+        for (NSString* key in allKeys) {
+            id object = [scriptMessageHandlers objectForKey:key];
+            if ([object conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
+                [wkWebView.configuration.userContentController addScriptMessageHandler:object name:key];
+            }
+        }
+    }
+
+    if (navigationDelegate && [navigationDelegate conformsToProtocol:@protocol(WKNavigationDelegate)]) {
+        wkWebView.navigationDelegate = navigationDelegate;
+    }
+
+    if (uiDelegate && [uiDelegate conformsToProtocol:@protocol(WKUIDelegate)]) {
+        wkWebView.UIDelegate = uiDelegate;
+    }
+
+    if (settings && [settings isKindOfClass:[NSDictionary class]]) {
+        [self updateSettings:settings];
+    }
+}
+
+// This forwards the methods that are in the header that are not implemented here.
+// Both WKWebView and UIWebView implement the below:
+//     loadHTMLString:baseURL:
+//     loadRequest:
+- (id)forwardingTargetForSelector:(SEL)aSelector
+{
+    return _engineWebView;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWKWebViewPreferences.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewPreferences.h b/CordovaLib/Classes/CDVWKWebViewPreferences.h
deleted file mode 100644
index ffa357a..0000000
--- a/CordovaLib/Classes/CDVWKWebViewPreferences.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- 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.
- */
-
-#import "CDVWebViewPreferences.h"
-#import <WebKit/WebKit.h>
-
-@interface CDVWKWebViewPreferences : CDVWebViewPreferences
-
-@property (nonatomic, weak) WKWebView* webView;
-
-- (instancetype)initWithWebView:(WKWebView*)webView settings:(NSDictionary*)settings;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWKWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewPreferences.m b/CordovaLib/Classes/CDVWKWebViewPreferences.m
deleted file mode 100644
index 6cf1a78..0000000
--- a/CordovaLib/Classes/CDVWKWebViewPreferences.m
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- 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.
- */
-
-#import "CDVWKWebViewPreferences.h"
-
-@implementation CDVWKWebViewPreferences
-
-- (instancetype)initWithWebView:(WKWebView*)webView settings:(NSDictionary*)settings
-{
-    self = [super initWithSettings:settings];
-    if (self) {
-        self.webView = webView;
-    }
-
-    return self;
-}
-
-- (void)update
-{
-    self.webView.configuration.preferences.minimumFontSize = [self floatSettingForKey:@"MinimumFontSize" defaultValue:0.0];
-    self.webView.configuration.allowsInlineMediaPlayback = [self boolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:NO];
-    self.webView.configuration.mediaPlaybackRequiresUserAction = [self boolSettingForKey:@"MediaPlaybackRequiresUserAction" defaultValue:YES];
-    self.webView.configuration.suppressesIncrementalRendering = [self boolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO];
-    self.webView.configuration.mediaPlaybackAllowsAirPlay = [self boolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES];
-
-    /*
-     self.webView.configuration.preferences.javaScriptEnabled = [self boolSettingForKey:@"JavaScriptEnabled" default:YES];
-     self.webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = [self boolSettingForKey:@"JavaScriptCanOpenWindowsAutomatically" default:NO];
-     */
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWKWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewUIDelegate.h b/CordovaLib/Classes/CDVWKWebViewUIDelegate.h
new file mode 100644
index 0000000..f8971a9
--- /dev/null
+++ b/CordovaLib/Classes/CDVWKWebViewUIDelegate.h
@@ -0,0 +1,29 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import <WebKit/WebKit.h>
+
+@interface CDVWKWebViewUIDelegate : NSObject <WKUIDelegate>
+
+@property (nonatomic, copy) NSString* title;
+
+- (instancetype)initWithTitle:(NSString*)title;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWKWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewUIDelegate.m b/CordovaLib/Classes/CDVWKWebViewUIDelegate.m
new file mode 100644
index 0000000..e3024b0
--- /dev/null
+++ b/CordovaLib/Classes/CDVWKWebViewUIDelegate.m
@@ -0,0 +1,126 @@
+/*
+ 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.
+ */
+
+#ifdef __IPHONE_8_0
+
+#import "CDVWKWebViewUIDelegate.h"
+
+    @implementation CDVWKWebViewUIDelegate
+
+    - (instancetype)initWithTitle:(NSString*)title
+    {
+        self = [super init];
+        if (self) {
+            self.title = title;
+        }
+
+        return self;
+    }
+
+    - (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
+        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:message
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler();
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    - (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
+        initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:message
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler(YES);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                                                         style:UIAlertActionStyleDefault
+                                                       handler:^(UIAlertAction* action)
+            {
+                completionHandler(NO);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+        [alert addAction:cancel];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    - (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
+              defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
+        completionHandler:(void (^)(NSString* result))completionHandler
+    {
+        UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+                                                                       message:prompt
+                                                                preferredStyle:UIAlertControllerStyleAlert];
+
+        UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+                                                     style:UIAlertActionStyleDefault
+                                                   handler:^(UIAlertAction* action)
+            {
+                completionHandler(((UITextField*)alert.textFields[0]).text);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+
+        [alert addAction:ok];
+
+        UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                                                         style:UIAlertActionStyleDefault
+                                                       handler:^(UIAlertAction* action)
+            {
+                completionHandler(nil);
+                [alert dismissViewControllerAnimated:YES completion:nil];
+            }];
+        [alert addAction:cancel];
+
+        [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
+            textField.text = defaultText;
+        }];
+
+        UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+        [rootController presentViewController:alert animated:YES completion:nil];
+    }
+
+    @end
+#endif /* ifdef __IPHONE_8_0 */

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWebViewDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewDelegate.h b/CordovaLib/Classes/CDVWebViewDelegate.h
deleted file mode 100644
index 4b60bab..0000000
--- a/CordovaLib/Classes/CDVWebViewDelegate.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- 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.
- */
-
-#import <UIKit/UIKit.h>
-#import "CDVAvailability.h"
-
-/**
- * Distinguishes top-level navigations from sub-frame navigations.
- * shouldStartLoadWithRequest is called for every request, but didStartLoad
- * and didFinishLoad is called only for top-level navigations.
- * Relevant bug: CB-2389
- */
-@interface CDVWebViewDelegate : NSObject <UIWebViewDelegate>{
-    __weak NSObject <UIWebViewDelegate>* _delegate;
-    NSInteger _loadCount;
-    NSInteger _state;
-    NSInteger _curLoadToken;
-    NSInteger _loadStartPollCount;
-}
-
-- (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate;
-- (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest CDV_DEPRECATED(3.5, "Use request:isEqualToRequestAfterStrippingFragments: instead.");
-
-- (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce6604db/CordovaLib/Classes/CDVWebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewDelegate.m b/CordovaLib/Classes/CDVWebViewDelegate.m
deleted file mode 100644
index 5a187f4..0000000
--- a/CordovaLib/Classes/CDVWebViewDelegate.m
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- 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.
- */
-
-//
-// Testing shows:
-//
-// In all cases, webView.request.URL is the previous page's URL (or empty) during the didStartLoad callback.
-// When loading a page with a redirect:
-// 1. shouldStartLoading (requestURL is target page)
-// 2. didStartLoading
-// 3. shouldStartLoading (requestURL is redirect target)
-// 4. didFinishLoad (request.URL is redirect target)
-//
-// Note the lack of a second didStartLoading **
-//
-// When loading a page with iframes:
-// 1. shouldStartLoading (requestURL is main page)
-// 2. didStartLoading
-// 3. shouldStartLoading (requestURL is one of the iframes)
-// 4. didStartLoading
-// 5. didFinishLoad
-// 6. didFinishLoad
-//
-// Note there is no way to distinguish which didFinishLoad maps to which didStartLoad **
-//
-// Loading a page by calling window.history.go(-1):
-// 1. didStartLoading
-// 2. didFinishLoad
-//
-// Note the lack of a shouldStartLoading call **
-// Actually - this is fixed on iOS6. iOS6 has a shouldStart. **
-//
-// Loading a page by calling location.reload()
-// 1. shouldStartLoading
-// 2. didStartLoading
-// 3. didFinishLoad
-//
-// Loading a page with an iframe that fails to load:
-// 1. shouldStart (main page)
-// 2. didStart
-// 3. shouldStart (iframe)
-// 4. didStart
-// 5. didFailWithError
-// 6. didFinish
-//
-// Loading a page with an iframe that fails to load due to an invalid URL:
-// 1. shouldStart (main page)
-// 2. didStart
-// 3. shouldStart (iframe)
-// 5. didFailWithError
-// 6. didFinish
-//
-// This case breaks our logic since there is a missing didStart. To prevent this,
-// we check URLs in shouldStart and return NO if they are invalid.
-//
-// Loading a page with an invalid URL
-// 1. shouldStart (main page)
-// 2. didFailWithError
-//
-// TODO: Record order when page is re-navigated before the first navigation finishes.
-//
-
-#import "CDVWebViewDelegate.h"
-#import "CDVAvailability.h"
-
-// #define VerboseLog NSLog
-#define VerboseLog(...) do {} while (0)
-
-typedef enum {
-    STATE_IDLE = 0,
-    STATE_WAITING_FOR_LOAD_START = 1,
-    STATE_WAITING_FOR_LOAD_FINISH = 2,
-    STATE_IOS5_POLLING_FOR_LOAD_START = 3,
-    STATE_IOS5_POLLING_FOR_LOAD_FINISH = 4,
-    STATE_CANCELLED = 5
-} State;
-
-static NSString *stripFragment(NSString* url)
-{
-    NSRange r = [url rangeOfString:@"#"];
-
-    if (r.location == NSNotFound) {
-        return url;
-    }
-    return [url substringToIndex:r.location];
-}
-
-@implementation CDVWebViewDelegate
-
-- (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate
-{
-    self = [super init];
-    if (self != nil) {
-        _delegate = delegate;
-        _loadCount = -1;
-        _state = STATE_IDLE;
-    }
-    return self;
-}
-
-- (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest
-{
-    return [self request:newRequest isEqualToRequestAfterStrippingFragments:originalRequest];
-}
-
-- (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest
-{
-    if (originalRequest.URL && newRequest.URL) {
-        NSString* originalRequestUrl = [originalRequest.URL absoluteString];
-        NSString* newRequestUrl = [newRequest.URL absoluteString];
-
-        NSString* baseOriginalRequestUrl = stripFragment(originalRequestUrl);
-        NSString* baseNewRequestUrl = stripFragment(newRequestUrl);
-        return [baseOriginalRequestUrl isEqualToString:baseNewRequestUrl];
-    }
-
-    return NO;
-}
-
-- (BOOL)isPageLoaded:(UIWebView*)webView
-{
-    NSString* readyState = [webView stringByEvaluatingJavaScriptFromString:@"document.readyState"];
-
-    return [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
-}
-
-- (BOOL)isJsLoadTokenSet:(UIWebView*)webView
-{
-    NSString* loadToken = [webView stringByEvaluatingJavaScriptFromString:@"window.__cordovaLoadToken"];
-
-    return [[NSString stringWithFormat:@"%ld", (long)_curLoadToken] isEqualToString:loadToken];
-}
-
-- (void)setLoadToken:(UIWebView*)webView
-{
-    _curLoadToken += 1;
-    [webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"window.__cordovaLoadToken=%ld", (long)_curLoadToken]];
-}
-
-- (NSString*)evalForCurrentURL:(UIWebView*)webView
-{
-    return [webView stringByEvaluatingJavaScriptFromString:@"location.href"];
-}
-
-- (void)pollForPageLoadStart:(UIWebView*)webView
-{
-    if (_state != STATE_IOS5_POLLING_FOR_LOAD_START) {
-        return;
-    }
-    if (![self isJsLoadTokenSet:webView]) {
-        VerboseLog(@"Polled for page load start. result = YES!");
-        _state = STATE_IOS5_POLLING_FOR_LOAD_FINISH;
-        [self setLoadToken:webView];
-        if ([_delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
-            [_delegate webViewDidStartLoad:webView];
-        }
-        [self pollForPageLoadFinish:webView];
-    } else {
-        VerboseLog(@"Polled for page load start. result = NO");
-        // Poll only for 1 second, and then fall back on checking only when delegate methods are called.
-        ++_loadStartPollCount;
-        if (_loadStartPollCount < (1000 * .05)) {
-            [self performSelector:@selector(pollForPageLoadStart:) withObject:webView afterDelay:.05];
-        }
-    }
-}
-
-- (void)pollForPageLoadFinish:(UIWebView*)webView
-{
-    if (_state != STATE_IOS5_POLLING_FOR_LOAD_FINISH) {
-        return;
-    }
-    if ([self isPageLoaded:webView]) {
-        VerboseLog(@"Polled for page load finish. result = YES!");
-        _state = STATE_IDLE;
-        if ([_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
-            [_delegate webViewDidFinishLoad:webView];
-        }
-    } else {
-        VerboseLog(@"Polled for page load finish. result = NO");
-        [self performSelector:@selector(pollForPageLoadFinish:) withObject:webView afterDelay:.05];
-    }
-}
-
-- (BOOL)shouldLoadRequest:(NSURLRequest*)request
-{
-    NSString* scheme = [[request URL] scheme];
-
-    if ([scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"tel"]) {
-        return YES;
-    }
-
-    return [NSURLConnection canHandleRequest:request];
-}
-
-- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
-{
-    BOOL shouldLoad = YES;
-
-    if ([_delegate respondsToSelector:@selector(webView:shouldStartLoadWithRequest:navigationType:)]) {
-        shouldLoad = [_delegate webView:webView shouldStartLoadWithRequest:request navigationType:navigationType];
-    }
-
-    VerboseLog(@"webView shouldLoad=%d (before) state=%d loadCount=%d URL=%@", shouldLoad, _state, _loadCount, request.URL);
-
-    if (shouldLoad) {
-        // When devtools refresh occurs, it blindly uses the same request object. If a history.replaceState() has occured, then
-        // mainDocumentURL != URL even though it's a top-level navigation.
-        BOOL isDevToolsRefresh = (request == webView.request);
-        BOOL isTopLevelNavigation = isDevToolsRefresh || [request.URL isEqual:[request mainDocumentURL]];
-        if (isTopLevelNavigation) {
-            // Ignore hash changes that don't navigate to a different page.
-            // webView.request does actually update when history.replaceState() gets called.
-            if ([self request:request isEqualToRequestAfterStrippingFragments:webView.request]) {
-                NSString* prevURL = [self evalForCurrentURL:webView];
-                if ([prevURL isEqualToString:[request.URL absoluteString]]) {
-                    VerboseLog(@"Page reload detected.");
-                } else {
-                    VerboseLog(@"Detected hash change shouldLoad");
-                    return shouldLoad;
-                }
-            }
-
-            switch (_state) {
-                case STATE_WAITING_FOR_LOAD_FINISH:
-                    // Redirect case.
-                    // We expect loadCount == 1.
-                    if (_loadCount != 1) {
-                        NSLog(@"CDVWebViewDelegate: Detected redirect when loadCount=%ld", (long)_loadCount);
-                    }
-                    break;
-
-                case STATE_IDLE:
-                case STATE_IOS5_POLLING_FOR_LOAD_START:
-                case STATE_CANCELLED:
-                    // Page navigation start.
-                    _loadCount = 0;
-                    _state = STATE_WAITING_FOR_LOAD_START;
-                    break;
-
-                default:
-                    {
-                        _loadCount = 0;
-                        _state = STATE_WAITING_FOR_LOAD_START;
-                        NSString* description = [NSString stringWithFormat:@"CDVWebViewDelegate: Navigation started when state=%ld", (long)_state];
-                        NSLog(@"%@", description);
-                        if ([_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
-                            NSDictionary* errorDictionary = @{NSLocalizedDescriptionKey : description};
-                            NSError* error = [[NSError alloc] initWithDomain:@"CDVWebViewDelegate" code:1 userInfo:errorDictionary];
-                            [_delegate webView:webView didFailLoadWithError:error];
-                        }
-                    }
-            }
-        } else {
-            // Deny invalid URLs so that we don't get the case where we go straight from
-            // webViewShouldLoad -> webViewDidFailLoad (messes up _loadCount).
-            shouldLoad = shouldLoad && [self shouldLoadRequest:request];
-        }
-        VerboseLog(@"webView shouldLoad=%d (after) isTopLevelNavigation=%d state=%d loadCount=%d", shouldLoad, isTopLevelNavigation, _state, _loadCount);
-    }
-    return shouldLoad;
-}
-
-- (void)webViewDidStartLoad:(UIWebView*)webView
-{
-    VerboseLog(@"webView didStartLoad (before). state=%d loadCount=%d", _state, _loadCount);
-    BOOL fireCallback = NO;
-    switch (_state) {
-        case STATE_IDLE:
-            if (IsAtLeastiOSVersion(@"6.0")) {
-                break;
-            }
-            // If history.go(-1) is used pre-iOS6, the shouldStartLoadWithRequest function is not called.
-            // Without shouldLoad, we can't distinguish an iframe from a top-level navigation.
-            // We could try to distinguish using [UIWebView canGoForward], but that's too much complexity,
-            // and would work only on the first time it was used.
-
-            // Our work-around is to set a JS variable and poll until it disappears (from a navigation).
-            _state = STATE_IOS5_POLLING_FOR_LOAD_START;
-            _loadStartPollCount = 0;
-            [self setLoadToken:webView];
-            [self pollForPageLoadStart:webView];
-            break;
-
-        case STATE_CANCELLED:
-            fireCallback = YES;
-            _state = STATE_WAITING_FOR_LOAD_FINISH;
-            _loadCount += 1;
-            break;
-
-        case STATE_WAITING_FOR_LOAD_START:
-            if (_loadCount != 0) {
-                NSLog(@"CDVWebViewDelegate: Unexpected loadCount in didStart. count=%ld", (long)_loadCount);
-            }
-            fireCallback = YES;
-            _state = STATE_WAITING_FOR_LOAD_FINISH;
-            _loadCount = 1;
-            break;
-
-        case STATE_WAITING_FOR_LOAD_FINISH:
-            _loadCount += 1;
-            break;
-
-        case STATE_IOS5_POLLING_FOR_LOAD_START:
-            [self pollForPageLoadStart:webView];
-            break;
-
-        case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
-            [self pollForPageLoadFinish:webView];
-            break;
-
-        default:
-            NSLog(@"CDVWebViewDelegate: Unexpected didStart with state=%ld loadCount=%ld", (long)_state, (long)_loadCount);
-    }
-    VerboseLog(@"webView didStartLoad (after). state=%d loadCount=%d fireCallback=%d", _state, _loadCount, fireCallback);
-    if (fireCallback && [_delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
-        [_delegate webViewDidStartLoad:webView];
-    }
-}
-
-- (void)webViewDidFinishLoad:(UIWebView*)webView
-{
-    VerboseLog(@"webView didFinishLoad (before). state=%d loadCount=%d", _state, _loadCount);
-    BOOL fireCallback = NO;
-    switch (_state) {
-        case STATE_IDLE:
-            break;
-
-        case STATE_WAITING_FOR_LOAD_START:
-            NSLog(@"CDVWebViewDelegate: Unexpected didFinish while waiting for load start.");
-            break;
-
-        case STATE_WAITING_FOR_LOAD_FINISH:
-            if (_loadCount == 1) {
-                fireCallback = YES;
-                _state = STATE_IDLE;
-            }
-            _loadCount -= 1;
-            break;
-
-        case STATE_IOS5_POLLING_FOR_LOAD_START:
-            [self pollForPageLoadStart:webView];
-            break;
-
-        case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
-            [self pollForPageLoadFinish:webView];
-            break;
-    }
-    VerboseLog(@"webView didFinishLoad (after). state=%d loadCount=%d fireCallback=%d", _state, _loadCount, fireCallback);
-    if (fireCallback && [_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
-        [_delegate webViewDidFinishLoad:webView];
-    }
-}
-
-- (void)webView:(UIWebView*)webView didFailLoadWithError:(NSError*)error
-{
-    VerboseLog(@"webView didFailLoad (before). state=%d loadCount=%d", _state, _loadCount);
-    BOOL fireCallback = NO;
-
-    switch (_state) {
-        case STATE_IDLE:
-            break;
-
-        case STATE_WAITING_FOR_LOAD_START:
-            if ([error code] == NSURLErrorCancelled) {
-                _state = STATE_CANCELLED;
-            } else {
-                _state = STATE_IDLE;
-            }
-            fireCallback = YES;
-            break;
-
-        case STATE_WAITING_FOR_LOAD_FINISH:
-            if ([error code] != NSURLErrorCancelled) {
-                if (_loadCount == 1) {
-                    _state = STATE_IDLE;
-                    fireCallback = YES;
-                }
-                _loadCount = -1;
-            } else {
-                fireCallback = YES;
-                _state = STATE_CANCELLED;
-                _loadCount -= 1;
-            }
-            break;
-
-        case STATE_IOS5_POLLING_FOR_LOAD_START:
-            [self pollForPageLoadStart:webView];
-            break;
-
-        case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
-            [self pollForPageLoadFinish:webView];
-            break;
-    }
-    VerboseLog(@"webView didFailLoad (after). state=%d loadCount=%d, fireCallback=%d", _state, _loadCount, fireCallback);
-    if (fireCallback && [_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
-        [_delegate webView:webView didFailLoadWithError:error];
-    }
-}
-
-@end


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[21/43] ios commit: Renamed CDVWebViewOperationsDelegate to CDVWebViewProxy (plus uncrustify style fixups)

Posted by sh...@apache.org.
Renamed CDVWebViewOperationsDelegate to CDVWebViewProxy (plus uncrustify style fixups)


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

Branch: refs/heads/4.0.x
Commit: 46910664ac236c2d75d9c5e7c9a0134a8e3b2e40
Parents: 3a41824
Author: Shazron Abdullah <sh...@apache.org>
Authored: Sun Nov 2 00:07:21 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Sun Nov 2 00:07:21 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDV.h                        |   2 +-
 CordovaLib/Classes/CDVCommandDelegateImpl.m     |  27 +++--
 CordovaLib/Classes/CDVCommandQueue.m            |   4 +-
 CordovaLib/Classes/CDVPlugin.m                  |   2 +-
 CordovaLib/Classes/CDVViewController.h          |   6 +-
 CordovaLib/Classes/CDVViewController.m          |  20 ++--
 .../Classes/CDVWebViewOperationsDelegate.h      |  39 -------
 .../Classes/CDVWebViewOperationsDelegate.m      | 104 -------------------
 CordovaLib/Classes/CDVWebViewProxy.h            |  39 +++++++
 CordovaLib/Classes/CDVWebViewProxy.m            | 104 +++++++++++++++++++
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |  20 ++--
 11 files changed, 183 insertions(+), 184 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index d368961..771bdc5 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -32,7 +32,7 @@
 #import "CDVScreenOrientationDelegate.h"
 #import "CDVTimer.h"
 #import "CDVWebViewPreferences.h"
-#import "CDVWebViewOperationsDelegate.h"
+#import "CDVWebViewProxy.h"
 
 #import "NSArray+Comparisons.h"
 #import "NSData+Base64.h"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/Classes/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandDelegateImpl.m b/CordovaLib/Classes/CDVCommandDelegateImpl.m
index 02e3064..9a5f2aa 100644
--- a/CordovaLib/Classes/CDVCommandDelegateImpl.m
+++ b/CordovaLib/Classes/CDVCommandDelegateImpl.m
@@ -6,9 +6,9 @@
  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
@@ -31,7 +31,7 @@
     if (self != nil) {
         _viewController = viewController;
         _commandQueue = _viewController.commandQueue;
-        
+
         NSError* err = nil;
         _callbackIdPattern = [NSRegularExpression regularExpressionWithPattern:@"[^A-Za-z0-9._-]" options:0 error:&err];
         if (err != nil) {
@@ -48,16 +48,16 @@
     NSBundle* mainBundle = [NSBundle mainBundle];
     NSMutableArray* directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]];
     NSString* filename = [directoryParts lastObject];
-    
+
     [directoryParts removeLastObject];
-    
+
     NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"];
     NSString* directoryStr = _viewController.wwwFolderName;
-    
+
     if ([directoryPartsJoined length] > 0) {
         directoryStr = [NSString stringWithFormat:@"%@/%@", _viewController.wwwFolderName, [directoryParts componentsJoinedByString:@"/"]];
     }
-    
+
     return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr];
 }
 
@@ -71,14 +71,14 @@
 - (void)evalJsHelper2:(NSString*)js
 {
     CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
-    [_viewController.webViewOperationsDelegate evaluateJavaScript:js completionHandler:^(id obj, NSError* error) {
+    [_viewController.webViewProxy evaluateJavaScript:js completionHandler:^(id obj, NSError* error) {
         // TODO: obj can be something other than string
         if ([obj isKindOfClass:[NSString class]]) {
             NSString* commandsJSON = (NSString*)obj;
             if ([commandsJSON length] > 0) {
                 CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
             }
-            
+
             [_commandQueue enqueueCommandBatch:commandsJSON];
             [_commandQueue executePending];
         }
@@ -109,8 +109,7 @@
 
 - (BOOL)isValidCallbackId:(NSString*)callbackId
 {
-    
-    if (callbackId == nil || _callbackIdPattern == nil) {
+    if ((callbackId == nil) || (_callbackIdPattern == nil)) {
         return NO;
     }
 
@@ -136,9 +135,9 @@
     int status = [result.status intValue];
     BOOL keepCallback = [result.keepCallback boolValue];
     NSString* argumentsAsJSON = [result argumentsAsJSON];
-    
+
     NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)", callbackId, status, argumentsAsJSON, keepCallback];
-    
+
     [self evalJsHelper:js];
 }
 
@@ -175,7 +174,7 @@
 - (BOOL)URLIsWhitelisted:(NSURL*)url
 {
     return ![_viewController.whitelist schemeIsAllowed:[url scheme]] ||
-    [_viewController.whitelist URLIsAllowed:url logFailure:NO];
+           [_viewController.whitelist URLIsAllowed:url logFailure:NO];
 }
 
 - (NSDictionary*)settings

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index bb2788b..21a6489 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -112,8 +112,8 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame.
     __weak CDVCommandQueue* weakSelf = self;
     NSString* js = @"cordova.require('cordova/exec').nativeFetchMessages()";
 
-    [_viewController.webViewOperationsDelegate evaluateJavaScript:js
-                                                completionHandler:^(id obj, NSError* error) {
+    [_viewController.webViewProxy evaluateJavaScript:js
+                                   completionHandler:^(id obj, NSError* error) {
         if ((error == nil) && [obj isKindOfClass:[NSString class]]) {
             NSString* queuedCommandsJSON = (NSString*)obj;
             CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/Classes/CDVPlugin.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPlugin.m b/CordovaLib/Classes/CDVPlugin.m
index 5f90311..bae6926 100644
--- a/CordovaLib/Classes/CDVPlugin.m
+++ b/CordovaLib/Classes/CDVPlugin.m
@@ -132,7 +132,7 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
 - (NSString*)writeJavascript:(NSString*)javascript
 {
     // TODO: although deprecated, should have some solution here instead of removing it
-    [((CDVViewController*)self.viewController).webViewOperationsDelegate evaluateJavaScript : javascript completionHandler : nil]; // bad cast, but ok for now
+    [((CDVViewController*)self.viewController).webViewProxy evaluateJavaScript : javascript completionHandler : nil]; // bad cast, but ok for now
     return @"";
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index 7bc005a..e5acc20 100644
--- a/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/Classes/CDVViewController.h
@@ -26,7 +26,7 @@
 #import "CDVWhitelist.h"
 #import "CDVScreenOrientationDelegate.h"
 #import "CDVPlugin.h"
-#import "CDVWebViewOperationsDelegate.h"
+#import "CDVWebViewProxy.h"
 #ifdef __IPHONE_8_0
     #import <WebKit/WebKit.h>
 #else
@@ -38,7 +38,7 @@
 
 @interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate, WKScriptMessageHandler>{
     @protected
-    CDVWebViewOperationsDelegate* _webViewOperationsDelegate;
+    CDVWebViewProxy* _webViewProxy;
     @protected
     id <CDVCommandDelegate> _commandDelegate;
     @protected
@@ -58,7 +58,7 @@
 @property (nonatomic, readwrite, copy) NSString* wwwFolderName;
 @property (nonatomic, readwrite, copy) NSString* startPage;
 @property (nonatomic, readonly, strong) CDVCommandQueue* commandQueue;
-@property (nonatomic, readonly, strong) CDVWebViewOperationsDelegate* webViewOperationsDelegate;
+@property (nonatomic, readonly, strong) CDVWebViewProxy* webViewProxy;
 @property (nonatomic, readonly, strong) id <CDVCommandDelegate> commandDelegate;
 
 /**

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index f8ced8b..3456c17 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -57,7 +57,7 @@
 @synthesize wwwFolderName, startPage, initialized, openURL, baseUserAgent;
 @synthesize commandDelegate = _commandDelegate;
 @synthesize commandQueue = _commandQueue;
-@synthesize webViewOperationsDelegate = _webViewOperationsDelegate;
+@synthesize webViewProxy = _webViewProxy;
 
 - (void)__init
 {
@@ -322,7 +322,7 @@
         [CDVUserAgentUtil setUserAgent:self.userAgent lockToken:lockToken];
         if (appURL) {
             NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
-            [_webViewOperationsDelegate loadRequest:appReq];
+            [_webViewProxy loadRequest:appReq];
         } else {
             NSString* loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.", self.wwwFolderName, self.startPage];
             NSLog(@"%@", loadErr);
@@ -331,10 +331,10 @@
             if (errorUrl) {
                 errorUrl = [NSURL URLWithString:[NSString stringWithFormat:@"?error=%@", [loadErr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] relativeToURL:errorUrl];
                 NSLog(@"%@", [errorUrl absoluteString]);
-                [_webViewOperationsDelegate loadRequest:[NSURLRequest requestWithURL:errorUrl]];
+                [_webViewProxy loadRequest:[NSURLRequest requestWithURL:errorUrl]];
             } else {
                 NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr];
-                [_webViewOperationsDelegate loadHTMLString:html baseURL:nil];
+                [_webViewProxy loadHTMLString:html baseURL:nil];
             }
         }
     }];
@@ -407,7 +407,7 @@
         , (long)[self mapIosOrientationToJsOrientation:interfaceOrientation]];
     __weak CDVViewController* weakSelf = self;
 
-    [_webViewOperationsDelegate evaluateJavaScript:jsCall completionHandler:^(NSString* obj, NSError* error) {
+    [_webViewProxy evaluateJavaScript:jsCall completionHandler:^(NSString* obj, NSError* error) {
         if ([obj length] > 0) {
             completionHandler([obj boolValue]);
         } else {
@@ -505,7 +505,7 @@
 
     self.webView = [self newCordovaViewWithFrame:webViewBounds];
     self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
-    _webViewOperationsDelegate = [[CDVWebViewOperationsDelegate alloc] initWithWebView:self.webView];
+    _webViewProxy = [[CDVWebViewProxy alloc] initWithWebView:self.webView];
 
     [self.view addSubview:self.webView];
     [self.view sendSubviewToBack:self.webView];
@@ -900,8 +900,8 @@
 
     dispatch_block_t handleOpenUrl = ^(void) {
         NSString* jsString = [NSString stringWithFormat:@"if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}", url];
-        [_webViewOperationsDelegate evaluateJavaScript:jsString
-                                     completionHandler:^(id object, NSError* error) {
+        [_webViewProxy evaluateJavaScript:jsString
+                        completionHandler:^(id object, NSError* error) {
             if (error == nil) {
                 weakSelf.openURL = nil;
             }
@@ -911,8 +911,8 @@
     if (!pageLoaded) {
         // query the webview for readystate
         NSString* jsString = @"document.readystate";
-        [_webViewOperationsDelegate evaluateJavaScript:jsString
-                                     completionHandler:^(id object, NSError* error) {
+        [_webViewProxy evaluateJavaScript:jsString
+                        completionHandler:^(id object, NSError* error) {
             if ((error == nil) && [object isKindOfClass:[NSString class]]) {
                 NSString* readyState = (NSString*)object;
                 BOOL ready = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewOperationsDelegate.h b/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
deleted file mode 100644
index ee539f7..0000000
--- a/CordovaLib/Classes/CDVWebViewOperationsDelegate.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- 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.
- */
-
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-
-#ifdef __IPHONE_8_0
-    #pragma message("For iOS 8 - Please add WebKit.framework into your 'Link Binary with Libraries' Build Phase Project Setting. This will be baked in once Xcode 6 is required.")
-#endif /* ifdef __IPHONE_8_0 */
-
-@interface CDVWebViewOperationsDelegate : NSObject {
-    @private
-    __weak UIView* _webView;
-}
-
-- (instancetype)initWithWebView:(UIView*)webView;
-
-- (void)loadRequest:(NSURLRequest*)request;
-- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL;
-- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler;
-- (void)loadFileURL:(NSURL*)URL allowingReadAccessToURL:(NSURL*)readAccessURL;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewOperationsDelegate.m b/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
deleted file mode 100644
index 8f32539..0000000
--- a/CordovaLib/Classes/CDVWebViewOperationsDelegate.m
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- 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.
- */
-
-#import <objc/message.h>
-#import "CDVWebViewOperationsDelegate.h"
-
-@implementation CDVWebViewOperationsDelegate
-
-- (instancetype)initWithWebView:(UIView*)webView
-{
-    self = [super init];
-    if (self) {
-        Class wk_class = NSClassFromString(@"WKWebView");
-        if (!([webView isKindOfClass:wk_class] || [webView isKindOfClass:[UIWebView class]])) {
-            return nil;
-        }
-        _webView = webView;
-    }
-
-    return self;
-}
-
-- (void)loadRequest:(NSURLRequest*)request
-{
-    SEL selector = @selector(loadRequest:);
-
-    if ([_webView respondsToSelector:selector]) {
-        // UIKit operations have to be on the main thread. and this method is synchronous
-        [_webView performSelectorOnMainThread:selector withObject:request waitUntilDone:YES];
-    }
-}
-
-- (void)loadFileURL:(NSURL*)url allowingReadAccessToURL:(NSURL*)readAccessURL
-{
-    SEL wk_sel = @selector(loadFileURL:allowingReadAccessToURL:);
-    __weak CDVWebViewOperationsDelegate* weakSelf = self;
-
-    // UIKit operations have to be on the main thread. This method does not need to be synchronous
-    dispatch_async(dispatch_get_main_queue(), ^{
-            if ([_webView respondsToSelector:wk_sel] && [[url scheme] isEqualToString:@"file"]) {
-                ((id (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, url, readAccessURL);
-            } else {
-                [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
-            }
-        });
-}
-
-- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL
-{
-    SEL selector = @selector(loadHTMLString:baseURL:);
-
-    dispatch_block_t invoke = ^(void) {
-        ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, selector, string, baseURL);
-    };
-
-    if ([_webView respondsToSelector:selector]) {
-        // UIKit operations have to be on the main thread.
-        // perform a synchronous invoke on the main thread without deadlocking
-        if ([NSThread isMainThread]) {
-            invoke();
-        } else {
-            dispatch_sync(dispatch_get_main_queue(), invoke);
-        }
-    }
-}
-
-- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
-{
-    SEL ui_sel = @selector(stringByEvaluatingJavaScriptFromString:);
-    SEL wk_sel = @selector(evaluateJavaScript:completionHandler:);
-
-    // UIKit operations have to be on the main thread. This method does not need to be synchronous
-    dispatch_async(dispatch_get_main_queue(), ^{
-            if ([_webView respondsToSelector:ui_sel]) {
-                NSString* ret = ((NSString * (*)(id, SEL, id))objc_msgSend)(_webView, ui_sel, javaScriptString);
-                completionHandler(ret, nil);
-            } else if ([_webView respondsToSelector:wk_sel]) {
-                ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, javaScriptString, completionHandler);
-            }
-        });
-}
-
-- (id)forwardingTargetForSelector:(SEL)aSelector
-{
-    return _webView;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/Classes/CDVWebViewProxy.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewProxy.h b/CordovaLib/Classes/CDVWebViewProxy.h
new file mode 100644
index 0000000..32b9839
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewProxy.h
@@ -0,0 +1,39 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+#ifdef __IPHONE_8_0
+    #pragma message("For iOS 8 - Please add WebKit.framework into your 'Link Binary with Libraries' Build Phase Project Setting. This will be baked in once Xcode 6 is required.")
+#endif /* ifdef __IPHONE_8_0 */
+
+@interface CDVWebViewProxy : NSObject {
+    @private
+    __weak UIView* _webView;
+}
+
+- (instancetype)initWithWebView:(UIView*)webView;
+
+- (void)loadRequest:(NSURLRequest*)request;
+- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL;
+- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler;
+- (void)loadFileURL:(NSURL*)URL allowingReadAccessToURL:(NSURL*)readAccessURL;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/Classes/CDVWebViewProxy.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewProxy.m b/CordovaLib/Classes/CDVWebViewProxy.m
new file mode 100644
index 0000000..dad0a15
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewProxy.m
@@ -0,0 +1,104 @@
+/*
+ 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.
+ */
+
+#import <objc/message.h>
+#import "CDVWebViewProxy.h"
+
+@implementation CDVWebViewProxy
+
+- (instancetype)initWithWebView:(UIView*)webView
+{
+    self = [super init];
+    if (self) {
+        Class wk_class = NSClassFromString(@"WKWebView");
+        if (!([webView isKindOfClass:wk_class] || [webView isKindOfClass:[UIWebView class]])) {
+            return nil;
+        }
+        _webView = webView;
+    }
+
+    return self;
+}
+
+- (void)loadRequest:(NSURLRequest*)request
+{
+    SEL selector = @selector(loadRequest:);
+
+    if ([_webView respondsToSelector:selector]) {
+        // UIKit operations have to be on the main thread. and this method is synchronous
+        [_webView performSelectorOnMainThread:selector withObject:request waitUntilDone:YES];
+    }
+}
+
+- (void)loadFileURL:(NSURL*)url allowingReadAccessToURL:(NSURL*)readAccessURL
+{
+    SEL wk_sel = @selector(loadFileURL:allowingReadAccessToURL:);
+    __weak CDVWebViewProxy* weakSelf = self;
+
+    // UIKit operations have to be on the main thread. This method does not need to be synchronous
+    dispatch_async(dispatch_get_main_queue(), ^{
+            if ([_webView respondsToSelector:wk_sel] && [[url scheme] isEqualToString:@"file"]) {
+                ((id (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, url, readAccessURL);
+            } else {
+                [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
+            }
+        });
+}
+
+- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL
+{
+    SEL selector = @selector(loadHTMLString:baseURL:);
+
+    dispatch_block_t invoke = ^(void) {
+        ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, selector, string, baseURL);
+    };
+
+    if ([_webView respondsToSelector:selector]) {
+        // UIKit operations have to be on the main thread.
+        // perform a synchronous invoke on the main thread without deadlocking
+        if ([NSThread isMainThread]) {
+            invoke();
+        } else {
+            dispatch_sync(dispatch_get_main_queue(), invoke);
+        }
+    }
+}
+
+- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
+{
+    SEL ui_sel = @selector(stringByEvaluatingJavaScriptFromString:);
+    SEL wk_sel = @selector(evaluateJavaScript:completionHandler:);
+
+    // UIKit operations have to be on the main thread. This method does not need to be synchronous
+    dispatch_async(dispatch_get_main_queue(), ^{
+            if ([_webView respondsToSelector:ui_sel]) {
+                NSString* ret = ((NSString * (*)(id, SEL, id))objc_msgSend)(_webView, ui_sel, javaScriptString);
+                completionHandler(ret, nil);
+            } else if ([_webView respondsToSelector:wk_sel]) {
+                ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, javaScriptString, completionHandler);
+            }
+        });
+}
+
+- (id)forwardingTargetForSelector:(SEL)aSelector
+{
+    return _webView;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/46910664/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 8d43b0b..8e3c7a6 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -12,10 +12,10 @@
 		1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F92F49F1314023E0046367C /* CDVPluginResult.m */; };
 		301F2F2A14F3C9CA003FE9FC /* CDV.h in Headers */ = {isa = PBXBuildFile; fileRef = 301F2F2914F3C9CA003FE9FC /* CDV.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		302965BC13A94E9D007046C5 /* CDVDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 302965BB13A94E9D007046C5 /* CDVDebug.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		302D72FC19554BFC0028C99F /* CDVWebViewOperationsDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D72FA19554BFC0028C99F /* CDVWebViewOperationsDelegate.m */; };
+		302D72FC19554BFC0028C99F /* CDVWebViewProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D72FA19554BFC0028C99F /* CDVWebViewProxy.m */; };
 		3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 3034979A1513D56A0090E688 /* CDVLocalStorage.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3034979E1513D56A0090E688 /* CDVLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 3034979B1513D56A0090E688 /* CDVLocalStorage.m */; };
-		303820731955603600C91592 /* CDVWebViewOperationsDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 302D72F919554BFC0028C99F /* CDVWebViewOperationsDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		303820731955603600C91592 /* CDVWebViewProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 302D72F919554BFC0028C99F /* CDVWebViewProxy.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */; };
@@ -33,10 +33,10 @@
 		30F5EBAB14CA26E700987760 /* CDVCommandDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E14B5A81705050A0032169E /* CDVTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E14B5A61705050A0032169E /* CDVTimer.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E14B5A91705050A0032169E /* CDVTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E14B5A71705050A0032169E /* CDVTimer.m */; };
+		7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E785B9A196F508900ABBDC8 /* CDVWebViewUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E785B9B196F508900ABBDC8 /* CDVWebViewUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */; };
 		7EE9ECF819525D24004CA6B9 /* CDVWebViewPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7EE9ECF919525D24004CA6B9 /* CDVWebViewPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */; };
 		8852C43A14B65FD800F0E735 /* CDVViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 8852C43614B65FD800F0E735 /* CDVViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		8852C43C14B65FD800F0E735 /* CDVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8852C43714B65FD800F0E735 /* CDVViewController.m */; };
@@ -66,8 +66,8 @@
 		1F92F49F1314023E0046367C /* CDVPluginResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVPluginResult.m; path = Classes/CDVPluginResult.m; sourceTree = "<group>"; };
 		301F2F2914F3C9CA003FE9FC /* CDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDV.h; path = Classes/CDV.h; sourceTree = "<group>"; };
 		302965BB13A94E9D007046C5 /* CDVDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVDebug.h; path = Classes/CDVDebug.h; sourceTree = "<group>"; };
-		302D72F919554BFC0028C99F /* CDVWebViewOperationsDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewOperationsDelegate.h; path = Classes/CDVWebViewOperationsDelegate.h; sourceTree = "<group>"; };
-		302D72FA19554BFC0028C99F /* CDVWebViewOperationsDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewOperationsDelegate.m; path = Classes/CDVWebViewOperationsDelegate.m; sourceTree = "<group>"; };
+		302D72F919554BFC0028C99F /* CDVWebViewProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewProxy.h; path = Classes/CDVWebViewProxy.h; sourceTree = "<group>"; };
+		302D72FA19554BFC0028C99F /* CDVWebViewProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewProxy.m; path = Classes/CDVWebViewProxy.m; sourceTree = "<group>"; };
 		30325A0B136B343700982B63 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
 		3034979A1513D56A0090E688 /* CDVLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVLocalStorage.h; path = Classes/CDVLocalStorage.h; sourceTree = "<group>"; };
 		3034979B1513D56A0090E688 /* CDVLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVLocalStorage.m; path = Classes/CDVLocalStorage.m; sourceTree = "<group>"; };
@@ -100,10 +100,10 @@
 		68A32D7414103017006B237C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
 		7E14B5A61705050A0032169E /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVTimer.h; path = Classes/CDVTimer.h; sourceTree = "<group>"; };
 		7E14B5A71705050A0032169E /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVTimer.m; path = Classes/CDVTimer.m; sourceTree = "<group>"; };
+		7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailabilityDeprecated.h; path = Classes/CDVAvailabilityDeprecated.h; sourceTree = "<group>"; };
 		7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewUIDelegate.h; path = Classes/CDVWebViewUIDelegate.h; sourceTree = "<group>"; };
 		7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewUIDelegate.m; path = Classes/CDVWebViewUIDelegate.m; sourceTree = "<group>"; };
 		7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewPreferences.h; path = Classes/CDVWebViewPreferences.h; sourceTree = "<group>"; };
-		7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailabilityDeprecated.h; path = Classes/CDVAvailabilityDeprecated.h; sourceTree = "<group>"; };
 		7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewPreferences.m; path = Classes/CDVWebViewPreferences.m; sourceTree = "<group>"; };
 		8220B5C316D5427E00EC3921 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
 		8852C43614B65FD800F0E735 /* CDVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVViewController.h; path = Classes/CDVViewController.h; sourceTree = "<group>"; };
@@ -190,8 +190,8 @@
 				EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */,
 				7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */,
 				7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */,
-				302D72F919554BFC0028C99F /* CDVWebViewOperationsDelegate.h */,
-				302D72FA19554BFC0028C99F /* CDVWebViewOperationsDelegate.m */,
+				302D72F919554BFC0028C99F /* CDVWebViewProxy.h */,
+				302D72FA19554BFC0028C99F /* CDVWebViewProxy.m */,
 				7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */,
 				7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */,
 			);
@@ -304,7 +304,7 @@
 				EB96673B16A8970A00D86CDF /* CDVUserAgentUtil.h in Headers */,
 				7E14B5A81705050A0032169E /* CDVTimer.h in Headers */,
 				7E785B9A196F508900ABBDC8 /* CDVWebViewUIDelegate.h in Headers */,
-				303820731955603600C91592 /* CDVWebViewOperationsDelegate.h in Headers */,
+				303820731955603600C91592 /* CDVWebViewProxy.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -383,7 +383,7 @@
 				EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */,
 				EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */,
 				7E14B5A91705050A0032169E /* CDVTimer.m in Sources */,
-				302D72FC19554BFC0028C99F /* CDVWebViewOperationsDelegate.m in Sources */,
+				302D72FC19554BFC0028C99F /* CDVWebViewProxy.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[36/43] ios commit: CB-8032 - Added a typedef for block definition.

Posted by sh...@apache.org.
CB-8032 - Added a typedef for block definition.


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

Branch: refs/heads/4.0.x
Commit: 1d4ba9778e6d15abe49fb8e0d6b66603372e7d7c
Parents: 0838a07
Author: Shazron Abdullah <sh...@apache.org>
Authored: Tue Dec 9 16:37:49 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Tue Dec 9 16:37:49 2014 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVCommandDelegate.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1d4ba977/CordovaLib/Classes/CDVCommandDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandDelegate.h b/CordovaLib/Classes/CDVCommandDelegate.h
index 2062519..926278a 100644
--- a/CordovaLib/Classes/CDVCommandDelegate.h
+++ b/CordovaLib/Classes/CDVCommandDelegate.h
@@ -24,10 +24,12 @@
 @class CDVPluginResult;
 @class CDVWhitelist;
 
+typedef NSURL* (^ UrlTransformerBlock)(NSURL*);
+
 @protocol CDVCommandDelegate <NSObject>
 
 @property (nonatomic, readonly) NSDictionary* settings;
-@property (nonatomic, copy) NSURL*(^urlTransformer)(NSURL*);
+@property (nonatomic, copy) UrlTransformerBlock urlTransformer;
 
 - (NSString*)pathForResource:(NSString*)resourcepath;
 - (id)getCommandInstance:(NSString*)pluginName;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[27/43] ios commit: Removed the WKWebViewEngine. The plugin now exists in the cordova-plugins repo.

Posted by sh...@apache.org.
Removed the WKWebViewEngine. The plugin now exists in the cordova-plugins repo.


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

Branch: refs/heads/4.0.x
Commit: 03e9c7162a9ae91648eaf3a8f89928a8ad5ce961
Parents: af1ec2c
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Nov 6 16:14:40 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Nov 6 16:14:40 2014 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDV.h                        |   2 -
 CordovaLib/Classes/CDVWKWebViewEngine.h         |  27 ---
 CordovaLib/Classes/CDVWKWebViewEngine.m         | 189 -------------------
 CordovaLib/Classes/CDVWKWebViewUIDelegate.h     |  28 ---
 CordovaLib/Classes/CDVWKWebViewUIDelegate.m     | 123 ------------
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |  24 ---
 6 files changed, 393 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/03e9c716/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index 2d14fc3..146e57b 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -37,8 +37,6 @@
 #import "CDVURLProtocol.h"
 #import "CDVUserAgentUtil.h"
 #import "CDVViewController.h"
-#import "CDVWKWebViewEngine.h"
-#import "CDVWKWebViewUIDelegate.h"
 #import "CDVWebViewEngineProtocol.h"
 #import "CDVWhitelist.h"
 #import "NSArray+Comparisons.h"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/03e9c716/CordovaLib/Classes/CDVWKWebViewEngine.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewEngine.h b/CordovaLib/Classes/CDVWKWebViewEngine.h
deleted file mode 100644
index e138b84..0000000
--- a/CordovaLib/Classes/CDVWKWebViewEngine.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- 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.
- */
-
-#import <WebKit/WebKit.h>
-#import "CDV.h"
-
-@interface CDVWKWebViewEngine : CDVPlugin <CDVWebViewEngineProtocol, WKScriptMessageHandler>
-
-@property (nonatomic, strong, readonly) id <WKUIDelegate> uiDelegate;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/03e9c716/CordovaLib/Classes/CDVWKWebViewEngine.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewEngine.m b/CordovaLib/Classes/CDVWKWebViewEngine.m
deleted file mode 100644
index 94ef0b2..0000000
--- a/CordovaLib/Classes/CDVWKWebViewEngine.m
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- 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.
- */
-
-#import "CDVWKWebViewEngine.h"
-#import "CDVWKWebViewUIDelegate.h"
-
-#import <objc/message.h>
-
-#define CDV_BRIDGE_NAME @"cordova"
-
-@interface CDVWKWebViewEngine ()
-
-@property (nonatomic, strong, readwrite) UIView* engineWebView;
-@property (nonatomic, strong, readwrite) id <WKUIDelegate> uiDelegate;
-
-@end
-
-// see forwardingTargetForSelector: selector comment for the reason for this pragma
-#pragma clang diagnostic ignored "-Wprotocol"
-
-@implementation CDVWKWebViewEngine
-
-@synthesize engineWebView = _engineWebView;
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
-    self = [super init];
-    if (self) {
-        self.uiDelegate = [[CDVWKWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
-
-        WKUserContentController* userContentController = [[WKUserContentController alloc] init];
-        [userContentController addScriptMessageHandler:self name:CDV_BRIDGE_NAME];
-
-        WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];
-        configuration.userContentController = userContentController;
-
-        WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:frame configuration:configuration];
-
-        wkWebView.UIDelegate = self.uiDelegate;
-
-        self.engineWebView = wkWebView;
-
-        NSLog(@"Using WKWebView");
-    }
-
-    return self;
-}
-
-- (void)pluginInitialize
-{
-    // viewController would be available now. we attempt to set all possible delegates to it, by default
-
-    WKWebView* wkWebView = (WKWebView*)_engineWebView;
-
-    if ([self.viewController conformsToProtocol:@protocol(WKUIDelegate)]) {
-        wkWebView.UIDelegate = (id <WKUIDelegate>)self.viewController;
-    }
-
-    if ([self.viewController conformsToProtocol:@protocol(WKNavigationDelegate)]) {
-        wkWebView.navigationDelegate = (id <WKNavigationDelegate>)self.viewController;
-    }
-
-    if ([self.viewController conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
-        [wkWebView.configuration.userContentController addScriptMessageHandler:(id < WKScriptMessageHandler >)self.viewController name:@"cordova"];
-    }
-
-    [self updateSettings:self.commandDelegate.settings];
-}
-
-// We implement this here because certain versions of iOS 8 do not implement this
-// in WKWebView, so we need to test for this during runtime.
-// It is speculated that this selector will be available in iOS 8.2 for WKWebView
-- (void)loadFileURL:(NSURL*)url allowingReadAccessToURL:(NSURL*)readAccessURL
-{
-    SEL wk_sel = @selector(loadFileURL:allowingReadAccessToURL:);
-    __weak CDVWKWebViewEngine* weakSelf = self;
-
-    // UIKit operations have to be on the main thread. This method does not need to be synchronous
-    dispatch_async(dispatch_get_main_queue(), ^{
-        if ([_engineWebView respondsToSelector:wk_sel] && [[url scheme] isEqualToString:@"file"]) {
-            ((id (*)(id, SEL, id, id))objc_msgSend)(_engineWebView, wk_sel, url, readAccessURL);
-        } else {
-            [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
-        }
-    });
-}
-
-- (void)updateSettings:(NSDictionary*)settings
-{
-    WKWebView* wkWebView = (WKWebView*)_engineWebView;
-
-    wkWebView.configuration.preferences.minimumFontSize = [settings cordovaFloatSettingForKey:@"MinimumFontSize" defaultValue:0.0];
-    wkWebView.configuration.allowsInlineMediaPlayback = [settings cordovaBoolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:NO];
-    wkWebView.configuration.mediaPlaybackRequiresUserAction = [settings cordovaBoolSettingForKey:@"MediaPlaybackRequiresUserAction" defaultValue:YES];
-    wkWebView.configuration.suppressesIncrementalRendering = [settings cordovaBoolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO];
-    wkWebView.configuration.mediaPlaybackAllowsAirPlay = [settings cordovaBoolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES];
-
-    /*
-     wkWebView.configuration.preferences.javaScriptEnabled = [settings cordovaBoolSettingForKey:@"JavaScriptEnabled" default:YES];
-     wkWebView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = [settings cordovaBoolSettingForKey:@"JavaScriptCanOpenWindowsAutomatically" default:NO];
-     */
-}
-
-- (void)updateWithInfo:(NSDictionary*)info
-{
-    NSDictionary* scriptMessageHandlers = [info objectForKey:kCDVWebViewEngineScriptMessageHandlers];
-    NSDictionary* settings = [info objectForKey:kCDVWebViewEngineWebViewPreferences];
-    id navigationDelegate = [info objectForKey:kCDVWebViewEngineWKNavigationDelegate];
-    id uiDelegate = [info objectForKey:kCDVWebViewEngineWKUIDelegate];
-
-    WKWebView* wkWebView = (WKWebView*)_engineWebView;
-
-    if (scriptMessageHandlers && [scriptMessageHandlers isKindOfClass:[NSDictionary class]]) {
-        NSArray* allKeys = [scriptMessageHandlers allKeys];
-
-        for (NSString* key in allKeys) {
-            id object = [scriptMessageHandlers objectForKey:key];
-            if ([object conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
-                [wkWebView.configuration.userContentController addScriptMessageHandler:object name:key];
-            }
-        }
-    }
-
-    if (navigationDelegate && [navigationDelegate conformsToProtocol:@protocol(WKNavigationDelegate)]) {
-        wkWebView.navigationDelegate = navigationDelegate;
-    }
-
-    if (uiDelegate && [uiDelegate conformsToProtocol:@protocol(WKUIDelegate)]) {
-        wkWebView.UIDelegate = uiDelegate;
-    }
-
-    if (settings && [settings isKindOfClass:[NSDictionary class]]) {
-        [self updateSettings:settings];
-    }
-}
-
-// This forwards the methods that are in the header that are not implemented here.
-// Both WKWebView and UIWebView implement the below:
-//     loadHTMLString:baseURL:
-//     loadRequest:
-- (id)forwardingTargetForSelector:(SEL)aSelector
-{
-    return _engineWebView;
-}
-
-#pragma mark WKScriptMessageHandler implementation
-
-- (void)userContentController:(WKUserContentController*)userContentController didReceiveScriptMessage:(WKScriptMessage*)message
-{
-    if (![message.name isEqualToString:CDV_BRIDGE_NAME]) {
-        return;
-    }
-
-    CDVViewController* vc = (CDVViewController*)self.viewController;
-
-    NSArray* jsonEntry = message.body; // NSString:callbackId, NSString:service, NSString:action, NSArray:args
-    CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
-    CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);
-
-    if (![vc.commandQueue execute:command]) {
-#ifdef DEBUG
-            NSString* commandJson = [jsonEntry JSONString];
-            static NSUInteger maxLogLength = 1024;
-            NSString* commandString = ([commandJson length] > maxLogLength) ?
-                [NSString stringWithFormat : @"%@[...]", [commandJson substringToIndex:maxLogLength]] :
-                commandJson;
-
-            DLog(@"FAILED pluginJSON = %@", commandString);
-#endif
-    }
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/03e9c716/CordovaLib/Classes/CDVWKWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewUIDelegate.h b/CordovaLib/Classes/CDVWKWebViewUIDelegate.h
deleted file mode 100644
index 33a179b..0000000
--- a/CordovaLib/Classes/CDVWKWebViewUIDelegate.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- 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.
- */
-
-#import <WebKit/WebKit.h>
-
-@interface CDVWKWebViewUIDelegate : NSObject <WKUIDelegate>
-
-@property (nonatomic, copy) NSString* title;
-
-- (instancetype)initWithTitle:(NSString*)title;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/03e9c716/CordovaLib/Classes/CDVWKWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWKWebViewUIDelegate.m b/CordovaLib/Classes/CDVWKWebViewUIDelegate.m
deleted file mode 100644
index c9e5ce9..0000000
--- a/CordovaLib/Classes/CDVWKWebViewUIDelegate.m
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- 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.
- */
-
-#import "CDVWKWebViewUIDelegate.h"
-
-@implementation CDVWKWebViewUIDelegate
-
-- (instancetype)initWithTitle:(NSString*)title
-{
-    self = [super init];
-    if (self) {
-        self.title = title;
-    }
-
-    return self;
-}
-
-- (void)     webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
-    initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
-{
-    UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                   message:message
-                                                            preferredStyle:UIAlertControllerStyleAlert];
-
-    UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                 style:UIAlertActionStyleDefault
-                                               handler:^(UIAlertAction* action)
-        {
-            completionHandler();
-            [alert dismissViewControllerAnimated:YES completion:nil];
-        }];
-
-    [alert addAction:ok];
-
-    UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-    [rootController presentViewController:alert animated:YES completion:nil];
-}
-
-- (void)     webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
-    initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
-{
-    UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                   message:message
-                                                            preferredStyle:UIAlertControllerStyleAlert];
-
-    UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                 style:UIAlertActionStyleDefault
-                                               handler:^(UIAlertAction* action)
-        {
-            completionHandler(YES);
-            [alert dismissViewControllerAnimated:YES completion:nil];
-        }];
-
-    [alert addAction:ok];
-
-    UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-        {
-            completionHandler(NO);
-            [alert dismissViewControllerAnimated:YES completion:nil];
-        }];
-    [alert addAction:cancel];
-
-    UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-    [rootController presentViewController:alert animated:YES completion:nil];
-}
-
-- (void)      webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
-          defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
-    completionHandler:(void (^)(NSString* result))completionHandler
-{
-    UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
-                                                                   message:prompt
-                                                            preferredStyle:UIAlertControllerStyleAlert];
-
-    UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
-                                                 style:UIAlertActionStyleDefault
-                                               handler:^(UIAlertAction* action)
-        {
-            completionHandler(((UITextField*)alert.textFields[0]).text);
-            [alert dismissViewControllerAnimated:YES completion:nil];
-        }];
-
-    [alert addAction:ok];
-
-    UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                                                     style:UIAlertActionStyleDefault
-                                                   handler:^(UIAlertAction* action)
-        {
-            completionHandler(nil);
-            [alert dismissViewControllerAnimated:YES completion:nil];
-        }];
-    [alert addAction:cancel];
-
-    [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
-        textField.text = defaultText;
-    }];
-
-    UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
-    [rootController presentViewController:alert animated:YES completion:nil];
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/03e9c716/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 678fbae..2a13f87 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -18,8 +18,6 @@
 		3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */; };
 		3073E9ED1656D51200957977 /* CDVScreenOrientationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		3083EB941A0AF1E100548672 /* CDVWKWebViewEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 3083EB921A0AF1E100548672 /* CDVWKWebViewEngine.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		3083EB951A0AF1E100548672 /* CDVWKWebViewEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 3083EB931A0AF1E100548672 /* CDVWKWebViewEngine.m */; };
 		3083EB981A0AF23A00548672 /* CDVUIWebViewEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 3083EB961A0AF23A00548672 /* CDVUIWebViewEngine.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		3083EB991A0AF23A00548672 /* CDVUIWebViewEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 3083EB971A0AF23A00548672 /* CDVUIWebViewEngine.m */; };
 		30B7A65C1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 30B7A65A1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -39,8 +37,6 @@
 		7E14B5A81705050A0032169E /* CDVTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E14B5A61705050A0032169E /* CDVTimer.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7E14B5A91705050A0032169E /* CDVTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E14B5A71705050A0032169E /* CDVTimer.m */; };
 		7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		7E785B9A196F508900ABBDC8 /* CDVWKWebViewUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E785B98196F508900ABBDC8 /* CDVWKWebViewUIDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		7E785B9B196F508900ABBDC8 /* CDVWKWebViewUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E785B99196F508900ABBDC8 /* CDVWKWebViewUIDelegate.m */; };
 		8852C43A14B65FD800F0E735 /* CDVViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 8852C43614B65FD800F0E735 /* CDVViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		8852C43C14B65FD800F0E735 /* CDVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8852C43714B65FD800F0E735 /* CDVViewController.m */; };
 		8887FD681090FBE7009987E8 /* NSDictionary+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -76,8 +72,6 @@
 		3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIDevice+Extensions.h"; path = "Classes/UIDevice+Extensions.h"; sourceTree = "<group>"; };
 		3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIDevice+Extensions.m"; path = "Classes/UIDevice+Extensions.m"; sourceTree = "<group>"; };
 		3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVScreenOrientationDelegate.h; path = Classes/CDVScreenOrientationDelegate.h; sourceTree = "<group>"; };
-		3083EB921A0AF1E100548672 /* CDVWKWebViewEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWKWebViewEngine.h; path = Classes/CDVWKWebViewEngine.h; sourceTree = "<group>"; };
-		3083EB931A0AF1E100548672 /* CDVWKWebViewEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWKWebViewEngine.m; path = Classes/CDVWKWebViewEngine.m; sourceTree = "<group>"; };
 		3083EB961A0AF23A00548672 /* CDVUIWebViewEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVUIWebViewEngine.h; path = Classes/CDVUIWebViewEngine.h; sourceTree = "<group>"; };
 		3083EB971A0AF23A00548672 /* CDVUIWebViewEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUIWebViewEngine.m; path = Classes/CDVUIWebViewEngine.m; sourceTree = "<group>"; };
 		30B7A65A1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+CordovaPreferences.h"; path = "Classes/NSDictionary+CordovaPreferences.h"; sourceTree = "<group>"; };
@@ -109,8 +103,6 @@
 		7E14B5A61705050A0032169E /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVTimer.h; path = Classes/CDVTimer.h; sourceTree = "<group>"; };
 		7E14B5A71705050A0032169E /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVTimer.m; path = Classes/CDVTimer.m; sourceTree = "<group>"; };
 		7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailabilityDeprecated.h; path = Classes/CDVAvailabilityDeprecated.h; sourceTree = "<group>"; };
-		7E785B98196F508900ABBDC8 /* CDVWKWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWKWebViewUIDelegate.h; path = Classes/CDVWKWebViewUIDelegate.h; sourceTree = "<group>"; };
-		7E785B99196F508900ABBDC8 /* CDVWKWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWKWebViewUIDelegate.m; path = Classes/CDVWKWebViewUIDelegate.m; sourceTree = "<group>"; };
 		8220B5C316D5427E00EC3921 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
 		8852C43614B65FD800F0E735 /* CDVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVViewController.h; path = Classes/CDVViewController.h; sourceTree = "<group>"; };
 		8852C43714B65FD800F0E735 /* CDVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVViewController.m; path = Classes/CDVViewController.m; sourceTree = "<group>"; };
@@ -188,7 +180,6 @@
 		3054098714B77FF3009841CA /* Cleaver */ = {
 			isa = PBXGroup;
 			children = (
-				30D552DF1A0AB176002007BB /* WKWebView */,
 				30CD6C651A0768DA00522A22 /* UIWebView */,
 				30D552E01A0AB1F5002007BB /* CDVWebViewEngineProtocol.h */,
 				F858FBC4166009A8007DA594 /* CDVConfigParser.h */,
@@ -212,17 +203,6 @@
 			name = UIWebView;
 			sourceTree = "<group>";
 		};
-		30D552DF1A0AB176002007BB /* WKWebView */ = {
-			isa = PBXGroup;
-			children = (
-				7E785B98196F508900ABBDC8 /* CDVWKWebViewUIDelegate.h */,
-				7E785B99196F508900ABBDC8 /* CDVWKWebViewUIDelegate.m */,
-				3083EB921A0AF1E100548672 /* CDVWKWebViewEngine.h */,
-				3083EB931A0AF1E100548672 /* CDVWKWebViewEngine.m */,
-			);
-			name = WKWebView;
-			sourceTree = "<group>";
-		};
 		32C88DFF0371C24200C91783 /* Other Sources */ = {
 			isa = PBXGroup;
 			children = (
@@ -328,10 +308,8 @@
 				30B7A65C1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.h in Headers */,
 				3083EB981A0AF23A00548672 /* CDVUIWebViewEngine.h in Headers */,
 				30D552E11A0AB1F5002007BB /* CDVWebViewEngineProtocol.h in Headers */,
-				3083EB941A0AF1E100548672 /* CDVWKWebViewEngine.h in Headers */,
 				EB96673B16A8970A00D86CDF /* CDVUserAgentUtil.h in Headers */,
 				7E14B5A81705050A0032169E /* CDVTimer.h in Headers */,
-				7E785B9A196F508900ABBDC8 /* CDVWKWebViewUIDelegate.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -392,7 +370,6 @@
 				8887FD691090FBE7009987E8 /* NSDictionary+Extensions.m in Sources */,
 				8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */,
 				8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */,
-				3083EB951A0AF1E100548672 /* CDVWKWebViewEngine.m in Sources */,
 				1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */,
 				30B7A65D1A0B73AF0010C630 /* NSDictionary+CordovaPreferences.m in Sources */,
 				30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */,
@@ -407,7 +384,6 @@
 				EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */,
 				F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */,
 				30F3930C169F839700B22307 /* CDVJSON.m in Sources */,
-				7E785B9B196F508900ABBDC8 /* CDVWKWebViewUIDelegate.m in Sources */,
 				3083EB991A0AF23A00548672 /* CDVUIWebViewEngine.m in Sources */,
 				EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */,
 				EBFF4DBC16D3FE2E008F452B /* CDVUIWebViewDelegate.m in Sources */,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[40/43] ios commit: Tweak CSP in app template

Posted by sh...@apache.org.
Tweak CSP in app template


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

Branch: refs/heads/4.0.x
Commit: b3c26fcd598da7c84f020f5a6b9309fe638cbb5d
Parents: ed27203
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Mar 6 09:55:49 2015 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Mar 6 09:55:49 2015 -0500

----------------------------------------------------------------------
 bin/templates/project/www/index.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/b3c26fcd/bin/templates/project/www/index.html
----------------------------------------------------------------------
diff --git a/bin/templates/project/www/index.html b/bin/templates/project/www/index.html
index af4f11c..714b443 100755
--- a/bin/templates/project/www/index.html
+++ b/bin/templates/project/www/index.html
@@ -19,7 +19,7 @@
 -->
 <html>
     <head>
-        <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: blob: https://ssl.gstatic.com/accessibility/javascript/android/; style-src 'self' 'unsafe-inline'">
+        <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap:; style-src 'self' 'unsafe-inline'; media-src: *">
         <meta name="format-detection" content="telephone=no">
         <meta name="msapplication-tap-highlight" content="no">
         <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[32/43] ios commit: Changes in CDVWebViewEngineProtocol.

Posted by sh...@apache.org.
Changes in CDVWebViewEngineProtocol.

Removed loadFileURL (implicit handling in loadRequest), and changed the return signatures for loadHTMLString and loadRequest.


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

Branch: refs/heads/4.0.x
Commit: 8dcdde821ffee3b1854313c40eb989dfc61d69d1
Parents: 62aa5b8
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Nov 12 07:02:21 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed Nov 12 07:02:21 2014 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewEngineProtocol.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8dcdde82/CordovaLib/Classes/CDVWebViewEngineProtocol.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewEngineProtocol.h b/CordovaLib/Classes/CDVWebViewEngineProtocol.h
index f560f1d..a36a7f4 100644
--- a/CordovaLib/Classes/CDVWebViewEngineProtocol.h
+++ b/CordovaLib/Classes/CDVWebViewEngineProtocol.h
@@ -29,10 +29,9 @@
 
 @property (nonatomic, strong, readonly) UIView* engineWebView;
 
-- (void)loadRequest:(NSURLRequest*)request;
-- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL;
+- (id)loadRequest:(NSURLRequest*)request;
+- (id)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL;
 - (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler;
-- (void)loadFileURL:(NSURL*)URL allowingReadAccessToURL:(NSURL*)readAccessURL;
 
 - (instancetype)initWithFrame:(CGRect)frame;
 - (void)updateWithInfo:(NSDictionary*)info;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[33/43] ios commit: Changes in CDVUIWebViewEngine for new changes in CDVWebViewEngineProtocol.

Posted by sh...@apache.org.
Changes in CDVUIWebViewEngine for new changes in CDVWebViewEngineProtocol.

Made protocol implementation explicit, instead of forwarded (removed pragma). Style fix-ups.


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

Branch: refs/heads/4.0.x
Commit: a11803a9bd40cd09c200f333e9bd89acdf143c7d
Parents: 8dcdde8
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Nov 12 07:04:04 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed Nov 12 07:04:04 2014 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVUIWebViewEngine.m | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a11803a9/CordovaLib/Classes/CDVUIWebViewEngine.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVUIWebViewEngine.m b/CordovaLib/Classes/CDVUIWebViewEngine.m
index f2594ad..cc15d52 100644
--- a/CordovaLib/Classes/CDVUIWebViewEngine.m
+++ b/CordovaLib/Classes/CDVUIWebViewEngine.m
@@ -30,9 +30,6 @@
 
 @end
 
-// see forwardingTargetForSelector: selector comment for the reason for this pragma
-#pragma clang diagnostic ignored "-Wprotocol"
-
 @implementation CDVUIWebViewEngine
 
 @synthesize engineWebView = _engineWebView;
@@ -64,21 +61,23 @@
 
 - (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
 {
-    NSString* ret = [(UIWebView*)_engineWebView stringByEvaluatingJavaScriptFromString:javaScriptString];
+    NSString* ret = [(UIWebView*)_engineWebView stringByEvaluatingJavaScriptFromString : javaScriptString];
 
     if (completionHandler) {
         completionHandler(ret, nil);
     }
 }
 
-- (void)loadFileURL:(NSURL*)url allowingReadAccessToURL:(NSURL*)readAccessURL
+- (id)loadRequest:(NSURLRequest*)request
 {
-    __weak CDVUIWebViewEngine* weakSelf = self;
+    [(UIWebView*)_engineWebView loadRequest : request];
+    return nil;
+}
 
-    // UIKit operations have to be on the main thread. This method does not need to be synchronous
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [weakSelf loadRequest:[NSURLRequest requestWithURL:url]];
-    });
+- (id)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL
+{
+    [(UIWebView*)_engineWebView loadHTMLString : string baseURL : baseURL];
+    return nil;
 }
 
 - (void)updateSettings:(NSDictionary*)settings
@@ -113,7 +112,7 @@
     }
 
     NSString* decelerationSetting = [settings cordovaSettingForKey:@"UIWebViewDecelerationSpeed"];
-    if (![@"fast" isEqualToString:decelerationSetting]) {
+    if (![@"fast" isEqualToString : decelerationSetting]) {
         [uiWebView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[09/43] ios commit: CB-6884 - Support new Cordova bridge under iOS 8 WKWebView (typo fix)

Posted by sh...@apache.org.
CB-6884 - Support new Cordova bridge under iOS 8 WKWebView (typo fix)


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

Branch: refs/heads/4.0.x
Commit: 2a38ad254de202b7aef893427f5c08de2903a415
Parents: 8955572
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Aug 13 23:33:44 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed Aug 13 23:33:44 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/2a38ad25/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 0bde78e..85483c0 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -425,7 +425,7 @@
 
             // scriptMessageHandler is the object that conforms to the WKScriptMessageHandler protocol
             // see https://developer.apple.com/library/prerelease/ios/documentation/WebKit/Reference/WKScriptMessageHandler_Ref/index.html#//apple_ref/swift/intf/WKScriptMessageHandler
-            if ([_commandDelegate conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
+            if ([self conformsToProtocol:@protocol(WKScriptMessageHandler)]) {
                 [userContentController addScriptMessageHandler:self name:@"cordova"];
             }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[23/43] ios commit: Cleaned up CDVWebViewProxy code for redundancies.

Posted by sh...@apache.org.
Cleaned up CDVWebViewProxy code for redundancies.


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

Branch: refs/heads/4.0.x
Commit: 5bb42457549a29f3720b3b1ce75c65f01e3db48a
Parents: 9ec77c0
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Nov 3 01:21:43 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Nov 3 01:21:43 2014 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewProxy.m | 77 ++++++++++++-------------------
 1 file changed, 30 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5bb42457/CordovaLib/Classes/CDVWebViewProxy.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewProxy.m b/CordovaLib/Classes/CDVWebViewProxy.m
index dad0a15..03b8049 100644
--- a/CordovaLib/Classes/CDVWebViewProxy.m
+++ b/CordovaLib/Classes/CDVWebViewProxy.m
@@ -18,16 +18,36 @@
  */
 
 #import <objc/message.h>
+#import <WebKit/WebKit.h>
 #import "CDVWebViewProxy.h"
 
+@interface UIWebView (Extensions)
+
+- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler;
+
+@end
+
+@implementation UIWebView (Extensions)
+
+- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
+{
+    NSString* ret = [self stringByEvaluatingJavaScriptFromString:javaScriptString];
+
+    completionHandler(ret, nil);
+}
+
+@end
+
+// see forwardingTargetForSelector: selector comment for the reason for this pragma
+#pragma clang diagnostic ignored "-Wincomplete-implementation"
+
 @implementation CDVWebViewProxy
 
 - (instancetype)initWithWebView:(UIView*)webView
 {
     self = [super init];
     if (self) {
-        Class wk_class = NSClassFromString(@"WKWebView");
-        if (!([webView isKindOfClass:wk_class] || [webView isKindOfClass:[UIWebView class]])) {
+        if (!([webView isKindOfClass:[WKWebView class]] || [webView isKindOfClass:[UIWebView class]])) {
             return nil;
         }
         _webView = webView;
@@ -36,16 +56,9 @@
     return self;
 }
 
-- (void)loadRequest:(NSURLRequest*)request
-{
-    SEL selector = @selector(loadRequest:);
-
-    if ([_webView respondsToSelector:selector]) {
-        // UIKit operations have to be on the main thread. and this method is synchronous
-        [_webView performSelectorOnMainThread:selector withObject:request waitUntilDone:YES];
-    }
-}
-
+// We implement this here because certain versions of iOS 8 do not implement this
+// in WKWebView, so we need to test for this during runtime.
+// It is speculated that this selector will be available in iOS 8.2 for WKWebView
 - (void)loadFileURL:(NSURL*)url allowingReadAccessToURL:(NSURL*)readAccessURL
 {
     SEL wk_sel = @selector(loadFileURL:allowingReadAccessToURL:);
@@ -61,41 +74,11 @@
         });
 }
 
-- (void)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL
-{
-    SEL selector = @selector(loadHTMLString:baseURL:);
-
-    dispatch_block_t invoke = ^(void) {
-        ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, selector, string, baseURL);
-    };
-
-    if ([_webView respondsToSelector:selector]) {
-        // UIKit operations have to be on the main thread.
-        // perform a synchronous invoke on the main thread without deadlocking
-        if ([NSThread isMainThread]) {
-            invoke();
-        } else {
-            dispatch_sync(dispatch_get_main_queue(), invoke);
-        }
-    }
-}
-
-- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler
-{
-    SEL ui_sel = @selector(stringByEvaluatingJavaScriptFromString:);
-    SEL wk_sel = @selector(evaluateJavaScript:completionHandler:);
-
-    // UIKit operations have to be on the main thread. This method does not need to be synchronous
-    dispatch_async(dispatch_get_main_queue(), ^{
-            if ([_webView respondsToSelector:ui_sel]) {
-                NSString* ret = ((NSString * (*)(id, SEL, id))objc_msgSend)(_webView, ui_sel, javaScriptString);
-                completionHandler(ret, nil);
-            } else if ([_webView respondsToSelector:wk_sel]) {
-                ((void (*)(id, SEL, id, id))objc_msgSend)(_webView, wk_sel, javaScriptString, completionHandler);
-            }
-        });
-}
-
+// This forwards the methods that are in the header that are not implemented here.
+// Both WKWebView and UIWebView implement the below:
+//     loadHTMLString:baseURL:
+//     loadRequest:
+//     evaluateJavaScript:completionHandler: (UIWebView implements in Category above)
 - (id)forwardingTargetForSelector:(SEL)aSelector
 {
     return _webView;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[12/43] ios commit: CB-7047 - Support config.xml preferences for WKWebView

Posted by sh...@apache.org.
CB-7047 - Support config.xml preferences for WKWebView


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

Branch: refs/heads/4.0.x
Commit: d801bacac2a41ff730bd8aa6967004ea6bf3f82b
Parents: 686ef8a
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 21 14:34:05 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 15:37:43 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewPreferences.m | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/d801baca/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
index a42b3aa..55f447b 100644
--- a/CordovaLib/Classes/CDVWebViewPreferences.m
+++ b/CordovaLib/Classes/CDVWebViewPreferences.m
@@ -242,6 +242,27 @@
         }
         theWebView.configuration.preferences.minimumFontSize = minimumFontSize;
 
+        BOOL allowInlineMediaPlayback = NO; // default
+        prefObj = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
+        if (prefObj != nil) {
+            allowInlineMediaPlayback = [(NSNumber*)prefObj boolValue];
+        }
+        theWebView.configuration.allowsInlineMediaPlayback = allowInlineMediaPlayback;
+
+        BOOL mediaPlaybackRequiresUserAction = YES;  // default
+        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
+        if (prefObj != nil) {
+            mediaPlaybackRequiresUserAction = [(NSNumber*)prefObj boolValue];
+        }
+        theWebView.configuration.mediaPlaybackRequiresUserAction = mediaPlaybackRequiresUserAction;
+
+        BOOL suppressesIncrementalRendering = NO; // default
+        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
+        if (prefObj != nil) {
+            suppressesIncrementalRendering = [(NSNumber*)prefObj boolValue];
+        }
+        theWebView.configuration.suppressesIncrementalRendering = suppressesIncrementalRendering;
+
         /*
         BOOL javaScriptEnabled = YES;  // default value
         if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org