Skip to content

Commit

Permalink
Merge pull request #6660 from vector-im/gil/6513-Glitchy_room_list_he…
Browse files Browse the repository at this point in the history
…ader_when_scrolling

Glitchy room list header when scrolling
  • Loading branch information
gileluard authored Sep 5, 2022
2 parents b0dd477 + 356824b commit d5e54af
Show file tree
Hide file tree
Showing 24 changed files with 1,576 additions and 336 deletions.
3 changes: 2 additions & 1 deletion Riot/Modules/Application/LegacyAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

@protocol Configurable;
@protocol LegacyAppDelegateDelegate;
@protocol SplitViewMasterViewControllerProtocol;
@class CallBar;
@class CallPresenter;
@class RoomNavigationParameters;
Expand Down Expand Up @@ -69,7 +70,7 @@ UINavigationControllerDelegate
/**
Application main view controller
*/
@property (nonatomic, readonly) MasterTabBarController *masterTabBarController;
@property (nonatomic, readonly) UIViewController<SplitViewMasterViewControllerProtocol>* masterTabBarController;

@property (strong, nonatomic) UIWindow *window;

Expand Down
5 changes: 4 additions & 1 deletion Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,10 @@ - (void)crossSigningSetupBannerCellDidTapCloseAction:(CrossSigningSetupBannerCel
- (void)recentsListServiceDidChangeData:(id<RecentsListServiceProtocol>)service
totalCountsChanged:(BOOL)totalCountsChanged
{
[[AppDelegate theDelegate].masterTabBarController refreshTabBarBadges];
if (!BuildSettings.isNewAppLayoutActivated)
{
[[AppDelegate theDelegate].masterTabBarController refreshTabBarBadges];
}
}

- (void)recentsListServiceDidChangeData:(id<RecentsListServiceProtocol>)service
Expand Down
23 changes: 17 additions & 6 deletions Riot/Modules/Common/Recents/RecentsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,6 @@ - (void)viewDidLayoutSubviews

- (void)refreshRecentsTable
{
MXLogDebug(@"[RecentsViewController]: Refreshing recents table view")

if (!self.recentsUpdateEnabled)
{
isRefreshNeeded = YES;
Expand All @@ -384,7 +382,11 @@ - (void)refreshRecentsTable
isRefreshNeeded = NO;

// Refresh the tabBar icon badges
[[AppDelegate theDelegate].masterTabBarController refreshTabBarBadges];
if (!BuildSettings.isNewAppLayoutActivated)
{
// Refresh the tabBar icon badges
[[AppDelegate theDelegate].masterTabBarController refreshTabBarBadges];
}

// do not refresh if there is a pending recent drag and drop
if (movingCellPath)
Expand Down Expand Up @@ -1103,9 +1105,12 @@ - (void)dataSource:(MXKDataSource *)dataSource didCellChange:(id)changes
[self refreshRecentsTable];
}

// Since we've enabled room list pagination, `refreshRecentsTable` not called in this case.
// Refresh tab bar badges separately.
[[AppDelegate theDelegate].masterTabBarController refreshTabBarBadges];
if (!BuildSettings.isNewAppLayoutActivated)
{
// Since we've enabled room list pagination, `refreshRecentsTable` not called in this case.
// Refresh tab bar badges separately.
[[AppDelegate theDelegate].masterTabBarController refreshTabBarBadges];
}

[self showEmptyViewIfNeeded];

Expand Down Expand Up @@ -1513,6 +1518,12 @@ - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButto

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (!self.recentsSearchBar)
{
[super scrollViewDidScroll:scrollView];
return;
}

dispatch_async(dispatch_get_main_queue(), ^{

[self refreshStickyHeadersContainersHeight];
Expand Down
14 changes: 7 additions & 7 deletions Riot/Modules/Common/Recents/Views/RecentTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,25 @@ - (void)render:(MXKCellData *)cellData
{
self.lastEventDescription.text = roomCellData.lastEventTextMessage;
}

self.unsentImageView.hidden = roomCellData.roomSummary.sentStatus == MXRoomSummarySentStatusOk;
self.lastEventDecriptionLabelTrailingConstraint.constant = self.unsentImageView.hidden ? 10 : 30;

// Notify unreads and bing
if (roomCellData.hasUnread)
{
self.missedNotifAndUnreadIndicator.hidden = NO;

if (0 < roomCellData.notificationCount)
{
self.missedNotifAndUnreadIndicator.backgroundColor = roomCellData.highlightCount ? ThemeService.shared.theme.noticeColor : ThemeService.shared.theme.noticeSecondaryColor;

self.missedNotifAndUnreadBadgeBgView.hidden = NO;
self.missedNotifAndUnreadBadgeBgView.backgroundColor = self.missedNotifAndUnreadIndicator.backgroundColor;

self.missedNotifAndUnreadBadgeLabel.text = roomCellData.notificationCountStringValue;
[self.missedNotifAndUnreadBadgeLabel sizeToFit];

self.missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = self.missedNotifAndUnreadBadgeLabel.frame.size.width + 18;
}
else
Expand All @@ -120,8 +120,8 @@ - (void)render:(MXKCellData *)cellData
else
{
self.lastEventDate.textColor = ThemeService.shared.theme.textSecondaryColor;
// The room title is not bold anymore

// The room title is not bold anymore
self.roomTitle.font = [UIFont systemFontOfSize:17 weight:UIFontWeightMedium];
}

Expand Down
Loading

0 comments on commit d5e54af

Please sign in to comment.