mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 23:48:29 +02:00
MESSENGER-4802 personal notes in favorites
This commit is contained in:
@@ -129,23 +129,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
|
||||
}
|
||||
- (NSArray<id<MXRoomSummaryProtocol>> *)favoriteCellDataArray
|
||||
{
|
||||
// bwi: for personal notes room
|
||||
NSMutableArray<id<MXRoomSummaryProtocol>> *filteredArray = [NSMutableArray arrayWithArray:self.recentsListService.favoritedRoomListData.rooms];
|
||||
|
||||
if( _recentsDataSourceMode == RecentsDataSourceModeFavourites) {
|
||||
PersonalNotesDefaultService *service = [[PersonalNotesDefaultService alloc] initWithMxSession:self.mxSession];
|
||||
PersonalNotesSettings *settings = [[PersonalNotesSettings alloc] init];
|
||||
|
||||
if ([service personalNotesRoomId] && settings.personalNotesVisible) {
|
||||
MXRoom* room = [self.mxSession roomWithRoomId:[service personalNotesRoomId]];
|
||||
if (room) {
|
||||
MXRoomSummary *summary = [self.mxSession roomSummaryWithRoomId:[service personalNotesRoomId]];
|
||||
[filteredArray insertObject:summary atIndex:0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return filteredArray;
|
||||
// bwi #4802: for personal notes room
|
||||
return [self filteredRoomCellDataArray:self.recentsListService.favoritedRoomListData.rooms];
|
||||
}
|
||||
- (NSArray<id<MXRoomSummaryProtocol>> *)peopleCellDataArray
|
||||
{
|
||||
@@ -153,17 +138,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
|
||||
}
|
||||
- (NSArray<id<MXRoomSummaryProtocol>> *)conversationCellDataArray
|
||||
{
|
||||
// bwi: for personal notes room
|
||||
NSMutableArray<id<MXRoomSummaryProtocol>> *filteredArray = [NSMutableArray arrayWithCapacity:self.recentsListService.conversationRoomListData.rooms.count];
|
||||
|
||||
for ( id<MXRoomSummaryProtocol> object in self.recentsListService.conversationRoomListData.rooms) {
|
||||
MXRoom* room = [self.mxSession roomWithRoomId:object.roomId];
|
||||
if (!room.isPersonalNotesRoom) {
|
||||
[filteredArray addObject:object];
|
||||
}
|
||||
}
|
||||
|
||||
return filteredArray;
|
||||
// bwi #4802: for personal notes room
|
||||
return [self filteredRoomCellDataArray:self.recentsListService.conversationRoomListData.rooms];
|
||||
}
|
||||
- (NSArray<id<MXRoomSummaryProtocol>> *)lowPriorityCellDataArray
|
||||
{
|
||||
@@ -179,26 +155,28 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
|
||||
}
|
||||
- (NSArray<id<MXRoomSummaryProtocol>> *)breadcrumbsRoomCellDataArray
|
||||
{
|
||||
// bwi: for personal notes room
|
||||
NSMutableArray<id<MXRoomSummaryProtocol>> *filteredArray = [NSMutableArray arrayWithCapacity:self.recentsListService.breadcrumbsRoomListData.rooms.count];
|
||||
|
||||
for ( id<MXRoomSummaryProtocol> object in self.recentsListService.breadcrumbsRoomListData.rooms) {
|
||||
MXRoom* room = [self.mxSession roomWithRoomId:object.roomId];
|
||||
if (!room.isPersonalNotesRoom) {
|
||||
[filteredArray addObject:object];
|
||||
}
|
||||
}
|
||||
|
||||
return filteredArray;
|
||||
// bwi #4802: for personal notes room
|
||||
return [self filteredRoomCellDataArray:self.recentsListService.breadcrumbsRoomListData.rooms];
|
||||
}
|
||||
- (NSArray<id<MXRoomSummaryProtocol>> *)allChatsRoomCellDataArray
|
||||
{
|
||||
// bwi: for personal notes room
|
||||
NSMutableArray<id<MXRoomSummaryProtocol>> *filteredArray = [NSMutableArray arrayWithCapacity:self.recentsListService.allChatsRoomListData.rooms.count];
|
||||
// bwi #4802: for personal notes room
|
||||
return [self filteredRoomCellDataArray:self.recentsListService.allChatsRoomListData.rooms];
|
||||
}
|
||||
|
||||
- (NSArray<id<MXRoomSummaryProtocol>> *)filteredRoomCellDataArray:(NSArray<id<MXRoomSummaryProtocol>> *)arrayToFilter {
|
||||
// bwi: #4802 for personal notes room
|
||||
NSMutableArray<id<MXRoomSummaryProtocol>> *filteredArray = [NSMutableArray arrayWithCapacity:arrayToFilter.count];
|
||||
|
||||
for ( id<MXRoomSummaryProtocol> object in self.recentsListService.allChatsRoomListData.rooms) {
|
||||
PersonalNotesSettings *settings = [[PersonalNotesSettings alloc] init];
|
||||
|
||||
for ( id<MXRoomSummaryProtocol> object in arrayToFilter) {
|
||||
MXRoom* room = [self.mxSession roomWithRoomId:object.roomId];
|
||||
if (!room.isPersonalNotesRoom) {
|
||||
if (room.isPersonalNotesRoom ) {
|
||||
if (settings.personalNotesVisible && BWIBuildSettings.shared.bwiPersonalNotesRoom) {
|
||||
[filteredArray addObject:object];
|
||||
}
|
||||
} else {
|
||||
[filteredArray addObject:object];
|
||||
}
|
||||
}
|
||||
@@ -265,9 +243,6 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
|
||||
}
|
||||
}
|
||||
|
||||
if (self.recentsListService.shouldShowBWIPersonalNotes) {
|
||||
[types addObject:@(RecentsDataSourceSectionTypePersonalNotes)];
|
||||
}
|
||||
|
||||
if (self.favoriteCellDataArray.count > 0 || _recentsDataSourceMode == RecentsDataSourceModeFavourites)
|
||||
{
|
||||
@@ -716,10 +691,6 @@ 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])
|
||||
@@ -744,7 +715,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
|
||||
(sectionType == RecentsDataSourceSectionTypeInvites && self.recentsDataSourceMode == RecentsDataSourceModeAllChats) ||
|
||||
(sectionType == RecentsDataSourceSectionTypeAllChats && !self.allChatsFilterOptions.optionsCount) ||
|
||||
(sectionType == RecentsDataSourceSectionTypeAllChats && self.currentSpace != nil && self.currentSpace.childRoomIds.count == 0) ||
|
||||
sectionType == RecentsDataSourceSectionTypePersonalNotes || sectionType == RecentsDataSourceSectionTypeFeatureBanner)
|
||||
sectionType == RecentsDataSourceSectionTypeFeatureBanner)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
@@ -1284,11 +1255,6 @@ 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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user