diff --git a/ElementX/Sources/Services/Room/MockRoomProxy.swift b/ElementX/Sources/Services/Room/MockRoomProxy.swift index cd90d486a..7c6601fb2 100644 --- a/ElementX/Sources/Services/Room/MockRoomProxy.swift +++ b/ElementX/Sources/Services/Room/MockRoomProxy.swift @@ -55,7 +55,7 @@ struct MockRoomProxy: RoomProxyProtocol { .failure(.failedAddingTimelineListener) } - func paginateBackwards(count: UInt) async -> Result { + func paginateBackwards(count: UInt) async -> Result { .failure(.failedPaginatingBackwards) } diff --git a/ElementX/Sources/Services/Room/RoomProxy.swift b/ElementX/Sources/Services/Room/RoomProxy.swift index 294fea740..64dda898b 100644 --- a/ElementX/Sources/Services/Room/RoomProxy.swift +++ b/ElementX/Sources/Services/Room/RoomProxy.swift @@ -142,7 +142,7 @@ class RoomProxy: RoomProxyProtocol { // } } - func paginateBackwards(count: UInt) async -> Result { + func paginateBackwards(count: UInt) async -> Result { guard backPaginationOutcome?.moreMessages != false else { return .failure(.noMoreMessagesToBackPaginate) } @@ -152,7 +152,7 @@ class RoomProxy: RoomProxyProtocol { try self.room.paginateBackwards(limit: UInt16(count)) } update(backPaginationOutcome: outcome) - return .success(()) + return .success(UInt(outcome.numUpdates)) } catch { return .failure(.failedPaginatingBackwards) } diff --git a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift index 6b62ecc57..e2e6225c5 100644 --- a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift +++ b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift @@ -56,7 +56,7 @@ protocol RoomProxyProtocol { func addTimelineListener(listener: TimelineListener) -> Result - func paginateBackwards(count: UInt) async -> Result + func paginateBackwards(count: UInt) async -> Result func sendMessage(_ message: String, inReplyToEventId: String?) async -> Result diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift index 9e1d37c20..b4300c2cf 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift @@ -99,7 +99,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol { // MARK: - Private fileprivate func updateRoomsWithDiffs(_ diffs: [SlidingSyncViewRoomsListDiff]) { - MXLog.info("Received diffs") + MXLog.info("Received \(diffs.count) diffs") rooms = diffs .reduce(rooms) { currentItems, diff in diff --git a/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift b/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift index c74d163b3..50727fd4f 100644 --- a/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift +++ b/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift @@ -72,8 +72,12 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol { MXLog.info("Started back pagination request") switch await roomProxy.paginateBackwards(count: count) { - case .success: - MXLog.info("Finished back pagination request") + case .success(let numUpdates): + MXLog.info("Finished back pagination request. Got \(numUpdates) updates") + + if numUpdates == 0 { + backPaginationPublisher.send(false) + } return .success(()) case .failure(let error): MXLog.error("Failed back pagination request with error: \(error)") diff --git a/changelog.d/394.bugfix b/changelog.d/394.bugfix new file mode 100644 index 000000000..8b20e3b81 --- /dev/null +++ b/changelog.d/394.bugfix @@ -0,0 +1 @@ +Fix stuck timeline pagination because of too many membership events \ No newline at end of file