diff --git a/Riot/Modules/Room/RoomInfo/RoomInfoCoordinator.swift b/Riot/Modules/Room/RoomInfo/RoomInfoCoordinator.swift index 569803fbf..b61fbe4c0 100644 --- a/Riot/Modules/Room/RoomInfo/RoomInfoCoordinator.swift +++ b/Riot/Modules/Room/RoomInfo/RoomInfoCoordinator.swift @@ -188,6 +188,10 @@ extension RoomInfoCoordinator: RoomInfoListCoordinatorDelegate { func roomInfoListCoordinatorDidCancel(_ coordinator: RoomInfoListCoordinatorType) { self.delegate?.roomInfoCoordinatorDidComplete(self) } + + func roomInfoListCoordinatorDidLeaveRoom(_ coordinator: RoomInfoListCoordinatorType) { + self.delegate?.roomInfoCoordinatorDidLeaveRoom(self) + } } diff --git a/Riot/Modules/Room/RoomInfo/RoomInfoCoordinatorBridgePresenter.swift b/Riot/Modules/Room/RoomInfo/RoomInfoCoordinatorBridgePresenter.swift index 48dc70d3e..4f5d3cb65 100644 --- a/Riot/Modules/Room/RoomInfo/RoomInfoCoordinatorBridgePresenter.swift +++ b/Riot/Modules/Room/RoomInfo/RoomInfoCoordinatorBridgePresenter.swift @@ -21,6 +21,7 @@ import Foundation @objc protocol RoomInfoCoordinatorBridgePresenterDelegate { func roomInfoCoordinatorBridgePresenterDelegateDidComplete(_ coordinatorBridgePresenter: RoomInfoCoordinatorBridgePresenter) func roomInfoCoordinatorBridgePresenter(_ coordinatorBridgePresenter: RoomInfoCoordinatorBridgePresenter, didRequestMentionForMember member: MXRoomMember) + func roomInfoCoordinatorBridgePresenterDelegateDidLeaveRoom(_ coordinatorBridgePresenter: RoomInfoCoordinatorBridgePresenter) } /// RoomInfoCoordinatorBridgePresenter enables to start RoomInfoCoordinator from a view controller. @@ -120,6 +121,9 @@ extension RoomInfoCoordinatorBridgePresenter: RoomInfoCoordinatorDelegate { self.delegate?.roomInfoCoordinatorBridgePresenter(self, didRequestMentionForMember: member) } + func roomInfoCoordinatorDidLeaveRoom(_ coordinator: RoomInfoCoordinatorType) { + self.delegate?.roomInfoCoordinatorBridgePresenterDelegateDidLeaveRoom(self) + } } // MARK: - UIAdaptivePresentationControllerDelegate diff --git a/Riot/Modules/Room/RoomInfo/RoomInfoCoordinatorType.swift b/Riot/Modules/Room/RoomInfo/RoomInfoCoordinatorType.swift index 092a3b874..41065a236 100644 --- a/Riot/Modules/Room/RoomInfo/RoomInfoCoordinatorType.swift +++ b/Riot/Modules/Room/RoomInfo/RoomInfoCoordinatorType.swift @@ -21,6 +21,7 @@ import Foundation protocol RoomInfoCoordinatorDelegate: AnyObject { func roomInfoCoordinatorDidComplete(_ coordinator: RoomInfoCoordinatorType) func roomInfoCoordinator(_ coordinator: RoomInfoCoordinatorType, didRequestMentionForMember member: MXRoomMember) + func roomInfoCoordinatorDidLeaveRoom(_ coordinator: RoomInfoCoordinatorType) } /// `RoomInfoCoordinatorType` is a protocol describing a Coordinator that handle keybackup setup navigation flow. diff --git a/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListCoordinator.swift b/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListCoordinator.swift index 0dfa1be56..6da79ca32 100644 --- a/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListCoordinator.swift +++ b/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListCoordinator.swift @@ -70,5 +70,9 @@ extension RoomInfoListCoordinator: RoomInfoListViewModelCoordinatorDelegate { func roomInfoListViewModelDidCancel(_ viewModel: RoomInfoListViewModelType) { self.delegate?.roomInfoListCoordinatorDidCancel(self) } + + func roomInfoListViewModelDidLeaveRoom(_ viewModel: RoomInfoListViewModelType) { + self.delegate?.roomInfoListCoordinatorDidLeaveRoom(self) + } } diff --git a/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListCoordinatorType.swift b/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListCoordinatorType.swift index 7979d1aa8..592acd67b 100644 --- a/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListCoordinatorType.swift +++ b/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListCoordinatorType.swift @@ -21,6 +21,7 @@ import Foundation protocol RoomInfoListCoordinatorDelegate: AnyObject { func roomInfoListCoordinator(_ coordinator: RoomInfoListCoordinatorType, wantsToNavigateTo target: RoomInfoListTarget) func roomInfoListCoordinatorDidCancel(_ coordinator: RoomInfoListCoordinatorType) + func roomInfoListCoordinatorDidLeaveRoom(_ coordinator: RoomInfoListCoordinatorType) } /// `RoomInfoListCoordinatorType` is a protocol describing a Coordinator that handle key backup setup passphrase navigation flow. diff --git a/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModel.swift b/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModel.swift index e4c87f608..689a91b60 100644 --- a/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModel.swift +++ b/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModel.swift @@ -106,7 +106,7 @@ final class RoomInfoListViewModel: NSObject, RoomInfoListViewModelType { self.room.leave { (response) in switch response { case .success: - self.coordinatorDelegate?.roomInfoListViewModelDidCancel(self) + self.coordinatorDelegate?.roomInfoListViewModelDidLeaveRoom(self) case .failure(let error): self.startObservingSummaryChanges() self.update(viewState: .error(error)) diff --git a/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModelType.swift b/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModelType.swift index 2610d89a2..8a5a1b411 100644 --- a/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModelType.swift +++ b/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModelType.swift @@ -24,6 +24,7 @@ protocol RoomInfoListViewModelViewDelegate: AnyObject { protocol RoomInfoListViewModelCoordinatorDelegate: AnyObject { func roomInfoListViewModelDidCancel(_ viewModel: RoomInfoListViewModelType) + func roomInfoListViewModelDidLeaveRoom(_ viewModel: RoomInfoListViewModelType) func roomInfoListViewModel(_ viewModel: RoomInfoListViewModelType, wantsToNavigateTo target: RoomInfoListTarget) } diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 757f187e0..725db7ad1 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -1080,6 +1080,8 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; self.jumpToLastUnreadBannerContainer.hidden = YES; [super leaveRoomOnEvent:event]; + + [[LegacyAppDelegate theDelegate] restoreInitialDisplay:nil]; } // Set the input toolbar according to the current display @@ -6146,6 +6148,11 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; [self mention:member]; } +- (void)roomInfoCoordinatorBridgePresenterDelegateDidLeaveRoom:(RoomInfoCoordinatorBridgePresenter *)coordinatorBridgePresenter +{ + [[LegacyAppDelegate theDelegate] restoreInitialDisplay:nil]; +} + #pragma mark - RemoveJitsiWidgetViewDelegate - (void)removeJitsiWidgetViewDidCompleteSliding:(RemoveJitsiWidgetView *)view diff --git a/Riot/Modules/Room/Settings/RoomSettingsViewController.m b/Riot/Modules/Room/Settings/RoomSettingsViewController.m index 08d18f655..44bff4dc2 100644 --- a/Riot/Modules/Room/Settings/RoomSettingsViewController.m +++ b/Riot/Modules/Room/Settings/RoomSettingsViewController.m @@ -3494,7 +3494,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti [self startActivityIndicator]; [self->mxRoom leave:^{ - [self withdrawViewControllerAnimated:YES completion:nil]; + [[LegacyAppDelegate theDelegate] restoreInitialDisplay:nil]; } failure:^(NSError *error) { diff --git a/changelog.d/1482.change b/changelog.d/1482.change new file mode 100644 index 000000000..7085f4fc7 --- /dev/null +++ b/changelog.d/1482.change @@ -0,0 +1 @@ +Popping the user back to the home screen after leaving a room. \ No newline at end of file