2014-08-21 23:08:34 +08:00
|
|
|
|
2014-09-05 06:49:03 +08:00
|
|
|
(function () {
|
2014-08-25 23:49:01 +08:00
|
|
|
|
|
|
|
'use strict';
|
2014-08-21 23:08:34 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
2014-10-30 21:59:25 +08:00
|
|
|
function SocialUserSettings()
|
2014-08-21 23:08:34 +08:00
|
|
|
{
|
2014-08-25 15:10:51 +08:00
|
|
|
var
|
2014-09-05 06:49:03 +08:00
|
|
|
Utils = require('Common/Utils'),
|
2015-01-26 07:09:22 +08:00
|
|
|
SocialStore = require('Stores/Social')
|
2014-08-25 15:10:51 +08:00
|
|
|
;
|
|
|
|
|
2015-01-26 07:09:22 +08:00
|
|
|
this.googleEnable = SocialStore.google.enabled;
|
|
|
|
this.googleEnableAuth = SocialStore.google.capa.auth;
|
2015-06-01 01:40:54 +08:00
|
|
|
this.googleEnableAuthFast = SocialStore.google.capa.authFast;
|
2015-01-26 07:09:22 +08:00
|
|
|
this.googleEnableDrive = SocialStore.google.capa.drive;
|
|
|
|
this.googleEnablePreview = SocialStore.google.capa.preview;
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2015-01-26 07:09:22 +08:00
|
|
|
this.googleActions = SocialStore.google.loading;
|
|
|
|
this.googleLoggined = SocialStore.google.loggined;
|
|
|
|
this.googleUserName = SocialStore.google.userName;
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2015-01-26 07:09:22 +08:00
|
|
|
this.facebookEnable = SocialStore.facebook.enabled;
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2015-01-26 07:09:22 +08:00
|
|
|
this.facebookActions = SocialStore.facebook.loading;
|
|
|
|
this.facebookLoggined = SocialStore.facebook.loggined;
|
|
|
|
this.facebookUserName = SocialStore.facebook.userName;
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2015-01-26 07:09:22 +08:00
|
|
|
this.twitterEnable = SocialStore.twitter.enabled;
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2015-01-26 07:09:22 +08:00
|
|
|
this.twitterActions = SocialStore.twitter.loading;
|
|
|
|
this.twitterLoggined = SocialStore.twitter.loggined;
|
|
|
|
this.twitterUserName = SocialStore.twitter.userName;
|
2014-08-21 23:08:34 +08:00
|
|
|
|
|
|
|
this.connectGoogle = Utils.createCommand(this, function () {
|
|
|
|
if (!this.googleLoggined())
|
|
|
|
{
|
2015-11-19 01:32:29 +08:00
|
|
|
require('App/User').default.googleConnect();
|
2014-08-21 23:08:34 +08:00
|
|
|
}
|
|
|
|
}, function () {
|
|
|
|
return !this.googleLoggined() && !this.googleActions();
|
|
|
|
});
|
|
|
|
|
|
|
|
this.disconnectGoogle = Utils.createCommand(this, function () {
|
2015-11-19 01:32:29 +08:00
|
|
|
require('App/User').default.googleDisconnect();
|
2014-08-21 23:08:34 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
this.connectFacebook = Utils.createCommand(this, function () {
|
|
|
|
if (!this.facebookLoggined())
|
|
|
|
{
|
2015-11-19 01:32:29 +08:00
|
|
|
require('App/User').default.facebookConnect();
|
2014-08-21 23:08:34 +08:00
|
|
|
}
|
|
|
|
}, function () {
|
|
|
|
return !this.facebookLoggined() && !this.facebookActions();
|
|
|
|
});
|
|
|
|
|
|
|
|
this.disconnectFacebook = Utils.createCommand(this, function () {
|
2015-11-19 01:32:29 +08:00
|
|
|
require('App/User').default.facebookDisconnect();
|
2014-08-21 23:08:34 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
this.connectTwitter = Utils.createCommand(this, function () {
|
|
|
|
if (!this.twitterLoggined())
|
|
|
|
{
|
2015-11-19 01:32:29 +08:00
|
|
|
require('App/User').default.twitterConnect();
|
2014-08-21 23:08:34 +08:00
|
|
|
}
|
|
|
|
}, function () {
|
|
|
|
return !this.twitterLoggined() && !this.twitterActions();
|
|
|
|
});
|
|
|
|
|
|
|
|
this.disconnectTwitter = Utils.createCommand(this, function () {
|
2015-11-19 01:32:29 +08:00
|
|
|
require('App/User').default.twitterDisconnect();
|
2014-08-21 23:08:34 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-10-30 21:59:25 +08:00
|
|
|
module.exports = SocialUserSettings;
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-06-28 04:54:38 +08:00
|
|
|
}());
|