mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 14:53:25 +01:00
Fixes UIApplication.keyWindow deprecation warning
This commit is contained in:
@@ -434,6 +434,21 @@ extension PatreonAPI: ASWebAuthenticationPresentationContextProviding
|
||||
{
|
||||
public func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor
|
||||
{
|
||||
return UIApplication.alt_shared?.keyWindow ?? UIWindow()
|
||||
//TODO: Properly support multiple scenes.
|
||||
|
||||
guard let windowScene = UIApplication.alt_shared?.connectedScenes.lazy.compactMap({ $0 as? UIWindowScene }).first else { return UIWindow() }
|
||||
|
||||
if #available(iOS 15, *), let keyWindow = windowScene.keyWindow
|
||||
{
|
||||
return keyWindow
|
||||
}
|
||||
else if let delegate = windowScene.delegate as? UIWindowSceneDelegate,
|
||||
let optionalWindow = delegate.window,
|
||||
let window = optionalWindow
|
||||
{
|
||||
return window
|
||||
}
|
||||
|
||||
return UIWindow()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user