fix: delete autolock pref on passcode remove
This commit is contained in:
@@ -549,7 +549,9 @@ class AccountMenuCtrl extends PureViewCtrl<{}, AccountMenuState> {
|
||||
confirmButtonStyle: 'danger'
|
||||
})) {
|
||||
await preventRefreshing(STRING_CONFIRM_APP_QUIT_DURING_PASSCODE_REMOVAL, async () => {
|
||||
await this.application.getAutolockService().deleteAutolockPreference();
|
||||
await this.application!.removePasscode();
|
||||
await this.reloadAutoLockInterval();
|
||||
});
|
||||
this.refreshEncryptionStatus();
|
||||
}
|
||||
|
||||
@@ -43,12 +43,16 @@ export class AutolockService extends ApplicationService {
|
||||
|
||||
deinit() {
|
||||
this.unsubState();
|
||||
this.cancelAutoLockTimer();
|
||||
if (this.pollFocusInterval) {
|
||||
clearInterval(this.pollFocusInterval);
|
||||
}
|
||||
}
|
||||
|
||||
private lockApplication() {
|
||||
if (!this.application.hasPasscode()) {
|
||||
throw Error('Attempting to lock application with no passcode');
|
||||
}
|
||||
this.application.lock();
|
||||
}
|
||||
|
||||
@@ -70,6 +74,13 @@ export class AutolockService extends ApplicationService {
|
||||
}
|
||||
}
|
||||
|
||||
async deleteAutolockPreference() {
|
||||
await this.application!.removeValue(
|
||||
STORAGE_KEY_AUTOLOCK_INTERVAL
|
||||
);
|
||||
this.cancelAutoLockTimer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify document is in focus every so often as visibilitychange event is
|
||||
* not triggered on a typical window blur event but rather on tab changes.
|
||||
@@ -133,7 +144,7 @@ export class AutolockService extends ApplicationService {
|
||||
}
|
||||
|
||||
async beginAutoLockTimer() {
|
||||
var interval = await this.getAutoLockInterval();
|
||||
const interval = await this.getAutoLockInterval();
|
||||
if (interval === LOCK_INTERVAL_NONE) {
|
||||
return;
|
||||
}
|
||||
@@ -160,5 +171,6 @@ export class AutolockService extends ApplicationService {
|
||||
cancelAutoLockTimer() {
|
||||
clearTimeout(this.lockTimeout);
|
||||
this.lockAfterDate = undefined;
|
||||
this.lockTimeout = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user