2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Move updates handling MainWidget -> Api::Updates.

This commit is contained in:
John Preston
2020-06-11 13:41:03 +04:00
parent ee43027bea
commit 0b028b959b
30 changed files with 2526 additions and 2218 deletions

View File

@@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_session_controller.h"
#include "core/application.h"
#include "mainwindow.h"
#include "mainwidget.h"
#include "api/api_updates.h"
#include "apiwrap.h"
#include "main/main_session.h"
#include "facades.h"
@@ -120,9 +120,10 @@ void System::schedule(not_null<HistoryItem*> item) {
auto delay = item->Has<HistoryMessageForwarded>() ? 500 : 100;
const auto t = base::unixtime::now();
const auto ms = crl::now();
const bool isOnline = App::main()->lastWasOnline();
const auto &updates = history->session().updates();
const bool isOnline = updates.lastWasOnline();
const auto otherNotOld = ((cOtherOnline() * 1000LL) + Global::OnlineCloudTimeout() > t * 1000LL);
const bool otherLaterThanMe = (cOtherOnline() * 1000LL + (ms - App::main()->lastSetOnline()) > t * 1000LL);
const bool otherLaterThanMe = (cOtherOnline() * 1000LL + (ms - updates.lastSetOnline()) > t * 1000LL);
if (!isOnline && otherNotOld && otherLaterThanMe) {
delay = Global::NotifyCloudDelay();
} else if (cOtherOnline() >= t) {