Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
657 changes: 372 additions & 285 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ metadata.makepad-auto-version = "zqpv-Yj-K7WNVK2I8h5Okhho46Q="
# makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "dev", features = ["serde"] }
# makepad-code-editor = { git = "https://github.com/makepad/makepad", branch = "dev" }

makepad-widgets = { git = "https://github.com/kevinaboos/makepad", branch = "view_optimize_dont_redraw_cached_textures", features = ["serde"] }
makepad-code-editor = { git = "https://github.com/kevinaboos/makepad", branch = "view_optimize_dont_redraw_cached_textures" }
makepad-widgets = { git = "https://github.com/kevinaboos/makepad", branch = "gl_sampling_fallback", features = ["serde"] }
makepad-code-editor = { git = "https://github.com/kevinaboos/makepad", branch = "gl_sampling_fallback" }


## Including this crate automatically configures all `robius-*` crates to work with Makepad.
Expand Down
8 changes: 5 additions & 3 deletions resources/icons/add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions resources/icons/upload.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/home/add_room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,11 +585,11 @@ impl Widget for AddRoomScreen {
FetchedRoomAvatar::Text(text) => {
room_avatar.show_text(cx, None, None, text);
}
FetchedRoomAvatar::Image(image_data) => {
FetchedRoomAvatar::Image(avatar_image) => {
let res = room_avatar.show_image(
cx,
None,
|cx, img_ref| utils::load_image(&img_ref, cx, image_data),
|cx, img_ref| utils::load_avatar_image(&img_ref, cx, avatar_image),
);
if res.is_err() {
room_avatar.show_text(
Expand Down
16 changes: 16 additions & 0 deletions src/home/home_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,11 @@ impl HomeScreen {
fn sync_effective_view_mode(&mut self, cx: &mut Cx, app_state: &mut AppState) {
let is_desktop = effective_is_desktop(cx);
let Some(was_desktop) = self.last_effective_is_desktop.replace(is_desktop) else {
// Mobile mode starts on the rooms list with no room open, so no
// room should be drawn as selected until one is actually clicked.
if !is_desktop {
cx.action(AppStateAction::FocusNone);
}
return;
};
if was_desktop == is_desktop {
Expand All @@ -661,6 +666,12 @@ impl HomeScreen {
}

self.clear_mobile_navigation_state(cx);

// Switching into mobile mode lands on the rooms list, so no room should
// be drawn as selected until one is actually clicked.
if !is_desktop {
cx.action(AppStateAction::FocusNone);
}
}

fn update_active_page_from_selection(
Expand Down Expand Up @@ -771,6 +782,8 @@ impl HomeScreen {
let stack_navigation_view = stack_navigation.view_by_id(cx, view_id);
Self::hide_displayed_stack_screen(cx, &stack_navigation_view);
}
// Also go back to the root stack view to ensure no old roomscreens persist.
stack_navigation.pop_to_root(cx);
}

fn hide_displayed_stack_screen(cx: &mut Cx, stack_navigation_view: &WidgetRef) {
Expand Down Expand Up @@ -827,6 +840,9 @@ impl HomeScreen {
return;
}
let Some(current_screen) = app_state.selected_room.take() else {
// If we didn't have a current screen, something's buggy,
// so the safest option is to clear the mobile stack and start over. nbd.
self.mobile_screen_history.clear();
return;
};
match self.mobile_screen_history.pop() {
Expand Down
8 changes: 4 additions & 4 deletions src/home/invite_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,11 @@ impl Widget for InviteScreen {
let (is_visible, invite_text) = if let Some(inviter) = info.inviter.as_ref() {
let inviter_avatar = inviter_view.avatar(cx, ids!(inviter_avatar));
let mut drew_avatar = false;
if let Some(avatar_bytes) = inviter.avatar.as_ref() {
if let Some(avatar_image) = inviter.avatar.as_ref() {
drew_avatar = inviter_avatar.show_image(
cx,
None, // don't make this avatar clickable.
|cx, img| utils::load_image(&img, cx, avatar_bytes),
|cx, img| utils::load_avatar_image(&img, cx, avatar_image),
).is_ok();
}
if !drew_avatar {
Expand Down Expand Up @@ -441,11 +441,11 @@ impl Widget for InviteScreen {
text,
);
}
FetchedRoomAvatar::Image(avatar_bytes) => {
FetchedRoomAvatar::Image(avatar_image) => {
let _ = room_avatar.show_image(
cx,
None, // don't make this avatar clickable.
|cx, img| utils::load_image(&img, cx, avatar_bytes),
|cx, img| utils::load_avatar_image(&img, cx, avatar_image),
);
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/home/light_themed_dock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,14 @@ script_mod! {
draw_bg +: {
// Light blue-ish color, de-saturated from COLOR_ACTIVE_PRIMARY
color: #E1EEFA
color_2: #E1EEFA
// A slightly darker shade of the tab color for hover visibility
color_hover: #C8DDEF
color_active: COLOR_ACTIVE_PRIMARY
color_2_hover: #C8DDEF
// Active (selected) tabs are a deeper blue, with a vertical gradient
// to a slightly lighter blue.
color_active: #0660FE
color_2_active: #398CFE
// Remove the border and rounded corners from the default Tab style
border_size: 0.0
border_radius: 3.0
Expand Down
12 changes: 7 additions & 5 deletions src/home/navigation_tab_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ script_mod! {
margin: 0,
icon_walk: Walk {
margin: 0,
width: 30,
height: 30
width: 27,
height: 27
}
draw_icon +: {
color: (COLOR_NAVIGATION_TAB_FG)
Expand Down Expand Up @@ -173,6 +173,7 @@ script_mod! {

mod.widgets.NavigationTabBar = #(NavigationTabBar::register_widget(vm)) {
Desktop := RoundedView {
new_batch: true,
flow: Down,
align: Align{x: 0.5}
padding: Inset{
Expand Down Expand Up @@ -206,6 +207,7 @@ script_mod! {
}

Mobile := RoundedView {
new_batch: true,
flow: Right
align: Align{x: 0.5, y: 0.5}
width: Fill,
Expand Down Expand Up @@ -417,11 +419,11 @@ impl Widget for ProfileIcon {
};

let mut drew_avatar = false;
if let Some(avatar_img_data) = own_profile.avatar_state.data() {
if let Some(avatar_image) = own_profile.avatar_state.image() {
drew_avatar = our_own_avatar.show_image(
cx,
None, // don't make this avatar clickable; we handle clicks on this ProfileIcon widget directly.
|cx, img| utils::load_image(&img, cx, avatar_img_data),
|cx, img| utils::load_avatar_image(&img, cx, avatar_image),
).is_ok();
}
if !drew_avatar {
Expand Down Expand Up @@ -673,7 +675,7 @@ pub fn get_own_profile(cx: &mut Cx) -> Option<UserProfile> {
if let Some(Some(avatar_uri)) = avatar_uri_to_fetch {
if let AvatarCacheEntry::Loaded(data) = avatar_cache::get_or_fetch_avatar(cx, &avatar_uri) {
if let Some(p) = own_profile.as_mut() {
p.avatar_state = AvatarState::Loaded(data);
p.avatar_state = AvatarState::Loaded((avatar_uri.clone(), data).into());
// Update the user profile cache with the new avatar data.
user_profile_cache::enqueue_user_profile_update(
UserProfileUpdate::UserProfileOnly(p.clone())
Expand Down
10 changes: 9 additions & 1 deletion src/home/room_read_receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,15 @@ pub struct AvatarRow {
}

impl Widget for AvatarRow {
fn handle_event(&mut self, cx: &mut Cx, event: &Event, _scope: &mut Scope) {
fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {
// The avatars aren't children of this widget (they're created from a template),
// so we have to manually forward events to them (mostly async image loads).
if let Event::Actions(_) = event {
for (avatar_ref, _) in self.buttons.iter() {
avatar_ref.handle_event(cx, event, scope);
}
}

let Some(read_receipts) = &self.read_receipts else {
return;
};
Expand Down
Loading
Loading