Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions OnePasswordExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ If your project's Deployment Target is earlier than iOS 8.0, please make sure th

<a href="https://vimeo.com/102142106" target="_blank"><img src="https://www.evernote.com/shard/s340/sh/7547419d-6c49-4b45-bdb1-575c28678164/49cb7e0c1f508d1f67f5cf0361d58d3a/deep/0/WebView-Demo-for-iOS.xcodeproj.png" width="640"></a>

#### 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` (runtime checks for iOS 8 deveices), you simply need to add `ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW=1` to your `Preprocessor Macros`.

<a href="https://vimeo.com/102142106" target="_blank"><img src="https://www.evernote.com/l/AVTawUykz6dHea_aKawqBwTCza2zvJYbeVMB/image.png" width="640"></a>

## Best Practices

* Use the same `URLString` during Registration and Login.
Expand Down