forked from mystiq/hydrogen-web
Store and load theme from setting
This commit is contained in:
parent
daae7442bb
commit
ecb83bb277
2 changed files with 9 additions and 0 deletions
|
@ -133,6 +133,7 @@ export class SettingsViewModel extends ViewModel {
|
|||
|
||||
setTheme(name) {
|
||||
this.platform.setTheme(name);
|
||||
this.platform.settingsStorage.setString("theme", name);
|
||||
}
|
||||
|
||||
_formatBytes(n) {
|
||||
|
|
|
@ -178,6 +178,14 @@ export class Platform {
|
|||
this._serviceWorkerHandler,
|
||||
this._config.push
|
||||
);
|
||||
await this._loadThemeFromSetting();
|
||||
}
|
||||
|
||||
async _loadThemeFromSetting() {
|
||||
const themeName = await this.settingsStorage.getString("theme");
|
||||
if (themeName) {
|
||||
this.setTheme(themeName);
|
||||
}
|
||||
}
|
||||
|
||||
_createLogger(isDevelopment) {
|
||||
|
|
Loading…
Reference in a new issue