mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-04 05:52:44 +08:00
0b64083543
Array.isNotEmpty to isNonEmptyArray
27 lines
850 B
JavaScript
27 lines
850 B
JavaScript
import ko from 'ko';
|
|
import { $htmlCL, leftPanelDisabled, Settings, SettingsGet } from 'Common/Globals';
|
|
import { isArray } from 'Common/Utils';
|
|
|
|
export const ThemeStore = {
|
|
themes: ko.observableArray(),
|
|
userBackgroundName: ko.observable(''),
|
|
userBackgroundHash: ko.observable(''),
|
|
isMobile: ko.observable($htmlCL.contains('rl-mobile')),
|
|
|
|
populate: function(){
|
|
const themes = Settings.app('themes');
|
|
|
|
this.themes(isArray(themes) ? themes : []);
|
|
this.theme(SettingsGet('Theme'));
|
|
if (!this.isMobile()) {
|
|
this.userBackgroundName(SettingsGet('UserBackgroundName'));
|
|
this.userBackgroundHash(SettingsGet('UserBackgroundHash'));
|
|
}
|
|
|
|
leftPanelDisabled(this.isMobile());
|
|
}
|
|
};
|
|
|
|
ThemeStore.theme = ko.observable('').extend({ limitedList: ThemeStore.themes });
|
|
|
|
ThemeStore.isMobile.subscribe(value => $htmlCL.toggle('rl-mobile', value));
|