Feature/4014 new layout notes room

This commit is contained in:
Frank Rotermund
2023-01-27 10:18:49 +00:00
committed by JanNiklas Grabowski
parent e57b51ed09
commit 0d1b84b04e
17 changed files with 169 additions and 67 deletions

View File

@@ -173,7 +173,17 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
}
- (NSArray<id<MXRoomSummaryProtocol>> *)allChatsRoomCellDataArray
{
return self.recentsListService.allChatsRoomListData.rooms;
// bwi: for personal notes room
NSMutableArray<id<MXRoomSummaryProtocol>> *filteredArray = [NSMutableArray arrayWithCapacity:self.recentsListService.allChatsRoomListData.rooms.count];
for ( id<MXRoomSummaryProtocol> object in self.recentsListService.allChatsRoomListData.rooms) {
MXRoom* room = [self.mxSession roomWithRoomId:object.roomId];
if (!room.isPersonalNotesRoom) {
[filteredArray addObject:object];
}
}
return filteredArray;
}
- (NSInteger)totalVisibleItemCount
@@ -229,6 +239,10 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
[types addObject:@(RecentsDataSourceSectionTypeBreadcrumbs)];
}
}
if (self.recentsListService.shouldShowBWIPersonalNotes) {
[types addObject:@(RecentsDataSourceSectionTypePersonalNotes)];
}
if (self.favoriteCellDataArray.count > 0 || _recentsDataSourceMode == RecentsDataSourceModeFavourites)
{
@@ -673,6 +687,10 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
{
count = self.allChatsRoomCellDataArray.count ?: 1;
}
else if (sectionType == RecentsDataSourceSectionTypePersonalNotes)
{
count = 1;
}
// Adjust this count according to the potential dragged cell.
if ([self isMovingCellSection:section])
@@ -696,7 +714,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
sectionType == RecentsDataSourceSectionTypeBreadcrumbs ||
(sectionType == RecentsDataSourceSectionTypeInvites && self.recentsDataSourceMode == RecentsDataSourceModeAllChats) ||
(sectionType == RecentsDataSourceSectionTypeAllChats && !self.allChatsFilterOptions.optionsCount) ||
(sectionType == RecentsDataSourceSectionTypeAllChats && self.currentSpace != nil && self.currentSpace.childRoomIds.count == 0))
(sectionType == RecentsDataSourceSectionTypeAllChats && self.currentSpace != nil && self.currentSpace.childRoomIds.count == 0) ||
sectionType == RecentsDataSourceSectionTypePersonalNotes )
{
return 0.0;
}
@@ -1236,6 +1255,11 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
summary = self.allChatsRoomCellDataArray[cellDataIndex];
}
}
else if (sectionType == RecentsDataSourceSectionTypePersonalNotes) {
PersonalNotesDefaultService* service = [[PersonalNotesDefaultService alloc] initWithMxSession:self.mxSession];
summary = [self.mxSession roomWithRoomId:[service personalNotesRoomId]].summary;
}
if (summary)
{