diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 55a24ebe33..71c25351ae 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -177,7 +177,7 @@ test_detekt_test = { module = "io.gitlab.arturbosch.detekt:detekt-test", version # https://github.com/matrix-org/matrix-rust-components-kotlin/commits/main/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt # All new features should not be implemented in the pull request that upgrades the version, developers should # only fix API breaks and may add some TODOs. -matrix_sdk = "org.matrix.rustcomponents:sdk-android:25.12.10" +matrix_sdk = "org.matrix.rustcomponents:sdk-android:25.12.17" # Others coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/roomlist/RoomSummaryFactory.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/roomlist/RoomSummaryFactory.kt index 4872dc48e8..738c1f72ea 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/roomlist/RoomSummaryFactory.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/roomlist/RoomSummaryFactory.kt @@ -16,6 +16,7 @@ import io.element.android.libraries.matrix.impl.timeline.item.event.TimelineEven import io.element.android.libraries.matrix.impl.timeline.item.event.map import org.matrix.rustcomponents.sdk.Room import org.matrix.rustcomponents.sdk.use +import uniffi.matrix_sdk_ui.LatestEventValueLocalState import org.matrix.rustcomponents.sdk.LatestEventValue as RustLatestEventValue class RoomSummaryFactory( @@ -27,13 +28,24 @@ class RoomSummaryFactory( val latestEvent = room.latestEvent().use { event -> when (event) { is RustLatestEventValue.None -> LatestEventValue.None - is RustLatestEventValue.Local -> LatestEventValue.Local( - timestamp = event.timestamp.toLong(), - content = contentMapper.map(event.content), - isSending = event.isSending, - senderId = UserId(event.sender), - senderProfile = event.profile.map(), - ) + is RustLatestEventValue.Local -> when (event.state) { + LatestEventValueLocalState.IS_SENDING, + LatestEventValueLocalState.CANNOT_BE_SENT -> LatestEventValue.Local( + timestamp = event.timestamp.toLong(), + content = contentMapper.map(event.content), + isSending = event.state == LatestEventValueLocalState.IS_SENDING, + senderId = UserId(event.sender), + senderProfile = event.profile.map(), + ) + // This is the same as a remote event, we just haven't received the local -> remote update yet + LatestEventValueLocalState.HAS_BEEN_SENT -> LatestEventValue.Remote( + timestamp = event.timestamp.toLong(), + content = contentMapper.map(event.content), + senderId = UserId(event.sender), + senderProfile = event.profile.map(), + isOwn = true, + ) + } is RustLatestEventValue.Remote -> LatestEventValue.Remote( timestamp = event.timestamp.toLong(), content = contentMapper.map(event.content),