Skip to content

Commit

Permalink
pending room : use RoomPreview internally
Browse files Browse the repository at this point in the history
  • Loading branch information
ganfra committed Nov 15, 2024
1 parent c9b35ef commit 09aa34c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ package io.element.android.libraries.matrix.impl.room
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.SessionId
import io.element.android.libraries.matrix.api.room.PendingRoom
import org.matrix.rustcomponents.sdk.Room
import org.matrix.rustcomponents.sdk.RoomPreview

class RustPendingRoom(
override val sessionId: SessionId,
private val inner: Room,
override val roomId: RoomId,
private val inner: RoomPreview,
) : PendingRoom {
override val roomId = RoomId(inner.id())

override suspend fun leave(): Result<Unit> = runCatching {
inner.leave()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ class RustRoomFactory(
return@withContext null
}
val innerRoom = try {
// TODO use new method when available, for now it'll fail for knocked rooms
roomListItem.invitedRoom()
roomListItem.previewRoom(via = emptyList())
} catch (e: RoomListException) {
Timber.e(e, "Failed to get pending room for $roomId")
return@withContext null
}
RustPendingRoom(
sessionId = sessionId,
roomId = roomId,
inner = innerRoom,
)
}
Expand Down

0 comments on commit 09aa34c

Please sign in to comment.