mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Move Knoin routOff, routOn, routReload & setHash to rl.route.*
This commit is contained in:
parent
03a40f3249
commit
467f615713
17 changed files with 83 additions and 111 deletions
|
|
@ -14,8 +14,6 @@ import { initOnStartOrLangChange, initNotificationLanguage } from 'Common/Transl
|
||||||
import LanguageStore from 'Stores/Language';
|
import LanguageStore from 'Stores/Language';
|
||||||
import ThemeStore from 'Stores/Theme';
|
import ThemeStore from 'Stores/Theme';
|
||||||
|
|
||||||
import { routeReload } from 'Knoin/Knoin';
|
|
||||||
|
|
||||||
const Settings = rl.settings;
|
const Settings = rl.settings;
|
||||||
|
|
||||||
class AbstractApp {
|
class AbstractApp {
|
||||||
|
|
@ -89,7 +87,7 @@ class AbstractApp {
|
||||||
if (location.href !== logoutLink) {
|
if (location.href !== logoutLink) {
|
||||||
setTimeout(() => (Settings.app('inIframe') ? parent : window).location.href = logoutLink, 100);
|
setTimeout(() => (Settings.app('inIframe') ? parent : window).location.href = logoutLink, 100);
|
||||||
} else {
|
} else {
|
||||||
routeReload();
|
rl.route.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { root } from 'Common/Links';
|
|
||||||
import { StorageResultType } from 'Common/Enums';
|
import { StorageResultType } from 'Common/Enums';
|
||||||
|
|
||||||
import AppStore from 'Stores/Admin/App';
|
import AppStore from 'Stores/Admin/App';
|
||||||
|
|
@ -13,7 +12,7 @@ import Remote from 'Remote/Admin/Fetch';
|
||||||
import { SettingsAdminScreen } from 'Screen/Admin/Settings';
|
import { SettingsAdminScreen } from 'Screen/Admin/Settings';
|
||||||
import { LoginAdminScreen } from 'Screen/Admin/Login';
|
import { LoginAdminScreen } from 'Screen/Admin/Login';
|
||||||
|
|
||||||
import { hideLoading, routeOff, setHash, startScreens } from 'Knoin/Knoin';
|
import { hideLoading, startScreens } from 'Knoin/Knoin';
|
||||||
import { AbstractApp } from 'App/Abstract';
|
import { AbstractApp } from 'App/Abstract';
|
||||||
|
|
||||||
class AdminApp extends AbstractApp {
|
class AdminApp extends AbstractApp {
|
||||||
|
|
@ -108,13 +107,8 @@ class AdminApp extends AbstractApp {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
||||||
if (!rl.settings.app('allowAdminPanel')) {
|
if (!rl.settings.app('allowAdminPanel')) {
|
||||||
routeOff();
|
rl.route.root();
|
||||||
setHash(root(), true);
|
setTimeout(() => location.href = '/', 1);
|
||||||
routeOff();
|
|
||||||
|
|
||||||
setTimeout(() =>
|
|
||||||
location.href = '/'
|
|
||||||
, 1);
|
|
||||||
} else {
|
} else {
|
||||||
if (rl.settings.get('Auth')) {
|
if (rl.settings.get('Auth')) {
|
||||||
startScreens([SettingsAdminScreen]);
|
startScreens([SettingsAdminScreen]);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ import { LoginUserScreen } from 'Screen/User/Login';
|
||||||
import { MailBoxUserScreen } from 'Screen/User/MailBox';
|
import { MailBoxUserScreen } from 'Screen/User/MailBox';
|
||||||
import { SettingsUserScreen } from 'Screen/User/Settings';
|
import { SettingsUserScreen } from 'Screen/User/Settings';
|
||||||
|
|
||||||
import { hideLoading, routeOff, routeOn, setHash, startScreens, showScreenPopup } from 'Knoin/Knoin';
|
import { hideLoading, startScreens, showScreenPopup } from 'Knoin/Knoin';
|
||||||
|
|
||||||
import { AbstractApp } from 'App/Abstract';
|
import { AbstractApp } from 'App/Abstract';
|
||||||
|
|
||||||
|
|
@ -149,7 +149,7 @@ class AppUser extends AbstractApp {
|
||||||
MessageStore.messageListPageBeforeThread(1);
|
MessageStore.messageListPageBeforeThread(1);
|
||||||
iOffset = 0;
|
iOffset = 0;
|
||||||
|
|
||||||
setHash(
|
rl.route.setHash(
|
||||||
mailBox(
|
mailBox(
|
||||||
FolderStore.currentFolderFullNameHash(),
|
FolderStore.currentFolderFullNameHash(),
|
||||||
MessageStore.messageListPage(),
|
MessageStore.messageListPage(),
|
||||||
|
|
@ -948,9 +948,7 @@ class AppUser extends AbstractApp {
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (startupUrl) {
|
if (startupUrl) {
|
||||||
routeOff();
|
rl.route.setHash(root(startupUrl), true);
|
||||||
setHash(root(startupUrl), true);
|
|
||||||
routeOn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.crypto && crypto.getRandomValues && Settings.capa(Capa.OpenPGP)) {
|
if (window.crypto && crypto.getRandomValues && Settings.capa(Capa.OpenPGP)) {
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ import ko from 'ko';
|
||||||
|
|
||||||
import { $htmlCL, VIEW_MODELS } from 'Common/Globals';
|
import { $htmlCL, VIEW_MODELS } from 'Common/Globals';
|
||||||
|
|
||||||
import { root } from 'Common/Links';
|
|
||||||
|
|
||||||
//import { bMobileDevice } from 'Common/Globals';
|
//import { bMobileDevice } from 'Common/Globals';
|
||||||
|
|
||||||
let currentScreen = null,
|
let currentScreen = null,
|
||||||
|
|
@ -82,30 +80,6 @@ export function addSettingsViewModel(SettingsViewModelClass, template, labelName
|
||||||
VIEW_MODELS.settings.push(SettingsViewModelClass);
|
VIEW_MODELS.settings.push(SettingsViewModelClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
export function routeReload() {
|
|
||||||
routeOff();
|
|
||||||
setHash(root(), true);
|
|
||||||
routeOff();
|
|
||||||
setTimeout(() => (rl.settings.app('inIframe') ? parent : window).location.reload(), 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
export function routeOff() {
|
|
||||||
hasher.changed.active = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
export function routeOn() {
|
|
||||||
hasher.changed.active = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} screenName
|
* @param {string} screenName
|
||||||
* @returns {?Object}
|
* @returns {?Object}
|
||||||
|
|
@ -422,28 +396,6 @@ export function startScreens(screensClasses) {
|
||||||
setTimeout(() => $htmlCL.add('rl-started-delay'), 200);
|
setTimeout(() => $htmlCL.add('rl-started-delay'), 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} sHash
|
|
||||||
* @param {boolean=} silence = false
|
|
||||||
* @param {boolean=} replace = false
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
export function setHash(hash, silence = false, replace = false) {
|
|
||||||
hash = hash.replace(/^[#/]+/, '');
|
|
||||||
|
|
||||||
const cmd = replace ? 'replaceHash' : 'setHash';
|
|
||||||
|
|
||||||
if (silence) {
|
|
||||||
hasher.changed.active = false;
|
|
||||||
hasher[cmd](hash);
|
|
||||||
hasher.changed.active = true;
|
|
||||||
} else {
|
|
||||||
hasher.changed.active = true;
|
|
||||||
hasher[cmd](hash);
|
|
||||||
hasher.setHash(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} params
|
* @param {Object} params
|
||||||
* @returns {Function}
|
* @returns {Function}
|
||||||
|
|
@ -524,7 +476,7 @@ function settingsMenuKeysHandler(items) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultHash = items[index].href;
|
const resultHash = items[index].href;
|
||||||
resultHash && setHash(resultHash, false, true);
|
resultHash && rl.route.setHash(resultHash, false, true);
|
||||||
}
|
}
|
||||||
}).throttle(200);
|
}).throttle(200);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { VIEW_MODELS } from 'Common/Globals';
|
||||||
import { pString } from 'Common/Utils';
|
import { pString } from 'Common/Utils';
|
||||||
import { settings } from 'Common/Links';
|
import { settings } from 'Common/Links';
|
||||||
|
|
||||||
import { setHash } from 'Knoin/Knoin';
|
|
||||||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||||
|
|
||||||
class AbstractSettingsScreen extends AbstractScreen {
|
class AbstractSettingsScreen extends AbstractScreen {
|
||||||
|
|
@ -128,7 +127,7 @@ class AbstractSettingsScreen extends AbstractScreen {
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setHash(settings(), false, true);
|
rl.route.setHash(settings(), false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { Capa, StorageResultType } from 'Common/Enums';
|
import { Capa, StorageResultType } from 'Common/Enums';
|
||||||
import { root } from 'Common/Links';
|
|
||||||
|
|
||||||
import AccountStore from 'Stores/User/Account';
|
import AccountStore from 'Stores/User/Account';
|
||||||
import IdentityStore from 'Stores/User/Identity';
|
import IdentityStore from 'Stores/User/Identity';
|
||||||
import Remote from 'Remote/User/Fetch';
|
import Remote from 'Remote/User/Fetch';
|
||||||
|
|
||||||
import { showScreenPopup, routeOff, setHash } from 'Knoin/Knoin';
|
import { showScreenPopup } from 'Knoin/Knoin';
|
||||||
|
|
||||||
class AccountsUserSettings {
|
class AccountsUserSettings {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
@ -59,10 +58,7 @@ class AccountsUserSettings {
|
||||||
|
|
||||||
Remote.accountDelete((result, data) => {
|
Remote.accountDelete((result, data) => {
|
||||||
if (StorageResultType.Success === result && data && data.Result && data.Reload) {
|
if (StorageResultType.Success === result && data && data.Result && data.Reload) {
|
||||||
routeOff();
|
rl.route.root();
|
||||||
setHash(root(), true);
|
|
||||||
routeOff();
|
|
||||||
|
|
||||||
setTimeout(() => location.reload(), 1);
|
setTimeout(() => location.reload(), 1);
|
||||||
} else {
|
} else {
|
||||||
rl.app.accountsAndIdentities();
|
rl.app.accountsAndIdentities();
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ import { EmailCollectionModel } from 'Model/EmailCollection';
|
||||||
import { MessageModel } from 'Model/Message';
|
import { MessageModel } from 'Model/Message';
|
||||||
import { MessageCollectionModel } from 'Model/MessageCollection';
|
import { MessageCollectionModel } from 'Model/MessageCollection';
|
||||||
|
|
||||||
import { setHash } from 'Knoin/Knoin';
|
|
||||||
|
|
||||||
import AppStore from 'Stores/User/App';
|
import AppStore from 'Stores/User/App';
|
||||||
import AccountStore from 'Stores/User/Account';
|
import AccountStore from 'Stores/User/Account';
|
||||||
import FolderStore from 'Stores/User/Folder';
|
import FolderStore from 'Stores/User/Folder';
|
||||||
|
|
@ -127,7 +125,7 @@ class MessageUserStore {
|
||||||
this.mainMessageListSearch = ko.computed({
|
this.mainMessageListSearch = ko.computed({
|
||||||
read: this.messageListSearch,
|
read: this.messageListSearch,
|
||||||
write: (value) => {
|
write: (value) => {
|
||||||
setHash(
|
rl.route.setHash(
|
||||||
mailBox(FolderStore.currentFolderFullNameHash(), 1, value.toString().trim(), this.messageListThreadUid())
|
mailBox(FolderStore.currentFolderFullNameHash(), 1, value.toString().trim(), this.messageListThreadUid())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -374,7 +372,7 @@ class MessageUserStore {
|
||||||
if (message && this.messageListThreadUid() !== pString(message.uid)) {
|
if (message && this.messageListThreadUid() !== pString(message.uid)) {
|
||||||
this.messageListThreadUid(pString(message.uid));
|
this.messageListThreadUid(pString(message.uid));
|
||||||
|
|
||||||
setHash(
|
rl.route.setHash(
|
||||||
mailBox(
|
mailBox(
|
||||||
FolderStore.currentFolderFullNameHash(),
|
FolderStore.currentFolderFullNameHash(),
|
||||||
this.messageListPage(),
|
this.messageListPage(),
|
||||||
|
|
@ -388,7 +386,7 @@ class MessageUserStore {
|
||||||
if (1 < this.messageListPage()) {
|
if (1 < this.messageListPage()) {
|
||||||
this.messageListPage(this.messageListPage() - 1);
|
this.messageListPage(this.messageListPage() - 1);
|
||||||
|
|
||||||
setHash(
|
rl.route.setHash(
|
||||||
mailBox(
|
mailBox(
|
||||||
FolderStore.currentFolderFullNameHash(),
|
FolderStore.currentFolderFullNameHash(),
|
||||||
this.messageListPage(),
|
this.messageListPage(),
|
||||||
|
|
@ -401,7 +399,7 @@ class MessageUserStore {
|
||||||
} else {
|
} else {
|
||||||
this.messageListThreadUid('');
|
this.messageListThreadUid('');
|
||||||
|
|
||||||
setHash(
|
rl.route.setHash(
|
||||||
mailBox(
|
mailBox(
|
||||||
FolderStore.currentFolderFullNameHash(),
|
FolderStore.currentFolderFullNameHash(),
|
||||||
this.messageListPageBeforeThread(),
|
this.messageListPageBeforeThread(),
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { getNotification } from 'Common/Translator';
|
||||||
|
|
||||||
import Remote from 'Remote/Admin/Fetch';
|
import Remote from 'Remote/Admin/Fetch';
|
||||||
|
|
||||||
import { view, command, ViewType, routeOff, routeReload } from 'Knoin/Knoin';
|
import { view, command, ViewType } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
@view({
|
@view({
|
||||||
|
|
@ -68,7 +68,7 @@ class LoginAdminView extends AbstractViewNext {
|
||||||
(sResult, oData) => {
|
(sResult, oData) => {
|
||||||
if (StorageResultType.Success === sResult && oData && 'AdminLogin' === oData.Action) {
|
if (StorageResultType.Success === sResult && oData && 'AdminLogin' === oData.Action) {
|
||||||
if (oData.Result) {
|
if (oData.Result) {
|
||||||
routeReload();
|
rl.route.reload();
|
||||||
} else if (oData.ErrorCode) {
|
} else if (oData.ErrorCode) {
|
||||||
this.submitRequest(false);
|
this.submitRequest(false);
|
||||||
this.submitError(getNotification(oData.ErrorCode));
|
this.submitError(getNotification(oData.ErrorCode));
|
||||||
|
|
@ -86,7 +86,7 @@ class LoginAdminView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
routeOff();
|
rl.route.off();
|
||||||
}
|
}
|
||||||
|
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ import Remote from 'Remote/User/Fetch';
|
||||||
|
|
||||||
import { ComposeAttachmentModel } from 'Model/ComposeAttachment';
|
import { ComposeAttachmentModel } from 'Model/ComposeAttachment';
|
||||||
|
|
||||||
import { popup, command, isPopupVisible, showScreenPopup, hideScreenPopup, routeOn, routeOff } from 'Knoin/Knoin';
|
import { popup, command, isPopupVisible, showScreenPopup, hideScreenPopup } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
const Settings = rl.settings;
|
const Settings = rl.settings;
|
||||||
|
|
@ -636,7 +636,7 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
|
|
||||||
this.to.focused(false);
|
this.to.focused(false);
|
||||||
|
|
||||||
routeOn();
|
rl.route.on();
|
||||||
|
|
||||||
this.resizeObserver.disconnect();
|
this.resizeObserver.disconnect();
|
||||||
}
|
}
|
||||||
|
|
@ -719,7 +719,7 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
* @param {string=} sCustomPlainText = null
|
* @param {string=} sCustomPlainText = null
|
||||||
*/
|
*/
|
||||||
onShow(type, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText) {
|
onShow(type, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText) {
|
||||||
routeOff();
|
rl.route.off();
|
||||||
|
|
||||||
const ro = this.resizeObserver;
|
const ro = this.resizeObserver;
|
||||||
ro.observe(ro.compose);
|
ro.observe(ro.compose);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import { EmailModel } from 'Model/Email';
|
||||||
import { ContactModel } from 'Model/Contact';
|
import { ContactModel } from 'Model/Contact';
|
||||||
import { ContactPropertyModel } from 'Model/ContactProperty';
|
import { ContactPropertyModel } from 'Model/ContactProperty';
|
||||||
|
|
||||||
import { popup, command, showScreenPopup, hideScreenPopup, routeOn, routeOff } from 'Knoin/Knoin';
|
import { popup, command, showScreenPopup, hideScreenPopup } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
const trim = text => null == text ? "" : (text + "").trim();
|
const trim = text => null == text ? "" : (text + "").trim();
|
||||||
|
|
@ -633,12 +633,12 @@ class ContactsPopupView extends AbstractViewNext {
|
||||||
this.bBackToCompose = undefined === bBackToCompose ? false : !!bBackToCompose;
|
this.bBackToCompose = undefined === bBackToCompose ? false : !!bBackToCompose;
|
||||||
this.sLastComposeFocusedField = undefined === sLastComposeFocusedField ? '' : sLastComposeFocusedField;
|
this.sLastComposeFocusedField = undefined === sLastComposeFocusedField ? '' : sLastComposeFocusedField;
|
||||||
|
|
||||||
routeOff();
|
rl.route.off();
|
||||||
this.reloadContactList(true);
|
this.reloadContactList(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
onHide() {
|
onHide() {
|
||||||
routeOn();
|
rl.route.on();
|
||||||
|
|
||||||
this.currentContact(null);
|
this.currentContact(null);
|
||||||
this.emptySelection(true);
|
this.emptySelection(true);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import MessageStore from 'Stores/User/Message';
|
||||||
import { Capa, KeyState } from 'Common/Enums';
|
import { Capa, KeyState } from 'Common/Enums';
|
||||||
import { settings } from 'Common/Links';
|
import { settings } from 'Common/Links';
|
||||||
|
|
||||||
import { showScreenPopup, setHash } from 'Knoin/Knoin';
|
import { showScreenPopup } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
const Settings = rl.settings;
|
const Settings = rl.settings;
|
||||||
|
|
@ -60,7 +60,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext {
|
||||||
|
|
||||||
settingsClick() {
|
settingsClick() {
|
||||||
if (Settings.capa(Capa.Settings)) {
|
if (Settings.capa(Capa.Settings)) {
|
||||||
setHash(settings());
|
rl.route.setHash(settings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import * as Local from 'Storage/Client';
|
||||||
|
|
||||||
import Remote from 'Remote/User/Fetch';
|
import Remote from 'Remote/User/Fetch';
|
||||||
|
|
||||||
import { view, command, ViewType, routeOff, showScreenPopup, routeReload } from 'Knoin/Knoin';
|
import { view, command, ViewType, showScreenPopup } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
import { rootAdmin } from 'Common/Links';
|
import { rootAdmin } from 'Common/Links';
|
||||||
|
|
@ -182,7 +182,7 @@ class LoginUserView extends AbstractViewNext {
|
||||||
} else if (oData.Admin) {
|
} else if (oData.Admin) {
|
||||||
setTimeout(() => location.href = rootAdmin(), 100);
|
setTimeout(() => location.href = rootAdmin(), 100);
|
||||||
} else {
|
} else {
|
||||||
routeReload();
|
rl.route.reload();
|
||||||
}
|
}
|
||||||
} else if (oData.ErrorCode) {
|
} else if (oData.ErrorCode) {
|
||||||
this.submitRequest(false);
|
this.submitRequest(false);
|
||||||
|
|
@ -227,7 +227,7 @@ class LoginUserView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
routeOff();
|
rl.route.off();
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild() {
|
onBuild() {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import SettingsStore from 'Stores/User/Settings';
|
||||||
import FolderStore from 'Stores/User/Folder';
|
import FolderStore from 'Stores/User/Folder';
|
||||||
import MessageStore from 'Stores/User/Message';
|
import MessageStore from 'Stores/User/Message';
|
||||||
|
|
||||||
import { view, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
|
import { view, ViewType, showScreenPopup } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
const Settings = rl.settings;
|
const Settings = rl.settings;
|
||||||
|
|
@ -90,11 +90,10 @@ class FolderListMailBoxUserView extends AbstractViewNext {
|
||||||
setFolderHash(folder.fullNameRaw, '');
|
setFolderHash(folder.fullNameRaw, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (starred) {
|
rl.route.setHash(starred
|
||||||
setHash(mailBox(folder.fullNameHash, 1, 'is:flagged'));
|
? mailBox(folder.fullNameHash, 1, 'is:flagged')
|
||||||
} else {
|
: mailBox(folder.fullNameHash)
|
||||||
setHash(mailBox(folder.fullNameHash));
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AppStore.focusedState(Focused.MessageList);
|
AppStore.focusedState(Focused.MessageList);
|
||||||
|
|
@ -245,7 +244,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
configureFolders() {
|
configureFolders() {
|
||||||
setHash(settings('folders'));
|
rl.route.setHash(settings('folders'));
|
||||||
}
|
}
|
||||||
|
|
||||||
contactsClick() {
|
contactsClick() {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ import MessageStore from 'Stores/User/Message';
|
||||||
|
|
||||||
import Remote from 'Remote/User/Fetch';
|
import Remote from 'Remote/User/Fetch';
|
||||||
|
|
||||||
import { view, command, ViewType, showScreenPopup, setHash, popupVisibility } from 'Knoin/Knoin';
|
import { view, command, ViewType, showScreenPopup, popupVisibility } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
@ -235,14 +235,14 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ('INBOX' === sFolder) {
|
if ('INBOX' === sFolder) {
|
||||||
setHash(mailBox(sFolder, 1));
|
rl.route.setHash(mailBox(sFolder, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message) {
|
if (message) {
|
||||||
this.selector.selectMessageItem(message);
|
this.selector.selectMessageItem(message);
|
||||||
} else {
|
} else {
|
||||||
if ('INBOX' !== sFolder) {
|
if ('INBOX' !== sFolder) {
|
||||||
setHash(mailBox(sFolder, 1));
|
rl.route.setHash(mailBox(sFolder, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageStore.selectMessageByFolderAndUid(sFolder, sUid);
|
MessageStore.selectMessageByFolderAndUid(sFolder, sUid);
|
||||||
|
|
@ -452,7 +452,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelThreadUid() {
|
cancelThreadUid() {
|
||||||
setHash(
|
rl.route.setHash(
|
||||||
mailBox(
|
mailBox(
|
||||||
FolderStore.currentFolderFullNameHash(),
|
FolderStore.currentFolderFullNameHash(),
|
||||||
MessageStore.messageListPageBeforeThread(),
|
MessageStore.messageListPageBeforeThread(),
|
||||||
|
|
@ -690,7 +690,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
gotoPage(page) {
|
gotoPage(page) {
|
||||||
page && setHash(
|
page && rl.route.setHash(
|
||||||
mailBox(
|
mailBox(
|
||||||
FolderStore.currentFolderFullNameHash(),
|
FolderStore.currentFolderFullNameHash(),
|
||||||
page.value,
|
page.value,
|
||||||
|
|
@ -704,7 +704,9 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
if (message && 0 < message.threadsLen()) {
|
if (message && 0 < message.threadsLen()) {
|
||||||
MessageStore.messageListPageBeforeThread(MessageStore.messageListPage());
|
MessageStore.messageListPageBeforeThread(MessageStore.messageListPage());
|
||||||
|
|
||||||
setHash(mailBox(FolderStore.currentFolderFullNameHash(), 1, MessageStore.messageListSearch(), message.uid));
|
rl.route.setHash(
|
||||||
|
mailBox(FolderStore.currentFolderFullNameHash(), 1, MessageStore.messageListSearch(), message.uid)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { leftPanelDisabled } from 'Common/Globals';
|
||||||
import { settings, inbox } from 'Common/Links';
|
import { settings, inbox } from 'Common/Links';
|
||||||
import { getFolderInboxName } from 'Common/Cache';
|
import { getFolderInboxName } from 'Common/Cache';
|
||||||
|
|
||||||
import { view, ViewType, setHash, settingsMenuKeysHandler } from 'Knoin/Knoin';
|
import { view, ViewType, settingsMenuKeysHandler } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
@view({
|
@view({
|
||||||
|
|
@ -40,7 +40,7 @@ class MenuSettingsUserView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
backToMailBoxClick() {
|
backToMailBoxClick() {
|
||||||
setHash(inbox(getFolderInboxName()));
|
rl.route.setHash(inbox(getFolderInboxName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { leftPanelDisabled } from 'Common/Globals';
|
||||||
|
|
||||||
import MessageStore from 'Stores/User/Message';
|
import MessageStore from 'Stores/User/Message';
|
||||||
|
|
||||||
import { view, ViewType, setHash } from 'Knoin/Knoin';
|
import { view, ViewType } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
@view({
|
@view({
|
||||||
|
|
@ -44,7 +44,7 @@ class PaneSettingsUserView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
backToMailBoxClick() {
|
backToMailBoxClick() {
|
||||||
setHash(inbox(getFolderInboxName()));
|
rl.route.setHash(inbox(getFolderInboxName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
36
dev/bootstrap.js
vendored
36
dev/bootstrap.js
vendored
|
|
@ -3,6 +3,8 @@ import * as Enums from 'Common/Enums';
|
||||||
import * as Plugins from 'Common/Plugins';
|
import * as Plugins from 'Common/Plugins';
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
|
|
||||||
|
import { root } from 'Common/Links';
|
||||||
|
|
||||||
export default (App) => {
|
export default (App) => {
|
||||||
|
|
||||||
addEventListener('keydown', event => {
|
addEventListener('keydown', event => {
|
||||||
|
|
@ -53,6 +55,40 @@ export default (App) => {
|
||||||
dropdownVisibility(!!rl.Dropdowns.find(item => item.classList.contains('open')))
|
dropdownVisibility(!!rl.Dropdowns.find(item => item.classList.contains('open')))
|
||||||
).debounce(50);
|
).debounce(50);
|
||||||
|
|
||||||
|
rl.route = {
|
||||||
|
root: () => {
|
||||||
|
rl.route.setHash(root(), true);
|
||||||
|
rl.route.off();
|
||||||
|
},
|
||||||
|
reload: () => {
|
||||||
|
rl.root();
|
||||||
|
setTimeout(() => (rl.settings.app('inIframe') ? parent : window).location.reload(), 100);
|
||||||
|
},
|
||||||
|
off: () => hasher.changed.active = false,
|
||||||
|
on: () => hasher.changed.active = true,
|
||||||
|
/**
|
||||||
|
* @param {string} sHash
|
||||||
|
* @param {boolean=} silence = false
|
||||||
|
* @param {boolean=} replace = false
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
setHash: (hash, silence = false, replace = false) => {
|
||||||
|
hash = hash.replace(/^[#/]+/, '');
|
||||||
|
|
||||||
|
const cmd = replace ? 'replaceHash' : 'setHash';
|
||||||
|
|
||||||
|
if (silence) {
|
||||||
|
hasher.changed.active = false;
|
||||||
|
hasher[cmd](hash);
|
||||||
|
hasher.changed.active = true;
|
||||||
|
} else {
|
||||||
|
hasher.changed.active = true;
|
||||||
|
hasher[cmd](hash);
|
||||||
|
hasher.setHash(hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
rl.fetchJSON = (resource, init, postData) => {
|
rl.fetchJSON = (resource, init, postData) => {
|
||||||
init = Object.assign({
|
init = Object.assign({
|
||||||
mode: 'same-origin',
|
mode: 'same-origin',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue