Clear highlighted event when view gone

This commit is contained in:
ismailgulek 2021-12-03 02:41:01 +03:00
parent 42185a2ec2
commit 9eef855e7c
No known key found for this signature in database
GPG key ID: E96336D42D9470A9

View file

@ -658,6 +658,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
[self cancelEventSelection];
}
}
[self cancelEventHighlight];
// Hide preview header to restore navigation bar settings
[self showPreviewHeader:NO];
@ -4526,24 +4527,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
[super scrollViewWillBeginDragging:scrollView];
}
// if data source is highlighting an event, dismiss the highlight when user dragges the table view
if (customizedRoomDataSource.highlightedEventId)
{
NSInteger row = [self.roomDataSource indexOfCellDataWithEventId:customizedRoomDataSource.highlightedEventId];
if (row == NSNotFound)
{
customizedRoomDataSource.highlightedEventId = nil;
return;
}
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
if ([[self.bubblesTableView indexPathsForVisibleRows] containsObject:indexPath])
{
customizedRoomDataSource.highlightedEventId = nil;
[self.bubblesTableView reloadRowsAtIndexPaths:@[indexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
}
}
[self cancelEventHighlight];
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
@ -6452,6 +6436,28 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
}
- (void)cancelEventHighlight
{
// if data source is highlighting an event, dismiss the highlight when user dragges the table view
if (customizedRoomDataSource.highlightedEventId)
{
NSInteger row = [self.roomDataSource indexOfCellDataWithEventId:customizedRoomDataSource.highlightedEventId];
if (row == NSNotFound)
{
customizedRoomDataSource.highlightedEventId = nil;
return;
}
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
if ([[self.bubblesTableView indexPathsForVisibleRows] containsObject:indexPath])
{
customizedRoomDataSource.highlightedEventId = nil;
[self.bubblesTableView reloadRowsAtIndexPaths:@[indexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
}
}
}
- (void)updateThreadListBarButtonBadgeWith:(MXThreadingService *)service
{
if (!threadListBarButtonItem || !service)