feat: Add EventType::CallMissed and emit it for missed calls (#7840)

Before, only `CallEnded` was emitted for missed calls, or, if a call arrives already being stale,
`IncomingMsg`. Now:
- `CallMissed` is emitted in addition to `CallEnded`.
- `IncomingMsg` is replaced with `CallMissed` for stale calls.
Having only one event type for missed calls should simplify handling them in the apps.

This doesn't emit `CallMissed` for those who aren't allowed to call us. Also, don't emit `CallEnded`
if the caller isn't allowed to call us and the call wasn't accepted, as there's no previous
`IncomingCall` event in this case.
This commit is contained in:
iequidoo
2026-03-04 20:12:47 -03:00
parent ef718bb869
commit 79c45e338c
6 changed files with 194 additions and 51 deletions

View File

@@ -463,6 +463,14 @@ pub enum EventType {
chat_id: u32,
},
/// Call missed.
CallMissed {
/// ID of the info message referring to the call.
msg_id: u32,
/// ID of the chat which the message belongs to.
chat_id: u32,
},
/// One or more transports has changed.
///
/// UI should update the list.
@@ -658,6 +666,10 @@ impl From<CoreEventType> for EventType {
msg_id: msg_id.to_u32(),
chat_id: chat_id.to_u32(),
},
CoreEventType::CallMissed { msg_id, chat_id } => CallMissed {
msg_id: msg_id.to_u32(),
chat_id: chat_id.to_u32(),
},
CoreEventType::TransportsModified => TransportsModified,
#[allow(unreachable_patterns)]