mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
prettier --write
This commit is contained in:
parent
450528ff00
commit
8a0be3212d
164 changed files with 7053 additions and 9008 deletions
|
|
@ -1,22 +1,19 @@
|
|||
|
||||
import _ from '_';
|
||||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
|
||||
import {VIEW_MODELS} from 'Common/Globals';
|
||||
import {delegateRun, windowResize, log, isUnd, pString} from 'Common/Utils';
|
||||
import {settings} from 'Common/Links';
|
||||
import { VIEW_MODELS } from 'Common/Globals';
|
||||
import { delegateRun, windowResize, log, isUnd, pString } from 'Common/Utils';
|
||||
import { settings } from 'Common/Links';
|
||||
|
||||
import {setHash} from 'Knoin/Knoin';
|
||||
import {AbstractScreen} from 'Knoin/AbstractScreen';
|
||||
import { setHash } from 'Knoin/Knoin';
|
||||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||
|
||||
class AbstractSettingsScreen extends AbstractScreen
|
||||
{
|
||||
class AbstractSettingsScreen extends AbstractScreen {
|
||||
/**
|
||||
* @param {Array} viewModels
|
||||
*/
|
||||
constructor(viewModels)
|
||||
{
|
||||
constructor(viewModels) {
|
||||
super('settings', viewModels);
|
||||
|
||||
this.menu = ko.observableArray([]);
|
||||
|
|
@ -31,51 +28,57 @@ class AbstractSettingsScreen extends AbstractScreen
|
|||
* @param {Function=} fCallback
|
||||
*/
|
||||
setupSettings(fCallback = null) {
|
||||
if (fCallback)
|
||||
{
|
||||
if (fCallback) {
|
||||
fCallback();
|
||||
}
|
||||
}
|
||||
|
||||
onRoute(subName) {
|
||||
let
|
||||
settingsScreen = null,
|
||||
let settingsScreen = null,
|
||||
RoutedSettingsViewModel = null,
|
||||
viewModelPlace = null,
|
||||
viewModelDom = null;
|
||||
|
||||
RoutedSettingsViewModel = _.find(VIEW_MODELS.settings,
|
||||
(SettingsViewModel) => SettingsViewModel && SettingsViewModel.__rlSettingsData && subName === SettingsViewModel.__rlSettingsData.Route
|
||||
RoutedSettingsViewModel = _.find(
|
||||
VIEW_MODELS.settings,
|
||||
(SettingsViewModel) =>
|
||||
SettingsViewModel && SettingsViewModel.__rlSettingsData && subName === SettingsViewModel.__rlSettingsData.Route
|
||||
);
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (_.find(VIEW_MODELS['settings-removed'], (DisabledSettingsViewModel) => DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel))
|
||||
{
|
||||
if (RoutedSettingsViewModel) {
|
||||
if (
|
||||
_.find(
|
||||
VIEW_MODELS['settings-removed'],
|
||||
(DisabledSettingsViewModel) =>
|
||||
DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel
|
||||
)
|
||||
) {
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel && _.find(VIEW_MODELS['settings-disabled'],
|
||||
(DisabledSettingsViewModel) => DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel))
|
||||
{
|
||||
if (
|
||||
RoutedSettingsViewModel &&
|
||||
_.find(
|
||||
VIEW_MODELS['settings-disabled'],
|
||||
(DisabledSettingsViewModel) =>
|
||||
DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel
|
||||
)
|
||||
) {
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
|
||||
{
|
||||
if (RoutedSettingsViewModel) {
|
||||
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm) {
|
||||
settingsScreen = RoutedSettingsViewModel.__vm;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
viewModelPlace = this.oViewModelPlace;
|
||||
if (viewModelPlace && 1 === viewModelPlace.length)
|
||||
{
|
||||
if (viewModelPlace && 1 === viewModelPlace.length) {
|
||||
settingsScreen = new RoutedSettingsViewModel();
|
||||
|
||||
viewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
|
||||
viewModelDom = $('<div></div>')
|
||||
.addClass('rl-settings-view-model')
|
||||
.hide();
|
||||
viewModelDom.appendTo(viewModelPlace);
|
||||
|
||||
settingsScreen.viewModelDom = viewModelDom;
|
||||
|
|
@ -86,26 +89,26 @@ class AbstractSettingsScreen extends AbstractScreen
|
|||
RoutedSettingsViewModel.__builded = true;
|
||||
RoutedSettingsViewModel.__vm = settingsScreen;
|
||||
|
||||
const tmpl = {name: RoutedSettingsViewModel.__rlSettingsData.Template};
|
||||
ko.applyBindingAccessorsToNode(viewModelDom[0], {
|
||||
translatorInit: true,
|
||||
template: () => tmpl
|
||||
}, settingsScreen);
|
||||
const tmpl = { name: RoutedSettingsViewModel.__rlSettingsData.Template };
|
||||
ko.applyBindingAccessorsToNode(
|
||||
viewModelDom[0],
|
||||
{
|
||||
translatorInit: true,
|
||||
template: () => tmpl
|
||||
},
|
||||
settingsScreen
|
||||
);
|
||||
|
||||
delegateRun(settingsScreen, 'onBuild', [viewModelDom]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
log('Cannot find sub settings view model position: SettingsSubScreen');
|
||||
}
|
||||
}
|
||||
|
||||
if (settingsScreen)
|
||||
{
|
||||
if (settingsScreen) {
|
||||
_.defer(() => {
|
||||
// hide
|
||||
if (this.oCurrentSubScreen)
|
||||
{
|
||||
if (this.oCurrentSubScreen) {
|
||||
delegateRun(this.oCurrentSubScreen, 'onHide');
|
||||
this.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
|
|
@ -114,15 +117,18 @@ class AbstractSettingsScreen extends AbstractScreen
|
|||
this.oCurrentSubScreen = settingsScreen;
|
||||
|
||||
// show
|
||||
if (this.oCurrentSubScreen)
|
||||
{
|
||||
if (this.oCurrentSubScreen) {
|
||||
delegateRun(this.oCurrentSubScreen, 'onBeforeShow');
|
||||
this.oCurrentSubScreen.viewModelDom.show();
|
||||
delegateRun(this.oCurrentSubScreen, 'onShow');
|
||||
delegateRun(this.oCurrentSubScreen, 'onShowWithDelay', [], 200);
|
||||
|
||||
_.each(this.menu(), (item) => {
|
||||
item.selected(settingsScreen && settingsScreen.__rlSettingsData && item.route === settingsScreen.__rlSettingsData.Route);
|
||||
item.selected(
|
||||
settingsScreen &&
|
||||
settingsScreen.__rlSettingsData &&
|
||||
item.route === settingsScreen.__rlSettingsData.Route
|
||||
);
|
||||
});
|
||||
|
||||
$('#rl-content .b-settings .b-content .content').scrollTop(0);
|
||||
|
|
@ -132,16 +138,13 @@ class AbstractSettingsScreen extends AbstractScreen
|
|||
windowResize();
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setHash(settings(), false, true);
|
||||
}
|
||||
}
|
||||
|
||||
onHide() {
|
||||
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
|
||||
{
|
||||
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom) {
|
||||
delegateRun(this.oCurrentSubScreen, 'onHide');
|
||||
this.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
|
|
@ -149,15 +152,22 @@ class AbstractSettingsScreen extends AbstractScreen
|
|||
|
||||
onBuild() {
|
||||
_.each(VIEW_MODELS.settings, (SettingsViewModel) => {
|
||||
if (SettingsViewModel && SettingsViewModel.__rlSettingsData && !_.find(VIEW_MODELS['settings-removed'],
|
||||
(RemoveSettingsViewModel) => RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel))
|
||||
{
|
||||
if (
|
||||
SettingsViewModel &&
|
||||
SettingsViewModel.__rlSettingsData &&
|
||||
!_.find(
|
||||
VIEW_MODELS['settings-removed'],
|
||||
(RemoveSettingsViewModel) => RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel
|
||||
)
|
||||
) {
|
||||
this.menu.push({
|
||||
route: SettingsViewModel.__rlSettingsData.Route,
|
||||
label: SettingsViewModel.__rlSettingsData.Label,
|
||||
selected: ko.observable(false),
|
||||
disabled: !!_.find(VIEW_MODELS['settings-disabled'],
|
||||
(DisabledSettingsViewModel) => DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel)
|
||||
disabled: !!_.find(
|
||||
VIEW_MODELS['settings-disabled'],
|
||||
(DisabledSettingsViewModel) => DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel
|
||||
)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -166,12 +176,13 @@ class AbstractSettingsScreen extends AbstractScreen
|
|||
}
|
||||
|
||||
routes() {
|
||||
const
|
||||
DefaultViewModel = _.find(
|
||||
const DefaultViewModel = _.find(
|
||||
VIEW_MODELS.settings,
|
||||
(SettingsViewModel) => SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData.IsDefault
|
||||
(SettingsViewModel) =>
|
||||
SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData.IsDefault
|
||||
),
|
||||
defaultRoute = DefaultViewModel && DefaultViewModel.__rlSettingsData ? DefaultViewModel.__rlSettingsData.Route : 'general',
|
||||
defaultRoute =
|
||||
DefaultViewModel && DefaultViewModel.__rlSettingsData ? DefaultViewModel.__rlSettingsData.Route : 'general',
|
||||
rules = {
|
||||
subname: /^(.*)$/,
|
||||
normalize_: (rquest, vals) => {
|
||||
|
|
@ -180,12 +191,8 @@ class AbstractSettingsScreen extends AbstractScreen
|
|||
}
|
||||
};
|
||||
|
||||
return [
|
||||
['{subname}/', rules],
|
||||
['{subname}', rules],
|
||||
['', rules]
|
||||
];
|
||||
return [['{subname}/', rules], ['{subname}', rules], ['', rules]];
|
||||
}
|
||||
}
|
||||
|
||||
export {AbstractSettingsScreen, AbstractSettingsScreen as default};
|
||||
export { AbstractSettingsScreen, AbstractSettingsScreen as default };
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||
|
||||
import {AbstractScreen} from 'Knoin/AbstractScreen';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { LoginAdminView } from 'View/Admin/Login';
|
||||
|
||||
import {LoginAdminView} from 'View/Admin/Login';
|
||||
|
||||
class LoginAdminScreen extends AbstractScreen
|
||||
{
|
||||
class LoginAdminScreen extends AbstractScreen {
|
||||
constructor() {
|
||||
super('login', [
|
||||
LoginAdminView
|
||||
]);
|
||||
super('login', [LoginAdminView]);
|
||||
}
|
||||
|
||||
onShow() {
|
||||
|
|
@ -18,4 +14,4 @@ class LoginAdminScreen extends AbstractScreen
|
|||
}
|
||||
}
|
||||
|
||||
export {LoginAdminScreen, LoginAdminScreen as default};
|
||||
export { LoginAdminScreen, LoginAdminScreen as default };
|
||||
|
|
|
|||
|
|
@ -1,93 +1,82 @@
|
|||
import {addSettingsViewModel} from 'Knoin/Knoin';
|
||||
import {runSettingsViewModelHooks} from 'Common/Plugins';
|
||||
import { addSettingsViewModel } from 'Knoin/Knoin';
|
||||
import { runSettingsViewModelHooks } from 'Common/Plugins';
|
||||
|
||||
import {AbstractSettingsScreen} from 'Screen/AbstractSettings';
|
||||
import { AbstractSettingsScreen } from 'Screen/AbstractSettings';
|
||||
|
||||
import {GeneralAdminSettings} from 'Settings/Admin/General';
|
||||
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';
|
||||
import { GeneralAdminSettings } from 'Settings/Admin/General';
|
||||
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';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
import {MenuSettingsAdminView} from 'View/Admin/Settings/Menu';
|
||||
import {PaneSettingsAdminView} from 'View/Admin/Settings/Pane';
|
||||
import { MenuSettingsAdminView } from 'View/Admin/Settings/Menu';
|
||||
import { PaneSettingsAdminView } from 'View/Admin/Settings/Pane';
|
||||
|
||||
class SettingsAdminScreen extends AbstractSettingsScreen
|
||||
{
|
||||
class SettingsAdminScreen extends AbstractSettingsScreen {
|
||||
constructor() {
|
||||
super([
|
||||
MenuSettingsAdminView,
|
||||
PaneSettingsAdminView
|
||||
]);
|
||||
super([MenuSettingsAdminView, PaneSettingsAdminView]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback = null
|
||||
*/
|
||||
setupSettings(fCallback = null) {
|
||||
|
||||
let branding = null,
|
||||
licensing = null;
|
||||
|
||||
if (RL_COMMUNITY)
|
||||
{
|
||||
if (RL_COMMUNITY) {
|
||||
branding = require('Settings/Admin/Branding').default;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
branding = require('Settings/Admin/Prem/Branding').default;
|
||||
licensing = require('Settings/Admin/Prem/Licensing').default;
|
||||
}
|
||||
|
||||
addSettingsViewModel(GeneralAdminSettings,
|
||||
'AdminSettingsGeneral', 'TABS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
addSettingsViewModel(
|
||||
GeneralAdminSettings,
|
||||
'AdminSettingsGeneral',
|
||||
'TABS_LABELS/LABEL_GENERAL_NAME',
|
||||
'general',
|
||||
true
|
||||
);
|
||||
|
||||
addSettingsViewModel(DomainsAdminSettings,
|
||||
'AdminSettingsDomains', 'TABS_LABELS/LABEL_DOMAINS_NAME', 'domains');
|
||||
addSettingsViewModel(DomainsAdminSettings, 'AdminSettingsDomains', 'TABS_LABELS/LABEL_DOMAINS_NAME', 'domains');
|
||||
|
||||
addSettingsViewModel(LoginAdminSettings,
|
||||
'AdminSettingsLogin', 'TABS_LABELS/LABEL_LOGIN_NAME', 'login');
|
||||
addSettingsViewModel(LoginAdminSettings, 'AdminSettingsLogin', 'TABS_LABELS/LABEL_LOGIN_NAME', 'login');
|
||||
|
||||
if (branding)
|
||||
{
|
||||
addSettingsViewModel(branding,
|
||||
'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
|
||||
if (branding) {
|
||||
addSettingsViewModel(branding, 'AdminSettingsBranding', 'TABS_LABELS/LABEL_BRANDING_NAME', 'branding');
|
||||
}
|
||||
|
||||
addSettingsViewModel(ContactsAdminSettings,
|
||||
'AdminSettingsContacts', 'TABS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
addSettingsViewModel(ContactsAdminSettings, 'AdminSettingsContacts', 'TABS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
|
||||
addSettingsViewModel(SecurityAdminSettings,
|
||||
'AdminSettingsSecurity', 'TABS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
addSettingsViewModel(SecurityAdminSettings, 'AdminSettingsSecurity', 'TABS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
|
||||
addSettingsViewModel(SocialAdminSettings,
|
||||
'AdminSettingsSocial', 'TABS_LABELS/LABEL_INTEGRATION_NAME', 'integrations');
|
||||
addSettingsViewModel(
|
||||
SocialAdminSettings,
|
||||
'AdminSettingsSocial',
|
||||
'TABS_LABELS/LABEL_INTEGRATION_NAME',
|
||||
'integrations'
|
||||
);
|
||||
|
||||
addSettingsViewModel(PluginsAdminSettings,
|
||||
'AdminSettingsPlugins', 'TABS_LABELS/LABEL_PLUGINS_NAME', 'plugins');
|
||||
addSettingsViewModel(PluginsAdminSettings, 'AdminSettingsPlugins', 'TABS_LABELS/LABEL_PLUGINS_NAME', 'plugins');
|
||||
|
||||
addSettingsViewModel(PackagesAdminSettings,
|
||||
'AdminSettingsPackages', 'TABS_LABELS/LABEL_PACKAGES_NAME', 'packages');
|
||||
addSettingsViewModel(PackagesAdminSettings, 'AdminSettingsPackages', 'TABS_LABELS/LABEL_PACKAGES_NAME', 'packages');
|
||||
|
||||
if (licensing)
|
||||
{
|
||||
addSettingsViewModel(licensing,
|
||||
'AdminSettingsLicensing', 'TABS_LABELS/LABEL_LICENSING_NAME', 'licensing');
|
||||
if (licensing) {
|
||||
addSettingsViewModel(licensing, 'AdminSettingsLicensing', 'TABS_LABELS/LABEL_LICENSING_NAME', 'licensing');
|
||||
}
|
||||
|
||||
addSettingsViewModel(AboutAdminSettings,
|
||||
'AdminSettingsAbout', 'TABS_LABELS/LABEL_ABOUT_NAME', 'about');
|
||||
addSettingsViewModel(AboutAdminSettings, 'AdminSettingsAbout', 'TABS_LABELS/LABEL_ABOUT_NAME', 'about');
|
||||
|
||||
runSettingsViewModelHooks(true);
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
if (fCallback) {
|
||||
fCallback();
|
||||
}
|
||||
}
|
||||
|
|
@ -97,4 +86,4 @@ class SettingsAdminScreen extends AbstractSettingsScreen
|
|||
}
|
||||
}
|
||||
|
||||
export {SettingsAdminScreen, SettingsAdminScreen as default};
|
||||
export { SettingsAdminScreen, SettingsAdminScreen as default };
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||
|
||||
import {AbstractScreen} from 'Knoin/AbstractScreen';
|
||||
import { AboutUserView } from 'View/User/About';
|
||||
|
||||
import {AboutUserView} from 'View/User/About';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
|
||||
class AboutUserScreen extends AbstractScreen
|
||||
{
|
||||
class AboutUserScreen extends AbstractScreen {
|
||||
constructor() {
|
||||
super('about', [AboutUserView]);
|
||||
}
|
||||
|
|
@ -16,4 +14,4 @@ class AboutUserScreen extends AbstractScreen
|
|||
}
|
||||
}
|
||||
|
||||
export {AboutUserScreen, AboutUserScreen as default};
|
||||
export { AboutUserScreen, AboutUserScreen as default };
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||
|
||||
import {AbstractScreen} from 'Knoin/AbstractScreen';
|
||||
import { LoginUserView } from 'View/User/Login';
|
||||
|
||||
import {LoginUserView} from 'View/User/Login';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
|
||||
class LoginUserScreen extends AbstractScreen
|
||||
{
|
||||
class LoginUserScreen extends AbstractScreen {
|
||||
constructor() {
|
||||
super('login', [LoginUserView]);
|
||||
}
|
||||
|
|
@ -16,4 +14,4 @@ class LoginUserScreen extends AbstractScreen
|
|||
}
|
||||
}
|
||||
|
||||
export {LoginUserScreen, LoginUserScreen as default};
|
||||
export { LoginUserScreen, LoginUserScreen as default };
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
import _ from '_';
|
||||
|
||||
import {Focused, Capa, ClientSideKeyName, Magics} from 'Common/Enums';
|
||||
import {$html, leftPanelDisabled, leftPanelType, moveAction, bMobileDevice} from 'Common/Globals';
|
||||
import {pString, pInt, decodeURI, windowResizeCallback} from 'Common/Utils';
|
||||
import {getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName} from 'Common/Cache';
|
||||
import {i18n} from 'Common/Translator';
|
||||
import { Focused, Capa, ClientSideKeyName, Magics } from 'Common/Enums';
|
||||
import { $html, leftPanelDisabled, leftPanelType, moveAction, bMobileDevice } from 'Common/Globals';
|
||||
import { pString, pInt, decodeURI, windowResizeCallback } from 'Common/Utils';
|
||||
import { getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName } from 'Common/Cache';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
||||
import * as Events from 'Common/Events';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
|
@ -16,19 +15,18 @@ import SettingsStore from 'Stores/User/Settings';
|
|||
import FolderStore from 'Stores/User/Folder';
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import {SystemDropDownMailBoxUserView} from 'View/User/MailBox/SystemDropDown';
|
||||
import {FolderListMailBoxUserView} from 'View/User/MailBox/FolderList';
|
||||
import {MessageListMailBoxUserView} from 'View/User/MailBox/MessageList';
|
||||
import {MessageViewMailBoxUserView} from 'View/User/MailBox/MessageView';
|
||||
import { SystemDropDownMailBoxUserView } from 'View/User/MailBox/SystemDropDown';
|
||||
import { FolderListMailBoxUserView } from 'View/User/MailBox/FolderList';
|
||||
import { MessageListMailBoxUserView } from 'View/User/MailBox/MessageList';
|
||||
import { MessageViewMailBoxUserView } from 'View/User/MailBox/MessageView';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {warmUpScreenPopup} from 'Knoin/Knoin';
|
||||
import { warmUpScreenPopup } from 'Knoin/Knoin';
|
||||
|
||||
import {AbstractScreen} from 'Knoin/AbstractScreen';
|
||||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||
|
||||
class MailBoxUserScreen extends AbstractScreen
|
||||
{
|
||||
class MailBoxUserScreen extends AbstractScreen {
|
||||
constructor() {
|
||||
super('mailbox', [
|
||||
SystemDropDownMailBoxUserView,
|
||||
|
|
@ -45,12 +43,16 @@ class MailBoxUserScreen extends AbstractScreen
|
|||
let foldersInboxUnreadCount = FolderStore.foldersInboxUnreadCount();
|
||||
const email = AccountStore.email();
|
||||
|
||||
if (Settings.appSettingsGet('listPermanentFiltered'))
|
||||
{
|
||||
if (Settings.appSettingsGet('listPermanentFiltered')) {
|
||||
foldersInboxUnreadCount = 0;
|
||||
}
|
||||
|
||||
getApp().setWindowTitle(('' === email ? '' : '' + (0 < foldersInboxUnreadCount ? '(' + foldersInboxUnreadCount + ') ' : ' ') + email + ' - ') + i18n('TITLES/MAILBOX'));
|
||||
getApp().setWindowTitle(
|
||||
('' === email
|
||||
? ''
|
||||
: '' + (0 < foldersInboxUnreadCount ? '(' + foldersInboxUnreadCount + ') ' : ' ') + email + ' - ') +
|
||||
i18n('TITLES/MAILBOX')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -62,17 +64,13 @@ class MailBoxUserScreen extends AbstractScreen
|
|||
AppStore.focusedState(Focused.None);
|
||||
AppStore.focusedState(Focused.MessageList);
|
||||
|
||||
if (Settings.appSettingsGet('mobile'))
|
||||
{
|
||||
if (Settings.appSettingsGet('mobile')) {
|
||||
leftPanelDisabled(true);
|
||||
}
|
||||
|
||||
if (!Settings.capa(Capa.Folders))
|
||||
{
|
||||
if (!Settings.capa(Capa.Folders)) {
|
||||
leftPanelType(Settings.capa(Capa.Composer) || Settings.capa(Capa.Contacts) ? 'short' : 'none');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
leftPanelType('');
|
||||
}
|
||||
}
|
||||
|
|
@ -87,10 +85,8 @@ class MailBoxUserScreen extends AbstractScreen
|
|||
let threadUid = folderHash.replace(/^(.+)~([\d]+)$/, '$2');
|
||||
const folder = getFolderFromCacheList(getFolderFullNameRaw(folderHash.replace(/~([\d]+)$/, '')));
|
||||
|
||||
if (folder)
|
||||
{
|
||||
if (folderHash === threadUid)
|
||||
{
|
||||
if (folder) {
|
||||
if (folderHash === threadUid) {
|
||||
threadUid = '';
|
||||
}
|
||||
|
||||
|
|
@ -121,8 +117,7 @@ class MailBoxUserScreen extends AbstractScreen
|
|||
|
||||
const email = AccountStore.email();
|
||||
_.each(AccountStore.accounts(), (item) => {
|
||||
if (item && email === item.email)
|
||||
{
|
||||
if (item && email === item.email) {
|
||||
item.count(count);
|
||||
}
|
||||
});
|
||||
|
|
@ -135,8 +130,7 @@ class MailBoxUserScreen extends AbstractScreen
|
|||
* @returns {void}
|
||||
*/
|
||||
onBuild() {
|
||||
if (!bMobileDevice && !Settings.appSettingsGet('mobile'))
|
||||
{
|
||||
if (!bMobileDevice && !Settings.appSettingsGet('mobile')) {
|
||||
_.defer(() => {
|
||||
getApp().initHorizontalLayoutResizer(ClientSideKeyName.MessageListSize);
|
||||
});
|
||||
|
|
@ -151,16 +145,14 @@ class MailBoxUserScreen extends AbstractScreen
|
|||
* @returns {Array}
|
||||
*/
|
||||
routes() {
|
||||
const
|
||||
inboxFolderName = getFolderInboxName(),
|
||||
const inboxFolderName = getFolderInboxName(),
|
||||
fNormS = (request, vals) => {
|
||||
vals[0] = pString(vals[0]);
|
||||
vals[1] = pInt(vals[1]);
|
||||
vals[1] = 0 >= vals[1] ? 1 : vals[1];
|
||||
vals[2] = pString(vals[2]);
|
||||
|
||||
if ('' === request)
|
||||
{
|
||||
if ('' === request) {
|
||||
vals[0] = inboxFolderName;
|
||||
vals[1] = 1;
|
||||
}
|
||||
|
|
@ -171,8 +163,7 @@ class MailBoxUserScreen extends AbstractScreen
|
|||
vals[0] = pString(vals[0]);
|
||||
vals[1] = pString(vals[1]);
|
||||
|
||||
if ('' === request)
|
||||
{
|
||||
if ('' === request) {
|
||||
vals[0] = inboxFolderName;
|
||||
}
|
||||
|
||||
|
|
@ -180,12 +171,12 @@ class MailBoxUserScreen extends AbstractScreen
|
|||
};
|
||||
|
||||
return [
|
||||
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)\/(.+)\/?$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9~]+)\/(.+)\/?$/, {'normalize_': fNormD}],
|
||||
[/^([^\/]*)$/, {'normalize_': fNormS}]
|
||||
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)\/(.+)\/?$/, { 'normalize_': fNormS }],
|
||||
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)$/, { 'normalize_': fNormS }],
|
||||
[/^([a-zA-Z0-9~]+)\/(.+)\/?$/, { 'normalize_': fNormD }],
|
||||
[/^([^/]*)$/, { 'normalize_': fNormS }]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
export {MailBoxUserScreen, MailBoxUserScreen as default};
|
||||
export { MailBoxUserScreen, MailBoxUserScreen as default };
|
||||
|
|
|
|||
|
|
@ -1,135 +1,127 @@
|
|||
|
||||
import {Capa, KeyState} from 'Common/Enums';
|
||||
import {keyScope, leftPanelType, leftPanelDisabled} from 'Common/Globals';
|
||||
import {runSettingsViewModelHooks} from 'Common/Plugins';
|
||||
import {initOnStartOrLangChange, i18n} from 'Common/Translator';
|
||||
import { Capa, KeyState } from 'Common/Enums';
|
||||
import { keyScope, leftPanelType, leftPanelDisabled } from 'Common/Globals';
|
||||
import { runSettingsViewModelHooks } from 'Common/Plugins';
|
||||
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
||||
|
||||
import AppStore from 'Stores/User/App';
|
||||
import AccountStore from 'Stores/User/Account';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
import {addSettingsViewModel} from 'Knoin/Knoin';
|
||||
import { addSettingsViewModel } from 'Knoin/Knoin';
|
||||
|
||||
import {AbstractSettingsScreen} from 'Screen/AbstractSettings';
|
||||
import { AbstractSettingsScreen } from 'Screen/AbstractSettings';
|
||||
|
||||
import {GeneralUserSettings} from 'Settings/User/General';
|
||||
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';
|
||||
import {ThemesUserSettings} from 'Settings/User/Themes';
|
||||
import {OpenPgpUserSettings} from 'Settings/User/OpenPgp';
|
||||
import { GeneralUserSettings } from 'Settings/User/General';
|
||||
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';
|
||||
import { ThemesUserSettings } from 'Settings/User/Themes';
|
||||
import { OpenPgpUserSettings } from 'Settings/User/OpenPgp';
|
||||
|
||||
import {SystemDropDownSettingsUserView} from 'View/User/Settings/SystemDropDown';
|
||||
import {MenuSettingsUserView} from 'View/User/Settings/Menu';
|
||||
import {PaneSettingsUserView} from 'View/User/Settings/Pane';
|
||||
import { SystemDropDownSettingsUserView } from 'View/User/Settings/SystemDropDown';
|
||||
import { MenuSettingsUserView } from 'View/User/Settings/Menu';
|
||||
import { PaneSettingsUserView } from 'View/User/Settings/Pane';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
class SettingsUserScreen extends AbstractSettingsScreen
|
||||
{
|
||||
class SettingsUserScreen extends AbstractSettingsScreen {
|
||||
constructor() {
|
||||
super([
|
||||
SystemDropDownSettingsUserView,
|
||||
MenuSettingsUserView,
|
||||
PaneSettingsUserView
|
||||
]);
|
||||
super([SystemDropDownSettingsUserView, MenuSettingsUserView, PaneSettingsUserView]);
|
||||
|
||||
initOnStartOrLangChange(() => {
|
||||
this.sSettingsTitle = i18n('TITLES/SETTINGS');
|
||||
}, () => {
|
||||
this.setSettingsTitle();
|
||||
});
|
||||
initOnStartOrLangChange(
|
||||
() => {
|
||||
this.sSettingsTitle = i18n('TITLES/SETTINGS');
|
||||
},
|
||||
() => {
|
||||
this.setSettingsTitle();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
setupSettings(fCallback = null) {
|
||||
if (!Settings.capa(Capa.Settings))
|
||||
{
|
||||
if (fCallback)
|
||||
{
|
||||
if (!Settings.capa(Capa.Settings)) {
|
||||
if (fCallback) {
|
||||
fCallback();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
addSettingsViewModel(GeneralUserSettings,
|
||||
'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
addSettingsViewModel(GeneralUserSettings, 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
|
||||
if (AppStore.contactsIsAllowed())
|
||||
{
|
||||
addSettingsViewModel(ContactsUserSettings,
|
||||
'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
if (AppStore.contactsIsAllowed()) {
|
||||
addSettingsViewModel(ContactsUserSettings, 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.AdditionalAccounts) || Settings.capa(Capa.Identities))
|
||||
{
|
||||
addSettingsViewModel(AccountsUserSettings, 'SettingsAccounts',
|
||||
Settings.capa(Capa.AdditionalAccounts) ? 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME' : 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'accounts');
|
||||
if (Settings.capa(Capa.AdditionalAccounts) || Settings.capa(Capa.Identities)) {
|
||||
addSettingsViewModel(
|
||||
AccountsUserSettings,
|
||||
'SettingsAccounts',
|
||||
Settings.capa(Capa.AdditionalAccounts)
|
||||
? 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME'
|
||||
: 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME',
|
||||
'accounts'
|
||||
);
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.Sieve))
|
||||
{
|
||||
addSettingsViewModel(FiltersUserSettings,
|
||||
'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
if (Settings.capa(Capa.Sieve)) {
|
||||
addSettingsViewModel(FiltersUserSettings, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.AutoLogout) || Settings.capa(Capa.TwoFactor))
|
||||
{
|
||||
addSettingsViewModel(SecurityUserSettings,
|
||||
'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
if (Settings.capa(Capa.AutoLogout) || Settings.capa(Capa.TwoFactor)) {
|
||||
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 (
|
||||
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,
|
||||
'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
|
||||
if (Settings.settingsGet('ChangePasswordIsAllowed')) {
|
||||
addSettingsViewModel(
|
||||
ChangePasswordUserSettings,
|
||||
'SettingsChangePassword',
|
||||
'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME',
|
||||
'change-password'
|
||||
);
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.Templates))
|
||||
{
|
||||
addSettingsViewModel(TemplatesUserSettings,
|
||||
'SettingsTemplates', 'SETTINGS_LABELS/LABEL_TEMPLATES_NAME', 'templates');
|
||||
if (Settings.capa(Capa.Templates)) {
|
||||
addSettingsViewModel(
|
||||
TemplatesUserSettings,
|
||||
'SettingsTemplates',
|
||||
'SETTINGS_LABELS/LABEL_TEMPLATES_NAME',
|
||||
'templates'
|
||||
);
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.Folders))
|
||||
{
|
||||
addSettingsViewModel(FoldersUserSettings,
|
||||
'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
|
||||
if (Settings.capa(Capa.Folders)) {
|
||||
addSettingsViewModel(FoldersUserSettings, 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.Themes))
|
||||
{
|
||||
addSettingsViewModel(ThemesUserSettings,
|
||||
'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
|
||||
if (Settings.capa(Capa.Themes)) {
|
||||
addSettingsViewModel(ThemesUserSettings, 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.OpenPGP))
|
||||
{
|
||||
addSettingsViewModel(OpenPgpUserSettings,
|
||||
'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
|
||||
if (Settings.capa(Capa.OpenPGP)) {
|
||||
addSettingsViewModel(OpenPgpUserSettings, 'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
|
||||
}
|
||||
|
||||
runSettingsViewModelHooks(false);
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
if (fCallback) {
|
||||
fCallback();
|
||||
}
|
||||
|
||||
|
|
@ -141,8 +133,7 @@ class SettingsUserScreen extends AbstractSettingsScreen
|
|||
keyScope(KeyState.Settings);
|
||||
leftPanelType('');
|
||||
|
||||
if (Settings.appSettingsGet('mobile'))
|
||||
{
|
||||
if (Settings.appSettingsGet('mobile')) {
|
||||
leftPanelDisabled(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -153,4 +144,4 @@ class SettingsUserScreen extends AbstractSettingsScreen
|
|||
}
|
||||
}
|
||||
|
||||
export {SettingsUserScreen, SettingsUserScreen as default};
|
||||
export { SettingsUserScreen, SettingsUserScreen as default };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue