snappymail/dev/Stores/AbstractApp.js

38 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-11-19 01:32:29 +08:00
import ko from 'ko';
import { $htmlCL, bMobileDevice } from 'Common/Globals';
2016-06-16 07:36:44 +08:00
import * as Settings from 'Storage/Settings';
2015-02-03 07:58:58 +08:00
2019-07-05 03:19:24 +08:00
class AbstractAppStore {
2016-07-16 05:29:42 +08:00
constructor() {
2015-02-03 07:58:58 +08:00
this.allowLanguagesOnSettings = ko.observable(true);
this.allowLanguagesOnLogin = ko.observable(true);
2017-02-09 01:48:53 +08:00
this.newMoveToFolder = ko.observable(true);
2015-02-03 07:58:58 +08:00
this.interfaceAnimation = ko.observable(true);
this.interfaceAnimation.subscribe((value) => {
const anim = bMobileDevice || !value;
$htmlCL.toggle('rl-anim', !anim);
$htmlCL.toggle('no-rl-anim', anim);
2015-02-03 07:58:58 +08:00
});
this.interfaceAnimation.valueHasMutated();
2015-02-03 18:42:06 +08:00
this.prem = ko.observable(false);
2015-05-03 04:22:32 +08:00
this.community = ko.observable(true);
2015-02-03 07:58:58 +08:00
}
2015-11-19 01:32:29 +08:00
populate() {
2015-02-03 07:58:58 +08:00
this.allowLanguagesOnLogin(!!Settings.settingsGet('AllowLanguagesOnLogin'));
this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
2017-02-09 01:48:53 +08:00
this.newMoveToFolder(!!Settings.settingsGet('NewMoveToFolder'));
2015-02-03 07:58:58 +08:00
this.interfaceAnimation(!!Settings.settingsGet('InterfaceAnimation'));
2015-02-03 18:42:06 +08:00
this.prem(!!Settings.settingsGet('PremType'));
2015-05-03 04:22:32 +08:00
this.community(!!Settings.settingsGet('Community'));
2015-11-19 01:32:29 +08:00
}
}
2015-02-03 07:58:58 +08:00
2019-07-05 03:19:24 +08:00
export { AbstractAppStore, AbstractAppStore as default };