Fix broken API changes: use Room.latestEvent, which will keep its name, but it'll be using the logic previously in Room.newLatestEvent
This commit is contained in:
parent
287d0a38d7
commit
289c0751d5
3 changed files with 4 additions and 11 deletions
|
|
@ -24,7 +24,7 @@ class RoomSummaryFactory(
|
||||||
) {
|
) {
|
||||||
suspend fun create(room: Room): RoomSummary {
|
suspend fun create(room: Room): RoomSummary {
|
||||||
val roomInfo = room.roomInfo().let(roomInfoMapper::map)
|
val roomInfo = room.roomInfo().let(roomInfoMapper::map)
|
||||||
val latestEvent = room.newLatestEvent().use { event ->
|
val latestEvent = room.latestEvent().use { event ->
|
||||||
when (event) {
|
when (event) {
|
||||||
is RustLatestEventValue.None -> LatestEventValue.None
|
is RustLatestEventValue.None -> LatestEventValue.None
|
||||||
is RustLatestEventValue.Local -> LatestEventValue.Local(
|
is RustLatestEventValue.Local -> LatestEventValue.Local(
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import io.element.android.libraries.matrix.api.core.RoomId
|
||||||
import io.element.android.libraries.matrix.impl.fixtures.factories.aRustRoomInfo
|
import io.element.android.libraries.matrix.impl.fixtures.factories.aRustRoomInfo
|
||||||
import io.element.android.libraries.matrix.test.A_ROOM_ID
|
import io.element.android.libraries.matrix.test.A_ROOM_ID
|
||||||
import io.element.android.tests.testutils.lambda.lambdaError
|
import io.element.android.tests.testutils.lambda.lambdaError
|
||||||
import org.matrix.rustcomponents.sdk.EventTimelineItem
|
|
||||||
import org.matrix.rustcomponents.sdk.LatestEventValue
|
import org.matrix.rustcomponents.sdk.LatestEventValue
|
||||||
import org.matrix.rustcomponents.sdk.NoHandle
|
import org.matrix.rustcomponents.sdk.NoHandle
|
||||||
import org.matrix.rustcomponents.sdk.Room
|
import org.matrix.rustcomponents.sdk.Room
|
||||||
|
|
@ -25,8 +24,7 @@ class FakeFfiRoom(
|
||||||
private val getMembers: () -> RoomMembersIterator = { lambdaError() },
|
private val getMembers: () -> RoomMembersIterator = { lambdaError() },
|
||||||
private val getMembersNoSync: () -> RoomMembersIterator = { lambdaError() },
|
private val getMembersNoSync: () -> RoomMembersIterator = { lambdaError() },
|
||||||
private val leaveLambda: () -> Unit = { lambdaError() },
|
private val leaveLambda: () -> Unit = { lambdaError() },
|
||||||
private val latestEventLambda: () -> EventTimelineItem? = { lambdaError() },
|
private val latestEventLambda: () -> LatestEventValue = { lambdaError() },
|
||||||
private val newLatestEventLambda: () -> LatestEventValue = { lambdaError() },
|
|
||||||
private val suggestedRoleForUserLambda: (String) -> RoomMemberRole = { lambdaError() },
|
private val suggestedRoleForUserLambda: (String) -> RoomMemberRole = { lambdaError() },
|
||||||
private val roomInfo: RoomInfo = aRustRoomInfo(id = roomId.value),
|
private val roomInfo: RoomInfo = aRustRoomInfo(id = roomId.value),
|
||||||
) : Room(NoHandle) {
|
) : Room(NoHandle) {
|
||||||
|
|
@ -50,7 +48,7 @@ class FakeFfiRoom(
|
||||||
return roomInfo
|
return roomInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun latestEvent(): EventTimelineItem? {
|
override suspend fun latestEvent(): LatestEventValue {
|
||||||
return latestEventLambda()
|
return latestEventLambda()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,10 +56,6 @@ class FakeFfiRoom(
|
||||||
return suggestedRoleForUserLambda(userId)
|
return suggestedRoleForUserLambda(userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun newLatestEvent(): LatestEventValue {
|
|
||||||
return newLatestEventLambda()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
// No-op
|
// No-op
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,7 @@ class RoomSummaryListProcessorTest {
|
||||||
|
|
||||||
private fun aRustRoom(roomId: RoomId = A_ROOM_ID) = FakeFfiRoom(
|
private fun aRustRoom(roomId: RoomId = A_ROOM_ID) = FakeFfiRoom(
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
latestEventLambda = { null },
|
latestEventLambda = { LatestEventValue.None }
|
||||||
newLatestEventLambda = { LatestEventValue.None }
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun TestScope.createProcessor() = RoomSummaryListProcessor(
|
private fun TestScope.createProcessor() = RoomSummaryListProcessor(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue