Skip to content

Commit

Permalink
Fix OIDExternalUserAgentIOSCustomBrowser on iOS 10+ (#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-sharma authored Oct 21, 2024
1 parent d4cbdfa commit b856e4b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Sources/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,26 @@ - (BOOL)presentExternalUserAgentRequest:(nonnull id<OIDExternalUserAgentRequest>
NSString *testURLString = [NSString stringWithFormat:@"%@://example.com", _canOpenURLScheme];
NSURL *testURL = [NSURL URLWithString:testURLString];
if (![[UIApplication sharedApplication] canOpenURL:testURL]) {
[[UIApplication sharedApplication] openURL:_appStoreURL];
if (@available(iOS 10.0, *)) {
[[UIApplication sharedApplication] openURL:_appStoreURL options:@{} completionHandler:nil];
} else {
[[UIApplication sharedApplication] openURL:_appStoreURL];
}
return NO;
}
}

// Transforms the request URL and opens it.
NSURL *requestURL = [request externalUserAgentRequestURL];
requestURL = _URLTransformation(requestURL);
BOOL openedInBrowser = [[UIApplication sharedApplication] openURL:requestURL];
return openedInBrowser;
if (@available(iOS 10.0, *)) {
BOOL willOpen = [[UIApplication sharedApplication] canOpenURL:requestURL];
[[UIApplication sharedApplication] openURL:requestURL options:@{} completionHandler:nil];
return willOpen;
} else {
BOOL openedInBrowser = [[UIApplication sharedApplication] openURL:requestURL];
return openedInBrowser;
}
}

- (void)dismissExternalUserAgentAnimated:(BOOL)animated
Expand Down

0 comments on commit b856e4b

Please sign in to comment.