Introduce RiotSettings.showAllRoomsInHomeSpace and adapt changes in filter options

This commit is contained in:
ismailgulek
2021-10-19 16:36:35 +03:00
parent 8c2bb8a3da
commit f8c024672d
4 changed files with 18 additions and 4 deletions

View File

@@ -138,6 +138,10 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
return MXSDKOptions.sharedInstance().autoAcceptRoomInvites
}
private var showAllRoomsInHomeSpace: Bool {
return RiotSettings.shared.showAllRoomsInHomeSpace
}
// swiftlint:disable weak_delegate
private let multicastDelegate: MXMulticastDelegate<RecentsListServiceDelegate> = MXMulticastDelegate()
// swiftlint:enable weak_delegate
@@ -253,6 +257,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
public func refresh() {
allFetchers.forEach({ $0.fetchOptions.sortOptions = sortOptions })
allFetchers.forEach({ $0.fetchOptions.filterOptions.showAllRoomsInHomeSpace = showAllRoomsInHomeSpace })
}
public func stop() {
@@ -299,6 +304,8 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
case RiotSettings.UserDefaultsKeys.pinRoomsWithMissedNotificationsOnHome,
RiotSettings.UserDefaultsKeys.pinRoomsWithUnreadMessagesOnHome:
refresh()
case RiotSettings.UserDefaultsKeys.showAllRoomsInHomeSpace:
refresh()
default:
break
}
@@ -357,7 +364,8 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
let filterOptions = MXRoomListDataFilterOptions(dataTypes: dataTypes,
onlySuggested: onlySuggested,
query: query,
space: space)
space: space,
showAllRoomsInHomeSpace: showAllRoomsInHomeSpace)
let fetchOptions = MXRoomListDataFetchOptions(filterOptions: filterOptions,
sortOptions: sortOptions,