Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

[Spaces] Show spaces in left panel #4509 #868

Merged
merged 1 commit into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MatrixKit/Models/RoomList/MXKRecentsDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
*/
@property (nonatomic, readonly) NSArray* searchPatternsList;

@property (nonatomic, strong) MXSpace *currentSpace;

#pragma mark - Configuration

/**
Expand Down
9 changes: 9 additions & 0 deletions MatrixKit/Models/RoomList/MXKRecentsDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ - (void)removeMatrixSession:(MXSession*)matrixSession
}
}

- (void)setCurrentSpace:(MXSpace *)currentSpace
{
_currentSpace = currentSpace;

for (MXKSessionRecentsDataSource *recentsDataSource in recentsDataSourceArray) {
recentsDataSource.currentSpace = currentSpace;
}
}

#pragma mark - MXKDataSource overridden

- (MXSession*)mxSession
Expand Down
4 changes: 4 additions & 0 deletions MatrixKit/Models/RoomList/MXKSessionRecentsDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#import "MXKDataSource.h"
#import "MXKRecentCellData.h"

@class MXSpace;

/**
Identifier to use for cells that display a room in the recents list.
*/
Expand Down Expand Up @@ -54,6 +56,8 @@ extern NSString *const kMXKRecentCellIdentifier;
*/
@property (nonatomic, readonly) BOOL hasUnread;

@property (nonatomic, strong, nullable) MXSpace *currentSpace;


#pragma mark - Life cycle

Expand Down
17 changes: 16 additions & 1 deletion MatrixKit/Models/RoomList/MXKSessionRecentsDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#import "MXKSessionRecentsDataSource.h"

#import "MXKRoomDataSourceManager.h"
#import <MatrixSDK/MatrixSDK-Swift.h>

#pragma mark - Constant definitions
NSString *const kMXKRecentCellIdentifier = @"kMXKRecentCellIdentifier";
Expand Down Expand Up @@ -105,6 +106,17 @@ - (void)didMXSessionStateChange
}
}

- (void)setCurrentSpace:(MXSpace *)currentSpace
{
if (_currentSpace == currentSpace)
{
return;
}

_currentSpace = currentSpace;
[self loadData];
}

#pragma mark -

- (NSInteger)numberOfCells
Expand Down Expand Up @@ -235,7 +247,10 @@ - (void)loadData
id<MXKRecentCellDataStoring> cellData = [[class alloc] initWithRoomSummary:roomSummary andRecentListDataSource:self];
if (cellData)
{
[internalCellDataArray addObject:cellData];
if (self.currentSpace == nil || [self.mxSession.spaceService isRoomWithId:roomSummary.roomId descendantOf:self.currentSpace.spaceId])
{
[internalCellDataArray addObject:cellData];
}
}
}
}
Expand Down