Skip to content

Commit

Permalink
Merge branch 'main' into dm_view_#139
Browse files Browse the repository at this point in the history
  • Loading branch information
alanpoon committed Oct 7, 2024
2 parents 5a7412f + 79490dc commit 4a8706e
Show file tree
Hide file tree
Showing 19 changed files with 934 additions and 194 deletions.
64 changes: 32 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ version = "0.0.1-pre-alpha"
metadata.makepad-auto-version = "zqpv-Yj-K7WNVK2I8h5Okhho46Q="

[dependencies]
makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "rik" }
# makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "rik" }
makepad-widgets = { git = "https://github.com/kevinaboos/makepad", branch = "modal_sends_dismissed_action_to_inner_modal_content" }

## Including this crate automatically configures all `robius-*` crates to work with Makepad.
robius-use-makepad = "0.1.0"
robius-open = "0.1.0"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ These are generally sorted in order of priority. If you're interested in helping
- [x] Reply button, send reply: https://github.com/project-robius/robrix/issues/83
- [ ] Error display banners: no connection, failure to login, sync timeout: https://github.com/project-robius/robrix/issues/121
- [ ] Collapsible/expandable view of contiguous "small" events: https://github.com/project-robius/robrix/issues/118
- [ ] E2EE device verification, decrypt message content: https://github.com/project-robius/robrix/issues/116
- [x] E2EE device verification, decrypt message content: https://github.com/project-robius/robrix/issues/116

### Auxiliary/admin features: login, registration, settings
- [ ] Username/password login screen: https://github.com/project-robius/robrix/issues/113
Expand All @@ -124,7 +124,8 @@ These are generally sorted in order of priority. If you're interested in helping
- [x] Side panel showing detailed user profile info (click on their Avatar)
- [x] Ignore and unignore users (see known issues)
- [ ] User settings screen
- [ ] Persistence of app state to disk: https://github.com/project-robius/robrix/issues/112
- [x] Persistence of app session to disk: https://github.com/project-robius/robrix/issues/112
- [ ] Save/restore events in rooms to/from the event cache upon app shutdown/start: https://github.com/project-robius/robrix/issues/164


## Known problems/issues
Expand Down
9 changes: 9 additions & 0 deletions resources/icons/checkmark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 42 additions & 7 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
use makepad_widgets::*;
use matrix_sdk::ruma::OwnedRoomId;

use crate::home::rooms_list::RoomListAction;
use crate::{
home::rooms_list::RoomListAction,
verification::VerificationAction,
verification_modal::{VerificationModalAction, VerificationModalWidgetRefExt},
};

live_design! {
import makepad_widgets::base::*;
import makepad_widgets::theme_desktop_dark::*;
import makepad_draw::shader::std::*;

import crate::shared::styles::*;
import crate::shared::clickable_view::ClickableView
import crate::home::home_screen::HomeScreen
import crate::home::room_screen::RoomScreen
import crate::profile::my_profile_screen::MyProfileScreen
import crate::shared::clickable_view::ClickableView;
import crate::home::home_screen::HomeScreen;
import crate::home::room_screen::RoomScreen;
import crate::profile::my_profile_screen::MyProfileScreen;
import crate::verification_modal::VerificationModal;

ICON_CHAT = dep("crate://self/resources/icons/chat.svg")
ICON_CONTACTS = dep("crate://self/resources/icons/contacts.svg")
Expand Down Expand Up @@ -103,7 +108,19 @@ live_design! {
pass: {clear_color: #2A}

body = {
home_screen = <HomeScreen> {}
// A wrapper view for showing top-level app modals/dialogs/popups
<View> {
width: Fill, height: Fill,
flow: Overlay,

home_screen = <HomeScreen> {}

verification_modal = <Modal> {
content: {
verification_modal_inner = <VerificationModal> {}
}
}
}
} // end of body
}
}
Expand All @@ -128,6 +145,7 @@ impl LiveRegister for App {
// then other modules widgets.
makepad_widgets::live_design(cx);
crate::shared::live_design(cx);
crate::verification_modal::live_design(cx);
crate::home::live_design(cx);
crate::profile::live_design(cx);
}
Expand Down Expand Up @@ -168,7 +186,23 @@ impl MatchEvent for App {
);
self.ui.redraw(cx);
}
_ => (),
RoomListAction::None => { }
}

// `VerificationAction`s come from a background thread, so they are NOT widget actions.
// Therefore, we cannot use `as_widget_action().cast()` to match them.
match action.downcast_ref() {
Some(VerificationAction::RequestReceived(state)) => {
self.ui.verification_modal(id!(verification_modal_inner))
.initialize_with_data(state.clone());
self.ui.modal(id!(verification_modal)).open(cx);
}
// other verification actions are handled by the verification modal itself.
_ => { }
}

if let VerificationModalAction::Close = action.as_widget_action().cast() {
self.ui.modal(id!(verification_modal)).close(cx);
}
}
}
Expand Down Expand Up @@ -222,3 +256,4 @@ pub struct SelectedRoom {
pub id: OwnedRoomId,
pub name: Option<String>,
}

Loading

0 comments on commit 4a8706e

Please sign in to comment.