Skip to content

Commit

Permalink
Merge pull request #21 from banjun/visionos-userconsent
Browse files Browse the repository at this point in the history
Fix visionOS UserConsent
  • Loading branch information
banjun authored Sep 24, 2024
2 parents 03a40c6 + 13e8144 commit 4856978
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions FrameworkTarget/SwiftHotReload.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"@executable_path/Frameworks",
"@loader_path/Frameworks",
Expand Down Expand Up @@ -398,7 +398,7 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"@executable_path/Frameworks",
"@loader_path/Frameworks",
Expand Down
6 changes: 5 additions & 1 deletion Sources/ProxyReloader/UserConsent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ import UIKit
extension UserConsent {
@MainActor
static func alert(_ title: String, _ message: String) async -> Bool {
guard let window = (UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.compactMap { $0.windows.first { $0.isKeyWindow } }.first) else {
let windowScenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }
#if os(visionOS)
.filter { $0.session.role != .immersiveSpaceApplication }
#endif
guard let window = (windowScenes.compactMap { $0.windows.first { $0.isKeyWindow } }.first) else {
NSLog("%@", "⚠️ cannot get keyWindow from scenes = \(UIApplication.shared.connectedScenes)")
return false
}
Expand Down

0 comments on commit 4856978

Please sign in to comment.