Merge pull request #5539 from vector-im/ismail/5537_home_badges

Home Screen: Fix Section & TabBar Badges
This commit is contained in:
ismailgulek
2022-02-10 11:49:50 +03:00
committed by GitHub
14 changed files with 123 additions and 41 deletions
@@ -30,6 +30,7 @@
#import "DirectoryRecentTableViewCell.h"
#import "RoomIdOrAliasTableViewCell.h"
#import "TableViewCellWithCollectionView.h"
#import "SectionHeaderView.h"
#import "GeneratedInterface-Swift.h"
@@ -145,6 +146,9 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
// Register key verification banner cells
[self.recentsTableView registerNib:CrossSigningSetupBannerCell.nib forCellReuseIdentifier:CrossSigningSetupBannerCell.defaultReuseIdentifier];
[self.recentsTableView registerClass:SectionHeaderView.class
forHeaderFooterViewReuseIdentifier:SectionHeaderView.defaultReuseIdentifier];
// Hide line separators of empty cells
self.recentsTableView.tableFooterView = [[UIView alloc] init];
@@ -1018,6 +1022,18 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
TableViewCellWithCollectionView *collectionViewCell = (TableViewCellWithCollectionView *)cell;
[collectionViewCell.collectionView reloadData];
cellReloaded = YES;
CGRect headerFrame = [self.recentsTableView rectForHeaderInSection:update.sectionIndex];
UIView *headerView = [self.recentsTableView headerViewForSection:update.sectionIndex];
UIView *updatedHeaderView = [self.dataSource viewForHeaderInSection:update.sectionIndex withFrame:headerFrame inTableView:self.recentsTableView];
if ([headerView isKindOfClass:SectionHeaderView.class]
&& [updatedHeaderView isKindOfClass:SectionHeaderView.class])
{
SectionHeaderView *sectionHeaderView = (SectionHeaderView *)headerView;
SectionHeaderView *updatedSectionHeaderView = (SectionHeaderView *)updatedHeaderView;
sectionHeaderView.headerLabel = updatedSectionHeaderView.headerLabel;
sectionHeaderView.accessoryView = updatedSectionHeaderView.accessoryView;
}
}
}
}