diff --git a/ElementX/Sources/Application/Windowing/WindowManager.swift b/ElementX/Sources/Application/Windowing/WindowManager.swift index 6d3ac2b1f..40b846212 100644 --- a/ElementX/Sources/Application/Windowing/WindowManager.swift +++ b/ElementX/Sources/Application/Windowing/WindowManager.swift @@ -174,6 +174,10 @@ class WindowManager: SecureWindowManagerProtocol { func lockOrientation(_ orientation: UIInterfaceOrientationMask) { appDelegate.orientationLock = orientation } + + func closeAuxiliaryWindow(forType type: WindowManagerWindowType) { + dismissWindowAction(value: type) + } } private class PassthroughWindow: UIWindow { diff --git a/ElementX/Sources/Application/Windowing/WindowManagerProtocol.swift b/ElementX/Sources/Application/Windowing/WindowManagerProtocol.swift index 4d4643275..7a3b1b27e 100644 --- a/ElementX/Sources/Application/Windowing/WindowManagerProtocol.swift +++ b/ElementX/Sources/Application/Windowing/WindowManagerProtocol.swift @@ -62,6 +62,9 @@ protocol WindowManagerProtocol: AnyObject, OrientationManagerProtocol { func showGlobalSearch() func hideGlobalSearch() + + /// Closes a previously opened window for the given type. + func closeAuxiliaryWindow(forType type: WindowManagerWindowType) } // sourcery: AutoMockable diff --git a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift index 01d862d6b..8d881c437 100644 --- a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift @@ -900,6 +900,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { // iPhone the compact module diffs call the dismissal callback and we present a blank space flow 🙈 if spaceRoomListProxy == nil { navigationStackCoordinator.setRootCoordinator(nil, animated: false) + flowParameters.windowManager.closeAuxiliaryWindow(forType: .room(roomID: roomProxy.id)) } } diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 2dff16643..63ac9834c 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -21462,8 +21462,13 @@ class WindowManagerMock: WindowManagerProtocol, @unchecked Sendable { } var showGlobalSearchCalled: Bool { return showGlobalSearchCallsCount > 0 + var closeAuxiliaryWindowForTypeCalled: Bool { + return closeAuxiliaryWindowForTypeCallsCount > 0 } var showGlobalSearchClosure: (() -> Void)? + var closeAuxiliaryWindowForTypeReceivedType: WindowManagerWindowType? + var closeAuxiliaryWindowForTypeReceivedInvocations: [WindowManagerWindowType] = [] + var closeAuxiliaryWindowForTypeClosure: ((WindowManagerWindowType) -> Void)? func showGlobalSearch() { showGlobalSearchCallsCount += 1