mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-19 14:19:06 -04:00
feat(ffi): Add methods on RoomListItem so that full_room isn't necessary.
Calling `RoomListItem::full_room` creates its associated `Timeline`. ElementX calls `full_room` to get the `is_direct`, `avatar_url` and `canonical_alias` values for _all_ rooms in the room list. Instead of doing so, let's add those methods directly in `RoomListItem` so that the `Timeline` isn't created for _all_ rooms.
This commit is contained in:
@@ -339,6 +339,18 @@ impl RoomListItem {
|
||||
RUNTIME.block_on(async { self.inner.name().await })
|
||||
}
|
||||
|
||||
pub fn is_direct(&self) -> Option<bool> {
|
||||
RUNTIME.block_on(async { self.inner.inner_room().is_direct().await.ok() })
|
||||
}
|
||||
|
||||
pub fn avatar_url(&self) -> Option<String> {
|
||||
self.inner.inner_room().avatar_url().map(|uri| uri.to_string())
|
||||
}
|
||||
|
||||
pub fn canonical_alias(&self) -> Option<String> {
|
||||
self.inner.inner_room().canonical_alias().map(|alias| alias.to_string())
|
||||
}
|
||||
|
||||
fn full_room(&self) -> Arc<Room> {
|
||||
Arc::new(Room::with_timeline(
|
||||
self.inner.inner_room().clone(),
|
||||
|
||||
Reference in New Issue
Block a user