From 73d00a4cafc7427f456d8d68c0a91ed5a5be5341 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 25 Apr 2022 13:41:24 +0400 Subject: [PATCH] Reload stale video chat on join. --- Telegram/SourceFiles/calls/group/calls_group_call.cpp | 8 ++++++++ Telegram/SourceFiles/calls/group/calls_group_call.h | 1 + 2 files changed, 9 insertions(+) diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index 09fb828dc1..c1ee3c2348 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -1065,6 +1065,7 @@ void GroupCall::start(TimeId scheduleDate, bool rtmp) { MTPstring(), // title MTP_int(scheduleDate) )).done([=](const MTPUpdates &result) { + _reloadedStaleCall = true; _acceptFields = true; _peer->session().api().applyUpdates(result); _acceptFields = false; @@ -1393,6 +1394,13 @@ void GroupCall::rejoin(not_null as) { sendSelfUpdate(SendUpdateType::CameraPaused); } sendPendingSelfUpdates(); + if (!_reloadedStaleCall + && _state.current() != State::Joining) { + if (const auto real = lookupReal()) { + _reloadedStaleCall = true; + real->reloadIfStale(); + } + } }).fail([=](const MTP::Error &error) { _joinState.finish(); diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.h b/Telegram/SourceFiles/calls/group/calls_group_call.h index 6f363c1c2e..8b8eb34ca5 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.h +++ b/Telegram/SourceFiles/calls/group/calls_group_call.h @@ -674,6 +674,7 @@ private: bool _hadJoinedState = false; bool _listenersHidden = false; bool _rtmp = false; + bool _reloadedStaleCall = false; int _rtmpVolume = 0; std::unique_ptr _mediaDevices;