Use Safari for OIDC account URL. (#1591)

* Handle RP-Initiated Logout URL.

Safari is only used on devices, the simulator doesn't work properly.
This commit is contained in:
Doug
2023-08-30 09:22:22 +01:00
committed by GitHub
parent 220279fd28
commit a5045e1598
6 changed files with 29 additions and 15 deletions
@@ -88,12 +88,19 @@ final class SettingsScreenCoordinator: CoordinatorProtocol {
return
}
// Safari never works in the simulator, use a Web Authentication Session instead.
accountSettingsPresenter = OIDCAccountSettingsPresenter(accountURL: accountURL, presentationAnchor: window)
accountSettingsPresenter?.start()
#if targetEnvironment(simulator)
let canOpenURL = false // Safari can't access the cookie on the iOS 16 simulator 🤷‍♂️
#else
let canOpenURL = UIApplication.shared.canOpenURL(accountURL)
#endif
// Safari isn't working with the shared browser session 😕
// UIApplication.shared.open(accountURL)
if canOpenURL {
UIApplication.shared.open(accountURL)
} else {
// Fall back to an ASWebAuthenticationSession to handle the URL inside the app.
accountSettingsPresenter = OIDCAccountSettingsPresenter(accountURL: accountURL, presentationAnchor: window)
accountSettingsPresenter?.start()
}
}
private func presentAnalyticsScreen() {