snappymail/dev/Stores/AbstractApp.js

37 lines
1 KiB
JavaScript
Raw Normal View History

2015-02-03 07:58:58 +08:00
2015-11-19 01:32:29 +08:00
import ko from 'ko';
2016-06-07 05:57:52 +08:00
import {$html, 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
2015-11-19 01:32:29 +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);
this.interfaceAnimation = ko.observable(true);
this.interfaceAnimation.subscribe((value) => {
const anim = bMobileDevice || !value;
$html.toggleClass('rl-anim', !anim).toggleClass('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'));
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
2015-11-19 01:32:29 +08:00
export {AbstractAppStore, AbstractAppStore as default};