snappymail/dev/Settings/User/Social.js

69 lines
1.9 KiB
JavaScript
Raw Normal View History

2014-08-21 23:08:34 +08:00
2016-07-16 05:29:42 +08:00
import {createCommand} from 'Common/Utils';
import SocialStore from 'Stores/Social';
import {getApp} from 'Helper/Apps/User';
2016-07-16 05:29:42 +08:00
class SocialUserSettings
2016-06-30 08:02:45 +08:00
{
2016-07-16 05:29:42 +08:00
constructor() {
this.googleEnable = SocialStore.google.enabled;
this.googleEnableAuth = SocialStore.google.capa.auth;
this.googleEnableAuthFast = SocialStore.google.capa.authFast;
this.googleEnableDrive = SocialStore.google.capa.drive;
this.googleEnablePreview = SocialStore.google.capa.preview;
this.googleActions = SocialStore.google.loading;
this.googleLoggined = SocialStore.google.loggined;
this.googleUserName = SocialStore.google.userName;
this.facebookEnable = SocialStore.facebook.enabled;
this.facebookActions = SocialStore.facebook.loading;
this.facebookLoggined = SocialStore.facebook.loggined;
this.facebookUserName = SocialStore.facebook.userName;
this.twitterEnable = SocialStore.twitter.enabled;
this.twitterActions = SocialStore.twitter.loading;
this.twitterLoggined = SocialStore.twitter.loggined;
this.twitterUserName = SocialStore.twitter.userName;
this.connectGoogle = createCommand(() => {
2016-07-16 05:29:42 +08:00
if (!this.googleLoggined())
{
getApp().googleConnect();
2016-07-16 05:29:42 +08:00
}
}, () => !this.googleLoggined() && !this.googleActions());
this.disconnectGoogle = createCommand(() => {
getApp().googleDisconnect();
2016-07-16 05:29:42 +08:00
});
this.connectFacebook = createCommand(() => {
2016-07-16 05:29:42 +08:00
if (!this.facebookLoggined())
{
getApp().facebookConnect();
2016-07-16 05:29:42 +08:00
}
}, () => !this.facebookLoggined() && !this.facebookActions());
this.disconnectFacebook = createCommand(() => {
getApp().facebookDisconnect();
2016-07-16 05:29:42 +08:00
});
this.connectTwitter = createCommand(() => {
2016-07-16 05:29:42 +08:00
if (!this.twitterLoggined())
{
getApp().twitterConnect();
2016-07-16 05:29:42 +08:00
}
}, () => !this.twitterLoggined() && !this.twitterActions());
this.disconnectTwitter = createCommand(() => {
getApp().twitterDisconnect();
2016-07-16 05:29:42 +08:00
});
}
2016-06-30 08:02:45 +08:00
}
2016-07-16 03:54:37 +08:00
export {SocialUserSettings, SocialUserSettings as default};