snappymail/dev/Settings/App/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
*/
function SocialAppSetting()
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'),
Data = require('Storage/App/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())
{
require('App/App').googleConnect();
2014-08-21 23:08:34 +08:00
}
}, function () {
return !this.googleLoggined() && !this.googleActions();
});
this.disconnectGoogle = Utils.createCommand(this, function () {
require('App/App').googleDisconnect();
2014-08-21 23:08:34 +08:00
});
this.connectFacebook = Utils.createCommand(this, function () {
if (!this.facebookLoggined())
{
require('App/App').facebookConnect();
2014-08-21 23:08:34 +08:00
}
}, function () {
return !this.facebookLoggined() && !this.facebookActions();
});
this.disconnectFacebook = Utils.createCommand(this, function () {
require('App/App').facebookDisconnect();
2014-08-21 23:08:34 +08:00
});
this.connectTwitter = Utils.createCommand(this, function () {
if (!this.twitterLoggined())
{
require('App/App').twitterConnect();
2014-08-21 23:08:34 +08:00
}
}, function () {
return !this.twitterLoggined() && !this.twitterActions();
});
this.disconnectTwitter = Utils.createCommand(this, function () {
require('App/App').twitterDisconnect();
2014-08-21 23:08:34 +08:00
});
}
module.exports = SocialAppSetting;
2014-08-21 23:08:34 +08:00
2014-09-05 06:49:03 +08:00
}());