2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 07:05:13 +00:00

Fix crash in passcode setup.

This commit is contained in:
John Preston
2019-03-04 22:40:21 +04:00
parent c27456277e
commit f4544b0964
3 changed files with 16 additions and 2 deletions

View File

@@ -476,9 +476,17 @@ void AuthSession::saveSettingsDelayed(crl::time delay) {
_saveDataTimer.callOnce(delay);
}
void AuthSession::localPasscodeChanged() {
_shouldLockAt = 0;
_autoLockTimer.cancel();
checkAutoLock();
}
void AuthSession::checkAutoLock() {
if (!Global::LocalPasscode()
|| Core::App().passcodeLocked()) {
_shouldLockAt = 0;
_autoLockTimer.cancel();
return;
}
@@ -487,6 +495,8 @@ void AuthSession::checkAutoLock() {
const auto shouldLockInMs = Global::AutoLock() * 1000LL;
const auto checkTimeMs = now - Core::App().lastNonIdleTime();
if (checkTimeMs >= shouldLockInMs || (_shouldLockAt > 0 && now > _shouldLockAt + kAutoLockTimeoutLateMs)) {
_shouldLockAt = 0;
_autoLockTimer.cancel();
Core::App().lockByPasscode();
} else {
_shouldLockAt = now + (shouldLockInMs - checkTimeMs);