notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit f28236374839e18690bd884e3f88325972c8903c
parent ba76b20ad2eef666945566e65c353bba7e8568d3
Author: Fernando López Guevara <fernando.lguevara@gmail.com>
Date:   Mon, 28 Jul 2025 19:53:54 -0300

feat(notedeck): add cross-platform URI opener

Diffstat:
M.gitignore | 6++++--
MCargo.lock | 120++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
MCargo.toml | 2+-
Mcrates/notedeck_chrome/Cargo.toml | 6++++++
Mcrates/notedeck_chrome/android/app/src/main/AndroidManifest.xml | 10+++++++++-
Mcrates/notedeck_columns/Cargo.toml | 2+-
Mcrates/notedeck_columns/src/support.rs | 2+-
Mcrates/notedeck_columns/src/ui/profile/mod.rs | 5+++--
Mcrates/notedeck_columns/src/ui/support.rs | 14++++++++++----
9 files changed, 118 insertions(+), 49 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -20,4 +20,6 @@ queries/damus-notifs.json scripts/macos_build_secrets.sh /tags .zed -.lsp -\ No newline at end of file +.lsp +.idea +local.properties +\ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock @@ -766,6 +766,25 @@ dependencies = [ ] [[package]] +name = "block-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7" +dependencies = [ + "objc-sys", +] + +[[package]] +name = "block2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e58aa60e59d8dbfcc36138f5f18be5f24394d33b38b24f7fd0b1caa33095f22f" +dependencies = [ + "block-sys", + "objc2 0.5.2", +] + +[[package]] name = "block2" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2509,6 +2528,16 @@ dependencies = [ ] [[package]] +name = "icrate" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb69199826926eb864697bddd27f73d9fddcffc004f5733131e15b465e30642" +dependencies = [ + "block2 0.4.0", + "objc2 0.5.2", +] + +[[package]] name = "icu_collections" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2746,25 +2775,6 @@ dependencies = [ ] [[package]] -name = "is-docker" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" -dependencies = [ - "once_cell", -] - -[[package]] -name = "is-wsl" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" -dependencies = [ - "is-docker", - "once_cell", -] - -[[package]] name = "itertools" version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3522,7 +3532,6 @@ dependencies = [ "notedeck", "notedeck_ui", "oot_bitset", - "open", "opener", "poll-promise", "pretty_assertions", @@ -3531,6 +3540,7 @@ dependencies = [ "puffin_egui", "rfd", "rmpv", + "robius-open", "security-framework 2.11.1", "serde", "serde_derive", @@ -4015,17 +4025,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] -name = "open" -version = "5.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95" -dependencies = [ - "is-wsl", - "libc", - "pathdiff", -] - -[[package]] name = "opener" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4138,12 +4137,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] -name = "pathdiff" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" - -[[package]] name = "pbkdf2" version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4951,6 +4944,30 @@ dependencies = [ ] [[package]] +name = "robius-android-env" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "087fcb3061ccc432658a605cb868edd44e0efb08e7a159b486f02804a7616bef" +dependencies = [ + "jni 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ndk-context", +] + +[[package]] +name = "robius-open" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243e2abbc8c1ca8ddc283056d4675b67e452fd527c3741c5318642da37840ff3" +dependencies = [ + "cfg-if", + "icrate", + "jni 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)", + "objc2 0.5.2", + "robius-android-env", + "windows 0.54.0", +] + +[[package]] name = "roxmltree" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6794,6 +6811,16 @@ dependencies = [ [[package]] name = "windows" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" +dependencies = [ + "windows-core 0.54.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows" version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" @@ -6813,6 +6840,16 @@ dependencies = [ [[package]] name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result 0.1.2", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" @@ -6889,6 +6926,15 @@ checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" [[package]] name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" diff --git a/Cargo.toml b/Cargo.toml @@ -51,7 +51,7 @@ notedeck_dave = { path = "crates/notedeck_dave" } notedeck_ui = { path = "crates/notedeck_ui" } tokenator = { path = "crates/tokenator" } once_cell = "1.19.0" -open = "5.3.0" +robius-open = "0.1" poll-promise = { version = "0.3.0", features = ["tokio"] } puffin = { git = "https://github.com/jb55/puffin", package = "puffin", rev = "c6a6242adaf90b6292c0f462d2acd34d96d224d2" } puffin_egui = { git = "https://github.com/jb55/puffin", package = "puffin_egui", rev = "c6a6242adaf90b6292c0f462d2acd34d96d224d2" } diff --git a/crates/notedeck_chrome/Cargo.toml b/crates/notedeck_chrome/Cargo.toml @@ -63,6 +63,12 @@ short_description = "The nostr browser" identifier = "com.damus.notedeck" icon = ["assets/app_icon.icns"] +[package.metadata.android.manifest.queries] +intent = [ + { action = ["android.intent.action.MAIN"] }, +] + + [package.metadata.android] package = "com.damus.app" apk_name = "Notedeck" diff --git a/crates/notedeck_chrome/android/app/src/main/AndroidManifest.xml b/crates/notedeck_chrome/android/app/src/main/AndroidManifest.xml @@ -23,11 +23,18 @@ </activity> </application> + <queries> + <intent> + <action android:name="android.intent.action.MAIN" /> + </intent> + </queries> + <uses-feature android:name="android.hardware.vulkan.level" android:required="true" android:version="1" /> + <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> -</manifest> +</manifest> +\ No newline at end of file diff --git a/crates/notedeck_columns/Cargo.toml b/crates/notedeck_columns/Cargo.toml @@ -32,7 +32,7 @@ image = { workspace = true } indexmap = { workspace = true } nostrdb = { workspace = true } notedeck_ui = { workspace = true } -open = { workspace = true } +robius-open = { workspace = true } poll-promise = { workspace = true } puffin = { workspace = true, optional = true } puffin_egui = { workspace = true, optional = true } diff --git a/crates/notedeck_columns/src/support.rs b/crates/notedeck_columns/src/support.rs @@ -28,7 +28,7 @@ impl Support { } static MAX_LOG_LINES: usize = 500; -static SUPPORT_EMAIL: &str = "support@damus.io"; +pub static SUPPORT_EMAIL: &str = "support+notedeck@damus.io"; static EMAIL_TEMPLATE: &str = concat!("version ", env!("CARGO_PKG_VERSION"), "\nCommit hash: ", env!("GIT_COMMIT_HASH"), "\n\nDescribe the bug you have encountered:\n<-- your statement here -->\n\n===== Paste your log below =====\n\n"); impl Support { diff --git a/crates/notedeck_columns/src/ui/profile/mod.rs b/crates/notedeck_columns/src/ui/profile/mod.rs @@ -6,6 +6,7 @@ use enostr::Pubkey; use nostrdb::{ProfileRecord, Transaction}; use notedeck::{tr, Localization}; use notedeck_ui::profile::follow_button; +use robius_open::Uri; use tracing::error; use crate::{ @@ -285,8 +286,8 @@ fn handle_link(ui: &mut egui::Ui, website_url: &str) { .interact(Sense::click()) .clicked() { - if let Err(e) = open::that(website_url) { - error!("Failed to open URL {} because: {}", website_url, e); + if let Err(e) = Uri::new(website_url).open() { + error!("Failed to open URL {} because: {:?}", website_url, e); }; } } diff --git a/crates/notedeck_columns/src/ui/support.rs b/crates/notedeck_columns/src/ui/support.rs @@ -1,10 +1,10 @@ +use crate::support::{Support, SUPPORT_EMAIL}; use egui::{vec2, Button, Label, Layout, RichText}; use notedeck::{tr, Localization, NamedFontFamily, NotedeckTextStyle}; use notedeck_ui::{colors::PINK, padding}; +use robius_open::Uri; use tracing::error; -use crate::support::Support; - pub struct SupportView<'a> { support: &'a mut Support, i18n: &'a mut Localization, @@ -44,15 +44,21 @@ impl<'a> SupportView<'a> { "Open your default email client to get help from the Damus team", "Instruction to open email client" )); + + ui.horizontal_wrapped(|ui| { + ui.label(tr!(self.i18n, "Support email:", "Support email address",)); + ui.label(RichText::new(SUPPORT_EMAIL).color(PINK)) + }); + let size = vec2(120.0, 40.0); ui.allocate_ui_with_layout(size, Layout::top_down(egui::Align::Center), |ui| { let font_size = notedeck::fonts::get_font_size(ui.ctx(), &NotedeckTextStyle::Body); let button_resp = ui.add(open_email_button(self.i18n, font_size, size)); if button_resp.clicked() { - if let Err(e) = open::that(self.support.get_mailto_url()) { + if let Err(e) = Uri::new(self.support.get_mailto_url()).open() { error!( - "Failed to open URL {} because: {}", + "Failed to open URL {} because: {:?}", self.support.get_mailto_url(), e );