Merge branch 'gil/SP1_space_creation' into gil/5225_invite_to_space_in_room_landing

# Conflicts:
#	Riot/Generated/Strings.swift
#	Riot/Modules/Room/Members/RoomParticipantsViewController.m
#	Riot/Modules/Spaces/SpaceMembers/MemberList/SpaceMemberListViewController.swift
#	Riot/Modules/Spaces/SpaceRoomList/ExploreRoom/SpaceExploreRoomViewController.swift
#	Riot/SupportingFiles/Riot-Bridging-Header.h
This commit is contained in:
Gil Eluard
2022-01-24 19:36:02 +01:00
494 changed files with 13663 additions and 2679 deletions

View File

@@ -607,17 +607,17 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
if (section == favoritesSection)
{
count = self.favoriteCellDataArray.count;
count = self.recentsListService.favoritedRoomListData.counts.total.numberOfRooms;
title = [VectorL10n roomRecentsFavouritesSection];
}
else if (section == peopleSection)
{
count = self.peopleCellDataArray.count;
count = self.recentsListService.peopleRoomListData.counts.total.numberOfRooms;
title = [VectorL10n roomRecentsPeopleSection];
}
else if (section == conversationSection)
{
count = self.conversationCellDataArray.count;
count = self.recentsListService.conversationRoomListData.counts.total.numberOfRooms;
if (_recentsDataSourceMode == RecentsDataSourceModePeople)
{
@@ -634,17 +634,17 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
}
else if (section == lowPrioritySection)
{
count = self.lowPriorityCellDataArray.count;
count = self.recentsListService.lowPriorityRoomListData.counts.total.numberOfRooms;
title = [VectorL10n roomRecentsLowPrioritySection];
}
else if (section == serverNoticeSection)
{
count = self.serverNoticeCellDataArray.count;
count = self.recentsListService.serverNoticeRoomListData.counts.total.numberOfRooms;
title = [VectorL10n roomRecentsServerNoticeSection];
}
else if (section == invitesSection)
{
count = self.invitesCellDataArray.count;
count = self.recentsListService.invitedRoomListData.counts.total.numberOfRooms;
if (_recentsDataSourceMode == RecentsDataSourceModePeople)
{
@@ -657,7 +657,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
}
else if (section == suggestedRoomsSection)
{
count = self.suggestedRoomCellDataArray.count;
count = self.recentsListService.suggestedRoomListData.counts.total.numberOfRooms;
title = [VectorL10n roomRecentsSuggestedRoomsSection];
}
@@ -715,26 +715,29 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
counts = self.recentsListService.suggestedRoomListData.counts;
}
if (counts.numberOfNotifications)
NSUInteger numberOfNotifications = counts.total.numberOfNotifications;
NSUInteger numberOfHighlights = counts.total.numberOfHighlights;
if (numberOfNotifications)
{
UILabel *missedNotifAndUnreadBadgeLabel = [[UILabel alloc] init];
missedNotifAndUnreadBadgeLabel.textColor = ThemeService.shared.theme.baseTextPrimaryColor;
missedNotifAndUnreadBadgeLabel.font = [UIFont boldSystemFontOfSize:14];
if (counts.numberOfNotifications > 1000)
if (numberOfNotifications > 1000)
{
CGFloat value = counts.numberOfNotifications / 1000.0;
CGFloat value = numberOfNotifications / 1000.0;
missedNotifAndUnreadBadgeLabel.text = [VectorL10n largeBadgeValueKFormat:value];
}
else
{
missedNotifAndUnreadBadgeLabel.text = [NSString stringWithFormat:@"%tu", counts.numberOfNotifications];
missedNotifAndUnreadBadgeLabel.text = [NSString stringWithFormat:@"%tu", numberOfNotifications];
}
[missedNotifAndUnreadBadgeLabel sizeToFit];
CGFloat bgViewWidth = missedNotifAndUnreadBadgeLabel.frame.size.width + 18;
BOOL highlight = counts.numberOfHighlights > 0;
BOOL highlight = numberOfHighlights > 0;
missedNotifAndUnreadBadgeBgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, bgViewWidth, 20)];
[missedNotifAndUnreadBadgeBgView.layer setCornerRadius:10];
missedNotifAndUnreadBadgeBgView.backgroundColor = highlight ? ThemeService.shared.theme.noticeColor : ThemeService.shared.theme.noticeSecondaryColor;
@@ -1337,6 +1340,38 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
return nil;
}
- (void)paginateInSection:(NSInteger)section
{
if (section == invitesSection)
{
[self.recentsListService paginateInSection:RecentsListServiceSectionInvited];
}
else if (section == favoritesSection)
{
[self.recentsListService paginateInSection:RecentsListServiceSectionFavorited];
}
else if (section == peopleSection)
{
[self.recentsListService paginateInSection:RecentsListServiceSectionPeople];
}
else if (section == conversationSection)
{
[self.recentsListService paginateInSection:RecentsListServiceSectionConversation];
}
else if (section == lowPrioritySection)
{
[self.recentsListService paginateInSection:RecentsListServiceSectionLowPriority];
}
else if (section == serverNoticeSection)
{
[self.recentsListService paginateInSection:RecentsListServiceSectionServerNotice];
}
else if (section == suggestedRoomsSection)
{
[self.recentsListService paginateInSection:RecentsListServiceSectionSuggested];
}
}
- (void)moveRoomCell:(MXRoom*)room from:(NSIndexPath*)oldPath to:(NSIndexPath*)newPath success:(void (^)(void))moveSuccess failure:(void (^)(NSError *error))moveFailure;
{
MXLogDebug(@"[RecentsDataSource] moveCellFrom (%tu, %tu) to (%tu, %tu)", oldPath.section, oldPath.row, newPath.section, newPath.row);
@@ -1432,10 +1467,41 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
#pragma mark - RecentsListServiceDelegate
- (void)serviceDidChangeData:(id<RecentsListServiceProtocol>)service
- (void)recentsListServiceDidChangeData:(id<RecentsListServiceProtocol>)service
{
// TODO: Update only updated sections
[self.delegate dataSource:self didCellChange:nil];
// no-op
}
- (void)recentsListServiceDidChangeData:(id<RecentsListServiceProtocol>)service
forSection:(RecentsListServiceSection)section
{
NSInteger sectionIndex = -1;
switch (section)
{
case RecentsListServiceSectionInvited:
sectionIndex = invitesSection;
break;
case RecentsListServiceSectionFavorited:
sectionIndex = favoritesSection;
break;
case RecentsListServiceSectionPeople:
sectionIndex = peopleSection;
break;
case RecentsListServiceSectionConversation:
sectionIndex = conversationSection;
break;
case RecentsListServiceSectionLowPriority:
sectionIndex = lowPrioritySection;
break;
case RecentsListServiceSectionServerNotice:
sectionIndex = serverNoticeSection;
break;
case RecentsListServiceSectionSuggested:
sectionIndex = suggestedRoomsSection;
break;
}
[self.delegate dataSource:self didCellChange:@(sectionIndex)];
}
@end