mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-29 20:56:57 +02:00
Reload section if total number of rooms changes, fixes #5448
This commit is contained in:
@@ -245,7 +245,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
|
||||
if let fetcher = favoritedRoomListDataFetcher {
|
||||
updateFavoritedFetcher(fetcher, for: mode)
|
||||
}
|
||||
allFetchers.forEach({ notifyDataChange(on: $0) })
|
||||
allFetchers.forEach({ notifyDataChange(on: $0, totalCountsChanged: true) })
|
||||
}
|
||||
|
||||
public func updateQuery(_ query: String?) {
|
||||
@@ -558,11 +558,14 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
private func notifyDataChange(on fetcher: MXRoomListDataFetcher) {
|
||||
private func notifyDataChange(on fetcher: MXRoomListDataFetcher, totalCountsChanged: Bool) {
|
||||
if let section = section(forFetcher: fetcher) {
|
||||
multicastDelegate.invoke { $0.recentsListServiceDidChangeData?(self, forSection: section) }
|
||||
multicastDelegate.invoke { $0.recentsListServiceDidChangeData?(self,
|
||||
forSection: section,
|
||||
totalCountsChanged: totalCountsChanged) }
|
||||
}
|
||||
multicastDelegate.invoke { $0.recentsListServiceDidChangeData?(self) }
|
||||
multicastDelegate.invoke { $0.recentsListServiceDidChangeData?(self,
|
||||
totalCountsChanged: totalCountsChanged) }
|
||||
}
|
||||
|
||||
deinit {
|
||||
@@ -575,8 +578,8 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
|
||||
|
||||
extension RecentsListService: MXRoomListDataFetcherDelegate {
|
||||
|
||||
public func fetcherDidChangeData(_ fetcher: MXRoomListDataFetcher) {
|
||||
notifyDataChange(on: fetcher)
|
||||
public func fetcherDidChangeData(_ fetcher: MXRoomListDataFetcher, totalCountsChanged: Bool) {
|
||||
notifyDataChange(on: fetcher, totalCountsChanged: totalCountsChanged)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public class MockRecentsListService: NSObject, RecentsListServiceProtocol {
|
||||
}
|
||||
|
||||
private func notifyDataChange() {
|
||||
multicastDelegate.invoke({ $0.recentsListServiceDidChangeData?(self) })
|
||||
multicastDelegate.invoke({ $0.recentsListServiceDidChangeData?(self, totalCountsChanged: true) })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,11 +21,15 @@ public protocol RecentsListServiceDelegate: AnyObject {
|
||||
|
||||
/// Delegate method to be called when service data updated
|
||||
/// - Parameter service: service object
|
||||
@objc optional func recentsListServiceDidChangeData(_ service: RecentsListServiceProtocol)
|
||||
/// - Parameter totalCountsChanged: true if total rooms count changed
|
||||
@objc optional func recentsListServiceDidChangeData(_ service: RecentsListServiceProtocol,
|
||||
totalCountsChanged: Bool)
|
||||
|
||||
/// Delegate method to be called when a specific section data updated. Called for each updated section before `recentsListServiceDidChangeData` if implemented.
|
||||
/// - Parameter service: service object
|
||||
/// - Parameter section: updated section
|
||||
/// - Parameter totalCountsChanged: true if total rooms count changed for the section
|
||||
@objc optional func recentsListServiceDidChangeData(_ service: RecentsListServiceProtocol,
|
||||
forSection section: RecentsListServiceSection)
|
||||
forSection section: RecentsListServiceSection,
|
||||
totalCountsChanged: Bool)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user