Skip to content

Commit

Permalink
Merge pull request #234 from kevinaboos/fix_tombstoned_rooms_sdk_upgrade
Browse files Browse the repository at this point in the history
Upgrade to newer SDK version that has removed `RoomList::entries()`
  • Loading branch information
kevinaboos authored Nov 7, 2024
2 parents a2438e8 + bff0003 commit 893f8ac
Show file tree
Hide file tree
Showing 8 changed files with 1,038 additions and 697 deletions.
1,408 changes: 828 additions & 580 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ htmlize = "1.0.5"
imbl = { version = "3.0.0", features = ["serde"] } # same as matrix-sdk-ui
imghdr = "0.7.0"
linkify = "0.10.0"
matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk", default-features = false, features = [ "experimental-sliding-sync", "e2e-encryption", "automatic-room-key-forwarding", "markdown", "sqlite", "rustls-tls", "bundled-sqlite" ] }
matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk", default-features = false, features = [ "experimental-sliding-sync", "e2e-encryption", "automatic-room-key-forwarding", "markdown", "sqlite", "rustls-tls", "bundled-sqlite" ] }
matrix-sdk-ui = { git = "https://github.com/matrix-org/matrix-rust-sdk", default-features = false, features = [ "rustls-tls" ] }
rand = "0.8.5"
rangemap = "1.5.0"
Expand Down
11 changes: 6 additions & 5 deletions src/home/room_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use matrix_sdk::{
FormattedBody, ImageMessageEventContent, LocationMessageEventContent, MessageFormat, MessageType, NoticeMessageEventContent, RoomMessageEventContent, TextMessageEventContent
},
MediaSource,
}, matrix_uri::MatrixId, uint, EventId, MatrixToUri, MatrixUri, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId, RoomId, UserId
}, matrix_uri::MatrixId, uint, EventId, MatrixToUri, MatrixUri, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId, UserId
},
OwnedServerName,
};
Expand Down Expand Up @@ -1220,6 +1220,7 @@ impl Widget for RoomScreen {
}

if !link_was_handled {
log!("Opening URL \"{}\"", url);
if let Err(e) = robius_open::Uri::new(&url).open() {
error!("Failed to open URL {:?}. Error: {:?}", url, e);
}
Expand Down Expand Up @@ -2275,7 +2276,7 @@ fn populate_message_view(
cx: &mut Cx2d,
list: &mut PortalList,
item_id: usize,
room_id: &RoomId,
room_id: &OwnedRoomId,
event_tl_item: &EventTimelineItem,
message: &timeline::Message,
prev_event: Option<&Arc<TimelineItem>>,
Expand Down Expand Up @@ -2596,7 +2597,7 @@ fn populate_location_message_content(
fn draw_replied_to_message(
cx: &mut Cx2d,
replied_to_message_view: &ViewRef,
room_id: &RoomId,
room_id: &OwnedRoomId,
message: &timeline::Message,
message_event_id: Option<&EventId>,
) -> (bool, Option<OwnedEventId>) {
Expand Down Expand Up @@ -2873,7 +2874,7 @@ fn populate_small_state_event(
cx: &mut Cx,
list: &mut PortalList,
item_id: usize,
room_id: &RoomId,
room_id: &OwnedRoomId,
event_tl_item: &EventTimelineItem,
event_content: &impl SmallStateEventContent,
item_drawn_status: ItemDrawnStatus,
Expand Down Expand Up @@ -2970,7 +2971,7 @@ fn set_timestamp(item: &WidgetRef, live_id_path: &[LiveId], timestamp: MilliSeco
fn set_avatar_and_get_username(
cx: &mut Cx,
avatar: AvatarRef,
room_id: &RoomId,
room_id: &OwnedRoomId,
sender_user_id: &UserId,
sender_profile: &TimelineDetails<Profile>,
event_id: Option<&EventId>,
Expand Down
8 changes: 8 additions & 0 deletions src/home/rooms_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ impl Widget for RoomsList {
.unwrap_or_else(|| {
error!("Error: couldn't find room {room_id} to remove room");
});

// TODO: send an action to the RoomScreen to hide this room
// if it is currently being displayed,
// and also ensure that the room's TimelineUIState is preserved
// and saved (if the room has not been left),
// and also that it's MediaCache instance is put into a special state
// where its internal update sender gets replaced upon next usage
// (that is, upon the next time that same room is opened by the user).
}
RoomsListUpdate::ClearRooms => {
self.all_rooms.clear();
Expand Down
16 changes: 2 additions & 14 deletions src/home/welcome_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,6 @@ live_design! {
}
}

subtitle = <Label> {
text: "
Our Matrix client is under heavy development.\nFor now, you can access the rooms you've joined in other clients.\nBut don't worry, we're working on expanding its features.\n
Tip: to load older messages, click on a selected room (repeatedly).
",
draw_text: {
color: (WELCOME_TEXT_COLOR),
text_style: {
font_size: 14.
}
}
}

// Using the HTML widget to taking advantage of embedding a link within text with proper vertical alignment
<RobrixHtml> {
padding: {top: 12, left: 0.}
Expand All @@ -59,7 +46,8 @@ live_design! {
// }
}
body:"
Look out for the latest announcements in our Matrix channel: <a href=\"https://matrix.to/#/#robius-robrix:matrix.org\">[m] Robrix</a><br/>
Our Matrix client is under heavy development.\nFor now, you can access the rooms you've joined in other clients.\nBut don't worry, we're working on expanding its features.\n
Look for the latest announcements in our Matrix channel: <b>#robrix:matrix.org</b><br/>
"
}
}
Expand Down
1 change: 1 addition & 0 deletions src/login/login_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ impl MatchEvent for LoginScreen {
let homeserver_input = self.view.text_input(id!(homeserver_input));

if signup_button.clicked(actions) {
log!("Opening URL \"{}\"", MATRIX_SIGN_UP_URL);
let _ = robius_open::Uri::new(MATRIX_SIGN_UP_URL).open();
}

Expand Down
Loading

0 comments on commit 893f8ac

Please sign in to comment.