Store and load theme from setting

This commit is contained in:
RMidhunSuresh 2022-04-25 14:47:16 +05:30
parent daae7442bb
commit ecb83bb277
2 changed files with 9 additions and 0 deletions

View file

@ -133,6 +133,7 @@ export class SettingsViewModel extends ViewModel {
setTheme(name) { setTheme(name) {
this.platform.setTheme(name); this.platform.setTheme(name);
this.platform.settingsStorage.setString("theme", name);
} }
_formatBytes(n) { _formatBytes(n) {

View file

@ -178,6 +178,14 @@ export class Platform {
this._serviceWorkerHandler, this._serviceWorkerHandler,
this._config.push this._config.push
); );
await this._loadThemeFromSetting();
}
async _loadThemeFromSetting() {
const themeName = await this.settingsStorage.getString("theme");
if (themeName) {
this.setTheme(themeName);
}
} }
_createLogger(isDevelopment) { _createLogger(isDevelopment) {