Cleanup __APP__/getApp code

This commit is contained in:
djmaze 2020-09-15 09:29:25 +02:00
parent 29cf711a6a
commit b904eca98e
34 changed files with 86 additions and 146 deletions

View file

@ -5,8 +5,6 @@ import { getNotification } from 'Common/Translator';
import Remote from 'Remote/User/Fetch';
import { getApp } from 'Helper/Apps/User';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -57,7 +55,7 @@ class AccountPopupView extends AbstractViewNext {
this.submitRequest(false);
if (StorageResultType.Success === result && data) {
if (data.Result) {
getApp().accountsAndIdentities();
rl.app.accountsAndIdentities();
this.cancelCommand();
} else {
this.submitError(

View file

@ -2,8 +2,6 @@ import ko from 'ko';
import PgpStore from 'Stores/User/Pgp';
import { getApp } from 'Helper/Apps/User';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -75,7 +73,7 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext {
openpgpKeyring.store();
getApp().reloadOpenPgpKeys();
rl.app.reloadOpenPgpKeys();
if (this.key.error()) {
return false;

View file

@ -40,8 +40,6 @@ import Remote from 'Remote/User/Fetch';
import { ComposeAttachmentModel } from 'Model/ComposeAttachment';
import { getApp } from 'Helper/Apps/User';
import { popup, command, isPopupVisible, showScreenPopup, hideScreenPopup, routeOn, routeOff } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -370,7 +368,7 @@ class ComposePopupView extends AbstractViewNext {
}
setMessageFlagsToCache(this.aDraftInfo[2], this.aDraftInfo[1], flagsCache);
getApp().reloadFlagsCurrentMessageListAndMessageFromCache();
rl.app.reloadFlagsCurrentMessageListAndMessageFromCache();
setFolderHash(this.aDraftInfo[2], '');
}
}
@ -421,7 +419,7 @@ class ComposePopupView extends AbstractViewNext {
i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'),
() => {
if (this.modalVisibility()) {
getApp().deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
rl.app.deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
hideScreenPopup(ComposePopupView);
}
}
@ -482,7 +480,7 @@ class ComposePopupView extends AbstractViewNext {
}
emailsSource(oData, fResponse) {
getApp().getAutocomplete(oData.term, aData => fResponse(aData.map(oEmailItem => oEmailItem.toLine(false))));
rl.app.getAutocomplete(oData.term, aData => fResponse(aData.map(oEmailItem => oEmailItem.toLine(false))));
}
openOpenPgpPopup() {
@ -507,9 +505,9 @@ class ComposePopupView extends AbstractViewNext {
if (draftFolder && UNUSED_OPTION_VALUE !== draftFolder) {
setFolderHash(draftFolder, '');
if (FolderStore.currentFolderFullNameRaw() === draftFolder) {
getApp().reloadMessageList(true);
rl.app.reloadMessageList(true);
} else {
getApp().folderInformation(draftFolder);
rl.app.folderInformation(draftFolder);
}
}
}

View file

@ -33,8 +33,6 @@ import { EmailModel } from 'Model/Email';
import { ContactModel } from 'Model/Contact';
import { ContactPropertyModel } from 'Model/ContactProperty';
import { getApp } from 'Helper/Apps/User';
import { popup, command, showScreenPopup, hideScreenPopup, routeOn, routeOff } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -336,7 +334,7 @@ class ContactsPopupView extends AbstractViewNext {
@command((self) => !self.contacts.syncing() && !self.contacts.importing())
syncCommand() {
getApp().contactsSync((result, data) => {
rl.app.contactsSync((result, data) => {
if (StorageResultType.Success !== result || !data || !data.Result) {
alert(getNotification(data && data.ErrorCode ? data.ErrorCode : Notification.ContactsSyncError));
}
@ -403,11 +401,11 @@ class ContactsPopupView extends AbstractViewNext {
}
exportVcf() {
getApp().download(exportContactsVcf());
rl.app.download(exportContactsVcf());
}
exportCsv() {
getApp().download(exportContactsCsv());
rl.app.download(exportContactsCsv());
}
initUploader() {

View file

@ -9,8 +9,6 @@ import CapaAdminStore from 'Stores/Admin/Capa';
import Remote from 'Remote/Admin/Fetch';
import { getApp } from 'Helper/Apps/Admin';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -317,7 +315,7 @@ class DomainPopupView extends AbstractViewNext {
this.saving(false);
if (StorageResultType.Success === sResult && oData) {
if (oData.Result) {
getApp().reloadDomainList();
rl.app.reloadDomainList();
this.closeCommand();
} else if (Notification.DomainAlreadyExists === oData.ErrorCode) {
this.savingError(i18n('ERRORS/DOMAIN_ALREADY_EXISTS'));

View file

@ -7,8 +7,6 @@ import DomainStore from 'Stores/Admin/Domain';
import Remote from 'Remote/Admin/Fetch';
import { getApp } from 'Helper/Apps/Admin';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -48,7 +46,7 @@ class DomainAliasPopupView extends AbstractViewNext {
this.saving(false);
if (StorageResultType.Success === result && data) {
if (data.Result) {
getApp().reloadDomainList();
rl.app.reloadDomainList();
this.closeCommand();
} else if (Notification.DomainAlreadyExists === data.ErrorCode) {
this.savingError(i18n('ERRORS/DOMAIN_ALREADY_EXISTS'));

View file

@ -8,8 +8,6 @@ import MessageStore from 'Stores/User/Message';
import Remote from 'Remote/User/Fetch';
import { getApp } from 'Helper/Apps/User';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -62,7 +60,7 @@ class FolderClearPopupView extends AbstractViewNext {
Remote.folderClear((result, data) => {
this.clearingProcess(false);
if (StorageResultType.Success === result && data && data.Result) {
getApp().reloadMessageList(true);
rl.app.reloadMessageList(true);
this.cancelCommand();
} else {
if (data && data.ErrorCode) {

View file

@ -9,8 +9,6 @@ import FolderStore from 'Stores/User/Folder';
import Remote from 'Remote/User/Fetch';
import { getApp } from 'Helper/Apps/User';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -53,7 +51,7 @@ class FolderCreateView extends AbstractViewNext {
parentFolderName = FolderStore.namespace.substr(0, FolderStore.namespace.length - 1);
}
getApp().foldersPromisesActionHelper(
rl.app.foldersPromisesActionHelper(
Remote.folderCreate(this.folderName(), parentFolderName, FolderStore.foldersCreating),
Notification.CantCreateFolder
);

View file

@ -7,8 +7,6 @@ import { getNotification } from 'Common/Translator';
import Remote from 'Remote/User/Fetch';
import { getApp } from 'Helper/Apps/User';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -89,7 +87,7 @@ class IdentityPopupView extends AbstractViewNext {
this.submitRequest(false);
if (StorageResultType.Success === result && data) {
if (data.Result) {
getApp().accountsAndIdentities();
rl.app.accountsAndIdentities();
this.cancelCommand();
} else if (data.ErrorCode) {
this.submitError(getNotification(data.ErrorCode));

View file

@ -4,8 +4,6 @@ import { pInt } from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
import { getApp } from 'Helper/Apps/User';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -68,7 +66,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
openpgpKeyring.store();
getApp().reloadOpenPgpKeys();
rl.app.reloadOpenPgpKeys();
this.cancelCommand && this.cancelCommand();
}
})

View file

@ -6,8 +6,6 @@ import { HtmlEditor } from 'Common/HtmlEditor';
import Remote from 'Remote/User/Fetch';
import { getApp } from 'Helper/Apps/User';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -62,7 +60,7 @@ class TemplatePopupView extends AbstractViewNext {
this.submitRequest(false);
if (StorageResultType.Success === result && data) {
if (data.Result) {
getApp().templates();
rl.app.templates();
this.cancelCommand();
} else if (data.ErrorCode) {
this.submitError(getNotification(data.ErrorCode));

View file

@ -6,8 +6,6 @@ import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import Remote from 'Remote/User/Fetch';
import { getApp } from 'Helper/Apps/User';
import { popup, showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -104,7 +102,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
}
logout() {
getApp().logout();
rl.app.logout();
}
testTwoFactor() {