Add mute handling

This commit is contained in:
Piotr Osiewicz 2023-11-24 15:16:03 +01:00
parent f2b62c3946
commit 6ebe5d5053
5 changed files with 122 additions and 21 deletions

View file

@ -17,6 +17,7 @@ use gpui::{
Subscription, Task, View, ViewContext, WeakModel, WeakView,
};
pub use participant::ParticipantLocation;
use participant::RemoteParticipant;
use postage::watch;
use project::Project;
use room::Event;
@ -628,6 +629,42 @@ impl CallHandler for Call {
this.invite(called_user_id, initial_project, cx)
})
}
fn remote_participants(&self, cx: &AppContext) -> Option<Vec<Arc<User>>> {
self.active_call
.as_ref()
.map(|call| {
call.0.read(cx).room().map(|room| {
room.read(cx)
.remote_participants()
.iter()
.map(|participant| participant.1.user.clone())
.collect()
})
})
.flatten()
}
fn is_muted(&self, cx: &AppContext) -> Option<bool> {
self.active_call
.as_ref()
.map(|call| {
call.0
.read(cx)
.room()
.map(|room| room.read(cx).is_muted(cx))
})
.flatten()
}
fn toggle_mute(&self, cx: &mut AppContext) {
self.active_call.as_ref().map(|call| {
call.0.update(cx, |this, cx| {
this.room().map(|room| {
room.update(cx, |this, cx| {
this.toggle_mute(cx);
})
})
})
});
}
}
#[cfg(test)]