mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 22:16:14 +00:00
Refactored counting idle time.
- psIdleTime() was replaced with Platform::LastUserInputTime(). - _lastTimeVideoPlayedAt was moved to Application as _lastNonIdleTime. - Call of updateNonIdle() was added while voice is recording. - Fixed #5695. - Thanks Preston. =)
This commit is contained in:
@@ -483,11 +483,9 @@ void AuthSession::checkAutoLock() {
|
||||
}
|
||||
|
||||
Core::App().checkLocalTime();
|
||||
auto now = crl::now();
|
||||
auto shouldLockInMs = Global::AutoLock() * 1000LL;
|
||||
auto idleForMs = psIdleTime();
|
||||
auto notPlayingVideoForMs = now - settings().lastTimeVideoPlayedAt();
|
||||
auto checkTimeMs = qMin(idleForMs, notPlayingVideoForMs);
|
||||
const auto now = crl::now();
|
||||
const auto shouldLockInMs = Global::AutoLock() * 1000LL;
|
||||
const auto checkTimeMs = now - Core::App().lastNonIdleTime();
|
||||
if (checkTimeMs >= shouldLockInMs || (_shouldLockAt > 0 && now > _shouldLockAt + kAutoLockTimeoutLateMs)) {
|
||||
Core::App().lockByPasscode();
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user