🔊 Trace events from Matrix client callbacks to domain methods

This commit is contained in:
2024-05-21 12:22:04 +02:00
parent b5da0ee992
commit cd6506fb03
11 changed files with 405 additions and 163 deletions

View File

@@ -2,43 +2,47 @@ use std::fmt::{Debug, Formatter};
use matrix_sdk::ruma::{OwnedMxcUri, OwnedRoomId, OwnedUserId};
use tokio::sync::broadcast::Receiver;
use tracing::Span;
use crate::domain::model::common::Avatar;
#[derive(Clone)]
pub enum RoomEvent {
Invitation(OwnedUserId, OwnedUserId, bool),
Join(OwnedUserId, Option<String>, Option<OwnedMxcUri>, bool),
Invitation(OwnedUserId, OwnedUserId, bool, Span),
Join(OwnedUserId, Option<String>, Option<OwnedMxcUri>, bool, Span),
NewTopic(Option<String>),
NewName(Option<String>),
NewAvatar(Option<Avatar>),
NewChild(OwnedRoomId),
NewTopic(Option<String>, Span),
NewName(Option<String>, Span),
NewAvatar(Option<Avatar>, Span),
NewChild(OwnedRoomId, Span),
}
impl Debug for RoomEvent {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
Self::Invitation(invitee_id, sender_id, is_account_user) => f
Self::Invitation(invitee_id, sender_id, is_account_user, _span) => f
.debug_tuple("RoomEvent::Invitation")
.field(invitee_id)
.field(sender_id)
.field(is_account_user)
.finish(),
Self::Join(user_id, user_name, avatar_url, is_account_user) => f
Self::Join(user_id, user_name, avatar_url, is_account_user, _span) => f
.debug_tuple("RoomEvent::Join")
.field(user_id)
.field(user_name)
.field(avatar_url)
.field(is_account_user)
.finish(),
Self::NewTopic(topic) => f.debug_tuple("RoomEvent::NewTopic").field(topic).finish(),
Self::NewName(name) => f.debug_tuple("RoomEvent::NewName").field(name).finish(),
Self::NewAvatar(avatar) => f
Self::NewTopic(topic, _span) => {
f.debug_tuple("RoomEvent::NewTopic").field(topic).finish()
}
Self::NewName(name, _span) => f.debug_tuple("RoomEvent::NewName").field(name).finish(),
Self::NewAvatar(avatar, _span) => f
// Self::NewAvatar(avatar) => f
.debug_tuple("RoomEvent::NewAvatar")
.field(&format!("is_some: {}", &avatar.is_some()))
.finish(),
Self::NewChild(room_id) => f
Self::NewChild(room_id, _span) => f
.debug_tuple("SpaceEvent::NewChild")
.field(room_id)
.finish(),