diff --git a/crates/client/src/gui.rs b/crates/client/src/gui.rs index 05e2d8e..433e4e4 100644 --- a/crates/client/src/gui.rs +++ b/crates/client/src/gui.rs @@ -587,6 +587,7 @@ pub struct Yumush { backups: Vec, pending_backup_delete: Option, share_apps: Vec, + send_order: Arc>, } impl Yumush { @@ -645,6 +646,7 @@ impl Yumush { backups: Vec::new(), pending_backup_delete: None, share_apps: Vec::new(), + send_order: Default::default(), }; yumush.chat.camera_task = Some(camera_view::ticker(cx)); yumush diff --git a/crates/client/src/gui/composer.rs b/crates/client/src/gui/composer.rs index 1ce4fce..146fd6e 100644 --- a/crates/client/src/gui/composer.rs +++ b/crates/client/src/gui/composer.rs @@ -266,9 +266,11 @@ impl Yumush { let network = self.network.clone(); let restore = input.clone(); let pending = self.chat.media.pending.clone(); + let order = self.send_order.clone(); self.chat.drafts.remove(&community_id); cx.spawn_in(window, async move |this, cx| { + let _turn = order.lock().await; match network .call(CreateMessage { community_id, diff --git a/crates/client/src/gui/voice_note.rs b/crates/client/src/gui/voice_note.rs index e55568f..2d552a8 100644 --- a/crates/client/src/gui/voice_note.rs +++ b/crates/client/src/gui/voice_note.rs @@ -267,6 +267,7 @@ impl Yumush { .map(|settings| settings.max_attachment_bytes); cx.notify(); + let order = self.send_order.clone(); cx.spawn_in(window, async move |this, cx| { let Some(path) = cx .background_executor() @@ -282,6 +283,7 @@ impl Yumush { Ok(attachment) => attachment, Err(error) => return notify_error(&this, cx, error), }; + let _turn = order.lock().await; ok_or_notify( network .call(CreateMessage {