Skip to content

Commit

Permalink
[Spaces] Show spaces in left panel #4509
Browse files Browse the repository at this point in the history
- moved space filtering to MatrixKit
  • Loading branch information
gileluard committed Jul 30, 2021
1 parent 8d6bdb7 commit 49e19c4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
2 changes: 0 additions & 2 deletions Riot/Modules/Common/Recents/DataSources/RecentsDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
18 changes: 1 addition & 17 deletions Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,6 @@ - (NSUInteger)unsentMessagesGroupDiscussionsCount
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
Expand Down Expand Up @@ -1165,17 +1155,11 @@ - (void)refreshRoomsSection:(void (^)(void))onComplete;
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) {
Expand Down

0 comments on commit 49e19c4

Please sign in to comment.