Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add property for WKUIDelegate method #3805

Merged
merged 1 commit into from
Jan 16, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,13 @@ - (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSStr
}
}

- (nullable WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So WebKit calls that method? And when nil is returned, it creates the web view itself?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup that WebKit calls it. When I tested it didn't look like it auto created when nil. One of the publisher cases uses it to intercept the URL and open in Safari and I saw another generic example here where they redirect to load in the existing webview while returning nil

if ([SFUserAccountManager sharedInstance].createWebview) {
return [SFUserAccountManager sharedInstance].createWebview(webView, configuration, navigationAction, windowFeatures);
}
return nil;
}

- (NSString *)brandedAuthorizeURL{
NSMutableString *brandedAuthorizeURL = [NSMutableString stringWithFormat:@"%@",kSFOAuthEndPointAuthorize];
if (self.brandLoginPath && ![self.brandLoginPath sfsdk_isEmptyOrWhitespaceAndNewlines]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ NS_SWIFT_NAME(UserAccountManager)
*/
@property (nonatomic, copy, nullable) WKNavigationActionPolicy (^navigationPolicyForAction)(WKWebView *webview, WKNavigationAction *action);

/** Use this to add custom handling for WKUIDelegate's `webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:`
*/
@property (nonatomic, copy, nullable) WKWebView * _Nullable (^createWebview)(WKWebView *webview, WKWebViewConfiguration *configuration, WKNavigationAction *action, WKWindowFeatures *windowFeatures);

/** Use this property to enable an app to become and IdentityProvider for other apps
*
*/
Expand Down
Loading