-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added support for webview as a provider for webauth (#875)
Co-authored-by: Rita Zerrizuela <[email protected]>
- Loading branch information
Showing
15 changed files
with
628 additions
and
111 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// UIWindow+TopViewController.swift | ||
// Auth0 | ||
// | ||
// Created by Desu Sai Venkat on 01/10/24. | ||
// Copyright © 2024 Auth0. All rights reserved. | ||
// | ||
|
||
#if os(iOS) | ||
import UIKit | ||
|
||
extension UIWindow { | ||
static var topViewController: UIViewController? { | ||
guard let root = UIApplication.shared()?.windows.last(where: \.isKeyWindow)?.rootViewController else { | ||
return nil | ||
} | ||
return findTopViewController(from: root) | ||
} | ||
|
||
private static func findTopViewController(from root: UIViewController) -> UIViewController? { | ||
if let presented = root.presentedViewController { return self.findTopViewController(from: presented) } | ||
|
||
switch root { | ||
case let split as UISplitViewController: | ||
guard let last = split.viewControllers.last else { return split } | ||
return self.findTopViewController(from: last) | ||
case let navigation as UINavigationController: | ||
guard let top = navigation.topViewController else { return navigation } | ||
return self.findTopViewController(from: top) | ||
case let tab as UITabBarController: | ||
guard let selected = tab.selectedViewController else { return tab } | ||
return self.findTopViewController(from: selected) | ||
default: | ||
return root | ||
} | ||
} | ||
} | ||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -413,6 +413,5 @@ public extension WebAuth { | |
return try await self.clearSession(federated: federated) | ||
} | ||
#endif | ||
|
||
} | ||
#endif |
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
Oops, something went wrong.