diff --git a/Cargo.lock b/Cargo.lock index 7f6bc7cf..e13e571a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3123,6 +3123,17 @@ dependencies = [ "syn 2.0.38", ] +[[package]] +name = "pulldown-cmark" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" +dependencies = [ + "bitflags 1.3.2", + "memchr", + "unicase", +] + [[package]] name = "quote" version = "1.0.33" @@ -3437,6 +3448,7 @@ dependencies = [ "js_int", "js_option", "percent-encoding", + "pulldown-cmark", "regex", "ruma-common", "ruma-html", @@ -4442,6 +4454,15 @@ dependencies = [ "rand", ] +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.13" diff --git a/Cargo.toml b/Cargo.toml index 3b0c8f89..bb3f896a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ eyeball-im = "0.4.2" futures-util = "0.3" imbl = { version = "2.0.0", features = ["serde"] } # same as matrix-sdk-ui imghdr = "0.7.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", "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 = [ "e2e-encryption", "rustls-tls" ] } rangemap = "1.5.0" tokio = { version = "1.33.0", features = ["macros", "rt-multi-thread"] } diff --git a/README.md b/README.md index efbb20d3..4265e6d3 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,26 @@ # Robrix: a Rust Matrix client built atop [Robius](https://github.com/project-robius) +[![Robrix Matrix Chat](https://img.shields.io/matrix/robius-robrix%3Amatrix.org?server_fqdn=matrix.org&style=flat&logo=matrix&label=Robrix Matrix%20Chat&color=B7410E)](https://matrix.to/#/#robius-robrix:matrix.org) + Robrix is a Matrix chat client written in Rust to demonstrate the functionality of the Robius, a framework for multi-platform application development in Rust. > ⚠️ Robrix is just getting started and is not yet fully functional. > > It is currently based on the [Makepad WeChat example](https://github.com/project-robius/makepad_wechat); only the first "Rooms" tab is in use. + +| Host OS | Target Platform | Builds? | Runs? | +| ------- | --------------- | ------- | ----- | +| macOS | macOS | ✅ | ✅ | +| macOS | Android | ✅ | ✅ | +| macOS | iOS | ✅ | ✅ | +| Linux | Linux | ✅ | ✅ | +| Linux | Android | ✅ | ✅ | +| Windows | Windows | ✅ | ✅ | +| Windows | Android | ✅ | ✅ | + + + ## Building and Running First, [install Rust](https://www.rust-lang.org/tools/install). diff --git a/src/app.rs b/src/app.rs index 436e6b93..a6b97cc8 100644 --- a/src/app.rs +++ b/src/app.rs @@ -266,6 +266,7 @@ impl MatchEvent for App { log!("App::handle_startup(): starting matrix sdk loop"); crate::sliding_sync::start_matrix_tokio().unwrap(); } + /* fn handle_shutdown(&mut self, _cx: &mut Cx) { log!("App::handle_shutdown()"); } @@ -287,6 +288,8 @@ impl MatchEvent for App { fn handle_app_lost_focus(&mut self, _cx: &mut Cx) { log!("App::handle_app_lost_focus()"); } + */ + fn handle_actions(&mut self, cx: &mut Cx, actions: &Actions) { self.ui.radio_button_set(ids!( mobile_modes.tab1, diff --git a/src/home/room_screen.rs b/src/home/room_screen.rs index 87c91bbb..0d2fcf05 100644 --- a/src/home/room_screen.rs +++ b/src/home/room_screen.rs @@ -464,15 +464,28 @@ live_design! { message_input = { width: Fill, height: Fit, margin: 0 align: {y: 0.5} - empty_message: "Write a message..." + empty_message: "Write a message (in Markdown) ..." draw_bg: { - color: #fff + color: #F9F9F9 } draw_text: { - text_style:{}, - + color: (MESSAGE_TEXT_COLOR), + text_style: {}, + fn get_color(self) -> vec4 { - return #ccc + return mix( + mix( + mix( + #xFFFFFF55, + #xFFFFFF88, + self.hover + ), + self.color, + self.focus + ), + #BBBBBB, + self.is_empty + ) } } @@ -553,7 +566,7 @@ impl Widget for RoomScreen { log!("Sending message to room {}: {:?}", room_id, entered_text); submit_async_request(MatrixRequest::SendMessage { room_id, - message: RoomMessageEventContent::text_plain(entered_text), + message: RoomMessageEventContent::text_markdown(entered_text), // TODO: support replies to specific messages, attaching mentions, rich text (html), etc. }); }