mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
This reverts commit cf24113924.
This commit is contained in:
@@ -26,11 +26,9 @@ export class OptionsComponent implements OnInit {
|
||||
disableIcons: boolean;
|
||||
enableGravatars: boolean;
|
||||
enableFullWidth: boolean;
|
||||
theme: string;
|
||||
locale: string;
|
||||
vaultTimeouts: any[];
|
||||
localeOptions: any[];
|
||||
themeOptions: any[];
|
||||
|
||||
private startingLocale: string;
|
||||
|
||||
@@ -62,11 +60,6 @@ export class OptionsComponent implements OnInit {
|
||||
localeOptions.sort(Utils.getSortFunction(i18nService, 'name'));
|
||||
localeOptions.splice(0, 0, { name: i18nService.t('default'), value: null });
|
||||
this.localeOptions = localeOptions;
|
||||
this.themeOptions = [
|
||||
{ name: i18nService.t('themeDefault'), value: 'themeDefaultSet' },
|
||||
{ name: i18nService.t('themeLight'), value: 'themeLight' },
|
||||
{ name: i18nService.t('themeDark'), value: 'themeDark' },
|
||||
];
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -76,7 +69,6 @@ export class OptionsComponent implements OnInit {
|
||||
this.enableGravatars = await this.storageService.get<boolean>('enableGravatars');
|
||||
this.enableFullWidth = await this.storageService.get<boolean>('enableFullWidth');
|
||||
this.locale = this.startingLocale = await this.storageService.get<string>(ConstantsService.localeKey);
|
||||
this.theme = await this.storageService.get<string>(ConstantsService.themeKey);
|
||||
}
|
||||
|
||||
async submit() {
|
||||
@@ -88,7 +80,6 @@ export class OptionsComponent implements OnInit {
|
||||
await this.stateService.save('enableGravatars', this.enableGravatars);
|
||||
await this.storageService.save('enableFullWidth', this.enableFullWidth);
|
||||
this.messagingService.send('setFullWidth');
|
||||
await this.storageService.save('theme', this.theme);
|
||||
await this.storageService.save(ConstantsService.localeKey, this.locale);
|
||||
if (this.locale !== this.startingLocale) {
|
||||
window.location.reload();
|
||||
@@ -110,22 +101,4 @@ export class OptionsComponent implements OnInit {
|
||||
}
|
||||
this.vaultTimeoutAction = newValue;
|
||||
}
|
||||
|
||||
async themeChanged(themeUpdate: string) {
|
||||
const theme = ['themeDefaultSet', 'themeDark', 'themeLight'];
|
||||
const htmlEl = window.document.documentElement;
|
||||
theme.forEach(element => {
|
||||
htmlEl.classList.remove(element);
|
||||
});
|
||||
if (themeUpdate === 'themeDefaultSet') {
|
||||
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
htmlEl.classList.add('themeDark', themeUpdate);
|
||||
}
|
||||
if (window.matchMedia('(prefers-color-scheme: light)').matches) {
|
||||
htmlEl.classList.add('themeLight', themeUpdate);
|
||||
}
|
||||
} else {
|
||||
htmlEl.classList.add(themeUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user