diff --git a/Cargo.lock b/Cargo.lock index 7459b559..18306a9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "makepad-derive-live" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-live-id", "makepad-micro-proc-macro", @@ -1732,7 +1732,7 @@ dependencies = [ [[package]] name = "makepad-derive-wasm-bridge" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-micro-proc-macro", ] @@ -1740,7 +1740,7 @@ dependencies = [ [[package]] name = "makepad-derive-widget" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-live-id", "makepad-micro-proc-macro", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "makepad-draw" version = "0.6.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "ab_glyph_rasterizer", "fxhash", @@ -1766,17 +1766,17 @@ dependencies = [ [[package]] name = "makepad-futures" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" [[package]] name = "makepad-futures-legacy" version = "0.7.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" [[package]] name = "makepad-html" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-live-id", ] @@ -1784,7 +1784,7 @@ dependencies = [ [[package]] name = "makepad-http" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" [[package]] name = "makepad-jni-sys" @@ -1795,7 +1795,7 @@ checksum = "9775cbec5fa0647500c3e5de7c850280a88335d1d2d770e5aa2332b801ba7064" [[package]] name = "makepad-live-compiler" version = "0.5.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-derive-live", "makepad-live-tokenizer", @@ -1805,7 +1805,7 @@ dependencies = [ [[package]] name = "makepad-live-id" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-live-id-macros", ] @@ -1813,7 +1813,7 @@ dependencies = [ [[package]] name = "makepad-live-id-macros" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-micro-proc-macro", ] @@ -1821,7 +1821,7 @@ dependencies = [ [[package]] name = "makepad-live-tokenizer" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-live-id", "makepad-math", @@ -1831,7 +1831,7 @@ dependencies = [ [[package]] name = "makepad-markdown" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-live-id", ] @@ -1839,17 +1839,17 @@ dependencies = [ [[package]] name = "makepad-math" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" [[package]] name = "makepad-micro-proc-macro" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" [[package]] name = "makepad-micro-serde" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-live-id", "makepad-micro-serde-derive", @@ -1858,7 +1858,7 @@ dependencies = [ [[package]] name = "makepad-micro-serde-derive" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-micro-proc-macro", ] @@ -1866,12 +1866,12 @@ dependencies = [ [[package]] name = "makepad-objc-sys" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" [[package]] name = "makepad-platform" version = "0.6.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "hilog-sys", "makepad-android-state", @@ -1893,7 +1893,7 @@ dependencies = [ [[package]] name = "makepad-rustybuzz" version = "0.8.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -1908,7 +1908,7 @@ dependencies = [ [[package]] name = "makepad-shader-compiler" version = "0.5.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-live-compiler", ] @@ -1916,7 +1916,7 @@ dependencies = [ [[package]] name = "makepad-vector" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "resvg", "ttf-parser", @@ -1925,7 +1925,7 @@ dependencies = [ [[package]] name = "makepad-wasm-bridge" version = "0.4.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-derive-wasm-bridge", "makepad-live-id", @@ -1934,7 +1934,7 @@ dependencies = [ [[package]] name = "makepad-widgets" version = "0.6.0" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-derive-widget", "makepad-draw", @@ -1948,16 +1948,16 @@ dependencies = [ [[package]] name = "makepad-windows" version = "0.51.1" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ - "windows-core 0.51.1 (git+https://github.com/makepad/makepad?branch=rik)", + "windows-core 0.51.1 (git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content)", "windows-targets 0.48.5", ] [[package]] name = "makepad-zune-core" version = "0.2.14" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "bitflags 2.4.1", ] @@ -1965,7 +1965,7 @@ dependencies = [ [[package]] name = "makepad-zune-inflate" version = "0.2.54" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "simd-adler32", ] @@ -1973,7 +1973,7 @@ dependencies = [ [[package]] name = "makepad-zune-jpeg" version = "0.3.17" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-zune-core", ] @@ -1981,7 +1981,7 @@ dependencies = [ [[package]] name = "makepad-zune-png" version = "0.2.1" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "makepad-zune-core", "makepad-zune-inflate", @@ -3967,7 +3967,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "ttf-parser" version = "0.21.1" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" [[package]] name = "typenum" @@ -4373,7 +4373,7 @@ dependencies = [ [[package]] name = "windows-core" version = "0.51.1" -source = "git+https://github.com/makepad/makepad?branch=rik#98cc605647409a95c60405837ff1fbeb35100a4b" +source = "git+https://github.com/kevinaboos/makepad?branch=modal_sends_dismissed_action_to_inner_modal_content#dd319e6e74d9d70f8c90fef639109ae32caee863" dependencies = [ "windows-targets 0.48.5", ] diff --git a/Cargo.toml b/Cargo.toml index 48e47290..9deb4084 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/README.md b/README.md index 86d6c76d..a30550b3 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/resources/icons/checkmark.svg b/resources/icons/checkmark.svg new file mode 100644 index 00000000..1e8e409e --- /dev/null +++ b/resources/icons/checkmark.svg @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/src/app.rs b/src/app.rs index 77cd32ba..04fae7b9 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,7 +1,11 @@ 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::*; @@ -9,10 +13,11 @@ live_design! { 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") @@ -103,7 +108,19 @@ live_design! { pass: {clear_color: #2A} body = { - home_screen = {} + // A wrapper view for showing top-level app modals/dialogs/popups + { + width: Fill, height: Fill, + flow: Overlay, + + home_screen = {} + + verification_modal = { + content: { + verification_modal_inner = {} + } + } + } } // end of body } } @@ -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); } @@ -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); } } } @@ -222,3 +256,4 @@ pub struct SelectedRoom { pub id: OwnedRoomId, pub name: Option, } + diff --git a/src/home/room_preview.rs b/src/home/room_preview.rs index b8212b41..cb559e39 100644 --- a/src/home/room_preview.rs +++ b/src/home/room_preview.rs @@ -50,16 +50,16 @@ live_design! { latest_message = { padding: {top: 3.0} html_view = { html = { - font_size: 9.3, line_spacing: 1., - draw_normal: { text_style: { font_size: 9.3, line_spacing: 1. } }, - draw_italic: { text_style: { font_size: 9.3, line_spacing: 1. } }, - draw_bold: { text_style: { font_size: 9.3, line_spacing: 1. } }, - draw_bold_italic: { text_style: { font_size: 9.3, line_spacing: 1. } }, - draw_fixed: { text_style: { font_size: 9.3, line_spacing: 1. } }, + font_size: 9.3, + draw_normal: { text_style: { font_size: 9.3 } }, + draw_italic: { text_style: { font_size: 9.3 } }, + draw_bold: { text_style: { font_size: 9.3 } }, + draw_bold_italic: { text_style: { font_size: 9.3 } }, + draw_fixed: { text_style: { font_size: 9.3 } }, } } plaintext_view = { pt_label = { draw_text: { - text_style: { font_size: 9.5, line_spacing: 1. }, + text_style: { font_size: 9.5 }, } text: "[Loading latest message]" } } diff --git a/src/home/room_screen.rs b/src/home/room_screen.rs index a836df4f..0f8ad193 100644 --- a/src/home/room_screen.rs +++ b/src/home/room_screen.rs @@ -65,13 +65,13 @@ live_design! { TEXT_SUB = { font_size: (10), - font: {path: dep("crate://makepad-widgets/resources/GoNotoKurrent-Regular.ttf")} + font: {path: dep("crate://makepad-widgets/resources/IBMPlexSans-Text.ttf")} } TEXT_P = { font_size: (12), height_factor: 1.65, - font: {path: dep("crate://makepad-widgets/resources/GoNotoKurrent-Regular.ttf")} + font: {path: dep("crate://makepad-widgets/resources/IBMPlexSans-Text.ttf")} } COLOR_BG = #xfff8ee @@ -262,7 +262,7 @@ live_design! { draw_bg: { border_width: 0.0, border_color: #000, - radius: 2 + radius: 2.0 } reply_button = { @@ -560,20 +560,18 @@ live_design! { DayDivider = { width: Fill, height: Fit, - margin: 0.0, + margin: {top: 7.0, bottom: 7.0} flow: Right, - padding: 0.0, + padding: {left: 7.0, right: 7.0}, spacing: 0.0, align: {x: 0.5, y: 0.5} // center horizontally and vertically left_line = { - margin: {top: 10.0, bottom: 10.0} draw_bg: {color: (COLOR_DIVIDER_DARK)} } date =