From c0234b07a895189c11ebb2dd02da3016038d20e8 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sat, 28 Sep 2024 11:56:03 +0200 Subject: [PATCH] Fix missing Window on iOS Broken by 9e6e59276b9d1ec82e98375dbba4603f428d7d05 --- Passepartout/App/PassepartoutApp.swift | 46 +++++++++++++++----------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/Passepartout/App/PassepartoutApp.swift b/Passepartout/App/PassepartoutApp.swift index c280b75c..a7e5de8d 100644 --- a/Passepartout/App/PassepartoutApp.swift +++ b/Passepartout/App/PassepartoutApp.swift @@ -48,26 +48,32 @@ struct PassepartoutApp: App { private var theme = Theme() var body: some Scene { - Window(appName, id: appName) { - AppCoordinator( - profileManager: context.profileManager, - tunnel: context.tunnel, - registry: context.registry - ) - .onLoad { - CommonLibrary.configureLogging( - to: Constants.shared.urlForAppLog, - parameters: Constants.shared.log - ) - AppUI.configure(with: context) - } - .themeLockScreen() - .environmentObject(theme) - .environmentObject(context.iapManager) - .environmentObject(context.connectionObserver) - } -#if os(macOS) - .defaultSize(width: 600.0, height: 400.0) +#if os(iOS) + WindowGroup(content: content) +#else + Window(appName, id: appName, content: content) + .defaultSize(width: 600.0, height: 400.0) #endif } } + +private extension PassepartoutApp { + func content() -> some View { + AppCoordinator( + profileManager: context.profileManager, + tunnel: context.tunnel, + registry: context.registry + ) + .onLoad { + CommonLibrary.configureLogging( + to: Constants.shared.urlForAppLog, + parameters: Constants.shared.log + ) + AppUI.configure(with: context) + } + .themeLockScreen() + .environmentObject(theme) + .environmentObject(context.iapManager) + .environmentObject(context.connectionObserver) + } +}