Skip to content

Commit 2408e98

Browse files
authored
Merge pull request #5389 from element-hq/feature/fga/timeline_fix_forward_pagination
fix (timeline) : forward pagination regression
2 parents 648583c + 1822489 commit 2408e98

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class RustTimeline(
123123
)
124124

125125
override val forwardPaginationStatus = MutableStateFlow(
126-
Timeline.PaginationStatus(isPaginating = false, hasMoreToLoad = mode !is Timeline.Mode.FocusedOnEvent)
126+
Timeline.PaginationStatus(isPaginating = false, hasMoreToLoad = mode is Timeline.Mode.FocusedOnEvent)
127127
)
128128

129129
init {
@@ -221,7 +221,6 @@ class RustTimeline(
221221
items = items,
222222
hasMoreToLoadBackward = backwardPaginationStatus.hasMoreToLoad,
223223
hasMoreToLoadForward = forwardPaginationStatus.hasMoreToLoad,
224-
timelineMode = mode,
225224
)
226225
}
227226
.let { items ->

libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/postprocessor/LoadingIndicatorsPostProcessor.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ class LoadingIndicatorsPostProcessor(private val systemClock: SystemClock) {
1818
items: List<MatrixTimelineItem>,
1919
hasMoreToLoadBackward: Boolean,
2020
hasMoreToLoadForward: Boolean,
21-
timelineMode: Timeline.Mode,
2221
): List<MatrixTimelineItem> {
23-
val shouldAddForwardLoadingIndicator = timelineMode is Timeline.Mode.Live && hasMoreToLoadForward && items.isNotEmpty()
22+
val shouldAddForwardLoadingIndicator = hasMoreToLoadForward && items.isNotEmpty()
2423
val currentTimestamp = systemClock.epochMillis()
2524
return buildList {
2625
if (hasMoreToLoadBackward) {

libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/timeline/postprocessor/LoadingIndicatorsPostProcessorTest.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class LoadingIndicatorsPostProcessorTest {
2424
items = listOf(messageEvent, messageEvent2),
2525
hasMoreToLoadBackward = true,
2626
hasMoreToLoadForward = false,
27-
timelineMode = Timeline.Mode.Live,
2827
)
2928
assertThat(result).containsExactly(
3029
MatrixTimelineItem.Virtual(
@@ -47,7 +46,6 @@ class LoadingIndicatorsPostProcessorTest {
4746
items = listOf(messageEvent, messageEvent2),
4847
hasMoreToLoadBackward = false,
4948
hasMoreToLoadForward = true,
50-
timelineMode = Timeline.Mode.Live,
5149
)
5250
assertThat(result).containsExactly(
5351
messageEvent,
@@ -70,7 +68,6 @@ class LoadingIndicatorsPostProcessorTest {
7068
items = listOf(messageEvent, messageEvent2),
7169
hasMoreToLoadBackward = true,
7270
hasMoreToLoadForward = true,
73-
timelineMode = Timeline.Mode.Live,
7471
)
7572
assertThat(result).containsExactly(
7673
MatrixTimelineItem.Virtual(
@@ -100,7 +97,6 @@ class LoadingIndicatorsPostProcessorTest {
10097
items = listOf(),
10198
hasMoreToLoadBackward = true,
10299
hasMoreToLoadForward = true,
103-
timelineMode = Timeline.Mode.Live,
104100
)
105101
assertThat(result).containsExactly(
106102
MatrixTimelineItem.Virtual(

0 commit comments

Comments
 (0)