[Spaces] Show spaces in left panel #4509

- moved space filtering to MatrixKit
This commit is contained in:
Gil Eluard 2021-07-30 06:56:37 +02:00
parent 8d6bdb7e8c
commit 49e19c48f0
2 changed files with 1 additions and 19 deletions

View file

@ -100,8 +100,6 @@ extern NSString *const kRecentsDataSourceTapOnDirectoryServerChange;
*/
@property (nonatomic) PublicRoomsDirectoryDataSource *publicRoomsDirectoryDataSource;
@property (nonatomic, strong) MXSpace *currentSpace;
/**
Refresh the recents data source and notify its delegate.
*/

View file

@ -166,16 +166,6 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
return state.unsentMessagesGroupDiscussionsCount;
}
- (void)setCurrentSpace:(MXSpace *)currentSpace
{
MXLogDebug(@"[Spaces] setCurrentSpace %@", currentSpace.spaceId);
_currentSpace = currentSpace;
[self refreshRoomsSection:^{
[self.delegate dataSource:self didCellChange:nil];
}];
}
#pragma mark -
- (void)setDelegate:(id<MXKDataSourceDelegate>)delegate andRecentsDataSourceMode:(RecentsDataSourceMode)recentsDataSourceMode
@ -1165,17 +1155,11 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
NSMutableArray<id<MXKRecentCellDataStoring>> *cells = [NSMutableArray new];
NSInteger count = recentsDataSource.numberOfCells;
NSDate *startDate = [NSDate new];
MXLogDebug(@"[Spaces] starting filtering rooms");
for (NSUInteger index = 0; index < count; index++)
{
id<MXKRecentCellDataStoring> cell = [recentsDataSource cellDataAtIndex:index];
if (self.currentSpace == nil || [self.mxSession.spaceService isRoomWithId:cell.roomSummary.roomId descendantOf:self.currentSpace.spaceId])
{
[cells addObject:cell];
}
[cells addObject:cell];
}
MXLogDebug(@"[Spaces] ended filtering rooms after %f", [[NSDate new] timeIntervalSinceDate:startDate]);
MXWeakify(self);
[self computeStateAsyncWithCells:cells recentsDataSourceMode:self.recentsDataSourceMode matrixSession:recentsDataSource.mxSession onComplete:^(RecentsDataSourceState *newState) {