From 2e6cff9eeb341d99f9e265b1629a471c4695bffd Mon Sep 17 00:00:00 2001 From: 2ro <17595647+2ro@users.noreply.github.com> Date: Mon, 15 Jun 2026 17:28:26 -0400 Subject: [PATCH] Receive screen: copy/share the npub, never a grin address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The right button copied the grin1 slatepack address and the left copied the nprofile — both wrong for 'how people pay me'. Now: left = Share a friendly 'Pay me on Goblin (goblin.st) — npub1…' message, right = Copy the bare npub. New receive.copy_npub / receive.share_message keys across all six locales. --- locales/de.yml | 2 ++ locales/en.yml | 2 ++ locales/fr.yml | 2 ++ locales/ru.yml | 2 ++ locales/tr.yml | 2 ++ locales/zh-CN.yml | 2 ++ src/gui/views/goblin/mod.rs | 43 +++++++++++++++---------------------- 7 files changed, 29 insertions(+), 26 deletions(-) diff --git a/locales/de.yml b/locales/de.yml index 836d9d0..dcc8fae 100644 --- a/locales/de.yml +++ b/locales/de.yml @@ -428,6 +428,8 @@ goblin: copied: "Kopiert" copy_nostr_id: "nostr-ID kopieren" copy_address: "Adresse kopieren" + copy_npub: "npub kopieren" + share_message: "Bezahl mich auf Goblin (goblin.st) — %{npub}" privacy_note: "Dein Benutzername ist öffentlich. Zahlungsinhalte bleiben im Netzwerk verschlüsselt." profile: title: "Profil" diff --git a/locales/en.yml b/locales/en.yml index fb44e5c..2cb82a6 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -428,6 +428,8 @@ goblin: copied: "Copied" copy_nostr_id: "Copy nostr ID" copy_address: "Copy address" + copy_npub: "Copy npub" + share_message: "Pay me on Goblin (goblin.st) — %{npub}" privacy_note: "Your username is public. Payment contents stay encrypted over the network." profile: title: "Profile" diff --git a/locales/fr.yml b/locales/fr.yml index c1a3411..cb29114 100644 --- a/locales/fr.yml +++ b/locales/fr.yml @@ -428,6 +428,8 @@ goblin: copied: "Copié" copy_nostr_id: "Copier l'ID nostr" copy_address: "Copier l'adresse" + copy_npub: "Copier npub" + share_message: "Payez-moi sur Goblin (goblin.st) — %{npub}" privacy_note: "Votre nom d'utilisateur est public. Le contenu des paiements reste chiffré sur le réseau." profile: title: "Profil" diff --git a/locales/ru.yml b/locales/ru.yml index 44183e7..89a5998 100644 --- a/locales/ru.yml +++ b/locales/ru.yml @@ -428,6 +428,8 @@ goblin: copied: "Скопировано" copy_nostr_id: "Копировать nostr ID" copy_address: "Копировать адрес" + copy_npub: "Копировать npub" + share_message: "Заплатите мне в Goblin (goblin.st) — %{npub}" privacy_note: "Ваше имя публично. Содержимое платежей остаётся зашифрованным в сети." profile: title: "Профиль" diff --git a/locales/tr.yml b/locales/tr.yml index a84406a..45a638a 100644 --- a/locales/tr.yml +++ b/locales/tr.yml @@ -428,6 +428,8 @@ goblin: copied: "Kopyalandı" copy_nostr_id: "nostr kimliğini kopyala" copy_address: "Adresi kopyala" + copy_npub: "npub kopyala" + share_message: "Goblin'de bana öde (goblin.st) — %{npub}" privacy_note: "Kullanıcı adın herkese açıktır. Ödeme içeriği ağ üzerinde şifreli kalır." profile: title: "Profil" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index 02a2b5d..9fdad4b 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -428,6 +428,8 @@ goblin: copied: "已复制" copy_nostr_id: "复制 nostr ID" copy_address: "复制地址" + copy_npub: "复制 npub" + share_message: "在 Goblin 上向我付款 (goblin.st) — %{npub}" privacy_note: "你的用户名是公开的。付款内容在网络中保持加密。" profile: title: "资料" diff --git a/src/gui/views/goblin/mod.rs b/src/gui/views/goblin/mod.rs index 0ba87ee..c643bbf 100644 --- a/src/gui/views/goblin/mod.rs +++ b/src/gui/views/goblin/mod.rs @@ -25,7 +25,7 @@ use eframe::epaint::{CornerRadius, FontId, Stroke}; use egui::{Align, Color32, Layout, Margin, RichText, ScrollArea, Sense, Vec2}; use crate::gui::icons::{ - ARROW_DOWN, ARROW_LEFT, CHECK, CLOCK, COPY, PROHIBIT, QR_CODE, USER_CIRCLE, WALLET, + ARROW_DOWN, ARROW_LEFT, CHECK, CLOCK, COPY, PROHIBIT, QR_CODE, SHARE, USER_CIRCLE, WALLET, }; use crate::gui::platform::PlatformCallbacks; use crate::gui::theme::{self, fonts}; @@ -1885,57 +1885,48 @@ impl GoblinWalletView { }); ui.add_space(12.0); - // Transient per-button "Copied" feedback; silent copies read as dead - // buttons. + // Transient "Copied" feedback on the copy button; a silent copy reads as + // a dead button. let fresh = |at: std::time::Instant| at.elapsed().as_millis() < 1500; - let copied0 = matches!(self.receive_copied, Some((0, at)) if fresh(at)); - let copied1 = matches!(self.receive_copied, Some((1, at)) if fresh(at)); + let copied = matches!(self.receive_copied, Some((1, at)) if fresh(at)); if self.receive_copied.is_some() { ui.ctx() .request_repaint_after(std::time::Duration::from_millis(200)); } ui.horizontal(|ui| { let half = (ui.available_width() - 10.0) / 2.0; + // Share a friendly "pay me" message carrying the bare npub — the + // public key people pay you on. Never the nprofile or a grin address. ui.scope_builder( egui::UiBuilder::new().max_rect(egui::Rect::from_min_size( ui.cursor().min, Vec2::new(half, 56.0), )), |ui| { - let label = if copied0 { - format!("{} {}", CHECK, t!("goblin.receive.copied")) - } else { - format!("{} {}", COPY, t!("goblin.receive.copy_nostr_id")) - }; - if w::big_action(ui, &label, true).clicked() { - let copy = if nprofile.is_empty() { - handle.clone() - } else { - nprofile.clone() - }; - cb.copy_string_to_buffer(copy); - self.receive_copied = Some((0, std::time::Instant::now())); + let label = t!("goblin.send.share_btn", "icon" => SHARE); + if w::big_action(ui, &label, true).clicked() && !npub.is_empty() { + cb.share_text( + t!("goblin.receive.share_message", "npub" => npub.clone()).to_string(), + ); } }, ); ui.add_space(10.0); + // Copy the bare npub itself. ui.scope_builder( egui::UiBuilder::new().max_rect(egui::Rect::from_min_size( ui.cursor().min, Vec2::new(half, 56.0), )), |ui| { - // Copy the grin1 slatepack address for manual exchange. - let label = if copied1 { + let label = if copied { format!("{} {}", CHECK, t!("goblin.receive.copied")) } else { - t!("goblin.receive.copy_address").to_string() + format!("{} {}", COPY, t!("goblin.receive.copy_npub")) }; - if w::big_action(ui, &label, false).clicked() { - if let Some(addr) = wallet.slatepack_address() { - cb.copy_string_to_buffer(addr); - self.receive_copied = Some((1, std::time::Instant::now())); - } + if w::big_action(ui, &label, false).clicked() && !npub.is_empty() { + cb.copy_string_to_buffer(npub.clone()); + self.receive_copied = Some((1, std::time::Instant::now())); } }, );