mirror of
https://github.com/chatmail/core.git
synced 2026-04-18 05:56:31 +03:00
notify adding reactions (#6072)
this PR adds an event for reactions received for one's own messages. this will allow UIs to add notification for these reactions. **Screenshots** at https://github.com/deltachat/deltachat-ios/pull/2331: --------- Co-authored-by: iequidoo <117991069+iequidoo@users.noreply.github.com>
This commit is contained in:
@@ -1106,6 +1106,24 @@ impl EventTracker {
|
||||
.expect("timeout waiting for event match")
|
||||
}
|
||||
|
||||
/// Consumes emitted events returning the first matching one if any.
|
||||
pub async fn get_matching_opt<F: Fn(&EventType) -> bool>(
|
||||
&self,
|
||||
ctx: &Context,
|
||||
event_matcher: F,
|
||||
) -> Option<EventType> {
|
||||
ctx.emit_event(EventType::Test);
|
||||
loop {
|
||||
let event = self.recv().await.unwrap();
|
||||
if event_matcher(&event.typ) {
|
||||
return Some(event.typ);
|
||||
}
|
||||
if let EventType::Test = event.typ {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Consumes events looking for an [`EventType::Info`] with substring matching.
|
||||
pub async fn get_info_contains(&self, s: &str) -> EventType {
|
||||
self.get_matching(|evt| match evt {
|
||||
|
||||
Reference in New Issue
Block a user