mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-18 19:23:43 +01:00
Fixes UIApplication.keyWindow deprecation warning
This commit is contained in:
@@ -417,6 +417,21 @@ extension PatreonAPI: ASWebAuthenticationPresentationContextProviding
|
|||||||
{
|
{
|
||||||
public func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor
|
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