mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 20:38:41 +00:00
Automatically dismiss (now) empty windows
This commit is contained in:
committed by
Stefan Ceriu
parent
f1ef968975
commit
35198460ce
@@ -67,9 +67,9 @@ class WindowManager: SecureWindowManagerProtocol {
|
|||||||
openWindowAction(value: type)
|
openWindowAction(value: type)
|
||||||
}
|
}
|
||||||
|
|
||||||
func windowForType(_ type: WindowManagerWindowType) -> AnyView? {
|
func windowForType(_ type: WindowManagerWindowType) -> AnyView {
|
||||||
guard let coordinator = coordinators[type]?.coordinator else {
|
guard let coordinator = coordinators[type]?.coordinator else {
|
||||||
return nil
|
return AnyView(InstantlyDismissingWindow())
|
||||||
}
|
}
|
||||||
|
|
||||||
return coordinator.toPresentable()
|
return coordinator.toPresentable()
|
||||||
@@ -179,3 +179,16 @@ private class PassthroughWindow: UIWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whenever restoring an app SwiftUI tries to restore its windows as well
|
||||||
|
/// which we're generally not prepared for so use this to just close them instead
|
||||||
|
private struct InstantlyDismissingWindow: View {
|
||||||
|
@Environment(\.dismissWindow) var dismissWindow
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Rectangle()
|
||||||
|
.task {
|
||||||
|
dismissWindow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ protocol SecureWindowManagerProtocol: WindowManagerProtocol {
|
|||||||
|
|
||||||
func handleRoute(_ appRoute: AppRoute, windowType: WindowManagerWindowType)
|
func handleRoute(_ appRoute: AppRoute, windowType: WindowManagerWindowType)
|
||||||
|
|
||||||
func windowForType(_ type: WindowManagerWindowType) -> AnyView?
|
func windowForType(_ type: WindowManagerWindowType) -> AnyView
|
||||||
|
|
||||||
/// Shows the main and overlay window combo, hiding the alternate window.
|
/// Shows the main and overlay window combo, hiding the alternate window.
|
||||||
func switchToMain()
|
func switchToMain()
|
||||||
|
|||||||
Reference in New Issue
Block a user