mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 23:48:29 +02:00
[Spaces] Show spaces in left panel #4509
- Display the none hierarchical list of spaces in the left panel - Space switching when new space selected - Refresh space list and recents data after sync
This commit is contained in:
@@ -98,10 +98,16 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
|
||||
|
||||
// Set default data and view classes
|
||||
[self registerCellDataClass:RecentCellData.class forCellIdentifier:kMXKRecentCellIdentifier];
|
||||
|
||||
[self registerSpaceServiceDidBuildGraphNotification];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self unregisterSpaceServiceDidBuildGraphNotification];
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
@@ -166,6 +172,13 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
|
||||
return state.unsentMessagesGroupDiscussionsCount;
|
||||
}
|
||||
|
||||
- (void)setCurrentSpace:(MXSpace *)currentSpace
|
||||
{
|
||||
_currentSpace = currentSpace;
|
||||
[self refreshRoomsSection:^{
|
||||
[self.delegate dataSource:self didCellChange:nil];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@@ -213,6 +226,23 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
|
||||
return stickyHeader;
|
||||
}
|
||||
|
||||
#pragma mark - Space Service notifications
|
||||
|
||||
- (void)registerSpaceServiceDidBuildGraphNotification
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(spaceServiceDidBuildGraphNotification:) name:MXSpaceService.didBuildSpaceGraph object:nil];
|
||||
}
|
||||
|
||||
- (void)spaceServiceDidBuildGraphNotification:(NSNotification*)notification
|
||||
{
|
||||
[self forceRefresh];
|
||||
}
|
||||
|
||||
- (void)unregisterSpaceServiceDidBuildGraphNotification
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:MXSpaceService.didBuildSpaceGraph object:nil];
|
||||
}
|
||||
|
||||
#pragma mark - Key backup setup banner
|
||||
|
||||
- (void)registerKeyBackupStateDidChangeNotification
|
||||
@@ -1204,7 +1234,10 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
|
||||
for (NSUInteger index = 0; index < count; index++)
|
||||
{
|
||||
id<MXKRecentCellDataStoring> cell = [recentsDataSource cellDataAtIndex:index];
|
||||
[cells addObject:cell];
|
||||
if (self.currentSpace == nil || [self.currentSpace isRoomAChildWithRoomId:cell.roomSummary.roomId])
|
||||
{
|
||||
[cells addObject:cell];
|
||||
}
|
||||
}
|
||||
|
||||
MXWeakify(self);
|
||||
|
||||
Reference in New Issue
Block a user