[TEST] Improve RR reliability
Change-Id: Icfc371829dcbe9103cf4cad40c5371e83db8e23c
This commit is contained in:
parent
837972a7be
commit
2ac877fe74
|
@ -29,7 +29,8 @@ import org.matrix.android.sdk.internal.database.model.RoomSummaryEntity
|
|||
internal fun isEventRead(realmConfiguration: RealmConfiguration,
|
||||
userId: String?,
|
||||
roomId: String?,
|
||||
eventId: String?): Boolean {
|
||||
eventId: String?,
|
||||
ignoreSenderId: Boolean = false): Boolean {
|
||||
if (userId.isNullOrBlank() || roomId.isNullOrBlank() || eventId.isNullOrBlank()) {
|
||||
return false
|
||||
}
|
||||
|
@ -42,9 +43,9 @@ internal fun isEventRead(realmConfiguration: RealmConfiguration,
|
|||
when {
|
||||
// The event doesn't exist locally, let's assume it hasn't been read
|
||||
eventToCheck == null -> false
|
||||
eventToCheck.root?.sender == userId -> true
|
||||
!ignoreSenderId && eventToCheck.root?.sender == userId -> true
|
||||
// If new event exists and the latest event is from ourselves we can infer the event is read
|
||||
latestEventIsFromSelf(realm, roomId, userId) -> true
|
||||
!ignoreSenderId && latestEventIsFromSelf(realm, roomId, userId) -> true
|
||||
eventToCheck.isBeforeLatestReadReceipt(realm, roomId, userId) -> true
|
||||
else -> false
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ internal class DefaultSetReadMarkersTask @Inject constructor(
|
|||
rmDimber.i { "Did not set to $fullyReadEventId" }
|
||||
}
|
||||
if (readReceiptEventId != null &&
|
||||
!isEventRead(monarchy.realmConfiguration, userId, params.roomId, readReceiptEventId)) {
|
||||
!isEventRead(monarchy.realmConfiguration, userId, params.roomId, readReceiptEventId, ignoreSenderId = true)) {
|
||||
if (LocalEcho.isLocalEchoId(readReceiptEventId)) {
|
||||
Timber.w("Can't set read receipt for local event $readReceiptEventId")
|
||||
} else {
|
||||
|
|
|
@ -690,9 +690,9 @@ class TimelineViewModel @AssistedInject constructor(
|
|||
session.coroutineScope.launch(NonCancellable) {
|
||||
rmDimber.i{"set RM and RR to $it"}
|
||||
tryOrNullAnon { room.readService().setReadMarker(it) }
|
||||
if (loadRoomAtFirstUnread()) {
|
||||
//if (loadRoomAtFirstUnread()) {
|
||||
tryOrNullAnon { room.readService().setReadReceipt(it) }
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
mostRecentDisplayedEvent = null
|
||||
|
|
Loading…
Reference in New Issue