ui: one clipboard path, and Copy invite link in the voice header
Copying went through a hidden text field on the phone's voice screen only. It moves into MainWindow: any screen calls Nav.copy(text), and Bridge.copied() confirms it in one toast, shown again when its text is the same as the last copy's. The invite leaves its own message for that toast (the channel and the link) instead of a status of its own, so a copy never shows two. The desktop voice channel view gets the same Invite as a Copy invite link button next to Chat only. Icons.channel is the speaker, for the channel spots that use it later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
This commit is contained in:
1 parent
3c47bc682f
commit
61636b23c8
11 files changed
+67
-18
No files matched your search
@@ -430,6 +430,9 @@ pub(crate) struct App {
|
||||
pub sessions: HashMap<i64, SessionView>,
|
||||
pub models: Models,
|
||||
pub status: String,
|
||||
/// What the toast of the next copy says instead of "Copied" (an invite
|
||||
/// names its channel and link).
|
||||
pub copy_note: Option<String>,
|
||||
/// The members panel's search.
|
||||
pub member_filter: String,
|
||||
/// The topics drawer's search.
|
||||
@@ -679,6 +682,7 @@ pub fn run(options: RunOptions) -> Result<()> {
|
||||
sessions: HashMap::new(),
|
||||
models,
|
||||
status: String::new(),
|
||||
copy_note: None,
|
||||
member_filter: String::new(),
|
||||
topic_filter: String::new(),
|
||||
voice_view: false,
|
||||
@@ -844,6 +848,12 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
/// Nav.copy put text on the clipboard: one toast says so.
|
||||
pub fn copied(&mut self) {
|
||||
let text = self.copy_note.take().unwrap_or_else(|| "Copied".to_owned());
|
||||
self.set_status(text);
|
||||
}
|
||||
|
||||
pub fn store_settings(&self) {
|
||||
if let Err(e) = self.prefs.set(&UI, self.settings.clone()) {
|
||||
warn!(%e, "could not store settings");
|
||||
|
||||
@@ -4,7 +4,7 @@ use slint::ComponentHandle;
|
||||
use voelin_core::Command;
|
||||
use voelin_model::ChannelId;
|
||||
|
||||
use crate::app::{Bridge, MainWindow, with_app};
|
||||
use crate::app::{App, Bridge, MainWindow, with_app};
|
||||
|
||||
pub(super) fn wire(ui: &MainWindow) {
|
||||
let bridge = ui.global::<Bridge>();
|
||||
@@ -56,4 +56,8 @@ pub(super) fn wire(ui: &MainWindow) {
|
||||
with_app(|app| app.client_playback_changed(&form));
|
||||
});
|
||||
bridge.on_invite(|| with_app(|app| app.invite_link()).unwrap_or_default().into());
|
||||
// Nav.copy, from any screen.
|
||||
bridge.on_copied(|| {
|
||||
with_app(App::copied);
|
||||
});
|
||||
}
|
||||
@@ -503,7 +503,8 @@ impl App {
|
||||
}
|
||||
|
||||
/// A link to the voice channel we are in, for the Invite button (which
|
||||
/// copies it); empty, with a note, without one.
|
||||
/// copies it, and the copy's toast names the channel); empty, with a
|
||||
/// note, without one.
|
||||
pub(crate) fn invite_link(&mut self) -> String {
|
||||
let bookmark = self.current.and_then(|id| self.bookmark(id)).map(|b| b.address.clone());
|
||||
let path = self.view().and_then(|v| {
|
||||
@@ -525,7 +526,8 @@ impl App {
|
||||
};
|
||||
let path: Vec<&str> = path.iter().map(String::as_str).collect();
|
||||
let link = vm::servers::invite_link(&address, &path);
|
||||
self.set_status(format!("Copied an invite to {}: {link}", path.last().unwrap_or(&"")));
|
||||
self.copy_note =
|
||||
Some(format!("Copied an invite to {}: {link}", path.last().unwrap_or(&"")));
|
||||
link
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user