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 2014/11/03 09:40:50 UTC

ios commit: Modularized CDVWebViewPreferences.

Repository: cordova-ios
Updated Branches:
  refs/heads/wkwebview 46910664a -> 9ec77c098


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/wkwebview
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