forge
Explore
Log in

Don't you dare go Hollow

Going ghost stops your camera and screen share first (the server dropped them but capture kept running and the buttons stayed on), share buttons hidden while ghost, a ghost's leave reaches their own client (stale in-call count)

Browse files at this commit

8b749c83f5ab034d04388754e887a6925385cb96Ahmet Kaan GümüşParent: a51e814
  • fix
    • going ghost stops your camera and screen share first (the server dropped them but capture kept running and the buttons stayed on), share buttons hidden while ghost, a ghost's leave reaches their own client (stale in-call count)
Show full message
🐛 fix: going ghost stops your camera and screen share first (the server dropped them but capture kept running and the buttons stayed on), share buttons hidden while ghost, a ghost's leave reaches their own client (stale in-call count)
crates/client/src/gui/builder.rsmodified+4 -0
@@ -448,6 +448,10 @@ impl Yumush {
448 let network = self.network.clone();448 let network = self.network.clone();
449 449
450 cx.spawn_in(window, async move |this, cx| {450 cx.spawn_in(window, async move |this, cx| {
451+ if enabled {
452+ let _ = network.stop_share().await;
453+ let _ = network.stop_camera().await;
454+ }
451 match network.call(SetGhost { enabled }).await {455 match network.call(SetGhost { enabled }).await {
452 Ok(()) => {456 Ok(()) => {
453 let _ = this.update(cx, |yumush, cx| {457 let _ = this.update(cx, |yumush, cx| {
crates/client/src/gui/call_bar.rsmodified+29 -26
@@ -25,6 +25,7 @@ pub struct CallBar {
25 pub screen: bool,25 pub screen: bool,
26 pub share: Option<(Option<VecDeque<f32>>, gpui_kit::Hsla)>,26 pub share: Option<(Option<VecDeque<f32>>, gpui_kit::Hsla)>,
27 pub stats: bool,27 pub stats: bool,
28+ pub ghost: bool,
28 }29 }
29 30
30 pub struct CallActions {31 pub struct CallActions {
@@ -83,32 +84,34 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
83 t,84 t,
84 run(&actions.deafen),85 run(&actions.deafen),
85 ))86 ))
86- .child(icon_button(87+ .when(!bar.ghost, |row| {
87- format!("bar_camera_{}", bar.camera),88+ row.child(icon_button(
88- IconName::Video,89+ format!("bar_camera_{}", bar.camera),
89- if bar.camera {90+ IconName::Video,
90- "Turn off camera"91+ if bar.camera {
91- } else {92+ "Turn off camera"
92- "Turn on camera"93+ } else {
93- },94+ "Turn on camera"
94- tone(bar.camera),95+ },
95- t,96+ tone(bar.camera),
96- run(&actions.camera),97+ t,
97- ))98+ run(&actions.camera),
98- .child(actions.camera_more)99+ ))
99- .child(icon_button(100+ .child(actions.camera_more)
100- format!("bar_screen_{}", bar.screen),101+ .child(icon_button(
101- IconName::ScreenShare,102+ format!("bar_screen_{}", bar.screen),
102- if bar.screen {103+ IconName::ScreenShare,
103- "Stop sharing"104+ if bar.screen {
104- } else {105+ "Stop sharing"
105- "Share screen"106+ } else {
106- },107+ "Share screen"
107- tone(bar.screen),108+ },
108- t,109+ tone(bar.screen),
109- run(&actions.screen),110+ t,
110- ))111+ run(&actions.screen),
111- .child(actions.screen_more)112+ ))
113+ .child(actions.screen_more)
114+ })
112 .child(icon_button(115 .child(icon_button(
113 "bar_leave",116 "bar_leave",
114 IconName::PhoneOff,117 IconName::PhoneOff,
crates/client/src/gui/dock.rsmodified+1 -0
@@ -45,6 +45,7 @@ impl Yumush {
45 deafened,45 deafened,
46 camera: self.network.share_source(Kind::Camera).is_some(),46 camera: self.network.share_source(Kind::Camera).is_some(),
47 screen: self.network.share_source(Kind::Screen).is_some(),47 screen: self.network.share_source(Kind::Screen).is_some(),
48+ ghost: self.chat.ghost,
48 share: self49 share: self
49 .network50 .network
50 .share_source(Kind::Screen)51 .share_source(Kind::Screen)
crates/client/src/gui/gallery.rsmodified+1 -0
@@ -337,6 +337,7 @@ fn call_page(state: State, t: Tokens) -> impl IntoElement {
337 screen: state == State::Many,337 screen: state == State::Many,
338 share: (state == State::Many).then(|| (Some(bands(2.)), t.hue(Hue::Amber))),338 share: (state == State::Many).then(|| (Some(bands(2.)), t.hue(Hue::Amber))),
339 stats: false,339 stats: false,
340+ ghost: false,
340 };341 };
341 let none = || -> call_bar::Action { Rc::new(|_, _| {}) };342 let none = || -> call_bar::Action { Rc::new(|_, _| {}) };
342 let actions = CallActions {343 let actions = CallActions {
crates/server/src/request.rsmodified+5 -0
@@ -196,6 +196,11 @@ pub async fn departed(
196 return Ok(broadcasts);196 return Ok(broadcasts);
197 };197 };
198 record_ghost_voice(user_id, community_id, seconds, db).await?;198 record_ghost_voice(user_id, community_id, seconds, db).await?;
199+ let event = Event::VoiceLeft {
200+ community_id,
201+ user_id,
202+ };
203+ broadcasts.push(Broadcast::new(To::User(user_id), event));
199 204
200 Ok(broadcasts)205 Ok(broadcasts)
201 }206 }