feat: add UIChatListChanged and UIChatListItemChanged events

This commit is contained in:
Simon Laux
2023-06-15 15:05:41 +02:00
parent 924d5b9377
commit a048d6b0d1
18 changed files with 173 additions and 4 deletions

View File

@@ -301,6 +301,18 @@ pub enum EventType {
WebxdcInstanceDeleted {
msg_id: u32,
},
/// Inform UI that Order (and content as in chat ids) of the chatlist changed.
///
/// Sometimes this is emitted together with `UIChatListItemChanged` such as on IncomingMessage.
UIChatListChanged,
/// Inform UI that a single chat list item changed and needs to be rerendered
/// If `chat_id` is set to None, then all currently visible chats need to be rerendered, and all not-visible items need to be cleared from cache if the UI has a cache.
#[serde(rename_all = "camelCase")]
UIChatListItemChanged {
chat_id: Option<u32>,
},
}
impl From<CoreEventType> for EventType {
@@ -406,6 +418,10 @@ impl From<CoreEventType> for EventType {
CoreEventType::WebxdcInstanceDeleted { msg_id } => WebxdcInstanceDeleted {
msg_id: msg_id.to_u32(),
},
EventType::UIChatListItemChanged { chat_id } => UIChatListItemChanged {
chat_id: chat_id.map(|id| id.to_u32()),
},
EventType::UIChatListChanged => UIChatListChanged,
}
}
}