Remove restoration from donation windows

This commit is contained in:
Balazs Perlaki-Horvath 2025-05-01 13:53:05 +02:00 committed by Kelson
parent 12d1c8f56e
commit 657d5b2379

View File

@ -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