Merge branch 'gil/4494_space_menu' into gil/4501_show_suggested_in_room_lists

This commit is contained in:
Gil Eluard
2021-07-26 12:03:49 +02:00
322 changed files with 6181 additions and 970 deletions

View File

@@ -19,7 +19,6 @@
#import "RecentCellData.h"
#import "SectionHeaderView.h"
#import "DirectorySectionHeaderContainerView.h"
#import "ThemeService.h"
@@ -37,7 +36,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";
@@ -48,10 +46,6 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
NSInteger shrinkedSectionsBitMask;
DirectorySectionHeaderContainerView *directorySectionContainer;
UILabel *networkLabel;
UILabel *directoryServerLabel;
NSMutableDictionary<NSString*, id> *roomTagsListenerByUserId;
// Timer to not refresh publicRoomsDirectoryDataSource on every keystroke.
@@ -513,13 +507,6 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
conversationSection = sectionsCount++;
}
if (_recentsDataSourceMode == RecentsDataSourceModeRooms
&& BuildSettings.publicRoomsShowDirectory)
{
// Add the directory section after "ROOMS"
directorySection = sectionsCount++;
}
if (self.lowPriorityCellDataArray.count > 0)
{
lowPrioritySection = sectionsCount++;
@@ -602,12 +589,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;
}
@@ -853,57 +834,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;
}