Update activity indicators on leaving room

Signed-off-by: Andy Uhnak <andyuhnak@gmail.com>
This commit is contained in:
Andy Uhnak
2022-02-17 11:10:55 +00:00
parent 2e88df4576
commit a5ae727f84
18 changed files with 437 additions and 84 deletions
+19 -27
View File
@@ -1066,15 +1066,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
self.jumpToLastUnreadBannerContainer.hidden = YES;
[super leaveRoomOnEvent:event];
if (self.delegate)
{
[self.delegate roomViewControllerDidLeaveRoom:self];
}
else
{
[[AppDelegate theDelegate] restoreInitialDisplay:nil];
}
[self notifyDelegateOnLeaveRoomIfNecessary];
}
// Set the input toolbar according to the current display
@@ -2192,16 +2184,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
[self.roomDataSource.room leave:^{
[self stopActivityIndicator];
// We remove the current view controller.
if (self.delegate)
{
[self.delegate roomViewControllerDidLeaveRoom:self];
}
else
{
[[AppDelegate theDelegate] restoreInitialDisplay:^{}];
}
[self notifyDelegateOnLeaveRoomIfNecessary];
} failure:^(NSError *error) {
@@ -2211,6 +2194,22 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}];
}
- (void)notifyDelegateOnLeaveRoomIfNecessary {
if (self.delegate)
{
// Leaving room often triggers multiple events, incl local delegate callbacks as well as global notifications,
// which may lead to multiple identical UI changes (navigating to home, displaying notification etc).
// To avoid this, as soon as we notify the delegate the first time, we nilify it, preventing future messages
// from being passed along, assuming that after leaving a room there is nothing else to communicate to the delegate.
[self.delegate roomViewControllerDidLeaveRoom:self];
self.delegate = nil;
}
else
{
[[AppDelegate theDelegate] restoreInitialDisplay:^{}];
}
}
- (void)roomPreviewDidTapCancelAction
{
// Decline this invitation = leave this page
@@ -7052,14 +7051,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
- (void)roomInfoCoordinatorBridgePresenterDelegateDidLeaveRoom:(RoomInfoCoordinatorBridgePresenter *)coordinatorBridgePresenter
{
if (self.delegate)
{
[self.delegate roomViewControllerDidLeaveRoom:self];
}
else
{
[[AppDelegate theDelegate] restoreInitialDisplay:nil];
}
[self notifyDelegateOnLeaveRoomIfNecessary];
}
#pragma mark - RemoveJitsiWidgetViewDelegate