From b608e633fc1ebd146f4df4208285c5c2881bb6ce Mon Sep 17 00:00:00 2001 From: Kevin Boos Date: Mon, 18 May 2026 18:07:23 -0700 Subject: [PATCH] Add "About" section to settings page. Other misc fixes Closes #862. Closes #855 via a makepad update. Fixes loads of other IME/scaling issues via makepad. --- Cargo.lock | 179 +++++++++-------- Cargo.toml | 9 +- build.rs | 95 +++++++++ src/app.rs | 13 +- src/home/add_room.rs | 1 - src/persistence/matrix_state.rs | 2 +- src/settings/about_settings.rs | 327 +++++++++++++++++++++++++++++++ src/settings/account_settings.rs | 6 +- src/settings/app_settings.rs | 2 +- src/settings/mod.rs | 2 + src/settings/settings_screen.rs | 16 +- src/tsp/tsp_settings_screen.rs | 2 + src/tsp_dummy/mod.rs | 2 +- 13 files changed, 556 insertions(+), 100 deletions(-) create mode 100644 src/settings/about_settings.rs diff --git a/Cargo.lock b/Cargo.lock index a2c548100..3e09e4243 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,7 +5,7 @@ version = 4 [[package]] name = "ab_glyph_rasterizer" version = "0.1.8" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "accessory" @@ -610,7 +610,7 @@ dependencies = [ [[package]] name = "bitflags" version = "2.10.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "bitmaps" @@ -728,7 +728,7 @@ checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "bytemuck" version = "1.25.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "byteorder" @@ -739,7 +739,7 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "byteorder" version = "1.5.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "bytes" @@ -1954,9 +1954,9 @@ dependencies = [ [[package]] name = "fxhash" version = "0.2.1" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ - "byteorder 1.5.0 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "byteorder 1.5.0 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", ] [[package]] @@ -2803,7 +2803,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.53.4", + "windows-targets 0.48.5", ] [[package]] @@ -2950,7 +2950,7 @@ dependencies = [ [[package]] name = "makepad-apple-sys" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-objc-sys", ] @@ -2958,12 +2958,12 @@ dependencies = [ [[package]] name = "makepad-byteorder-lite" version = "0.1.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "makepad-code-editor" version = "2.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-widgets", ] @@ -2971,7 +2971,7 @@ dependencies = [ [[package]] name = "makepad-derive-wasm-bridge" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-micro-proc-macro", ] @@ -2979,7 +2979,7 @@ dependencies = [ [[package]] name = "makepad-derive-widget" version = "2.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-live-id", "makepad-micro-proc-macro", @@ -2988,10 +2988,11 @@ dependencies = [ [[package]] name = "makepad-draw" version = "2.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "ab_glyph_rasterizer", "fxhash", + "makepad-gif", "makepad-live-id", "makepad-math", "makepad-platform", @@ -3002,15 +3003,15 @@ dependencies = [ "rustybuzz", "sdfer", "serde", - "unicode-bidi 0.3.18 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "unicode-bidi 0.3.18 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", "unicode-linebreak", - "unicode-segmentation 1.12.0 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "unicode-segmentation 1.12.0 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", ] [[package]] name = "makepad-error-log" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-micro-serde", ] @@ -3018,22 +3019,30 @@ dependencies = [ [[package]] name = "makepad-filesystem-watcher" version = "0.1.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "makepad-futures" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "makepad-futures-legacy" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" + +[[package]] +name = "makepad-gif" +version = "0.1.0" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" +dependencies = [ + "weezl", +] [[package]] name = "makepad-html" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-live-id", ] @@ -3047,7 +3056,7 @@ checksum = "9775cbec5fa0647500c3e5de7c850280a88335d1d2d770e5aa2332b801ba7064" [[package]] name = "makepad-latex-math" version = "0.1.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "ttf-parser", ] @@ -3055,7 +3064,7 @@ dependencies = [ [[package]] name = "makepad-live-id" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-live-id-macros", "serde", @@ -3064,7 +3073,7 @@ dependencies = [ [[package]] name = "makepad-live-id-macros" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-micro-proc-macro", ] @@ -3072,7 +3081,7 @@ dependencies = [ [[package]] name = "makepad-live-reload-core" version = "0.1.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-filesystem-watcher", ] @@ -3080,7 +3089,7 @@ dependencies = [ [[package]] name = "makepad-math" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-micro-serde", ] @@ -3088,12 +3097,12 @@ dependencies = [ [[package]] name = "makepad-micro-proc-macro" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "makepad-micro-serde" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-live-id", "makepad-micro-serde-derive", @@ -3102,7 +3111,7 @@ dependencies = [ [[package]] name = "makepad-micro-serde-derive" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-micro-proc-macro", ] @@ -3110,7 +3119,7 @@ dependencies = [ [[package]] name = "makepad-network" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-apple-sys", "makepad-error-log", @@ -3124,15 +3133,15 @@ dependencies = [ [[package]] name = "makepad-objc-sys" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "makepad-platform" version = "2.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "ash", - "bitflags 2.10.0 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "bitflags 2.10.0 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", "ctrlc", "hilog-sys", "makepad-android-state", @@ -3154,7 +3163,7 @@ dependencies = [ "napi-derive-ohos", "napi-ohos", "ohos-sys", - "smallvec 1.15.1 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "smallvec 1.15.1 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", "wayland-client", "wayland-egl", "wayland-protocols", @@ -3166,12 +3175,12 @@ dependencies = [ [[package]] name = "makepad-regex" version = "0.1.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "makepad-script" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-error-log", "makepad-html", @@ -3179,13 +3188,13 @@ dependencies = [ "makepad-math", "makepad-regex", "makepad-script-derive", - "smallvec 1.15.1 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "smallvec 1.15.1 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", ] [[package]] name = "makepad-script-derive" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-micro-proc-macro", ] @@ -3193,7 +3202,7 @@ dependencies = [ [[package]] name = "makepad-script-std" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-network", "makepad-script", @@ -3202,14 +3211,14 @@ dependencies = [ [[package]] name = "makepad-shared-bytes" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "makepad-studio-protocol" version = "0.1.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ - "bitflags 2.10.0 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "bitflags 2.10.0 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", "makepad-error-log", "makepad-live-id", "makepad-micro-serde", @@ -3219,7 +3228,7 @@ dependencies = [ [[package]] name = "makepad-svg" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-html", "makepad-live-id", @@ -3228,7 +3237,7 @@ dependencies = [ [[package]] name = "makepad-tsdf" version = "0.1.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-math", "makepad-micro-serde", @@ -3237,7 +3246,7 @@ dependencies = [ [[package]] name = "makepad-wasm-bridge" version = "1.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-derive-wasm-bridge", "makepad-live-id", @@ -3246,7 +3255,7 @@ dependencies = [ [[package]] name = "makepad-webp" version = "0.2.4" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-byteorder-lite", ] @@ -3254,7 +3263,7 @@ dependencies = [ [[package]] name = "makepad-widgets" version = "2.0.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-derive-widget", "makepad-draw", @@ -3263,18 +3272,18 @@ dependencies = [ "pulldown-cmark 0.12.2", "serde", "ttf-parser", - "unicode-segmentation 1.12.0 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "unicode-segmentation 1.12.0 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", ] [[package]] name = "makepad-zune-core" version = "0.5.1" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "makepad-zune-inflate" version = "0.2.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "simd-adler32", ] @@ -3282,7 +3291,7 @@ dependencies = [ [[package]] name = "makepad-zune-jpeg" version = "0.5.12" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-zune-core", ] @@ -3290,7 +3299,7 @@ dependencies = [ [[package]] name = "makepad-zune-png" version = "0.5.1" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "makepad-zune-core", "makepad-zune-inflate", @@ -3677,7 +3686,7 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "memchr" version = "2.7.6" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "mime" @@ -4430,10 +4439,10 @@ dependencies = [ [[package]] name = "pulldown-cmark" version = "0.12.2" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ - "bitflags 2.10.0 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", - "memchr 2.7.6 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "bitflags 2.10.0 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", + "memchr 2.7.6 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", "unicase 2.9.0", ] @@ -4959,6 +4968,7 @@ dependencies = [ "serde_json", "thiserror 2.0.17", "tokio", + "toml", "tracing-subscriber", "tsp_sdk", "unicode-segmentation 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5257,12 +5267,12 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "rustybuzz" version = "0.18.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ - "bitflags 2.10.0 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "bitflags 2.10.0 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", "bytemuck", "makepad-error-log", - "smallvec 1.15.1 (git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override)", + "smallvec 1.15.1 (git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion)", "ttf-parser", "unicode-bidi-mirroring", "unicode-ccc", @@ -5357,7 +5367,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sdfer" version = "0.2.1" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "sealed" @@ -5656,7 +5666,7 @@ dependencies = [ [[package]] name = "simd-adler32" version = "0.3.8" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "siphasher" @@ -5682,7 +5692,7 @@ dependencies = [ [[package]] name = "smallvec" version = "1.15.1" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "socket2" @@ -6463,7 +6473,7 @@ dependencies = [ [[package]] name = "ttf-parser" version = "0.24.1" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "tungstenite" @@ -6515,7 +6525,7 @@ checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicase" version = "2.9.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "unicode-bidi" @@ -6526,17 +6536,17 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-bidi" version = "0.3.18" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "unicode-bidi-mirroring" version = "0.3.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "unicode-ccc" version = "0.3.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "unicode-ident" @@ -6547,7 +6557,7 @@ checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" [[package]] name = "unicode-linebreak" version = "0.1.5" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "unicode-normalization" @@ -6567,12 +6577,12 @@ checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" [[package]] name = "unicode-properties" version = "0.1.4" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "unicode-script" version = "0.5.8" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "unicode-segmentation" @@ -6583,7 +6593,7 @@ checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-segmentation" version = "1.12.0" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "unicode-width" @@ -6915,7 +6925,7 @@ dependencies = [ [[package]] name = "wayland-backend" version = "0.3.12" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "downcast-rs", "libc", @@ -6927,7 +6937,7 @@ dependencies = [ [[package]] name = "wayland-client" version = "0.31.12" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "bitflags 2.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc", @@ -6937,7 +6947,7 @@ dependencies = [ [[package]] name = "wayland-egl" version = "0.32.9" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "wayland-backend", "wayland-sys", @@ -6946,7 +6956,7 @@ dependencies = [ [[package]] name = "wayland-protocols" version = "0.32.10" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "bitflags 2.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-backend", @@ -6956,7 +6966,7 @@ dependencies = [ [[package]] name = "wayland-sys" version = "0.31.8" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "log", "pkg-config", @@ -7013,6 +7023,11 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "weezl" +version = "0.1.12" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" + [[package]] name = "whoami" version = "1.6.1" @@ -7064,7 +7079,7 @@ dependencies = [ [[package]] name = "windows" version = "0.62.2" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "windows-collections 0.3.2", "windows-core 0.62.2", @@ -7083,7 +7098,7 @@ dependencies = [ [[package]] name = "windows-collections" version = "0.3.2" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "windows-core 0.62.2", ] @@ -7116,7 +7131,7 @@ dependencies = [ [[package]] name = "windows-core" version = "0.62.2" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "windows-link 0.2.1", "windows-result 0.4.1", @@ -7137,7 +7152,7 @@ dependencies = [ [[package]] name = "windows-future" version = "0.3.2" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "windows-core 0.62.2", ] @@ -7201,7 +7216,7 @@ checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" [[package]] name = "windows-link" version = "0.2.1" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" [[package]] name = "windows-numerics" @@ -7245,7 +7260,7 @@ dependencies = [ [[package]] name = "windows-result" version = "0.4.1" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "windows-link 0.2.1", ] @@ -7262,7 +7277,7 @@ dependencies = [ [[package]] name = "windows-strings" version = "0.5.1" -source = "git+https://github.com/kevinaboos/makepad?branch=runtime_dpi_override#da62750524402e4fadc25a8c15b14f09e4c95cce" +source = "git+https://github.com/kevinaboos/makepad?branch=dedup_ios_ime_conversion#f50b89db140cf75d7aec1da75d337689419f757b" dependencies = [ "windows-link 0.2.1", ] diff --git a/Cargo.toml b/Cargo.toml index 3cd0f9893..5ccf1998f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 = "runtime_dpi_override", features = ["serde"] } -makepad-code-editor = { git = "https://github.com/kevinaboos/makepad", branch = "runtime_dpi_override" } +makepad-widgets = { git = "https://github.com/kevinaboos/makepad", branch = "dedup_ios_ime_conversion", features = ["serde"] } +makepad-code-editor = { git = "https://github.com/kevinaboos/makepad", branch = "dedup_ios_ime_conversion" } ## Including this crate automatically configures all `robius-*` crates to work with Makepad. @@ -75,7 +75,7 @@ serde = "1.0" serde_json = "1.0" thiserror = "2.0.16" tokio = { version = "1.43.1", features = ["macros", "rt-multi-thread"] } -tracing-subscriber = "0.3.17" +tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } unicode-segmentation = "1.11.0" url = "2.5.0" @@ -166,6 +166,9 @@ askar-storage = { git = "https://github.com/openwallet-foundation/askar.git" } [patch."https://github.com/ruma/ruma"] ruma = { git = "https://github.com/project-robius/ruma.git", branch = "tsp" } +[build-dependencies] +toml = "1" + ## On Windows, use the `winresource` crate to embed the app's icon and metadata into the executable. [target.'cfg(windows)'.build-dependencies] winresource = "0.1" diff --git a/build.rs b/build.rs index 218879a52..e5dbeb6ab 100644 --- a/build.rs +++ b/build.rs @@ -11,4 +11,99 @@ fn main() { res.compile().expect("Failed to compile Windows resources"); } } + + // Get version info about Robrix, the matrix SDK, and testflight. + println!("cargo:rerun-if-changed=Cargo.lock"); + let (sdk_version, sdk_git_rev, sdk_url) = read_matrix_sdk_info(); + println!("cargo:rustc-env=MATRIX_SDK_VERSION={sdk_version}"); + println!("cargo:rustc-env=MATRIX_SDK_GIT_REV={sdk_git_rev}"); + println!("cargo:rustc-env=MATRIX_SDK_URL={sdk_url}"); + + let (robrix_git_rev, robrix_url) = read_robrix_git_info(); + println!("cargo:rustc-env=ROBRIX_GIT_COMMIT_HASH={robrix_git_rev}"); + println!("cargo:rustc-env=ROBRIX_GIT_COMMIT_URL={robrix_url}"); + + println!("cargo:rerun-if-env-changed=TESTFLIGHT_BUILD_NUMBER"); + let testflight_build = std::env::var("TESTFLIGHT_BUILD_NUMBER").unwrap_or_default(); + println!("cargo:rustc-env=TESTFLIGHT_BUILD_NUMBER={testflight_build}"); +} + +/// Returns Robrix's own current git commit info as a commit hash and a permalink. +fn read_robrix_git_info() -> (String, String) { + // Tell cargo to re-run when the git-tracked HEAD changes. + println!("cargo:rerun-if-changed=.git/HEAD"); + if let Ok(head) = std::fs::read_to_string(".git/HEAD") { + if let Some(branch_ref) = head.trim().strip_prefix("ref: ") { + println!("cargo:rerun-if-changed=.git/{branch_ref}"); + } + } + + let Ok(output) = std::process::Command::new("git") + .args(["rev-parse", "HEAD"]) + .output() + else { + return (String::new(), String::new()); + }; + if !output.status.success() { + return (String::new(), String::new()); + } + let full_sha = String::from_utf8_lossy(&output.stdout).trim().to_string(); + if full_sha.len() < 8 { + return (String::new(), String::new()); + } + let short_rev: String = full_sha.chars().take(8).collect(); + let url = format!("https://github.com/project-robius/robrix/tree/{full_sha}"); + (short_rev, url) +} + +/// Parses Cargo.lock to find the resolved version of `matrix-sdk`. +/// +/// Returns `(version, short_git_rev, url)`. +fn read_matrix_sdk_info() -> (String, String, String) { + let Ok(lockfile_text) = std::fs::read_to_string("Cargo.lock") else { + return (String::new(), String::new(), String::new()); + }; + let Ok(lockfile) = toml::from_str::(&lockfile_text) else { + return (String::new(), String::new(), String::new()); + }; + + let Some(pkg) = lockfile + .get("package") + .and_then(|p| p.as_array()) + .and_then(|pkgs| { + pkgs.iter().find(|p| { + p.get("name").and_then(|n| n.as_str()) == Some("matrix-sdk") + }) + }) + else { + return (String::new(), String::new(), String::new()); + }; + + let version = pkg + .get("version") + .and_then(|v| v.as_str()) + .unwrap_or("") + .to_string(); + let source = pkg.get("source").and_then(|s| s.as_str()).unwrap_or(""); + + // Git sources look like `git+?#`. + // The repo URL is the prefix before `?` or `#`; the commit is after `#`. + let (git_rev, url) = if let Some(rest) = source.strip_prefix("git+") { + let (left, full_commit) = rest.rsplit_once('#').unwrap_or((rest, "")); + let base = left.split_once('?').map_or(left, |(b, _)| b); + let short_rev: String = full_commit.chars().take(8).collect(); + let url = if full_commit.is_empty() { + base.to_string() + } else { + format!("{base}/tree/{full_commit}") + }; + (short_rev, url) + } else if !version.is_empty() { + // Registry/path/other sources: fall back to the crates.io URL. + (String::new(), format!("https://crates.io/crates/matrix-sdk/{version}")) + } else { + (String::new(), String::new()) + }; + + (version, git_rev, url) } diff --git a/src/app.rs b/src/app.rs index 199e1f866..4fe170252 100644 --- a/src/app.rs +++ b/src/app.rs @@ -194,8 +194,17 @@ impl ScriptHook for App { impl MatchEvent for App { fn handle_startup(&mut self, cx: &mut Cx) { - // only init logging/tracing once - let _ = tracing_subscriber::fmt::try_init(); + // only init logging/tracing once. + // `matrix_sdk::latest_events` emits a noisy per-room "Timer ... finished" + // INFO line on every load; silence it by default. RUST_LOG still wins + // when set, so you can re-enable it with `RUST_LOG=matrix_sdk::latest_events=info`. + let filter = tracing_subscriber::EnvFilter::try_from_default_env() + .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new( + "info,matrix_sdk::latest_events=warn", + )); + let _ = tracing_subscriber::fmt() + .with_env_filter(filter) + .try_init(); // On iOS (and potentially other devices), there is a very low limit // (albeit a soft limit) on max file descriptors, as little as 256. diff --git a/src/home/add_room.rs b/src/home/add_room.rs index c8da9e23d..6b2331144 100644 --- a/src/home/add_room.rs +++ b/src/home/add_room.rs @@ -247,7 +247,6 @@ script_mod! { width: Fill height: 20 } - } } diff --git a/src/persistence/matrix_state.rs b/src/persistence/matrix_state.rs index 096d35670..53bca52dc 100644 --- a/src/persistence/matrix_state.rs +++ b/src/persistence/matrix_state.rs @@ -211,7 +211,7 @@ pub async fn cleanup_orphan_db_dirs() { } if active.contains(&path) { kept += 1; - log!("cleanup_orphan_db_dirs: preserving referenced db dir: {}", path.display()); + // log!("cleanup_orphan_db_dirs: preserving referenced db dir: {}", path.display()); continue; } let size = dir_size_bytes(&path).await.unwrap_or(0); diff --git a/src/settings/about_settings.rs b/src/settings/about_settings.rs new file mode 100644 index 000000000..a4b8d79e0 --- /dev/null +++ b/src/settings/about_settings.rs @@ -0,0 +1,327 @@ +//! An "About Robrix" section within the SettingsScreen. +//! +//! Shows the app version and a set of external links (e.g., privacy policy). + +use makepad_widgets::*; + +use crate::shared::popup_list::{enqueue_popup_notification, PopupKind}; + +const PRIVACY_POLICY_URL: &str = "https://robrix.app/privacy/"; +const HOMEPAGE_URL: &str = "https://robrix.app"; +const SOURCE_URL: &str = "https://github.com/project-robius/robrix"; +const ISSUES_URL: &str = "https://github.com/project-robius/robrix/issues"; + +const ROBRIX_VERSION: &str = env!("CARGO_PKG_VERSION"); +const ROBRIX_GIT_COMMIT_HASH: &str = env!("ROBRIX_GIT_COMMIT_HASH"); +const ROBRIX_GIT_COMMIT_URL: &str = env!("ROBRIX_GIT_COMMIT_URL"); +const MATRIX_SDK_VERSION: &str = env!("MATRIX_SDK_VERSION"); +const MATRIX_SDK_GIT_REV: &str = env!("MATRIX_SDK_GIT_REV"); +const TESTFLIGHT_BUILD_NUMBER: &str = env!("TESTFLIGHT_BUILD_NUMBER"); +const MATRIX_SDK_URL: &str = env!("MATRIX_SDK_URL"); + +const ROBRIX_PREFIX: &str = "Robrix: "; +const TESTFLIGHT_PREFIX: &str = "TestFlight build: "; +const SDK_PREFIX: &str = "Matrix Rust SDK: "; + + +script_mod! { + use mod.prelude.widgets.* + use mod.widgets.* + + mod.widgets.SmallCopyButton = RobrixNeutralIconButton { + enable_long_press: true, + margin: 0, + padding: 5, + spacing: 0, + draw_icon.svg: (ICON_COPY) + icon_walk: Walk{width: 13, height: 13, margin: 0} + } + + mod.widgets.VersionHtml = mod.widgets.MessageHtml { + width: Fill, height: Fit + font_size: 11.5 + margin: Inset {top: 4} + body: "" + } + + // The About / Help section: version info and external links. + mod.widgets.AboutSettings = #(AboutSettings::register_widget(vm)) { + width: Fill, height: Fit + flow: Down + + TitleLabel { + text: "About Robrix" + } + + SubsectionLabel { + text: "Version Info" + } + + robrix_version_row := View { + width: Fill, height: Fit + flow: Right, + spacing: 10 + margin: Inset{top: 3, bottom: 3, left: 10} + + copy_robrix_version_button := mod.widgets.SmallCopyButton {} + robrix_version_html := mod.widgets.VersionHtml {} + } + + testflight_row := View { + visible: false, + width: Fill, height: Fit + flow: Right, + spacing: 10 + margin: Inset{top: 3, bottom: 3, left: 10} + + copy_testflight_button := mod.widgets.SmallCopyButton {} + testflight_html := mod.widgets.VersionHtml {} + } + + sdk_version_row := View { + width: Fill, height: Fit + flow: Right, + spacing: 10 + margin: Inset{top: 3, bottom: 3, left: 10} + + copy_sdk_version_button := mod.widgets.SmallCopyButton {} + sdk_version_html := mod.widgets.VersionHtml {} + } + + + SubsectionLabel { + text: "Privacy & Legal" + } + + privacy_policy_button := RobrixIconButton { + height: mod.widgets.SETTINGS_BUTTON_HEIGHT, + padding: Inset{left: 12, right: 15} + margin: Inset{left: 5, top: 5, bottom: 5} + draw_icon.svg: (ICON_EXTERNAL_LINK) + icon_walk: Walk{width: 16, height: 16} + text: "View Privacy Policy" + } + + + SubsectionLabel { + text: "Project & Support" + } + + View { + width: Fill, height: Fit + flow: Flow.Right{wrap: true}, + align: Align{y: 0.5}, + spacing: 10, + wrap_spacing: 2 + + homepage_button := RobrixIconButton { + height: mod.widgets.SETTINGS_BUTTON_HEIGHT, + padding: Inset{left: 12, right: 15} + margin: Inset{left: 5, top: 5, bottom: 5} + draw_icon.svg: (ICON_EXTERNAL_LINK) + icon_walk: Walk{width: 16, height: 16} + text: "Robrix Homepage" + } + + source_button := RobrixIconButton { + height: mod.widgets.SETTINGS_BUTTON_HEIGHT, + padding: Inset{left: 12, right: 15} + margin: Inset{left: 5, top: 5, bottom: 5} + draw_icon.svg: (ICON_EXTERNAL_LINK) + icon_walk: Walk{width: 16, height: 16} + text: "Source Code (GitHub)" + } + + issues_button := RobrixNegativeIconButton { + height: mod.widgets.SETTINGS_BUTTON_HEIGHT, + padding: Inset{left: 12, right: 15} + margin: Inset{left: 5, top: 5, bottom: 5} + draw_icon.svg: (ICON_EXTERNAL_LINK) + icon_walk: Walk{width: 16, height: 16} + text: "Report an Issue" + } + } + } +} + + +/// The About / Help section of the SettingsScreen. +#[derive(Script, Widget)] +pub struct AboutSettings { + #[deref] view: View, +} + +impl ScriptHook for AboutSettings { + fn on_after_apply( + &mut self, + vm: &mut ScriptVm, + _apply: &Apply, + _scope: &mut Scope, + _value: ScriptValue, + ) { + let cx = vm.cx_mut(); + Self::populate_text(cx, &self.view); + } +} + +impl Widget for AboutSettings { + fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) { + if let Event::Actions(actions) = event { + for action in actions { + if let HtmlLinkAction::Clicked { url, .. } = action.as_widget_action().cast() { + if !url.is_empty() { + open_url(&url); + } + } + } + self.handle_actions(cx, actions); + } + + // Long-press / hover tooltips per copy button, same pattern as + // the user-id copy button in account_settings.rs. + let robrix_btn = self.view.button(cx, ids!(copy_robrix_version_button)); + Self::handle_copy_tooltip(cx, event, &robrix_btn, "Copy Robrix version"); + if !TESTFLIGHT_BUILD_NUMBER.is_empty() { + let testflight_btn = self.view.button(cx, ids!(copy_testflight_button)); + Self::handle_copy_tooltip(cx, event, &testflight_btn, "Copy TestFlight build"); + } + let sdk_btn = self.view.button(cx, ids!(copy_sdk_version_button)); + Self::handle_copy_tooltip(cx, event, &sdk_btn, "Copy Matrix SDK version"); + + self.view.handle_event(cx, event, scope); + } + + fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep { + self.view.draw_walk(cx, scope, walk) + } +} + +impl AboutSettings { + fn handle_actions(&mut self, cx: &mut Cx, actions: &Actions) { + if self.view.button(cx, ids!(copy_robrix_version_button)).clicked(actions) { + Self::copy_with_toast(cx, &robrix_plaintext(), "Copied Robrix version."); + } + if !TESTFLIGHT_BUILD_NUMBER.is_empty() + && self.view.button(cx, ids!(copy_testflight_button)).clicked(actions) + { + Self::copy_with_toast(cx, &testflight_plaintext(), "Copied TestFlight build ID."); + } + if self.view.button(cx, ids!(copy_sdk_version_button)).clicked(actions) { + Self::copy_with_toast(cx, &sdk_plaintext(), "Copied Matrix SDK version."); + } + + if self.view.button(cx, ids!(privacy_policy_button)).clicked(actions) { + open_url(PRIVACY_POLICY_URL); + } + if self.view.button(cx, ids!(homepage_button)).clicked(actions) { + open_url(HOMEPAGE_URL); + } + if self.view.button(cx, ids!(source_button)).clicked(actions) { + open_url(SOURCE_URL); + } + if self.view.button(cx, ids!(issues_button)).clicked(actions) { + open_url(ISSUES_URL); + } + } + + fn populate_text(cx: &mut Cx, view: &View) { + view.html(cx, ids!(robrix_version_html)) + .set_text(cx, &robrix_html()); + view.html(cx, ids!(sdk_version_html)) + .set_text(cx, &sdk_html()); + + // Only show the TestFlight row if testflight env var is set. + let has_testflight = !TESTFLIGHT_BUILD_NUMBER.is_empty(); + view.view(cx, ids!(testflight_row)).set_visible(cx, has_testflight); + if has_testflight { + view.html(cx, ids!(testflight_html)) + .set_text(cx, &testflight_html()); + } + } + + fn copy_with_toast(cx: &mut Cx, payload: &str, success_msg: &str) { + cx.copy_to_clipboard(payload); + enqueue_popup_notification(success_msg.to_string(), PopupKind::Success, Some(3.0)); + } + + fn handle_copy_tooltip(cx: &mut Cx, event: &Event, button: &ButtonRef, tooltip_text: &str) { + let area = button.area(); + match event.hits(cx, area) { + Hit::FingerHoverIn(_) | Hit::FingerLongPress(_) => { + cx.widget_action( + button.widget_uid(), + TooltipAction::HoverIn { + text: tooltip_text.to_string(), + widget_rect: area.rect(cx), + options: CalloutTooltipOptions { + position: TooltipPosition::Top, + ..Default::default() + }, + }, + ); + } + Hit::FingerHoverOut(_) => { + cx.widget_action(button.widget_uid(), TooltipAction::HoverOut); + } + _ => {} + } + } +} + +fn robrix_html() -> String { + let value = robrix_plaintext(); + if ROBRIX_GIT_COMMIT_URL.is_empty() { + format!("{ROBRIX_PREFIX}{value}") + } else { + format!("{ROBRIX_PREFIX}{value}") + } +} + +fn robrix_plaintext() -> String { + if ROBRIX_GIT_COMMIT_HASH.is_empty() { + format!("v{ROBRIX_VERSION}") + } else { + format!("v{ROBRIX_VERSION} ({ROBRIX_GIT_COMMIT_HASH})") + } +} + +fn testflight_html() -> String { + format!("{TESTFLIGHT_PREFIX}{}", testflight_plaintext()) +} + +fn testflight_plaintext() -> String { + TESTFLIGHT_BUILD_NUMBER.to_string() +} + +fn sdk_html() -> String { + let value = sdk_plaintext(); + if MATRIX_SDK_URL.is_empty() { + format!("{SDK_PREFIX}{value}") + } else { + format!("{SDK_PREFIX}{value}") + } +} + +fn sdk_plaintext() -> String { + sdk_value_text() +} + +fn sdk_value_text() -> String { + if MATRIX_SDK_GIT_REV.is_empty() { + format!("v{MATRIX_SDK_VERSION}") + } else { + format!("v{MATRIX_SDK_VERSION} ({MATRIX_SDK_GIT_REV})") + } +} + +fn open_url(url: &str) { + log!("Opening URL \"{}\"", url); + if let Err(e) = robius_open::Uri::new(url).open() { + error!("Failed to open URL {:?}. Error: {:?}", url, e); + enqueue_popup_notification( + format!("Could not open URL: {url}"), + PopupKind::Error, + Some(10.0), + ); + } +} diff --git a/src/settings/account_settings.rs b/src/settings/account_settings.rs index 66f31b7cf..785270db0 100644 --- a/src/settings/account_settings.rs +++ b/src/settings/account_settings.rs @@ -173,7 +173,7 @@ script_mod! { } SubsectionLabel { - text: "Your Display Name:" + text: "Your Display Name" } display_name_input := RobrixTextInput { @@ -225,7 +225,7 @@ script_mod! { } SubsectionLabel { - text: "Your User ID:" + text: "Your User ID" } View { @@ -255,7 +255,7 @@ script_mod! { } SubsectionLabel { - text: "Other actions:" + text: "Other Actions" } View { diff --git a/src/settings/app_settings.rs b/src/settings/app_settings.rs index ee70cf653..f30b894a5 100644 --- a/src/settings/app_settings.rs +++ b/src/settings/app_settings.rs @@ -618,7 +618,7 @@ impl AppSettings { fn update_send_shortcut_description(cx: &mut Cx, view: &View, send_on_enter: bool) { let text = if send_on_enter { - "Current choice: 'Enter' to send, 'Shift + Enter' for a new line" + "Currently: 'Enter' to send, 'Shift + Enter' for a new line" } else { SEND_SHORTCUT_DESC_CMD }; diff --git a/src/settings/mod.rs b/src/settings/mod.rs index 1d2454cac..8341a0fae 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -3,11 +3,13 @@ use makepad_widgets::ScriptVm; pub mod settings_screen; pub mod account_settings; pub mod app_settings; +pub mod about_settings; pub mod app_preferences; pub fn script_mod(vm: &mut ScriptVm) { account_settings::script_mod(vm); app_settings::script_mod(vm); + about_settings::script_mod(vm); settings_screen::script_mod(vm); } diff --git a/src/settings/settings_screen.rs b/src/settings/settings_screen.rs index 10450dd65..2b578d7c7 100644 --- a/src/settings/settings_screen.rs +++ b/src/settings/settings_screen.rs @@ -59,16 +59,20 @@ script_mod! { // The Robrix app settings section. app_settings := AppSettings {} - LineH { width: 425, padding: 10, margin: Inset{top: 20, bottom: 5} } - // The TSP wallet settings section. tsp_settings_screen := TspSettingsScreen {} - // LineH { width: 425, padding: 10, margin: Inset{top: 20, bottom: 5} } + // Add other settings sections here. (Don't forget to add a `show()` fn) + + LineH { width: 425, padding: 10, margin: Inset{top: 20, bottom: 5} } + + // The About section, which should be the last item. + about_settings := AboutSettings {} - // Add other settings sections here as needed. - // Don't forget to add a `show()` fn to those settings sections - // and call them in `SettingsScreen::show()`. + View { + width: Fill + height: 20 + } } } diff --git a/src/tsp/tsp_settings_screen.rs b/src/tsp/tsp_settings_screen.rs index 879ae3ded..b3616984a 100644 --- a/src/tsp/tsp_settings_screen.rs +++ b/src/tsp/tsp_settings_screen.rs @@ -16,6 +16,8 @@ script_mod! { width: Fill, height: Fit flow: Down + LineH { width: 425, padding: 10, margin: Inset{top: 20, bottom: 5} } + TitleLabel { text: "TSP Wallet Settings" } diff --git a/src/tsp_dummy/mod.rs b/src/tsp_dummy/mod.rs index 1f7386949..81facf8db 100644 --- a/src/tsp_dummy/mod.rs +++ b/src/tsp_dummy/mod.rs @@ -24,7 +24,7 @@ script_mod! { mod.widgets.TspSettingsScreen = View { - width: Fill, height: 20 + width: Fill, height: 0 flow: Down }