mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Fix stuck timeline pagination because of too many membership events
Requires https://github.com/matrix-org/matrix-rust-sdk/pull/1314
This commit is contained in:
@@ -55,7 +55,7 @@ struct MockRoomProxy: RoomProxyProtocol {
|
|||||||
.failure(.failedAddingTimelineListener)
|
.failure(.failedAddingTimelineListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
func paginateBackwards(count: UInt) async -> Result<Void, RoomProxyError> {
|
func paginateBackwards(count: UInt) async -> Result<UInt, RoomProxyError> {
|
||||||
.failure(.failedPaginatingBackwards)
|
.failure(.failedPaginatingBackwards)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
func paginateBackwards(count: UInt) async -> Result<Void, RoomProxyError> {
|
func paginateBackwards(count: UInt) async -> Result<UInt, RoomProxyError> {
|
||||||
guard backPaginationOutcome?.moreMessages != false else {
|
guard backPaginationOutcome?.moreMessages != false else {
|
||||||
return .failure(.noMoreMessagesToBackPaginate)
|
return .failure(.noMoreMessagesToBackPaginate)
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
try self.room.paginateBackwards(limit: UInt16(count))
|
try self.room.paginateBackwards(limit: UInt16(count))
|
||||||
}
|
}
|
||||||
update(backPaginationOutcome: outcome)
|
update(backPaginationOutcome: outcome)
|
||||||
return .success(())
|
return .success(UInt(outcome.numUpdates))
|
||||||
} catch {
|
} catch {
|
||||||
return .failure(.failedPaginatingBackwards)
|
return .failure(.failedPaginatingBackwards)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ protocol RoomProxyProtocol {
|
|||||||
|
|
||||||
func addTimelineListener(listener: TimelineListener) -> Result<Void, RoomProxyError>
|
func addTimelineListener(listener: TimelineListener) -> Result<Void, RoomProxyError>
|
||||||
|
|
||||||
func paginateBackwards(count: UInt) async -> Result<Void, RoomProxyError>
|
func paginateBackwards(count: UInt) async -> Result<UInt, RoomProxyError>
|
||||||
|
|
||||||
func sendMessage(_ message: String, inReplyToEventId: String?) async -> Result<Void, RoomProxyError>
|
func sendMessage(_ message: String, inReplyToEventId: String?) async -> Result<Void, RoomProxyError>
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
fileprivate func updateRoomsWithDiffs(_ diffs: [SlidingSyncViewRoomsListDiff]) {
|
fileprivate func updateRoomsWithDiffs(_ diffs: [SlidingSyncViewRoomsListDiff]) {
|
||||||
MXLog.info("Received diffs")
|
MXLog.info("Received \(diffs.count) diffs")
|
||||||
|
|
||||||
rooms = diffs
|
rooms = diffs
|
||||||
.reduce(rooms) { currentItems, diff in
|
.reduce(rooms) { currentItems, diff in
|
||||||
|
|||||||
@@ -72,8 +72,12 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
|||||||
|
|
||||||
MXLog.info("Started back pagination request")
|
MXLog.info("Started back pagination request")
|
||||||
switch await roomProxy.paginateBackwards(count: count) {
|
switch await roomProxy.paginateBackwards(count: count) {
|
||||||
case .success:
|
case .success(let numUpdates):
|
||||||
MXLog.info("Finished back pagination request")
|
MXLog.info("Finished back pagination request. Got \(numUpdates) updates")
|
||||||
|
|
||||||
|
if numUpdates == 0 {
|
||||||
|
backPaginationPublisher.send(false)
|
||||||
|
}
|
||||||
return .success(())
|
return .success(())
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
MXLog.error("Failed back pagination request with error: \(error)")
|
MXLog.error("Failed back pagination request with error: \(error)")
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Fix stuck timeline pagination because of too many membership events
|
||||||
Reference in New Issue
Block a user