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
+37
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)]
+2 -1
View File
@@ -333,7 +333,8 @@ impl Room {
}
pub fn mute_on_join(cx: &AppContext) -> bool {
CallSettings::get_global(cx).mute_on_join || client::IMPERSONATE_LOGIN.is_some()
false
//CallSettings::get_global(cx).mute_on_join || client::IMPERSONATE_LOGIN.is_some()
}
fn from_join_response(