2016-08-17 06:01:20 +08:00
|
|
|
import ko from 'ko';
|
2021-02-15 22:20:22 +08:00
|
|
|
import { isMobile } from 'Common/Globals';
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2021-01-27 07:26:31 +08:00
|
|
|
export const ThemeStore = {
|
|
|
|
themes: ko.observableArray(),
|
|
|
|
themeBackgroundName: ko.observable(''),
|
|
|
|
themeBackgroundHash: ko.observable(''),
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2021-01-27 07:26:31 +08:00
|
|
|
populate: function(){
|
2020-09-04 18:05:17 +08:00
|
|
|
const Settings = rl.settings,
|
|
|
|
themes = Settings.app('themes');
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-07-30 03:49:41 +08:00
|
|
|
this.themes(Array.isArray(themes) ? themes : []);
|
2020-09-04 18:05:17 +08:00
|
|
|
this.theme(Settings.get('Theme'));
|
2021-02-15 22:20:22 +08:00
|
|
|
if (!isMobile()) {
|
|
|
|
this.themeBackgroundName(Settings.get('UserBackgroundName'));
|
|
|
|
this.themeBackgroundHash(Settings.get('UserBackgroundHash'));
|
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2021-01-27 07:26:31 +08:00
|
|
|
};
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2021-01-27 07:26:31 +08:00
|
|
|
ThemeStore.theme = ko.observable('').extend({ limitedList: ThemeStore.themes });
|