Created
August 12, 2015 17:17
-
-
Save kwylez/f19e6d6088fc2f10ea45 to your computer and use it in GitHub Desktop.
After the "OAuth dance" is complete the request is never sent back to the app. I didn't have this happen with UIWebViews.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { | |
RTVLog(@"decidePolicyForNavigationAction %@", navigationAction); | |
if (navigationAction.navigationType == WKNavigationTypeOther) { | |
NSURL *url = navigationAction.request.URL; | |
UIApplication *app = [UIApplication sharedApplication]; | |
if ([[url scheme] isEqualToString:RabbleURLScheme]) { | |
if ([app canOpenURL:url]) { | |
[app openURL:url]; | |
} | |
} | |
} else if (navigationAction.navigationType == WKNavigationTypeLinkActivated) { | |
NSString *url = navigationAction.request.URL.absoluteString; | |
self.goBackButtonItem.enabled = [url rangeOfString:__loginURL].location == NSNotFound ? YES : NO; | |
self.goBackButtonItem.title = NSLocalizedString(@"Back", nil); | |
} | |
decisionHandler(WKNavigationActionPolicyAllow); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment