From 807c97d076f3718b7b2f9706263e30ef0b180953 Mon Sep 17 00:00:00 2001 From: Gil Eluard Date: Wed, 23 Mar 2022 10:58:41 +0100 Subject: [PATCH] Update suggested room preview to behave the same way in all cases #5771 - Done --- .../Common/Recents/RecentsViewController.m | 34 ++++-- Riot/Modules/Home/HomeViewController.m | 3 +- .../Controllers/MXKRecentListViewController.h | 3 +- .../Controllers/MXKRecentListViewController.m | 3 +- .../SpaceChildRoomDetailBridgePresenter.swift | 113 ++++++++++++++++++ changelog.d/5771.change | 2 + 6 files changed, 145 insertions(+), 13 deletions(-) create mode 100644 Riot/Modules/Spaces/SpaceRoomList/SpaceChildRoomDetail/SpaceChildRoomDetailBridgePresenter.swift create mode 100644 changelog.d/5771.change diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 0c731f7237..a6a59f00cd 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -36,7 +36,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewControllerDataReadyNotification"; -@interface RecentsViewController () +@interface RecentsViewController () { // Tell whether a recents refresh is pending (suspended during editing mode). BOOL isRefreshPending; @@ -83,6 +83,8 @@ @interface RecentsViewController () Void)?) { + guard let coordinator = self.coordinator else { + return + } + coordinator.toPresentable().dismiss(animated: animated) { + self.coordinator = nil + + if let completion = completion { + completion() + } + } + } +} + +// MARK: - SpaceChildRoomDetailCoordinatorDelegate +extension SpaceChildRoomDetailBridgePresenter: SpaceChildRoomDetailCoordinatorDelegate { + func spaceChildRoomDetailCoordinator(_ coordinator: SpaceChildRoomDetailCoordinatorType, didOpenRoomWith roomId: String) { + delegate?.spaceChildRoomDetailBridgePresenter(self, didOpenRoomWith: roomId) + } + + func spaceChildRoomDetailCoordinatorDidCancel(_ coordinator: SpaceChildRoomDetailCoordinatorType) { + delegate?.spaceChildRoomDetailBridgePresenterDidCancel(self) + } +} + +// MARK: - UIAdaptivePresentationControllerDelegate +extension SpaceChildRoomDetailBridgePresenter: UIAdaptivePresentationControllerDelegate { + + func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { + delegate?.spaceChildRoomDetailBridgePresenterDidCancel(self) + } +} diff --git a/changelog.d/5771.change b/changelog.d/5771.change new file mode 100644 index 0000000000..cef75bd465 --- /dev/null +++ b/changelog.d/5771.change @@ -0,0 +1,2 @@ +Update suggested room preview to behave the same way in all cases +