snappymail/dev/Settings/SettingsSocial.js

77 lines
1.8 KiB
JavaScript
Raw Normal View History

2014-08-21 23:08:34 +08:00
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
2014-08-25 15:10:51 +08:00
'use strict';
2014-08-21 23:08:34 +08:00
(function (module) {
/**
* @constructor
*/
function SettingsSocial()
{
2014-08-25 15:10:51 +08:00
var
Utils = require('../Common/Utils.js'),
RL = require('../Boots/RainLoopApp.js'),
Data = require('../Storages/WebMailDataStorage.js')
;
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())
{
RL.googleConnect();
}
}, function () {
return !this.googleLoggined() && !this.googleActions();
});
this.disconnectGoogle = Utils.createCommand(this, function () {
RL.googleDisconnect();
});
this.connectFacebook = Utils.createCommand(this, function () {
if (!this.facebookLoggined())
{
RL.facebookConnect();
}
}, function () {
return !this.facebookLoggined() && !this.facebookActions();
});
this.disconnectFacebook = Utils.createCommand(this, function () {
RL.facebookDisconnect();
});
this.connectTwitter = Utils.createCommand(this, function () {
if (!this.twitterLoggined())
{
RL.twitterConnect();
}
}, function () {
return !this.twitterLoggined() && !this.twitterActions();
});
this.disconnectTwitter = Utils.createCommand(this, function () {
RL.twitterDisconnect();
});
}
module.exports = SettingsSocial;
}(module));