From 5bd7faf90937d1a93030efcaf36a589687dec988 Mon Sep 17 00:00:00 2001 From: Rad Azzouz Date: Fri, 15 May 2015 12:06:43 -0400 Subject: [PATCH 1/5] [NEW] Added the ability to use WKWebView on iOS8 while the Deployment Target is older than 8.0. --- OnePasswordExtension.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OnePasswordExtension.m b/OnePasswordExtension.m index cbfdc55..3ed1912 100644 --- a/OnePasswordExtension.m +++ b/OnePasswordExtension.m @@ -226,7 +226,7 @@ - (void)fillItemIntoWebView:(id)webView forViewController:(UIViewController *)vi } }]; } -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 || ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW else if ([webView isKindOfClass:[WKWebView class]]) { [self fillItemIntoWKWebView:webView forViewController:viewController sender:(id)sender showOnlyLogins:yesOrNo completion:^(BOOL success, NSError *error) { if (completion) { @@ -257,7 +257,7 @@ - (void)createExtensionItemForWebView:(id)webView completion:(void (^)(NSExtensi [self createExtensionItemForURLString:uiWebView.request.URL.absoluteString webPageDetails:collectedPageDetails completion:completion]; } -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 || ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW else if ([webView isKindOfClass:[WKWebView class]]) { WKWebView *wkWebView = (WKWebView *)webView; [wkWebView evaluateJavaScript:OPWebViewCollectFieldsScript completionHandler:^(NSString *result, NSError *evaluateError) { @@ -383,7 +383,7 @@ - (void)findLoginIn1PasswordWithURLString:(NSString *)URLString collectedPageDet [forViewController presentViewController:activityViewController animated:YES completion:nil]; } -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 || ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW - (void)fillItemIntoWKWebView:(WKWebView *)webView forViewController:(UIViewController *)viewController sender:(id)sender showOnlyLogins:(BOOL)yesOrNo completion:(void (^)(BOOL success, NSError *error))completion { [webView evaluateJavaScript:OPWebViewCollectFieldsScript completionHandler:^(NSString *result, NSError *error) { if (!result) { @@ -443,7 +443,7 @@ - (void)executeFillScript:(NSString *)fillScript inWebView:(id)webView completio return; } -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 || ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW if ([webView isKindOfClass:[WKWebView class]]) { [((WKWebView *)webView) evaluateJavaScript:scriptSource completionHandler:^(NSString *result, NSError *evaluationError) { BOOL success = (result != nil); From f7495471e6b04233d98e8b33e666d0b319f96833 Mon Sep 17 00:00:00 2001 From: Rad Azzouz Date: Fri, 15 May 2015 14:33:22 -0400 Subject: [PATCH 2/5] Added instructions to the README about `WKWebView` with iOS 7.1 or earlier. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 3798cad..9a2cc04 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,12 @@ If your project's Deployment Target is earlier than iOS 8.0, please make sure th +##### WKWebView support for projects with iOS 7.1 or earler as the Deployment Target + +If your project's **Deployment Target** is `7.1` or earlier and you are using `WKWebViews` on iOS 8 devices (runtime checks), you need to add `ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW=1` to your project's `Preprocessor Macros`. + + + ## Best Practices * Use the same `URLString` during Registration and Login. From e3a59506fba6860d626d255dfa0b5279bac6421e Mon Sep 17 00:00:00 2001 From: Rad Azzouz Date: Fri, 15 May 2015 14:35:29 -0400 Subject: [PATCH 3/5] Slightly larger title for the WKWebView instructions. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a2cc04..b73b9d7 100644 --- a/README.md +++ b/README.md @@ -237,7 +237,7 @@ If your project's Deployment Target is earlier than iOS 8.0, please make sure th -##### WKWebView support for projects with iOS 7.1 or earler as the Deployment Target +#### WKWebView support for projects with iOS 7.1 or earler as the Deployment Target If your project's **Deployment Target** is `7.1` or earlier and you are using `WKWebViews` on iOS 8 devices (runtime checks), you need to add `ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW=1` to your project's `Preprocessor Macros`. From 1edec40b1f6033cea6ddce1a8a36851a5cdb5f52 Mon Sep 17 00:00:00 2001 From: Rad Azzouz Date: Fri, 15 May 2015 14:39:47 -0400 Subject: [PATCH 4/5] Better wording for the instructions. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b73b9d7..8342829 100644 --- a/README.md +++ b/README.md @@ -239,7 +239,7 @@ If your project's Deployment Target is earlier than iOS 8.0, please make sure th #### WKWebView support for projects with iOS 7.1 or earler as the Deployment Target -If your project's **Deployment Target** is `7.1` or earlier and you are using `WKWebViews` on iOS 8 devices (runtime checks), you need to add `ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW=1` to your project's `Preprocessor Macros`. +If the **Deployment Target** is `7.1` or earlier in your project or target and you are using `WKWebViews` for iOS 8 devices (runtime checks), you simply need to add `ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW=1` to your `Preprocessor Macros`. From 15e080f354a4f260505f17a75df7ca6205f4e697 Mon Sep 17 00:00:00 2001 From: Rad Azzouz Date: Fri, 15 May 2015 14:50:00 -0400 Subject: [PATCH 5/5] Even better wording #whoknew ;-p --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8342829..8036935 100644 --- a/README.md +++ b/README.md @@ -239,7 +239,7 @@ If your project's Deployment Target is earlier than iOS 8.0, please make sure th #### WKWebView support for projects with iOS 7.1 or earler as the Deployment Target -If the **Deployment Target** is `7.1` or earlier in your project or target and you are using `WKWebViews` for iOS 8 devices (runtime checks), you simply need to add `ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW=1` to your `Preprocessor Macros`. +If the **Deployment Target** is `7.1` or earlier in your project or target and you are using `WKWebViews` (runtime checks for iOS 8 deveices), you simply need to add `ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW=1` to your `Preprocessor Macros`.