Add deafen and mute stubs

Mikayla Maki created

Change summary

crates/call/src/room.rs           | 11 +++++++++++
crates/collab_ui/src/collab_ui.rs | 26 +++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)

Detailed changes

crates/call/src/room.rs 🔗

@@ -1143,6 +1143,17 @@ impl Room {
         })
     }
 
+    pub fn toggle_mute(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
+        // https://docs.livekit.io/client/publish/
+        // Should be acessible from local participant / publication
+        todo!();
+    }
+
+    pub fn toggle_deafen(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
+        // iterate through publications and mute (?????)
+        todo!();
+    }
+
     pub fn unshare_screen(&mut self, cx: &mut ModelContext<Self>) -> Result<()> {
         if self.status.is_offline() {
             return Err(anyhow!("room is offline"));

crates/collab_ui/src/collab_ui.rs 🔗

@@ -15,7 +15,7 @@ use gpui::{actions, AppContext, Task};
 use std::sync::Arc;
 use workspace::AppState;
 
-actions!(collab, [ToggleScreenSharing]);
+actions!(collab, [ToggleScreenSharing, ToggleMute, ToggleDeafen]);
 
 pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
     collab_titlebar_item::init(cx);
@@ -27,6 +27,8 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
     sharing_status_indicator::init(cx);
 
     cx.add_global_action(toggle_screen_sharing);
+    cx.add_global_action(toggle_mute);
+    cx.add_global_action(toggle_deafen);
 }
 
 pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
@@ -41,3 +43,25 @@ pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
         toggle_screen_sharing.detach_and_log_err(cx);
     }
 }
+
+pub fn toggle_mute(_: &ToggleMute, cx: &mut AppContext) {
+    if let Some(room) = ActiveCall::global(cx).read(cx).room().cloned() {
+        let toggle_mut = room.update(cx, |room, cx| {
+            if room.is_sharing_mic() {
+                room.toggle_mute(cx)
+            } else {
+                room.share_mic(cx)
+            }
+        });
+        toggle_mut.detach_and_log_err(cx);
+    }
+}
+
+pub fn toggle_deafen(_: &ToggleDeafen, cx: &mut AppContext) {
+    if let Some(room) = ActiveCall::global(cx).read(cx).room().cloned() {
+        let toggle_deafan = room.update(cx, |room, cx| {
+            room.toggle_deafen(cx)
+        });
+        toggle_deafan.detach_and_log_err(cx);
+    }
+}