snappymail/dev/Stores/AbstractApp.jsx

38 lines
1 KiB
React
Raw Normal View History

2015-02-03 07:58:58 +08:00
2015-11-19 01:32:29 +08:00
import ko from 'ko';
import Globals from 'Common/Globals';
import Settings from 'Storage/Settings';
2015-02-03 07:58:58 +08:00
2015-11-19 01:32:29 +08:00
class AbstractAppStore
{
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(function (bValue) {
2015-11-19 01:32:29 +08:00
const bAnim = Globals.bMobileDevice || !bValue;
2015-02-03 07:58:58 +08:00
Globals.$html.toggleClass('rl-anim', !bAnim).toggleClass('no-rl-anim', bAnim);
});
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};