Add call events

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Joseph T. Lyons
2023-07-11 13:58:55 -04:00
co-authored by Max Brunsfeld
parent 8161438a85
commit 98a0113ac3
7 changed files with 57 additions and 21 deletions
+4 -11
View File
@@ -11,7 +11,7 @@ mod sharing_status_indicator;
use call::{ActiveCall, Room};
pub use collab_titlebar_item::{CollabTitlebarItem, ToggleContactsMenu};
use gpui::{actions, AppContext, Task};
use gpui::{actions, AppContext};
use std::sync::Arc;
use util::ResultExt;
use workspace::AppState;
@@ -44,16 +44,9 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
}
pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
if let Some(room) = ActiveCall::global(cx).read(cx).room().cloned() {
let toggle_screen_sharing = room.update(cx, |room, cx| {
if room.is_screen_sharing() {
Task::ready(room.unshare_screen(cx))
} else {
room.share_screen(cx)
}
});
toggle_screen_sharing.detach_and_log_err(cx);
}
ActiveCall::global(cx).update(cx, |call, cx| {
call.toggle_screen_sharing(cx);
});
}
pub fn toggle_mute(_: &ToggleMute, cx: &mut AppContext) {
@@ -99,8 +99,8 @@ impl IncomingCallNotification {
})
.detach_and_log_err(cx);
} else {
active_call.update(cx, |active_call, _| {
active_call.decline_incoming().log_err();
active_call.update(cx, |active_call, cx| {
active_call.decline_incoming(cx).log_err();
});
}
}