feat(notedeck): add cross-platform URI opener

This commit is contained in:
Fernando López Guevara
2025-07-28 19:53:54 -03:00
committed by William Casarin
parent ba76b20ad2
commit f282363748
9 changed files with 116 additions and 48 deletions

View File

@@ -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"

View File

@@ -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>

View File

@@ -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 }

View File

@@ -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 {

View File

@@ -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);
};
}
}

View File

@@ -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
);