mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Send read receipts (#713)
* Send read receipts * Add changelog * Add tests. * Optimise how sending read receipts work in the timeline. * Move the check for send read receipts to the presenter Also improve the way we find the first visible `Event` if we have `Virtual` ones in the timeline.
This commit is contained in:
committed by
GitHub
parent
f4e17cf12d
commit
469b54f204
+2
@@ -32,4 +32,6 @@ interface MatrixTimeline {
|
||||
|
||||
suspend fun paginateBackwards(requestSize: Int, untilNumberOfItems: Int): Result<Unit>
|
||||
suspend fun fetchDetailsForEvent(eventId: EventId): Result<Unit>
|
||||
|
||||
suspend fun sendReadReceipt(eventId: EventId): Result<Unit>
|
||||
}
|
||||
|
||||
+6
@@ -107,4 +107,10 @@ class RustMatrixTimeline(
|
||||
Timber.v("Success back paginating for room ${matrixRoom.roomId}")
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun sendReadReceipt(eventId: EventId) = withContext(coroutineDispatchers.io) {
|
||||
runCatching {
|
||||
innerRoom.sendReadReceipt(eventId = eventId.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -32,6 +32,9 @@ class FakeMatrixTimeline(
|
||||
private val paginationState: MutableStateFlow<MatrixTimeline.PaginationState> = MutableStateFlow(initialPaginationState)
|
||||
private val timelineItems: MutableStateFlow<List<MatrixTimelineItem>> = MutableStateFlow(initialTimelineItems)
|
||||
|
||||
var sendReadReceiptCount = 0
|
||||
private set
|
||||
|
||||
fun updatePaginationState(update: (MatrixTimeline.PaginationState.() -> MatrixTimeline.PaginationState)) {
|
||||
paginationState.value = update(paginationState.value)
|
||||
}
|
||||
@@ -66,4 +69,9 @@ class FakeMatrixTimeline(
|
||||
override suspend fun fetchDetailsForEvent(eventId: EventId): Result<Unit> {
|
||||
return Result.success(Unit)
|
||||
}
|
||||
|
||||
override suspend fun sendReadReceipt(eventId: EventId): Result<Unit> {
|
||||
sendReadReceiptCount++
|
||||
return Result.success(Unit)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user