forge
Explore
Log in

Don't you dare go Hollow

Resync voice and shares after reconnecting and always rejoin the call

Browse files at this commit

ff2ed3da8b7d668eba36b7a7183458df86071578Ahmet Kaan GümüşParent: 8dea773
  • fix
    • resync voice and shares after reconnecting and always rejoin the call
Show full message
🐛 fix: resync voice and shares after reconnecting and always rejoin the call
crates/client/src/gui/chat.rsmodified+7 -16
@@ -1608,13 +1608,17 @@ impl Yumush {
16081608 self.select_community(community_id, window, cx);
16091609 }
16101610
1611- pub(super) fn reload(&self, window: &mut Window, cx: &mut Context<Self>) {
1611+ pub(super) fn reload(&mut self, window: &mut Window, cx: &mut Context<Self>) {
1612+ self.chat.voice.clear();
1613+ self.chat.shares.clear();
16121614 self.load_communities(window, cx);
16131615 self.load_social(window, cx);
16141616
1615- if self.chat.selected_community_id.is_some() {
1617+ if let Some(community_id) = self.chat.selected_community_id.clone() {
16161618 self.load_members(window, cx);
16171619 self.load_messages(None, window, cx);
1620+ self.load_voice(window, cx);
1621+ self.load_shares(community_id, cx);
16181622 }
16191623 }
16201624
@@ -2042,20 +2046,7 @@ impl Yumush {
20422046 };
20432047 let flags = self.chat.voice_flags().unwrap_or((false, false));
20442048 self.chat.set_voice_off();
2045- let network = self.network.clone();
2046-
2047- cx.spawn_in(window, async move |this, cx| {
2048- let Ok(participants) = network.voice_participants(&community_id).await else {
2049- return;
2050- };
2051- let _ = this.update_in(cx, |yumush, window, cx| {
2052- if participants.iter().any(|id| !yumush.is_me(id)) {
2053- yumush.join_voice(community_id, flags, false, window, cx);
2054- }
2055- cx.notify();
2056- });
2057- })
2058- .detach();
2049+ self.join_voice(community_id, flags, false, window, cx);
20592050 }
20602051
20612052 pub(super) fn leave_voice_in(&mut self, community_id: &str, cx: &mut Context<Self>) {