Receive screen: copy/share the npub, never a grin address

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.
This commit is contained in:
2ro
2026-06-15 17:28:26 -04:00
parent ba504aa266
commit 2e6cff9eeb
7 changed files with 29 additions and 26 deletions
+17 -26
View File
@@ -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()));
}
},
);