refactor: reduce browser storage dependence, remove unused code

This commit is contained in:
sethburkart123
2024-06-09 18:04:26 +10:00
parent db98f24555
commit 736cf36068
9 changed files with 53 additions and 42 deletions
+3 -4
View File
@@ -1,13 +1,12 @@
import browser from 'webextension-polyfill';
import localforage from 'localforage';
import { CustomTheme } from '../../../interface/types/CustomThemes';
import { applyTheme } from './applyTheme';
import { settingsState } from '../../utils/listeners/SettingsState';
export const enableCurrentTheme = async () => {
const { selectedTheme } = await browser.storage.local.get('selectedTheme') as { selectedTheme: string; };
if (selectedTheme) {
const theme = await localforage.getItem(selectedTheme) as CustomTheme;
if (settingsState.selectedTheme) {
const theme = await localforage.getItem(settingsState.selectedTheme) as CustomTheme;
if (theme) {
await applyTheme(theme);
}