Add deafen and mute stubs
This commit is contained in:
parent
53062e8422
commit
ecd2129c2f
2 changed files with 36 additions and 1 deletions
|
@ -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<()> {
|
pub fn unshare_screen(&mut self, cx: &mut ModelContext<Self>) -> Result<()> {
|
||||||
if self.status.is_offline() {
|
if self.status.is_offline() {
|
||||||
return Err(anyhow!("room is offline"));
|
return Err(anyhow!("room is offline"));
|
||||||
|
|
|
@ -15,7 +15,7 @@ use gpui::{actions, AppContext, Task};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use workspace::AppState;
|
use workspace::AppState;
|
||||||
|
|
||||||
actions!(collab, [ToggleScreenSharing]);
|
actions!(collab, [ToggleScreenSharing, ToggleMute, ToggleDeafen]);
|
||||||
|
|
||||||
pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
|
pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
|
||||||
collab_titlebar_item::init(cx);
|
collab_titlebar_item::init(cx);
|
||||||
|
@ -27,6 +27,8 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
|
||||||
sharing_status_indicator::init(cx);
|
sharing_status_indicator::init(cx);
|
||||||
|
|
||||||
cx.add_global_action(toggle_screen_sharing);
|
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) {
|
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);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue