diff --git a/dev/Common/Consts.js b/dev/Common/Consts.js index 2e3f5f18f..882834bbc 100644 --- a/dev/Common/Consts.js +++ b/dev/Common/Consts.js @@ -1,41 +1,9 @@ -export const MESSAGES_PER_PAGE = 20; - export const MESSAGES_PER_PAGE_VALUES = [10, 20, 30, 50, 100]; -export const CONTACTS_PER_PAGE = 50; - export const DEFAULT_AJAX_TIMEOUT = 30000; -export const SEARCH_AJAX_TIMEOUT = 300000; - -export const SEND_MESSAGE_AJAX_TIMEOUT = 300000; - -export const SAVE_MESSAGE_AJAX_TIMEOUT = 200000; - -export const CONTACTS_SYNC_AJAX_TIMEOUT = 200000; - export const UNUSED_OPTION_VALUE = '__UNUSE__'; -export const CLIENT_SIDE_STORAGE_INDEX_NAME = 'rlcsc'; - -export const IMAP_DEFAULT_PORT = 143; - -export const IMAP_DEFAULT_SECURE_PORT = 993; - -export const SMTP_DEFAULT_PORT = 25; - -export const SMTP_DEFAULT_SECURE_PORT = 465; - -export const SIEVE_DEFAULT_PORT = 4190; - -export const MESSAGE_BODY_CACHE_LIMIT = 15; - -export const AJAX_ERROR_LIMIT = 7; - -export const TOKEN_ERROR_LIMIT = 10; - -export const RAINLOOP_TRIAL_KEY = 'RAINLOOP-TRIAL-KEY'; - /* eslint max-len: 0 */ export const DATA_IMAGE_USER_DOT_PIC = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuCAYAAABXuSs3AAAHHklEQVRoQ7VZW08bVxCeXRuwIbTGXIwNtBBaqjwgVUiR8lDlbza9qe1DpVZ9aNQ/0KpPeaJK07SpcuEeCEmUAObm21bfrL9lONjexSYrWfbunj37zXdmvpkz9oIgCKTD0Wg0xPd94TDP83Q0zvWa50vzklSrdanVanqf4/D84GBGr+F+Op3S8fqoJxLOdnZgTvsO/nYhenHA+UC7CWF1uXwkb9++ldPTUwVerVbVqFQqpR8YPjQ0JCMjI5LNDijoRgP3PQVu5+5Eor2XGLg7IV4GkIdHJ/LmzRs5ODiIwNbrdR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.js b/dev/Common/Globals.js index dc446dd01..ac9d36fb4 100644 --- a/dev/Common/Globals.js +++ b/dev/Common/Globals.js @@ -20,17 +20,9 @@ export const leftPanelDisabled = ko.observable(false); export const leftPanelType = ko.observable(''); export const leftPanelWidth = ko.observable(0); -leftPanelDisabled.subscribe((value) => { - if (value && moveAction()) { - moveAction(false); - } -}); +leftPanelDisabled.subscribe(value => value && moveAction() && moveAction(false)); -moveAction.subscribe((value) => { - if (value && leftPanelDisabled()) { - leftPanelDisabled(false); - } -}); +moveAction.subscribe(value => value && leftPanelDisabled() && leftPanelDisabled(false)); // keys export const keyScopeReal = ko.observable(KeyState.All); diff --git a/dev/Remote/AbstractFetch.js b/dev/Remote/AbstractFetch.js index 3962ca1bd..e05cab1c9 100644 --- a/dev/Remote/AbstractFetch.js +++ b/dev/Remote/AbstractFetch.js @@ -1,4 +1,4 @@ -import { TOKEN_ERROR_LIMIT, AJAX_ERROR_LIMIT, DEFAULT_AJAX_TIMEOUT } from 'Common/Consts'; +import { DEFAULT_AJAX_TIMEOUT } from 'Common/Consts'; import { StorageResultType, Notification } from 'Common/Enums'; import { pInt, pString } from 'Common/Utils'; import { serverRequest } from 'Common/Links'; @@ -36,11 +36,11 @@ checkResponseError = data => { ++iTokenErrorCount; } - if (TOKEN_ERROR_LIMIT < iTokenErrorCount) { + if (10 < iTokenErrorCount) { rl.logoutReload(); } - if (window.rl && (data.ClearAuth || data.Logout || AJAX_ERROR_LIMIT < iAjaxErrorCount)) { + if (window.rl && (data.ClearAuth || data.Logout || 7 < iAjaxErrorCount)) { rl.hash.clear(); if (!data.ClearAuth) { diff --git a/dev/Remote/User/Fetch.js b/dev/Remote/User/Fetch.js index a520690e0..e789c102b 100644 --- a/dev/Remote/User/Fetch.js +++ b/dev/Remote/User/Fetch.js @@ -1,12 +1,6 @@ import { pString, pInt } from 'Common/Utils'; -import { - CONTACTS_SYNC_AJAX_TIMEOUT, - DEFAULT_AJAX_TIMEOUT, - SEARCH_AJAX_TIMEOUT, - SAVE_MESSAGE_AJAX_TIMEOUT, - SEND_MESSAGE_AJAX_TIMEOUT -} from 'Common/Consts'; +import { DEFAULT_AJAX_TIMEOUT } from 'Common/Consts'; import { getFolderHash, @@ -136,7 +130,7 @@ class RemoteUserFetch extends AbstractFetchRemote { * @param {?Function} fCallback */ contactsSync(fCallback) { - this.defaultRequest(fCallback, 'ContactsSync', null, CONTACTS_SYNC_AJAX_TIMEOUT); + this.defaultRequest(fCallback, 'ContactsSync', null, 200000); } /** @@ -341,7 +335,7 @@ class RemoteUserFetch extends AbstractFetchRemote { fCallback, 'MessageList', params, - sSearch ? SEARCH_AJAX_TIMEOUT : DEFAULT_AJAX_TIMEOUT, + sSearch ? 300000 : DEFAULT_AJAX_TIMEOUT, sGetAdd, bSilent ? [] : ['MessageList'] ); @@ -533,7 +527,7 @@ class RemoteUserFetch extends AbstractFetchRemote { * @param {Object} oData */ saveMessage(fCallback, oData) { - this.defaultRequest(fCallback, 'SaveMessage', oData, SAVE_MESSAGE_AJAX_TIMEOUT); + this.defaultRequest(fCallback, 'SaveMessage', oData, 200000); } /** @@ -559,7 +553,7 @@ class RemoteUserFetch extends AbstractFetchRemote { * @param {Object} oData */ sendMessage(fCallback, oData) { - this.defaultRequest(fCallback, 'SendMessage', oData, SEND_MESSAGE_AJAX_TIMEOUT); + this.defaultRequest(fCallback, 'SendMessage', oData, 300000); } /** diff --git a/dev/Storage/Client.js b/dev/Storage/Client.js index b5c564ed7..30e753d19 100644 --- a/dev/Storage/Client.js +++ b/dev/Storage/Client.js @@ -1,6 +1,5 @@ -import { CLIENT_SIDE_STORAGE_INDEX_NAME } from 'Common/Consts'; - const storage = localStorage, +CLIENT_SIDE_STORAGE_INDEX_NAME = 'rlcsc', getStorage = () => { try { const value = storage.getItem(CLIENT_SIDE_STORAGE_INDEX_NAME) || null; diff --git a/dev/Stores/User/Message.js b/dev/Stores/User/Message.js index 3cdc8be26..11faf255a 100644 --- a/dev/Stores/User/Message.js +++ b/dev/Stores/User/Message.js @@ -21,7 +21,6 @@ import { clearNewMessageCache } from 'Common/Cache'; -import { MESSAGE_BODY_CACHE_LIMIT } from 'Common/Consts'; import { mailBox, notificationMailIcon } from 'Common/Links'; import { i18n, getNotification } from 'Common/Translator'; @@ -209,7 +208,7 @@ class MessageUserStore { } purgeMessageBodyCache() { - const end = iMessageBodyCacheCount - MESSAGE_BODY_CACHE_LIMIT; + const end = iMessageBodyCacheCount - 15; if (0 < end) { let count = 0; const messagesDom = this.messagesBodiesDom(); diff --git a/dev/Stores/User/Settings.js b/dev/Stores/User/Settings.js index 57f3a8034..cc583ef6a 100644 --- a/dev/Stores/User/Settings.js +++ b/dev/Stores/User/Settings.js @@ -1,6 +1,6 @@ import ko from 'ko'; -import { MESSAGES_PER_PAGE, MESSAGES_PER_PAGE_VALUES } from 'Common/Consts'; +import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts'; import { Layout, EditorDefaultType } from 'Common/Enums'; import { pInt } from 'Common/Utils'; @@ -21,7 +21,7 @@ class SettingsUserStore { ] }); - this.messagesPerPage = ko.observable(MESSAGES_PER_PAGE).extend({ limitedList: MESSAGES_PER_PAGE_VALUES }); + this.messagesPerPage = ko.observable(20).extend({ limitedList: MESSAGES_PER_PAGE_VALUES }); this.showImages = ko.observable(false); this.useCheckboxesInList = ko.observable(true); diff --git a/dev/Styles/Layout.less b/dev/Styles/Layout.less index 53f0f2708..39e56d0f0 100644 --- a/dev/Styles/Layout.less +++ b/dev/Styles/Layout.less @@ -55,17 +55,18 @@ html.rl-mobile { /* .resizable::after { - pointer-events: none; - position: absolute; - height: 22px; - width: 20px; - text-align: center; - bottom: 0; - right: 0; - background-color: #aaa; + background-color: #aaa; + bottom: 0; + content: ''; + height: 22px; + pointer-events: none; + position: absolute; + right: 0; + text-align: center; + width: 20px; } .resizable::-webkit-resizer { - background: #aaa; + background: #aaa; background: rgba(255,255,255,0.5); } */ diff --git a/dev/View/Popup/Contacts.js b/dev/View/Popup/Contacts.js index cc9e32aa1..3140adc3f 100644 --- a/dev/View/Popup/Contacts.js +++ b/dev/View/Popup/Contacts.js @@ -17,8 +17,6 @@ import { pInt } from 'Common/Utils'; -import { CONTACTS_PER_PAGE } from 'Common/Consts'; - import { Selector } from 'Common/Selector'; import { exportContactsVcf, exportContactsCsv, uploadContacts } from 'Common/Links'; import { i18n, getNotification } from 'Common/Translator'; @@ -35,7 +33,8 @@ import { ContactPropertyModel } from 'Model/ContactProperty'; import { popup, command, showScreenPopup, hideScreenPopup } from 'Knoin/Knoin'; import { AbstractViewNext } from 'Knoin/AbstractViewNext'; -const trim = text => null == text ? "" : (text + "").trim(); +const trim = text => null == text ? "" : (text + "").trim(), + CONTACTS_PER_PAGE = 50; @popup({ name: 'View/Popup/Contacts', diff --git a/dev/View/Popup/Domain.js b/dev/View/Popup/Domain.js index 685879358..f58129205 100644 --- a/dev/View/Popup/Domain.js +++ b/dev/View/Popup/Domain.js @@ -1,7 +1,6 @@ import ko from 'ko'; import { StorageResultType, ServerSecure, Ports, Notification } from 'Common/Enums'; -import { IMAP_DEFAULT_PORT, SIEVE_DEFAULT_PORT, SMTP_DEFAULT_PORT } from 'Common/Consts'; import { pInt, pString } from 'Common/Utils'; import { i18n } from 'Common/Translator'; @@ -48,16 +47,16 @@ class DomainPopupView extends AbstractViewNext { this.name = ko.observable(''); this.imapServer = ko.observable(''); - this.imapPort = ko.observable('' + IMAP_DEFAULT_PORT); + this.imapPort = ko.observable('143'); this.imapSecure = ko.observable(ServerSecure.None); this.imapShortLogin = ko.observable(false); this.useSieve = ko.observable(false); this.sieveAllowRaw = ko.observable(false); this.sieveServer = ko.observable(''); - this.sievePort = ko.observable('' + SIEVE_DEFAULT_PORT); + this.sievePort = ko.observable('4190'); this.sieveSecure = ko.observable(ServerSecure.None); this.smtpServer = ko.observable(''); - this.smtpPort = ko.observable('' + SMTP_DEFAULT_PORT); + this.smtpPort = ko.observable('25'); this.smtpSecure = ko.observable(ServerSecure.None); this.smtpShortLogin = ko.observable(false); this.smtpAuth = ko.observable(true); @@ -368,18 +367,18 @@ class DomainPopupView extends AbstractViewNext { this.name(''); this.imapServer(''); - this.imapPort('' + IMAP_DEFAULT_PORT); + this.imapPort('143'); this.imapSecure(ServerSecure.None); this.imapShortLogin(false); this.useSieve(false); this.sieveAllowRaw(false); this.sieveServer(''); - this.sievePort('' + SIEVE_DEFAULT_PORT); + this.sievePort('4190'); this.sieveSecure(ServerSecure.None); this.smtpServer(''); - this.smtpPort('' + SMTP_DEFAULT_PORT); + this.smtpPort('25'); this.smtpSecure(ServerSecure.None); this.smtpShortLogin(false); this.smtpAuth(true); diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index 3caeca8bf..3daf2caa9 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -336,18 +336,12 @@ class MessageListMailBoxUserView extends AbstractViewNext { if (this.newMoveToFolder() && this.mobileCheckedStateShow()) { if (vm && event && event.preventDefault) { event.preventDefault(); - if (event.stopPropagation) { - event.stopPropagation(); - } + event.stopPropagation(); } - if (moveAction()) { - AppStore.focusedState(Focused.MessageList); - moveAction(false); - } else { - AppStore.focusedState(Focused.FolderList); - moveAction(true); - } + let b = moveAction(); + AppStore.focusedState(b ? Focused.MessageList : Focused.FolderList); + moveAction(!b); } } @@ -378,10 +372,7 @@ class MessageListMailBoxUserView extends AbstractViewNext { clearTimeout(this.iGoToUpUpOrDownDownTimeout); this.iGoToUpUpOrDownDownTimeout = setTimeout(() => { - let prev = null, - next = null, - temp = null, - current = null; + let prev, next, temp, current; this.messageListPagenator().find(item => { if (item) { @@ -420,15 +411,9 @@ class MessageListMailBoxUserView extends AbstractViewNext { } useAutoSelect() { - if (this.messageListDisableAutoSelect()) { - return false; - } - - if (/is:unseen/.test(this.mainMessageListSearch())) { - return false; - } - - return Layout.NoPreview !== SettingsStore.layout(); + return !this.messageListDisableAutoSelect() + && !/is:unseen/.test(this.mainMessageListSearch()) + && Layout.NoPreview !== SettingsStore.layout(); } searchEnterAction() {