From 8401d924e0ccac88794a00dc443edd7e33816096 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 20 Oct 2023 00:40:26 +0800 Subject: [PATCH] add opcodes for updating status bar and running busy animations --- libs/chat/src/api.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libs/chat/src/api.rs b/libs/chat/src/api.rs index 2547a1892..41b29fab9 100644 --- a/libs/chat/src/api.rs +++ b/libs/chat/src/api.rs @@ -36,10 +36,20 @@ pub enum ChatOp { /// Find a Post by timestamp and Author PostFind, PostFlag, + /// Run or stop the busy animation. + SetBusyAnimationState, + /// Update just the state of the busy animation, if any. Internal opcode. + UpdateBusy, /// exit the application Quit, } +#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)] +pub(crate) enum BusyAnimOp { + Start, + Pump, +} + #[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)] pub enum IconOp { PostMenu = 0, @@ -120,3 +130,11 @@ pub enum AuthorFlag { Hidden, Right, } + +#[derive(Archive, Serialize, Deserialize, Debug)] +pub struct BusyMessage { + /// If None, restores the last non-busy status bar message, and stops the animation. + /// If Some, updates the status bar to contain the busy message and + /// starts the animation running. + pub busy_msg: Option>, +}