mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Reload stale video chats on group / channel open.
This commit is contained in:
@@ -26,6 +26,7 @@ constexpr auto kRequestPerPage = 50;
|
||||
constexpr auto kSpeakingAfterActive = crl::time(6000);
|
||||
constexpr auto kActiveAfterJoined = crl::time(1000);
|
||||
constexpr auto kWaitForUpdatesTimeout = 3 * crl::time(1000);
|
||||
constexpr auto kReloadStaleTimeout = 16 * crl::time(1000);
|
||||
|
||||
[[nodiscard]] QString ExtractNextOffset(const MTPphone_GroupCall &call) {
|
||||
return call.match([&](const MTPDphone_groupCall &data) {
|
||||
@@ -168,6 +169,7 @@ bool GroupCall::processSavedFullCall() {
|
||||
return false;
|
||||
}
|
||||
_reloadRequestId = 0;
|
||||
_reloadLastFinished = crl::now();
|
||||
processFullCallFields(*base::take(_savedFull));
|
||||
return true;
|
||||
}
|
||||
@@ -497,6 +499,15 @@ void GroupCall::computeParticipantsCount() {
|
||||
: std::max(int(_participants.size()), _serverParticipantsCount);
|
||||
}
|
||||
|
||||
void GroupCall::reloadIfStale() {
|
||||
if (!fullCount() && !participantsLoaded()) {
|
||||
reload();
|
||||
} else if (!_reloadLastFinished
|
||||
|| crl::now() > _reloadLastFinished + kReloadStaleTimeout) {
|
||||
reload();
|
||||
}
|
||||
}
|
||||
|
||||
void GroupCall::reload() {
|
||||
if (_reloadRequestId || _applyingQueuedUpdates) {
|
||||
return;
|
||||
@@ -528,9 +539,11 @@ void GroupCall::reload() {
|
||||
return;
|
||||
}
|
||||
_reloadRequestId = 0;
|
||||
_reloadLastFinished = crl::now();
|
||||
processFullCall(result);
|
||||
}).fail([=] {
|
||||
_reloadRequestId = 0;
|
||||
_reloadLastFinished = crl::now();
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user