Remove custom section header for room directory from RecentsDataSource.

This commit is contained in:
Doug
2021-07-07 14:31:52 +01:00
parent e51b62244e
commit b8a4a526b3

View File

@@ -37,7 +37,6 @@
#define RECENTSDATASOURCE_SECTION_PEOPLE 0x40
#define RECENTSDATASOURCE_DEFAULT_SECTION_HEADER_HEIGHT 30.0
#define RECENTSDATASOURCE_DIRECTORY_SECTION_HEADER_HEIGHT 65.0
NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSourceTapOnDirectoryServerChange";
@@ -565,12 +564,6 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
{
return 0.0;
}
else if (section == directorySection
&& !(shrinkedSectionsBitMask & RECENTSDATASOURCE_SECTION_DIRECTORY)
&& BuildSettings.publicRoomsAllowServerChange)
{
return RECENTSDATASOURCE_DIRECTORY_SECTION_HEADER_HEIGHT;
}
return RECENTSDATASOURCE_DEFAULT_SECTION_HEADER_HEIGHT;
}
@@ -816,57 +809,6 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
[sectionHeader addSubview:headerLabel];
sectionHeader.headerLabel = headerLabel;
if (section == directorySection
&& _recentsDataSourceMode == RecentsDataSourceModeRooms
&& !(shrinkedSectionsBitMask & RECENTSDATASOURCE_SECTION_DIRECTORY)
&& BuildSettings.publicRoomsAllowServerChange)
{
if (!directorySectionContainer)
{
directorySectionContainer = [[DirectorySectionHeaderContainerView alloc] initWithFrame:CGRectZero];
directorySectionContainer.backgroundColor = [UIColor clearColor];
// Add the "Network" label at the left
networkLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
networkLabel.font = [UIFont systemFontOfSize:16.0];
networkLabel.text = NSLocalizedStringFromTable(@"room_recents_directory_section_network", @"Vector", nil);
[directorySectionContainer addSubview:networkLabel];
directorySectionContainer.networkLabel = networkLabel;
// Add label for selected directory server
directoryServerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 30)];
directoryServerLabel.font = [UIFont systemFontOfSize:16.0];
directoryServerLabel.textAlignment = NSTextAlignmentRight;
[directorySectionContainer addSubview:directoryServerLabel];
directorySectionContainer.directoryServerLabel = directoryServerLabel;
// Chevron
UIImageView *chevronImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 6, 12)];
chevronImageView.contentMode = UIViewContentModeScaleAspectFit;
chevronImageView.image = [UIImage imageNamed:@"disclosure_icon"];
chevronImageView.tintColor = ThemeService.shared.theme.textSecondaryColor;
[directorySectionContainer addSubview:chevronImageView];
directorySectionContainer.disclosureView = chevronImageView;
// Set a tap listener on all the container
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onDirectoryServerPickerTap:)];
[tapGesture setNumberOfTouchesRequired:1];
[tapGesture setNumberOfTapsRequired:1];
[directorySectionContainer addGestureRecognizer:tapGesture];
}
// Apply the current UI theme.
networkLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
directoryServerLabel.textColor = ThemeService.shared.theme.textSecondaryColor;
// Set the current directory server name
directoryServerLabel.text = _publicRoomsDirectoryDataSource.directoryServerDisplayname;
// Add the check box container
[sectionHeader addSubview:directorySectionContainer];
sectionHeader.bottomView = directorySectionContainer;
}
return sectionHeader;
}