Skip to content

Commit

Permalink
keyWindow fix (#737)
Browse files Browse the repository at this point in the history
* Migrate onReceiveSessionTaskChallenge and onReceiveSessionTaskChallenge from closure to function (in the past this allowed reuse code for challenge responses between Kingfisher and Alamofire libraries), simplified their signature as the first two parameters were ignored, avoids useless initializers for URLSession and URLSessionDataTask

* Fix for keyWindow deprecation warning

---------

Signed-off-by: Dan Cunningham <[email protected]>
Co-authored-by: Dan Cunningham <[email protected]>
Signed-off-by: Tim Bert <[email protected]>
  • Loading branch information
timbms and digitaldan committed Nov 7, 2023
1 parent cfc940b commit 0a5a287
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion openHAB/OpenHABRootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ class OpenHABRootViewController: UIViewController {
if let menu = SideMenuManager.default.rightMenuNavigationController {
// don't try and push an already visible menu less you crash the app
dismiss(animated: false) {
var topMostViewController = UIApplication.shared.keyWindow?.rootViewController
var topMostViewController: UIViewController? = if #available(iOS 13, *) {
UIApplication.shared.connectedScenes.flatMap { ($0 as? UIWindowScene)?.windows ?? [] }.last { $0.isKeyWindow }?.rootViewController
} else {
UIApplication.shared.keyWindow?.rootViewController
}
while let presentedViewController = topMostViewController?.presentedViewController {
topMostViewController = presentedViewController
}
Expand Down

0 comments on commit 0a5a287

Please sign in to comment.