snappymail/dev/Settings/App/SettingsSocial.js

77 lines
1.9 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 23:49:01 +08:00
(function (module, require) {
'use strict';
2014-08-21 23:08:34 +08:00
/**
* @constructor
*/
function SettingsSocial()
{
2014-08-25 15:10:51 +08:00
var
2014-08-25 23:49:01 +08:00
Utils = require('Utils'),
2014-08-27 23:59:44 +08:00
Data = require('Storage:RainLoop: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-08-27 23:59:44 +08:00
require('App:RainLoop').googleConnect();
2014-08-21 23:08:34 +08:00
}
}, function () {
return !this.googleLoggined() && !this.googleActions();
});
this.disconnectGoogle = Utils.createCommand(this, function () {
2014-08-27 23:59:44 +08:00
require('App:RainLoop').googleDisconnect();
2014-08-21 23:08:34 +08:00
});
this.connectFacebook = Utils.createCommand(this, function () {
if (!this.facebookLoggined())
{
2014-08-27 23:59:44 +08:00
require('App:RainLoop').facebookConnect();
2014-08-21 23:08:34 +08:00
}
}, function () {
return !this.facebookLoggined() && !this.facebookActions();
});
this.disconnectFacebook = Utils.createCommand(this, function () {
2014-08-27 23:59:44 +08:00
require('App:RainLoop').facebookDisconnect();
2014-08-21 23:08:34 +08:00
});
this.connectTwitter = Utils.createCommand(this, function () {
if (!this.twitterLoggined())
{
2014-08-27 23:59:44 +08:00
require('App:RainLoop').twitterConnect();
2014-08-21 23:08:34 +08:00
}
}, function () {
return !this.twitterLoggined() && !this.twitterActions();
});
this.disconnectTwitter = Utils.createCommand(this, function () {
2014-08-27 23:59:44 +08:00
require('App:RainLoop').twitterDisconnect();
2014-08-21 23:08:34 +08:00
});
}
module.exports = SettingsSocial;
2014-08-25 23:49:01 +08:00
}(module, require));