diff --git a/App/App_macOS.swift b/App/App_macOS.swift index b6efba77..2f95822c 100644 --- a/App/App_macOS.swift +++ b/App/App_macOS.swift @@ -131,6 +131,7 @@ struct Kiwix: App { .windowStyle(.titleBar) .commandsRemoved() .defaultSize(width: 320, height: 400) + .restorationBehaviourDisabled() Window("", id: "donation-thank-you") { PaymentResultPopUp(state: .thankYou) @@ -139,6 +140,7 @@ struct Kiwix: App { .windowResizability(.contentMinSize) .commandsRemoved() .defaultSize(width: 320, height: 198) + .restorationBehaviourDisabled() Window("", id: "donation-error") { PaymentResultPopUp(state: .error) @@ -147,6 +149,7 @@ struct Kiwix: App { .windowResizability(.contentMinSize) .commandsRemoved() .defaultSize(width: 320, height: 198) + .restorationBehaviourDisabled() } private func closeDonation() { @@ -175,6 +178,16 @@ struct Kiwix: App { } } +private extension Scene { + nonisolated func restorationBehaviourDisabled() -> some Scene { + if #available(macOS 15.0, *) { + return restorationBehavior(.disabled) + } else { + return self + } + } +} + struct RootView: View { @Environment(\.openWindow) var openWindow @Environment(\.controlActiveState) var controlActiveState