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
67dee7bb5f
commit
27cb88d88e
3 changed files with 4 additions and 11 deletions
|
|
@ -24,7 +24,7 @@ class RoomSummaryFactory(
|
|||
) {
|
||||
suspend fun create(room: Room): RoomSummary {
|
||||
val roomInfo = room.roomInfo().let(roomInfoMapper::map)
|
||||
val latestEvent = room.newLatestEvent().use { event ->
|
||||
val latestEvent = room.latestEvent().use { event ->
|
||||
when (event) {
|
||||
is RustLatestEventValue.None -> LatestEventValue.None
|
||||
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.test.A_ROOM_ID
|
||||
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.NoHandle
|
||||
import org.matrix.rustcomponents.sdk.Room
|
||||
|
|
@ -25,8 +24,7 @@ class FakeFfiRoom(
|
|||
private val getMembers: () -> RoomMembersIterator = { lambdaError() },
|
||||
private val getMembersNoSync: () -> RoomMembersIterator = { lambdaError() },
|
||||
private val leaveLambda: () -> Unit = { lambdaError() },
|
||||
private val latestEventLambda: () -> EventTimelineItem? = { lambdaError() },
|
||||
private val newLatestEventLambda: () -> LatestEventValue = { lambdaError() },
|
||||
private val latestEventLambda: () -> LatestEventValue = { lambdaError() },
|
||||
private val suggestedRoleForUserLambda: (String) -> RoomMemberRole = { lambdaError() },
|
||||
private val roomInfo: RoomInfo = aRustRoomInfo(id = roomId.value),
|
||||
) : Room(NoHandle) {
|
||||
|
|
@ -50,7 +48,7 @@ class FakeFfiRoom(
|
|||
return roomInfo
|
||||
}
|
||||
|
||||
override suspend fun latestEvent(): EventTimelineItem? {
|
||||
override suspend fun latestEvent(): LatestEventValue {
|
||||
return latestEventLambda()
|
||||
}
|
||||
|
||||
|
|
@ -58,10 +56,6 @@ class FakeFfiRoom(
|
|||
return suggestedRoleForUserLambda(userId)
|
||||
}
|
||||
|
||||
override suspend fun newLatestEvent(): LatestEventValue {
|
||||
return newLatestEventLambda()
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
// No-op
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,8 +174,7 @@ class RoomSummaryListProcessorTest {
|
|||
|
||||
private fun aRustRoom(roomId: RoomId = A_ROOM_ID) = FakeFfiRoom(
|
||||
roomId = roomId,
|
||||
latestEventLambda = { null },
|
||||
newLatestEventLambda = { LatestEventValue.None }
|
||||
latestEventLambda = { LatestEventValue.None }
|
||||
)
|
||||
|
||||
private fun TestScope.createProcessor() = RoomSummaryListProcessor(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue