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 {
1608 self.select_community(community_id, window, cx);1608 self.select_community(community_id, window, cx);
1609 }1609 }
1610 1610
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();
1612 self.load_communities(window, cx);1614 self.load_communities(window, cx);
1613 self.load_social(window, cx);1615 self.load_social(window, cx);
1614 1616
1615- if self.chat.selected_community_id.is_some() {1617+ if let Some(community_id) = self.chat.selected_community_id.clone() {
1616 self.load_members(window, cx);1618 self.load_members(window, cx);
1617 self.load_messages(None, window, cx);1619 self.load_messages(None, window, cx);
1620+ self.load_voice(window, cx);
1621+ self.load_shares(community_id, cx);
1618 }1622 }
1619 }1623 }
1620 1624
@@ -2042,20 +2046,7 @@ impl Yumush {
2042 };2046 };
2043 let flags = self.chat.voice_flags().unwrap_or((false, false));2047 let flags = self.chat.voice_flags().unwrap_or((false, false));
2044 self.chat.set_voice_off();2048 self.chat.set_voice_off();
2045- let network = self.network.clone();2049+ self.join_voice(community_id, flags, false, window, cx);
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();
2059 }2050 }
2060 2051
2061 pub(super) fn leave_voice_in(&mut self, community_id: &str, cx: &mut Context<Self>) {2052 pub(super) fn leave_voice_in(&mut self, community_id: &str, cx: &mut Context<Self>) {