cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject 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)
Date Thu, 06 Nov 2014 23:28:16 GMT
Repository: cordova-ios
Updated Branches:
  refs/heads/wkwebview ce6604dbf -> af1ec2c40


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/wkwebview
Commit: af1ec2c40e2fb5ae4d01c87407a64d25d0b85b02
Parents: ce6604d
Author: Shazron Abdullah <shazron@apache.org>
Authored: Thu Nov 6 15:28:13 2014 -0800
Committer: Shazron Abdullah <shazron@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


Mime
View raw message