mirror of
https://github.com/bitwarden/browser
synced 2025-01-20 08:22:13 +01:00
use utils for lock options settings
This commit is contained in:
parent
b6a5180a6a
commit
ab1a918326
@ -32,10 +32,9 @@ export class SettingsController {
|
||||
}, 500);
|
||||
|
||||
this.showOnLocked = !utilsService.isFirefox() && !utilsService.isEdge();
|
||||
|
||||
chrome.storage.local.get(constantsService.lockOptionKey, (obj: any) => {
|
||||
if (obj && (obj[constantsService.lockOptionKey] || obj[constantsService.lockOptionKey] === 0)) {
|
||||
let option = obj[constantsService.lockOptionKey].toString();
|
||||
this.utilsService.getObjFromStorage(constantsService.lockOptionKey).then((lockOption: number) => {
|
||||
if (lockOption != null) {
|
||||
let option = lockOption.toString();
|
||||
if (option === '-2' && !this.showOnLocked) {
|
||||
option = '-1';
|
||||
}
|
||||
@ -47,14 +46,10 @@ export class SettingsController {
|
||||
}
|
||||
|
||||
changeLockOption() {
|
||||
const obj: any = {};
|
||||
obj[this.constantsService.lockOptionKey] = null;
|
||||
if (this.lockOption && this.lockOption !== '') {
|
||||
obj[this.constantsService.lockOptionKey] = parseInt(this.lockOption, 10);
|
||||
}
|
||||
|
||||
chrome.storage.local.set(obj, () => {
|
||||
this.cryptoService.getKeyHash().then((keyHash) => {
|
||||
const option = this.lockOption && this.lockOption !== '' ? parseInt(this.lockOption, 10) : null;
|
||||
this.utilsService.saveObjToStorage(this.constantsService.lockOptionKey, option).then(() => {
|
||||
return this.cryptoService.getKeyHash();
|
||||
}).then((keyHash) => {
|
||||
if (keyHash) {
|
||||
this.cryptoService.toggleKey();
|
||||
} else {
|
||||
@ -72,7 +67,6 @@ export class SettingsController {
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
lock() {
|
||||
|
Loading…
Reference in New Issue
Block a user