mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 19:19:21 +03:00
Removed: twitter, google, dropbox, facebook, owncloud, modernizr from JavaScript
This commit is contained in:
parent
e8d38a6870
commit
4468d5bd22
60 changed files with 7 additions and 4152 deletions
|
|
@ -26,7 +26,6 @@ import * as Settings from 'Storage/Settings';
|
|||
|
||||
import LanguageStore from 'Stores/Language';
|
||||
import ThemeStore from 'Stores/Theme';
|
||||
import SocialStore from 'Stores/Social';
|
||||
|
||||
import { routeOff, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractBoot } from 'Knoin/AbstractBoot';
|
||||
|
|
@ -38,7 +37,6 @@ class AbstractApp extends AbstractBoot {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.googlePreviewSupportedCache = null;
|
||||
this.isLocalAutocomplete = true;
|
||||
this.iframe = null;
|
||||
this.lastErrorTime = 0;
|
||||
|
|
@ -140,18 +138,6 @@ class AbstractApp extends AbstractBoot {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
googlePreviewSupported() {
|
||||
if (null === this.googlePreviewSupportedCache) {
|
||||
this.googlePreviewSupportedCache =
|
||||
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialPreview');
|
||||
}
|
||||
|
||||
return this.googlePreviewSupportedCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} title
|
||||
*/
|
||||
|
|
@ -345,7 +331,6 @@ class AbstractApp extends AbstractBoot {
|
|||
|
||||
LanguageStore.populate();
|
||||
ThemeStore.populate();
|
||||
SocialStore.populate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
104
dev/App/User.js
104
dev/App/User.js
|
|
@ -56,17 +56,13 @@ import {
|
|||
mailBox,
|
||||
root,
|
||||
openPgpWorkerJs,
|
||||
openPgpJs,
|
||||
socialGoogle,
|
||||
socialTwitter,
|
||||
socialFacebook
|
||||
openPgpJs
|
||||
} from 'Common/Links';
|
||||
|
||||
import * as Events from 'Common/Events';
|
||||
|
||||
import { getNotification, i18n } from 'Common/Translator';
|
||||
|
||||
import SocialStore from 'Stores/Social';
|
||||
import AppStore from 'Stores/User/App';
|
||||
import SettingsStore from 'Stores/User/Settings';
|
||||
import NotificationStore from 'Stores/User/Notification';
|
||||
|
|
@ -160,8 +156,6 @@ class AppUser extends AbstractApp {
|
|||
.removeAttr('style');
|
||||
}, Magics.Time1s);
|
||||
}
|
||||
|
||||
this.socialUsers = _.bind(this.socialUsers, this);
|
||||
}
|
||||
|
||||
remote() {
|
||||
|
|
@ -854,72 +848,6 @@ class AppUser extends AbstractApp {
|
|||
}
|
||||
}
|
||||
|
||||
googleConnect() {
|
||||
window.open(
|
||||
socialGoogle(),
|
||||
'Google',
|
||||
'left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes'
|
||||
);
|
||||
}
|
||||
|
||||
twitterConnect() {
|
||||
window.open(
|
||||
socialTwitter(),
|
||||
'Twitter',
|
||||
'left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes'
|
||||
);
|
||||
}
|
||||
|
||||
facebookConnect() {
|
||||
window.open(
|
||||
socialFacebook(),
|
||||
'Facebook',
|
||||
'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean=} fireAllActions = false
|
||||
*/
|
||||
socialUsers(fireAllActions = false) {
|
||||
if (true === fireAllActions) {
|
||||
SocialStore.google.loading(true);
|
||||
SocialStore.facebook.loading(true);
|
||||
SocialStore.twitter.loading(true);
|
||||
}
|
||||
|
||||
Remote.socialUsers((result, data) => {
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
SocialStore.google.userName(data.Result.Google || '');
|
||||
SocialStore.facebook.userName(data.Result.Facebook || '');
|
||||
SocialStore.twitter.userName(data.Result.Twitter || '');
|
||||
} else {
|
||||
SocialStore.google.userName('');
|
||||
SocialStore.facebook.userName('');
|
||||
SocialStore.twitter.userName('');
|
||||
}
|
||||
|
||||
SocialStore.google.loading(false);
|
||||
SocialStore.facebook.loading(false);
|
||||
SocialStore.twitter.loading(false);
|
||||
});
|
||||
}
|
||||
|
||||
googleDisconnect() {
|
||||
SocialStore.google.loading(true);
|
||||
Remote.googleDisconnect(this.socialUsers);
|
||||
}
|
||||
|
||||
facebookDisconnect() {
|
||||
SocialStore.facebook.loading(true);
|
||||
Remote.facebookDisconnect(this.socialUsers);
|
||||
}
|
||||
|
||||
twitterDisconnect() {
|
||||
SocialStore.twitter.loading(true);
|
||||
Remote.twitterDisconnect(this.socialUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} query
|
||||
* @param {Function} autocompleteCallback
|
||||
|
|
@ -1198,10 +1126,7 @@ class AppUser extends AbstractApp {
|
|||
let contactsSyncInterval = pInt(Settings.settingsGet('ContactsSyncInterval'));
|
||||
|
||||
const jsHash = Settings.appSettingsGet('jsHash'),
|
||||
startupUrl = pString(Settings.settingsGet('StartupUrl')),
|
||||
allowGoogle = Settings.settingsGet('AllowGoogleSocial'),
|
||||
allowFacebook = Settings.settingsGet('AllowFacebookSocial'),
|
||||
allowTwitter = Settings.settingsGet('AllowTwitterSocial');
|
||||
startupUrl = pString(Settings.settingsGet('StartupUrl'));
|
||||
|
||||
if (progressJs) {
|
||||
progressJs.set(90);
|
||||
|
|
@ -1276,10 +1201,6 @@ class AppUser extends AbstractApp {
|
|||
// false ? AboutUserScreen : null
|
||||
]);
|
||||
|
||||
if (allowGoogle || allowFacebook || allowTwitter) {
|
||||
this.socialUsers(true);
|
||||
}
|
||||
|
||||
Events.sub('interval.2m', () => this.folderInformation(getFolderInboxName()));
|
||||
Events.sub('interval.3m', () => {
|
||||
const sF = FolderStore.currentFolderFullNameRaw();
|
||||
|
|
@ -1356,27 +1277,6 @@ class AppUser extends AbstractApp {
|
|||
this.bootstartLoginScreen();
|
||||
}
|
||||
|
||||
if (allowGoogle) {
|
||||
window['rl_' + jsHash + '_google_service'] = () => {
|
||||
SocialStore.google.loading(true);
|
||||
this.socialUsers();
|
||||
};
|
||||
}
|
||||
|
||||
if (allowFacebook) {
|
||||
window['rl_' + jsHash + '_facebook_service'] = () => {
|
||||
SocialStore.facebook.loading(true);
|
||||
this.socialUsers();
|
||||
};
|
||||
}
|
||||
|
||||
if (allowTwitter) {
|
||||
window['rl_' + jsHash + '_twitter_service'] = () => {
|
||||
SocialStore.twitter.loading(true);
|
||||
this.socialUsers();
|
||||
};
|
||||
}
|
||||
|
||||
Events.sub('interval.1m', () => momentReload());
|
||||
|
||||
runHook('rl-start-screens');
|
||||
|
|
|
|||
|
|
@ -255,35 +255,6 @@ export function exportContactsCsv() {
|
|||
return SERVER_PREFIX + '/Raw/' + SUB_QUERY_PREFIX + '/' + AUTH_PREFIX + '/ContactsCsv/';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} xauth = false
|
||||
* @returns {string}
|
||||
*/
|
||||
export function socialGoogle(xauth = false) {
|
||||
return (
|
||||
SERVER_PREFIX +
|
||||
'SocialGoogle' +
|
||||
('' !== AUTH_PREFIX ? '/' + SUB_QUERY_PREFIX + '/' + AUTH_PREFIX + '/' : '') +
|
||||
(xauth ? '&xauth=1' : '')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
export function socialTwitter() {
|
||||
return SERVER_PREFIX + 'SocialTwitter' + ('' !== AUTH_PREFIX ? '/' + SUB_QUERY_PREFIX + '/' + AUTH_PREFIX + '/' : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
export function socialFacebook() {
|
||||
return (
|
||||
SERVER_PREFIX + 'SocialFacebook' + ('' !== AUTH_PREFIX ? '/' + SUB_QUERY_PREFIX + '/' + AUTH_PREFIX + '/' : '')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @returns {string}
|
||||
|
|
|
|||
|
|
@ -909,55 +909,6 @@ class RemoteUserAjax extends AbstractAjaxRemote {
|
|||
clearUserBackground(fCallback) {
|
||||
this.defaultRequest(fCallback, 'ClearUserBackground');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
facebookUser(fCallback) {
|
||||
this.defaultRequest(fCallback, 'SocialFacebookUserInformation');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
facebookDisconnect(fCallback) {
|
||||
this.defaultRequest(fCallback, 'SocialFacebookDisconnect');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
twitterUser(fCallback) {
|
||||
this.defaultRequest(fCallback, 'SocialTwitterUserInformation');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
twitterDisconnect(fCallback) {
|
||||
this.defaultRequest(fCallback, 'SocialTwitterDisconnect');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
googleUser(fCallback) {
|
||||
this.defaultRequest(fCallback, 'SocialGoogleUserInformation');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
googleDisconnect(fCallback) {
|
||||
this.defaultRequest(fCallback, 'SocialGoogleDisconnect');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
socialUsers(fCallback) {
|
||||
this.defaultRequest(fCallback, 'SocialUsers');
|
||||
}
|
||||
}
|
||||
|
||||
export default new RemoteUserAjax();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import { DomainsAdminSettings } from 'Settings/Admin/Domains';
|
|||
import { LoginAdminSettings } from 'Settings/Admin/Login';
|
||||
import { ContactsAdminSettings } from 'Settings/Admin/Contacts';
|
||||
import { SecurityAdminSettings } from 'Settings/Admin/Security';
|
||||
import { SocialAdminSettings } from 'Settings/Admin/Social';
|
||||
import { PluginsAdminSettings } from 'Settings/Admin/Plugins';
|
||||
import { PackagesAdminSettings } from 'Settings/Admin/Packages';
|
||||
import { AboutAdminSettings } from 'Settings/Admin/About';
|
||||
|
|
@ -57,13 +56,6 @@ class SettingsAdminScreen extends AbstractSettingsScreen {
|
|||
|
||||
addSettingsViewModel(SecurityAdminSettings, 'AdminSettingsSecurity', 'TABS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
|
||||
addSettingsViewModel(
|
||||
SocialAdminSettings,
|
||||
'AdminSettingsSocial',
|
||||
'TABS_LABELS/LABEL_INTEGRATION_NAME',
|
||||
'integrations'
|
||||
);
|
||||
|
||||
addSettingsViewModel(PluginsAdminSettings, 'AdminSettingsPlugins', 'TABS_LABELS/LABEL_PLUGINS_NAME', 'plugins');
|
||||
|
||||
addSettingsViewModel(PackagesAdminSettings, 'AdminSettingsPackages', 'TABS_LABELS/LABEL_PACKAGES_NAME', 'packages');
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import { ContactsUserSettings } from 'Settings/User/Contacts';
|
|||
import { AccountsUserSettings } from 'Settings/User/Accounts';
|
||||
import { FiltersUserSettings } from 'Settings/User/Filters';
|
||||
import { SecurityUserSettings } from 'Settings/User/Security';
|
||||
import { SocialUserSettings } from 'Settings/User/Social';
|
||||
import { ChangePasswordUserSettings } from 'Settings/User/ChangePassword';
|
||||
import { TemplatesUserSettings } from 'Settings/User/Templates';
|
||||
import { FoldersUserSettings } from 'Settings/User/Folders';
|
||||
|
|
@ -80,15 +79,6 @@ class SettingsUserScreen extends AbstractSettingsScreen {
|
|||
addSettingsViewModel(SecurityUserSettings, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
}
|
||||
|
||||
if (
|
||||
AccountStore.isRootAccount() &&
|
||||
((Settings.settingsGet('AllowGoogleSocial') && Settings.settingsGet('AllowGoogleSocialAuth')) ||
|
||||
Settings.settingsGet('AllowFacebookSocial') ||
|
||||
Settings.settingsGet('AllowTwitterSocial'))
|
||||
) {
|
||||
addSettingsViewModel(SocialUserSettings, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
|
||||
}
|
||||
|
||||
if (Settings.settingsGet('ChangePasswordIsAllowed')) {
|
||||
addSettingsViewModel(
|
||||
ChangePasswordUserSettings,
|
||||
|
|
|
|||
|
|
@ -1,105 +0,0 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import { SaveSettingsStep, Magics } from 'Common/Enums';
|
||||
import { settingsSaveHelperSimpleFunction, trim, boolToAjax } from 'Common/Utils';
|
||||
|
||||
import SocialStore from 'Stores/Social';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
class SocialAdminSettings {
|
||||
constructor() {
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
this.googleEnableAuthGmail = SocialStore.google.capa.authGmail;
|
||||
this.googleEnableDrive = SocialStore.google.capa.drive;
|
||||
this.googleEnablePreview = SocialStore.google.capa.preview;
|
||||
|
||||
this.googleEnableRequireClientSettings = SocialStore.google.require.clientSettings;
|
||||
this.googleEnableRequireApiKey = SocialStore.google.require.apiKeySettings;
|
||||
|
||||
this.googleClientID = SocialStore.google.clientID;
|
||||
this.googleClientSecret = SocialStore.google.clientSecret;
|
||||
this.googleApiKey = SocialStore.google.apiKey;
|
||||
|
||||
this.googleTrigger1 = ko.observable(SaveSettingsStep.Idle);
|
||||
this.googleTrigger2 = ko.observable(SaveSettingsStep.Idle);
|
||||
this.googleTrigger3 = ko.observable(SaveSettingsStep.Idle);
|
||||
|
||||
this.facebookSupported = SocialStore.facebook.supported;
|
||||
this.facebookEnable = SocialStore.facebook.enabled;
|
||||
this.facebookAppID = SocialStore.facebook.appID;
|
||||
this.facebookAppSecret = SocialStore.facebook.appSecret;
|
||||
|
||||
this.facebookTrigger1 = ko.observable(SaveSettingsStep.Idle);
|
||||
this.facebookTrigger2 = ko.observable(SaveSettingsStep.Idle);
|
||||
|
||||
this.twitterEnable = SocialStore.twitter.enabled;
|
||||
this.twitterConsumerKey = SocialStore.twitter.consumerKey;
|
||||
this.twitterConsumerSecret = SocialStore.twitter.consumerSecret;
|
||||
|
||||
this.twitterTrigger1 = ko.observable(SaveSettingsStep.Idle);
|
||||
this.twitterTrigger2 = ko.observable(SaveSettingsStep.Idle);
|
||||
|
||||
this.dropboxEnable = SocialStore.dropbox.enabled;
|
||||
this.dropboxApiKey = SocialStore.dropbox.apiKey;
|
||||
|
||||
this.dropboxTrigger1 = ko.observable(SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
_.delay(() => {
|
||||
const f1 = settingsSaveHelperSimpleFunction(this.facebookTrigger1, this),
|
||||
f2 = settingsSaveHelperSimpleFunction(this.facebookTrigger2, this),
|
||||
f3 = settingsSaveHelperSimpleFunction(this.twitterTrigger1, this),
|
||||
f4 = settingsSaveHelperSimpleFunction(this.twitterTrigger2, this),
|
||||
f5 = settingsSaveHelperSimpleFunction(this.googleTrigger1, this),
|
||||
f6 = settingsSaveHelperSimpleFunction(this.googleTrigger2, this),
|
||||
f7 = settingsSaveHelperSimpleFunction(this.googleTrigger3, this),
|
||||
f8 = settingsSaveHelperSimpleFunction(this.dropboxTrigger1, this);
|
||||
|
||||
this.facebookEnable.subscribe((value) => {
|
||||
if (this.facebookSupported()) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'FacebookEnable': boolToAjax(value)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.facebookAppID.subscribe((value) => {
|
||||
if (this.facebookSupported()) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'FacebookAppID': trim(value)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.facebookAppSecret.subscribe((value) => {
|
||||
if (this.facebookSupported()) {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'FacebookAppSecret': trim(value)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.twitterEnable.subscribe(Remote.saveAdminConfigHelper('TwitterEnable', boolToAjax));
|
||||
this.twitterConsumerKey.subscribe(Remote.saveAdminConfigHelper('TwitterConsumerKey', trim, f3));
|
||||
this.twitterConsumerSecret.subscribe(Remote.saveAdminConfigHelper('TwitterConsumerSecret', trim, f4));
|
||||
|
||||
this.googleEnable.subscribe(Remote.saveAdminConfigHelper('GoogleEnable', boolToAjax));
|
||||
this.googleEnableAuth.subscribe(Remote.saveAdminConfigHelper('GoogleEnableAuth', boolToAjax));
|
||||
this.googleEnableAuthGmail.subscribe(Remote.saveAdminConfigHelper('GoogleEnableAuthGmail', boolToAjax));
|
||||
this.googleEnableDrive.subscribe(Remote.saveAdminConfigHelper('GoogleEnableDrive', boolToAjax));
|
||||
this.googleEnablePreview.subscribe(Remote.saveAdminConfigHelper('GoogleEnablePreview', boolToAjax));
|
||||
this.googleClientID.subscribe(Remote.saveAdminConfigHelper('GoogleClientID', trim, f5));
|
||||
this.googleClientSecret.subscribe(Remote.saveAdminConfigHelper('GoogleClientSecret', trim, f6));
|
||||
this.googleApiKey.subscribe(Remote.saveAdminConfigHelper('GoogleApiKey', trim, f7));
|
||||
|
||||
this.dropboxEnable.subscribe(Remote.saveAdminConfigHelper('DropboxEnable', boolToAjax));
|
||||
this.dropboxApiKey.subscribe(Remote.saveAdminConfigHelper('DropboxApiKey', trim, f8));
|
||||
}, Magics.Time50ms);
|
||||
}
|
||||
}
|
||||
|
||||
export { SocialAdminSettings, SocialAdminSettings as default };
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
import SocialStore from 'Stores/Social';
|
||||
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import { command } from 'Knoin/Knoin';
|
||||
|
||||
class SocialUserSettings {
|
||||
constructor() {
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
this.googleEnableAuthGmail = SocialStore.google.capa.authGmail;
|
||||
this.googleEnableDrive = SocialStore.google.capa.drive;
|
||||
this.googleEnablePreview = SocialStore.google.capa.preview;
|
||||
|
||||
this.googleActions = SocialStore.google.loading;
|
||||
this.googleLoggined = SocialStore.google.loggined;
|
||||
this.googleUserName = SocialStore.google.userName;
|
||||
|
||||
this.facebookEnable = SocialStore.facebook.enabled;
|
||||
|
||||
this.facebookActions = SocialStore.facebook.loading;
|
||||
this.facebookLoggined = SocialStore.facebook.loggined;
|
||||
this.facebookUserName = SocialStore.facebook.userName;
|
||||
|
||||
this.twitterEnable = SocialStore.twitter.enabled;
|
||||
|
||||
this.twitterActions = SocialStore.twitter.loading;
|
||||
this.twitterLoggined = SocialStore.twitter.loggined;
|
||||
this.twitterUserName = SocialStore.twitter.userName;
|
||||
}
|
||||
|
||||
@command((self) => !self.googleLoggined() && !self.googleActions())
|
||||
connectGoogleCommand() {
|
||||
if (!this.googleLoggined()) {
|
||||
getApp().googleConnect();
|
||||
}
|
||||
}
|
||||
|
||||
@command()
|
||||
disconnectGoogleCommand() {
|
||||
getApp().googleDisconnect();
|
||||
}
|
||||
|
||||
@command((self) => !self.facebookLoggined() && !self.facebookActions())
|
||||
connectFacebookCommand() {
|
||||
if (!this.facebookLoggined()) {
|
||||
getApp().facebookConnect();
|
||||
}
|
||||
}
|
||||
|
||||
@command()
|
||||
disconnectFacebookCommand() {
|
||||
getApp().facebookDisconnect();
|
||||
}
|
||||
|
||||
@command((self) => !self.twitterLoggined() && !self.twitterActions())
|
||||
connectTwitterCommand() {
|
||||
if (!this.twitterLoggined()) {
|
||||
getApp().twitterConnect();
|
||||
}
|
||||
}
|
||||
|
||||
@command()
|
||||
disconnectTwitterCommand() {
|
||||
getApp().twitterDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
export { SocialUserSettings, SocialUserSettings as default };
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
import window from 'window';
|
||||
import ko from 'ko';
|
||||
import $ from '$';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class SocialStore {
|
||||
constructor() {
|
||||
this.google = {};
|
||||
this.twitter = {};
|
||||
this.facebook = {};
|
||||
this.dropbox = {};
|
||||
|
||||
// Google
|
||||
this.google.enabled = ko.observable(false);
|
||||
|
||||
this.google.clientID = ko.observable('');
|
||||
this.google.clientSecret = ko.observable('');
|
||||
this.google.apiKey = ko.observable('');
|
||||
|
||||
this.google.loading = ko.observable(false);
|
||||
this.google.userName = ko.observable('');
|
||||
|
||||
this.google.loggined = ko.computed(() => '' !== this.google.userName());
|
||||
|
||||
this.google.capa = {};
|
||||
this.google.capa.auth = ko.observable(false);
|
||||
this.google.capa.authGmail = ko.observable(false);
|
||||
this.google.capa.drive = ko.observable(false);
|
||||
this.google.capa.preview = ko.observable(false);
|
||||
|
||||
this.google.require = {};
|
||||
this.google.require.clientSettings = ko.computed(
|
||||
() =>
|
||||
this.google.enabled() && (this.google.capa.auth() || this.google.capa.authGmail() || this.google.capa.drive())
|
||||
);
|
||||
|
||||
this.google.require.apiKeySettings = ko.computed(() => this.google.enabled() && this.google.capa.drive());
|
||||
|
||||
// Facebook
|
||||
this.facebook.enabled = ko.observable(false);
|
||||
this.facebook.appID = ko.observable('');
|
||||
this.facebook.appSecret = ko.observable('');
|
||||
this.facebook.loading = ko.observable(false);
|
||||
this.facebook.userName = ko.observable('');
|
||||
this.facebook.supported = ko.observable(false);
|
||||
|
||||
this.facebook.loggined = ko.computed(() => '' !== this.facebook.userName());
|
||||
|
||||
// Twitter
|
||||
this.twitter.enabled = ko.observable(false);
|
||||
this.twitter.consumerKey = ko.observable('');
|
||||
this.twitter.consumerSecret = ko.observable('');
|
||||
this.twitter.loading = ko.observable(false);
|
||||
this.twitter.userName = ko.observable('');
|
||||
|
||||
this.twitter.loggined = ko.computed(() => '' !== this.twitter.userName());
|
||||
|
||||
// Dropbox
|
||||
this.dropbox.enabled = ko.observable(false);
|
||||
this.dropbox.apiKey = ko.observable('');
|
||||
}
|
||||
|
||||
populate() {
|
||||
this.google.enabled(!!Settings.settingsGet('AllowGoogleSocial'));
|
||||
this.google.clientID(Settings.settingsGet('GoogleClientID'));
|
||||
this.google.clientSecret(Settings.settingsGet('GoogleClientSecret'));
|
||||
this.google.apiKey(Settings.settingsGet('GoogleApiKey'));
|
||||
|
||||
this.google.capa.auth(!!Settings.settingsGet('AllowGoogleSocialAuth'));
|
||||
this.google.capa.authGmail(!!Settings.settingsGet('AllowGoogleSocialAuthGmail'));
|
||||
this.google.capa.drive(!!Settings.settingsGet('AllowGoogleSocialDrive'));
|
||||
this.google.capa.preview(!!Settings.settingsGet('AllowGoogleSocialPreview'));
|
||||
|
||||
this.facebook.enabled(!!Settings.settingsGet('AllowFacebookSocial'));
|
||||
this.facebook.appID(Settings.settingsGet('FacebookAppID'));
|
||||
this.facebook.appSecret(Settings.settingsGet('FacebookAppSecret'));
|
||||
this.facebook.supported(!!Settings.settingsGet('SupportedFacebookSocial'));
|
||||
|
||||
this.twitter.enabled = ko.observable(!!Settings.settingsGet('AllowTwitterSocial'));
|
||||
this.twitter.consumerKey = ko.observable(Settings.settingsGet('TwitterConsumerKey'));
|
||||
this.twitter.consumerSecret = ko.observable(Settings.settingsGet('TwitterConsumerSecret'));
|
||||
|
||||
this.dropbox.enabled(!!Settings.settingsGet('AllowDropboxSocial'));
|
||||
this.dropbox.apiKey(Settings.settingsGet('DropboxApiKey'));
|
||||
}
|
||||
|
||||
appendDropbox() {
|
||||
if (!window.Dropbox && this.dropbox.enabled() && this.dropbox.apiKey()) {
|
||||
if (!window.document.getElementById('dropboxjs')) {
|
||||
const script = window.document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = 'https://www.dropbox.com/static/api/2/dropins.js';
|
||||
$(script)
|
||||
.attr('id', 'dropboxjs')
|
||||
.attr('data-app-key', this.dropbox.apiKey());
|
||||
|
||||
window.document.body.appendChild(script);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new SocialStore();
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
@keyframes redirectingRotation {
|
||||
to {
|
||||
transform: rotate(1turn);
|
||||
}
|
||||
}
|
||||
|
||||
html, body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.social-icon-wrp {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.social-icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
font-size: 140px;
|
||||
margin: -60px 0 0 -60px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.redirecting:after{
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 240px;
|
||||
height: 240px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -120px;
|
||||
margin-left: -120px;
|
||||
|
||||
border: 8px solid transparent;
|
||||
border-color: transparent;
|
||||
border-top-color: #999;
|
||||
animation: redirectingRotation 1s infinite ease-in-out;
|
||||
|
||||
border-radius: 50%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
|
@ -49,7 +49,6 @@ import AccountStore from 'Stores/User/Account';
|
|||
import FolderStore from 'Stores/User/Folder';
|
||||
import PgpStore from 'Stores/User/Pgp';
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
import SocialStore from 'Stores/Social';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
|
|
@ -329,21 +328,6 @@ class ComposePopupView extends AbstractViewNext {
|
|||
this.showBcc.subscribe(this.resizerTrigger);
|
||||
this.showReplyTo.subscribe(this.resizerTrigger);
|
||||
|
||||
this.dropboxEnabled = SocialStore.dropbox.enabled;
|
||||
this.dropboxApiKey = SocialStore.dropbox.apiKey;
|
||||
|
||||
this.driveEnabled = ko.observable(
|
||||
bXMLHttpRequestSupported &&
|
||||
!!Settings.settingsGet('AllowGoogleSocial') &&
|
||||
!!Settings.settingsGet('AllowGoogleSocialDrive') &&
|
||||
!!Settings.settingsGet('GoogleClientID') &&
|
||||
!!Settings.settingsGet('GoogleApiKey')
|
||||
);
|
||||
|
||||
this.driveVisible = ko.observable(false);
|
||||
|
||||
this.driveCallback = _.bind(this.driveCallback, this);
|
||||
|
||||
this.onMessageUploadAttachments = _.bind(this.onMessageUploadAttachments, this);
|
||||
|
||||
this.bDisabeCloseOnEsc = true;
|
||||
|
|
@ -530,28 +514,6 @@ class ComposePopupView extends AbstractViewNext {
|
|||
}
|
||||
}
|
||||
|
||||
@command((self) => self.dropboxEnabled())
|
||||
dropboxCommand() {
|
||||
if (window.Dropbox) {
|
||||
window.Dropbox.choose({
|
||||
success: (files) => {
|
||||
if (files && files[0] && files[0].link) {
|
||||
this.addDropboxAttachment(files[0]);
|
||||
}
|
||||
},
|
||||
linkType: 'direct',
|
||||
multiselect: false
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@command((self) => self.driveEnabled())
|
||||
driveCommand() {
|
||||
this.driveOpenPopup();
|
||||
return true;
|
||||
}
|
||||
|
||||
autosaveFunction() {
|
||||
if (
|
||||
this.modalVisibility() &&
|
||||
|
|
@ -1289,16 +1251,6 @@ class ComposePopupView extends AbstractViewNext {
|
|||
Events.sub('window.resize.real', this.resizerTrigger);
|
||||
Events.sub('window.resize.real', _.debounce(this.resizerTrigger, Magics.Time50ms));
|
||||
|
||||
SocialStore.appendDropbox();
|
||||
|
||||
if (this.driveEnabled()) {
|
||||
$.getScript('https://apis.google.com/js/api.js', () => {
|
||||
if (window.gapi) {
|
||||
this.driveVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.setInterval(() => {
|
||||
if (this.modalVisibility() && this.oEditor) {
|
||||
this.oEditor.resize();
|
||||
|
|
@ -1306,137 +1258,6 @@ class ComposePopupView extends AbstractViewNext {
|
|||
}, Magics.Time5s);
|
||||
}
|
||||
|
||||
driveCallback(accessToken, data) {
|
||||
if (
|
||||
data &&
|
||||
window.XMLHttpRequest &&
|
||||
window.google &&
|
||||
data[window.google.picker.Response.ACTION] === window.google.picker.Action.PICKED &&
|
||||
data[window.google.picker.Response.DOCUMENTS] &&
|
||||
data[window.google.picker.Response.DOCUMENTS][0] &&
|
||||
data[window.google.picker.Response.DOCUMENTS][0].id
|
||||
) {
|
||||
const request = new window.XMLHttpRequest();
|
||||
request.open(
|
||||
'GET',
|
||||
'https://www.googleapis.com/drive/v2/files/' + data[window.google.picker.Response.DOCUMENTS][0].id
|
||||
);
|
||||
request.setRequestHeader('Authorization', 'Bearer ' + accessToken);
|
||||
request.addEventListener('load', () => {
|
||||
if (request && request.responseText) {
|
||||
const response = window.JSON.parse(request.responseText),
|
||||
fExport = (item, mimeType, ext) => {
|
||||
if (item && item.exportLinks) {
|
||||
if (item.exportLinks[mimeType]) {
|
||||
response.downloadUrl = item.exportLinks[mimeType];
|
||||
response.title = item.title + '.' + ext;
|
||||
response.mimeType = mimeType;
|
||||
} else if (item.exportLinks['application/pdf']) {
|
||||
response.downloadUrl = item.exportLinks['application/pdf'];
|
||||
response.title = item.title + '.pdf';
|
||||
response.mimeType = 'application/pdf';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (response && !response.downloadUrl && response.mimeType && response.exportLinks) {
|
||||
switch (response.mimeType.toString().toLowerCase()) {
|
||||
case 'application/vnd.google-apps.document':
|
||||
fExport(response, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docx');
|
||||
break;
|
||||
case 'application/vnd.google-apps.spreadsheet':
|
||||
fExport(response, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xlsx');
|
||||
break;
|
||||
case 'application/vnd.google-apps.drawing':
|
||||
fExport(response, 'image/png', 'png');
|
||||
break;
|
||||
case 'application/vnd.google-apps.presentation':
|
||||
fExport(response, 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'pptx');
|
||||
break;
|
||||
default:
|
||||
fExport(response, 'application/pdf', 'pdf');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (response && response.downloadUrl) {
|
||||
this.addDriveAttachment(response, accessToken);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
request.send();
|
||||
}
|
||||
}
|
||||
|
||||
driveCreatePiker(authToken) {
|
||||
if (window.gapi && authToken && authToken.access_token) {
|
||||
window.gapi.load('picker', {
|
||||
callback: () => {
|
||||
if (window.google && window.google.picker) {
|
||||
const drivePicker = new window.google.picker.PickerBuilder()
|
||||
// .addView(window.google.picker.ViewId.FOLDERS)
|
||||
.addView(window.google.picker.ViewId.DOCS)
|
||||
.setAppId(Settings.settingsGet('GoogleClientID'))
|
||||
.setOAuthToken(authToken.access_token)
|
||||
.setCallback(_.bind(this.driveCallback, this, authToken.access_token))
|
||||
.enableFeature(window.google.picker.Feature.NAV_HIDDEN)
|
||||
// .setOrigin(window.location.protocol + '//' + window.location.host)
|
||||
.build();
|
||||
|
||||
drivePicker.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
driveOpenPopup() {
|
||||
if (window.gapi) {
|
||||
window.gapi.load('auth', {
|
||||
callback: () => {
|
||||
const authToken = window.gapi.auth.getToken(),
|
||||
fResult = (authResult) => {
|
||||
if (authResult && !authResult.error) {
|
||||
const token = window.gapi.auth.getToken();
|
||||
if (token) {
|
||||
this.driveCreatePiker(token);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
if (!authToken) {
|
||||
window.gapi.auth.authorize(
|
||||
{
|
||||
'client_id': Settings.settingsGet('GoogleClientID'),
|
||||
'scope': 'https://www.googleapis.com/auth/drive.readonly',
|
||||
'immediate': true
|
||||
},
|
||||
(authResult) => {
|
||||
if (!fResult(authResult)) {
|
||||
window.gapi.auth.authorize(
|
||||
{
|
||||
'client_id': Settings.settingsGet('GoogleClientID'),
|
||||
'scope': 'https://www.googleapis.com/auth/drive.readonly',
|
||||
'immediate': false
|
||||
},
|
||||
fResult
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.driveCreatePiker(authToken);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @returns {?Object}
|
||||
|
|
@ -1643,83 +1464,6 @@ class ComposePopupView extends AbstractViewNext {
|
|||
return attachment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} dropboxFile
|
||||
* @returns {boolean}
|
||||
*/
|
||||
addDropboxAttachment(dropboxFile) {
|
||||
const attachmentSizeLimit = pInt(Settings.settingsGet('AttachmentLimit')),
|
||||
mSize = dropboxFile.bytes,
|
||||
attachment = this.addAttachmentHelper(dropboxFile.link, dropboxFile.name, mSize);
|
||||
|
||||
if (0 < mSize && 0 < attachmentSizeLimit && attachmentSizeLimit < mSize) {
|
||||
attachment.uploading(false).complete(true);
|
||||
attachment.error(i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
|
||||
return false;
|
||||
}
|
||||
|
||||
Remote.composeUploadExternals(
|
||||
(statusResult, data) => {
|
||||
let result = false;
|
||||
attachment.uploading(false).complete(true);
|
||||
|
||||
if (StorageResultType.Success === statusResult && data && data.Result) {
|
||||
if (data.Result[attachment.id]) {
|
||||
result = true;
|
||||
attachment.tempName(data.Result[attachment.id]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
attachment.error(getUploadErrorDescByCode(UploadErrorCode.FileNoUploaded));
|
||||
}
|
||||
},
|
||||
[dropboxFile.link]
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} driveFile
|
||||
* @param {string} accessToken
|
||||
* @returns {boolean}
|
||||
*/
|
||||
addDriveAttachment(driveFile, accessToken) {
|
||||
const attachmentSizeLimit = pInt(Settings.settingsGet('AttachmentLimit')),
|
||||
size = driveFile.fileSize ? pInt(driveFile.fileSize) : 0,
|
||||
attachment = this.addAttachmentHelper(driveFile.downloadUrl, driveFile.title, size);
|
||||
|
||||
if (0 < size && 0 < attachmentSizeLimit && attachmentSizeLimit < size) {
|
||||
attachment.uploading(false).complete(true);
|
||||
attachment.error(i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
|
||||
return false;
|
||||
}
|
||||
|
||||
Remote.composeUploadDrive(
|
||||
(statusResult, data) => {
|
||||
let result = false;
|
||||
attachment.uploading(false).complete(true);
|
||||
|
||||
if (StorageResultType.Success === statusResult && data && data.Result) {
|
||||
if (data.Result[attachment.id]) {
|
||||
result = true;
|
||||
attachment.tempName(data.Result[attachment.id][0]);
|
||||
attachment.size(pInt(data.Result[attachment.id][1]));
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
attachment.error(getUploadErrorDescByCode(UploadErrorCode.FileNoUploaded));
|
||||
}
|
||||
},
|
||||
driveFile.downloadUrl,
|
||||
accessToken
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MessageModel} message
|
||||
* @param {string} type
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import {
|
|||
import { trim, inArray, pInt, convertLangName, triggerAutocompleteInputChange } from 'Common/Utils';
|
||||
|
||||
import { $win } from 'Common/Globals';
|
||||
import { socialFacebook, socialGoogle, socialTwitter } from 'Common/Links';
|
||||
import { getNotification, getNotificationFromResponse, reload as translatorReload } from 'Common/Translator';
|
||||
|
||||
import * as Plugins from 'Common/Plugins';
|
||||
|
|
@ -141,19 +140,6 @@ class LoginUserView extends AbstractViewNext {
|
|||
|
||||
this.signMeVisibility = ko.computed(() => LoginSignMeType.Unused !== this.signMeType());
|
||||
|
||||
this.facebookLoginEnabled = ko.observable(false);
|
||||
this.googleLoginEnabled = ko.observable(false);
|
||||
this.googleGmailLoginEnabled = ko.observable(false);
|
||||
this.twitterLoginEnabled = ko.observable(false);
|
||||
|
||||
this.socialLoginEnabled = ko.computed(() => {
|
||||
const bF = this.facebookLoginEnabled(),
|
||||
bG = this.googleLoginEnabled(),
|
||||
bT = this.twitterLoginEnabled();
|
||||
|
||||
return bF || bG || bT;
|
||||
});
|
||||
|
||||
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError()) {
|
||||
this.submitError(Settings.settingsGet('AdditionalLoginError'));
|
||||
}
|
||||
|
|
@ -163,30 +149,6 @@ class LoginUserView extends AbstractViewNext {
|
|||
return `left=200,top=100,width=${wh},height=${wh},menubar=no,status=no,resizable=yes,scrollbars=yes`;
|
||||
}
|
||||
|
||||
@command((self) => !self.submitRequest() && self.facebookLoginEnabled())
|
||||
facebookCommand() {
|
||||
window.open(socialFacebook(), 'Facebook', this.windowOpenFeatures(500));
|
||||
return true;
|
||||
}
|
||||
|
||||
@command((self) => !self.submitRequest() && self.googleLoginEnabled())
|
||||
googleCommand() {
|
||||
window.open(socialGoogle(), 'Google', this.windowOpenFeatures(550));
|
||||
return true;
|
||||
}
|
||||
|
||||
@command((self) => !self.submitRequest() && self.googleGmailLoginEnabled())
|
||||
googleGmailCommand() {
|
||||
window.open(socialGoogle(true), 'Google', this.windowOpenFeatures(550));
|
||||
return true;
|
||||
}
|
||||
|
||||
@command((self) => !self.submitRequest() && self.twitterLoginEnabled())
|
||||
twitterCommand() {
|
||||
window.open(socialTwitter(), 'Twitter', this.windowOpenFeatures(500));
|
||||
return true;
|
||||
}
|
||||
|
||||
@command((self) => !self.submitRequest())
|
||||
submitCommand() {
|
||||
triggerAutocompleteInputChange();
|
||||
|
|
@ -328,25 +290,7 @@ class LoginUserView extends AbstractViewNext {
|
|||
onBuild() {
|
||||
const signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
|
||||
signMe = (Settings.settingsGet('SignMe') || 'unused').toLowerCase(),
|
||||
jsHash = Settings.appSettingsGet('jsHash'),
|
||||
fSocial = (iErrorCode) => {
|
||||
iErrorCode = pInt(iErrorCode);
|
||||
if (0 === iErrorCode) {
|
||||
this.submitRequest(true);
|
||||
getApp().loginAndLogoutReload(false);
|
||||
} else {
|
||||
this.submitError(getNotification(iErrorCode));
|
||||
}
|
||||
};
|
||||
|
||||
this.facebookLoginEnabled(!!Settings.settingsGet('AllowFacebookSocial'));
|
||||
this.twitterLoginEnabled(!!Settings.settingsGet('AllowTwitterSocial'));
|
||||
this.googleLoginEnabled(
|
||||
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuth')
|
||||
);
|
||||
this.googleGmailLoginEnabled(
|
||||
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuthGmail')
|
||||
);
|
||||
jsHash = Settings.appSettingsGet('jsHash');
|
||||
|
||||
switch (signMe) {
|
||||
case LoginSignMeTypeAsString.DefaultOff:
|
||||
|
|
@ -375,18 +319,6 @@ class LoginUserView extends AbstractViewNext {
|
|||
this.email(AppStore.devEmail);
|
||||
this.password(AppStore.devPassword);
|
||||
|
||||
if (this.googleLoginEnabled() || this.googleGmailLoginEnabled()) {
|
||||
window['rl_' + jsHash + '_google_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
if (this.facebookLoginEnabled()) {
|
||||
window['rl_' + jsHash + '_facebook_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
if (this.twitterLoginEnabled()) {
|
||||
window['rl_' + jsHash + '_twitter_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
_.delay(() => {
|
||||
LanguageStore.language.subscribe((value) => {
|
||||
this.langRequest(true);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ import { attachmentDownload } from 'Common/Links';
|
|||
|
||||
import { getUserPic, storeMessageFlagsToCache } from 'Common/Cache';
|
||||
|
||||
import SocialStore from 'Stores/Social';
|
||||
import AppStore from 'Stores/User/App';
|
||||
import SettingsStore from 'Stores/User/Settings';
|
||||
import AccountStore from 'Stores/User/Account';
|
||||
|
|
@ -144,46 +143,6 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
this.downloadAsZipLoading = ko.observable(false);
|
||||
this.downloadAsZipError = ko.observable(false).extend({ falseTimeout: 7000 });
|
||||
|
||||
this.saveToOwnCloudAllowed = ko.computed(
|
||||
() => -1 < inArray('owncloud', this.attachmentsActions()) && this.allowAttachmnetControls()
|
||||
);
|
||||
|
||||
this.saveToOwnCloudLoading = ko.observable(false);
|
||||
this.saveToOwnCloudSuccess = ko.observable(false).extend({ falseTimeout: 2000 });
|
||||
this.saveToOwnCloudError = ko.observable(false).extend({ falseTimeout: 7000 });
|
||||
|
||||
this.saveToOwnCloudSuccess.subscribe((v) => {
|
||||
if (v) {
|
||||
this.saveToOwnCloudError(false);
|
||||
}
|
||||
});
|
||||
|
||||
this.saveToOwnCloudError.subscribe((v) => {
|
||||
if (v) {
|
||||
this.saveToOwnCloudSuccess(false);
|
||||
}
|
||||
});
|
||||
|
||||
this.saveToDropboxAllowed = ko.computed(
|
||||
() => -1 < inArray('dropbox', this.attachmentsActions()) && this.allowAttachmnetControls()
|
||||
);
|
||||
|
||||
this.saveToDropboxLoading = ko.observable(false);
|
||||
this.saveToDropboxSuccess = ko.observable(false).extend({ falseTimeout: 2000 });
|
||||
this.saveToDropboxError = ko.observable(false).extend({ falseTimeout: 7000 });
|
||||
|
||||
this.saveToDropboxSuccess.subscribe((v) => {
|
||||
if (v) {
|
||||
this.saveToDropboxError(false);
|
||||
}
|
||||
});
|
||||
|
||||
this.saveToDropboxError.subscribe((v) => {
|
||||
if (v) {
|
||||
this.saveToDropboxSuccess(false);
|
||||
}
|
||||
});
|
||||
|
||||
this.showAttachmnetControls.subscribe((v) => {
|
||||
if (this.message()) {
|
||||
_.each(this.message().attachments(), (item) => {
|
||||
|
|
@ -243,9 +202,6 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
this.spamCommand = createCommandActionHelper(FolderType.Spam, true);
|
||||
this.notSpamCommand = createCommandActionHelper(FolderType.NotSpam, true);
|
||||
|
||||
this.dropboxEnabled = SocialStore.dropbox.enabled;
|
||||
this.dropboxApiKey = SocialStore.dropbox.apiKey;
|
||||
|
||||
// viewer
|
||||
|
||||
this.viewBodyTopValue = ko.observable(0);
|
||||
|
|
@ -606,8 +562,6 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0');
|
||||
});
|
||||
|
||||
SocialStore.appendDropbox();
|
||||
|
||||
this.oHeaderDom = $('.messageItemHeader', dom);
|
||||
this.oHeaderDom = this.oHeaderDom[0] ? this.oHeaderDom : null;
|
||||
|
||||
|
|
@ -956,77 +910,6 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
}
|
||||
}
|
||||
|
||||
saveToOwnCloud() {
|
||||
const hashes = this.getAttachmentsHashes();
|
||||
if (0 < hashes.length) {
|
||||
Promises.attachmentsActions('OwnCloud', hashes, this.saveToOwnCloudLoading)
|
||||
.then((result) => {
|
||||
if (result && result.Result) {
|
||||
this.saveToOwnCloudSuccess(true);
|
||||
} else {
|
||||
this.saveToOwnCloudError(true);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.saveToOwnCloudError(true);
|
||||
});
|
||||
} else {
|
||||
this.highlightUnselectedAttachments(true);
|
||||
}
|
||||
}
|
||||
|
||||
saveToDropbox() {
|
||||
const files = [],
|
||||
hashes = this.getAttachmentsHashes();
|
||||
|
||||
if (0 < hashes.length) {
|
||||
if (window.Dropbox) {
|
||||
Promises.attachmentsActions('Dropbox', hashes, this.saveToDropboxLoading)
|
||||
.then((result) => {
|
||||
if (result && result.Result && result.Result.Url && result.Result.ShortLife && result.Result.Files) {
|
||||
if (window.Dropbox && isArray(result.Result.Files)) {
|
||||
_.each(result.Result.Files, (item) => {
|
||||
files.push({
|
||||
url: result.Result.Url + attachmentDownload(item.Hash, result.Result.ShortLife),
|
||||
filename: item.FileName
|
||||
});
|
||||
});
|
||||
|
||||
window.Dropbox.save({
|
||||
files: files,
|
||||
progress: () => {
|
||||
this.saveToDropboxLoading(true);
|
||||
this.saveToDropboxError(false);
|
||||
this.saveToDropboxSuccess(false);
|
||||
},
|
||||
cancel: () => {
|
||||
this.saveToDropboxSuccess(false);
|
||||
this.saveToDropboxError(false);
|
||||
this.saveToDropboxLoading(false);
|
||||
},
|
||||
success: () => {
|
||||
this.saveToDropboxSuccess(true);
|
||||
this.saveToDropboxLoading(false);
|
||||
},
|
||||
error: () => {
|
||||
this.saveToDropboxError(true);
|
||||
this.saveToDropboxLoading(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.saveToDropboxError(true);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.saveToDropboxError(true);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.highlightUnselectedAttachments(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MessageModel} oMessage
|
||||
* @returns {void}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ window.progressJs.onbeforeend(() => {
|
|||
}
|
||||
});
|
||||
|
||||
require('../vendors/modernizr/modernizr-custom.js');
|
||||
require('Common/Booter');
|
||||
|
||||
if (window.__runBoot) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue