Unverified Commit 3cbeba85 authored by ismailgulek's avatar ismailgulek Committed by GitHub
Browse files

Merge pull request #4250 from vector-im/fix_room_leave

Fixes on Room Leave
parents 2e9da81b bcd82c97
......@@ -16,6 +16,8 @@ Changes to be released in next version
🐛 Bugfix
* PublicRoomsDirectoryDataSource: Fix search when NSFW filter is off.
* RoomVC: Fix navigation issue when a room left.
* RoomVC: Fix a crash when scroll to bottom tapped on a left room.
⚠️ API Changes
*
......
......@@ -33,6 +33,12 @@ final class RoomInfoCoordinatorBridgePresenter: NSObject {
private let coordinatorParameters: RoomInfoCoordinatorParameters
private var coordinator: RoomInfoCoordinator?
private var navigationType: NavigationType = .present
private enum NavigationType {
case present
case push
}
// MARK: Public
......@@ -61,6 +67,7 @@ final class RoomInfoCoordinatorBridgePresenter: NSObject {
roomInfoCoordinator.start()
self.coordinator = roomInfoCoordinator
self.navigationType = .present
}
func push(from navigationController: UINavigationController, animated: Bool) {
......@@ -71,13 +78,27 @@ final class RoomInfoCoordinatorBridgePresenter: NSObject {
roomInfoCoordinator.start()
self.coordinator = roomInfoCoordinator
self.navigationType = .push
}
func dismiss(animated: Bool, completion: (() -> Void)?) {
guard let coordinator = self.coordinator else {
return
}
coordinator.toPresentable().dismiss(animated: animated) {
switch navigationType {
case .present:
coordinator.toPresentable().dismiss(animated: animated) {
self.coordinator = nil
if let completion = completion {
completion()
}
}
case .push:
guard let navigationController = coordinator.toPresentable() as? UINavigationController else {
return
}
navigationController.popViewController(animated: animated)
self.coordinator = nil
if let completion = completion {
......
......@@ -4487,11 +4487,20 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
// Note: we check if `currentEventIdAtTableBottom` is set to know whether the table has been rendered at least once.
if (!self.roomDataSource.isLive || (currentEventIdAtTableBottom && [self isBubblesTableScrollViewAtTheBottom] == NO))
{
// Retrieve the unread messages count
NSUInteger unreadCount = self.roomDataSource.room.summary.localUnreadEventCount;
self.scrollToBottomBadgeLabel.text = unreadCount ? [NSString stringWithFormat:@"%lu", unreadCount] : nil;
self.scrollToBottomHidden = NO;
if (self.roomDataSource.room)
{
// Retrieve the unread messages count
NSUInteger unreadCount = self.roomDataSource.room.summary.localUnreadEventCount;
self.scrollToBottomBadgeLabel.text = unreadCount ? [NSString stringWithFormat:@"%lu", unreadCount] : nil;
self.scrollToBottomHidden = NO;
}
else
{
// will be here for left rooms
self.scrollToBottomBadgeLabel.text = nil;
self.scrollToBottomHidden = YES;
}
}
else if (serverNotices.usageLimit && serverNotices.usageLimit.isServerNoticeUsageLimit)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment