snappymail/dev/Settings/User/Social.js

76 lines
1.8 KiB
JavaScript
Raw Normal View History

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-18 21:43:44 +08:00
function SocialUserSetting()
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'),
2014-10-18 21:43:44 +08:00
Data = require('Storage/User/Data')
2014-08-25 15:10:51 +08:00
;
2014-08-22 23:08:56 +08:00
this.googleEnable = Data.googleEnable;
2014-08-21 23:08:34 +08:00
2014-08-22 23:08:56 +08:00
this.googleActions = Data.googleActions;
this.googleLoggined = Data.googleLoggined;
this.googleUserName = Data.googleUserName;
2014-08-21 23:08:34 +08:00
2014-08-22 23:08:56 +08:00
this.facebookEnable = Data.facebookEnable;
2014-08-21 23:08:34 +08:00
2014-08-22 23:08:56 +08:00
this.facebookActions = Data.facebookActions;
this.facebookLoggined = Data.facebookLoggined;
this.facebookUserName = Data.facebookUserName;
2014-08-21 23:08:34 +08:00
2014-08-22 23:08:56 +08:00
this.twitterEnable = Data.twitterEnable;
2014-08-21 23:08:34 +08:00
2014-08-22 23:08:56 +08:00
this.twitterActions = Data.twitterActions;
this.twitterLoggined = Data.twitterLoggined;
this.twitterUserName = Data.twitterUserName;
2014-08-21 23:08:34 +08:00
this.connectGoogle = Utils.createCommand(this, function () {
if (!this.googleLoggined())
{
2014-10-18 21:43:44 +08:00
require('App/User').googleConnect();
2014-08-21 23:08:34 +08:00
}
}, function () {
return !this.googleLoggined() && !this.googleActions();
});
this.disconnectGoogle = Utils.createCommand(this, function () {
2014-10-18 21:43:44 +08:00
require('App/User').googleDisconnect();
2014-08-21 23:08:34 +08:00
});
this.connectFacebook = Utils.createCommand(this, function () {
if (!this.facebookLoggined())
{
2014-10-18 21:43:44 +08:00
require('App/User').facebookConnect();
2014-08-21 23:08:34 +08:00
}
}, function () {
return !this.facebookLoggined() && !this.facebookActions();
});
this.disconnectFacebook = Utils.createCommand(this, function () {
2014-10-18 21:43:44 +08:00
require('App/User').facebookDisconnect();
2014-08-21 23:08:34 +08:00
});
this.connectTwitter = Utils.createCommand(this, function () {
if (!this.twitterLoggined())
{
2014-10-18 21:43:44 +08:00
require('App/User').twitterConnect();
2014-08-21 23:08:34 +08:00
}
}, function () {
return !this.twitterLoggined() && !this.twitterActions();
});
this.disconnectTwitter = Utils.createCommand(this, function () {
2014-10-18 21:43:44 +08:00
require('App/User').twitterDisconnect();
2014-08-21 23:08:34 +08:00
});
}
2014-10-18 21:43:44 +08:00
module.exports = SocialUserSetting;
2014-08-21 23:08:34 +08:00
2014-09-05 06:49:03 +08:00
}());