Fix idle time checking in MainWidget.

Regression was introduced in 78d00bcf22.

Fixes #5779, fixes #5780.
This commit is contained in:
John Preston 2019-03-13 11:21:56 +04:00
parent ed93669693
commit f9f84fd407
1 changed files with 3 additions and 2 deletions

View File

@ -3680,7 +3680,7 @@ void MainWidget::updateOnline(bool gotOtherOffline) {
bool isOnline = !App::quitting() && App::wnd()->isActive(); bool isOnline = !App::quitting() && App::wnd()->isActive();
int updateIn = Global::OnlineUpdatePeriod(); int updateIn = Global::OnlineUpdatePeriod();
if (isOnline) { if (isOnline) {
const auto idle = crl::now() - Platform::LastUserInputTime(); const auto idle = crl::now() - Core::App().lastNonIdleTime();
if (idle >= Global::OfflineIdleTimeout()) { if (idle >= Global::OfflineIdleTimeout()) {
isOnline = false; isOnline = false;
if (!_isIdle) { if (!_isIdle) {
@ -3796,7 +3796,8 @@ void MainWidget::writeDrafts(History *history) {
} }
void MainWidget::checkIdleFinish() { void MainWidget::checkIdleFinish() {
if (crl::now() - Platform::LastUserInputTime() < Global::OfflineIdleTimeout()) { if (crl::now() - Core::App().lastNonIdleTime()
< Global::OfflineIdleTimeout()) {
_idleFinishTimer.cancel(); _idleFinishTimer.cancel();
_isIdle = false; _isIdle = false;
updateOnline(); updateOnline();