Add spaces option

This commit is contained in:
ismailgulek
2021-09-29 15:10:41 +03:00
parent 6e6f14b246
commit 714d9fa0be
2 changed files with 17 additions and 3 deletions
@@ -100,7 +100,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
fetchersContainer = [[RecentsRoomListFetchersContainer alloc] initWithSession:self.mxSession
mode:_recentsDataSourceMode
query:nil];
query:nil
space:nil];
[fetchersContainer addDelegate:self];
}
@@ -229,6 +230,11 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
[fetchersContainer updateMode:_recentsDataSourceMode];
}
- (void)setCurrentSpace:(MXSpace *)currentSpace
{
[fetchersContainer updateSpace:currentSpace];
}
- (UIView *)viewForStickyHeaderInSection:(NSInteger)section withFrame:(CGRect)frame
{
UIView *stickyHeader;
@@ -22,6 +22,7 @@ public class RecentsRoomListFetchersContainer: NSObject {
public let session: MXSession
public private(set) var mode: RecentsDataSourceMode
public private(set) var query: String?
public private(set) var space: MXSpace?
// MARK: - Fetchers
@@ -158,10 +159,12 @@ public class RecentsRoomListFetchersContainer: NSObject {
public init(withSession session: MXSession,
mode: RecentsDataSourceMode = .home,
query: String? = nil) {
query: String? = nil,
space: MXSpace? = nil) {
self.session = session
self.mode = mode
self.query = query
self.space = space
super.init()
createFetchers()
addRiotSettingsObserver()
@@ -239,6 +242,11 @@ public class RecentsRoomListFetchersContainer: NSObject {
visibleFetchers.forEach({ $0.fetchOptions.filterOptions.query = query })
}
public func updateSpace(_ space: MXSpace?) {
self.space = space
allFetchers.forEach({ $0.fetchOptions.filterOptions.space = space })
}
public func refresh() {
allFetchers.forEach({ $0.fetchOptions.sortOptions = sortOptions })
}
@@ -378,7 +386,7 @@ public class RecentsRoomListFetchersContainer: NSObject {
}
private func updateConversationFetcher(_ fetcher: MXRoomListDataFetcher, for mode: RecentsDataSourceMode) {
var notDataTypes: MXRoomSummaryDataTypes = [.hidden, .conferenceUser, .direct, .lowPriority, .serverNotice]
var notDataTypes: MXRoomSummaryDataTypes = [.hidden, .conferenceUser, .direct, .lowPriority, .serverNotice, .space]
switch mode {
case .home:
notDataTypes.insert([.invited, .favorited])