[Spaces] Show spaces in left panel #4509

- filter rooms using `MXSpaceService` new API
- Added logs
This commit is contained in:
Gil Eluard
2021-07-27 19:50:36 +02:00
parent f61a5751d2
commit 00befeca34

View File

@@ -168,6 +168,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
- (void)setCurrentSpace:(MXSpace *)currentSpace
{
MXLogDebug(@"[Spaces] setCurrentSpace %@", currentSpace.spaceId);
_currentSpace = currentSpace;
[self refreshRoomsSection:^{
[self.delegate dataSource:self didCellChange:nil];
@@ -440,6 +442,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
- (void)forceRefresh
{
MXLogDebug(@"[Spaces] forceRefresh \n%@", [NSThread callStackSymbols]);
// Refresh is disabled during drag&drop animation"
if (!self.droppingCellIndexPath)
{
@@ -1160,16 +1164,20 @@ 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.currentSpace isRoomAChildWithRoomId:cell.roomSummary.roomId])
// if (self.currentSpace == nil || [self.currentSpace isRoomAChildWithRoomId:cell.roomSummary.roomId])
if (self.currentSpace == nil || [self.mxSession.spaceService isRoomWithId:cell.roomSummary.roomId descendantOf:self.currentSpace.spaceId])
{
[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) {
MXStrongifyAndReturnIfNil(self);
@@ -1536,6 +1544,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
- (void)dataSource:(MXKDataSource*)dataSource didCellChange:(id)changes
{
MXLogDebug(@"[Spaces] dataSource didCellChange");
// Refresh is disabled during drag&drop animation
if (self.droppingCellIndexPath)
{