Improved knockout observables management to prevent memory leaks

This commit is contained in:
djmaze 2020-10-26 12:54:03 +01:00
parent b165a1de4f
commit 3eb6ab1ef7
46 changed files with 1020 additions and 1013 deletions

View file

@ -30,7 +30,7 @@ class Folder implements \JsonSerializable
/**
* @var bool
*/
private $bExisten;
private $bExists;
/**
* @var bool
@ -50,7 +50,7 @@ class Folder implements \JsonSerializable
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
*/
function __construct(\MailSo\Imap\Folder $oImapFolder, bool $bSubscribed = true, bool $bExisten = true)
function __construct(\MailSo\Imap\Folder $oImapFolder, bool $bSubscribed = true, bool $bExists = true)
{
$this->oImapFolder = $oImapFolder;
$this->oSubFolders = null;
@ -66,7 +66,7 @@ class Folder implements \JsonSerializable
}
$this->bSubscribed = $bSubscribed;
$this->bExisten = $bExisten;
$this->bExists = $bExists;
}
/**
@ -164,12 +164,12 @@ class Folder implements \JsonSerializable
public function IsExists() : bool
{
return $this->bExisten;
return $this->bExists;
}
public function IsSelectable() : bool
{
return $this->IsExists() && $this->oImapFolder->IsSelectable();
return $this->bExists && $this->oImapFolder->IsSelectable();
}
/**
@ -236,9 +236,9 @@ class Folder implements \JsonSerializable
'FullNameRaw' => $this->FullNameRaw(),
'Delimiter' => (string) $this->Delimiter(),
'HasVisibleSubFolders' => $this->HasVisibleSubFolders(),
'IsSubscribed' => $this->IsSubscribed(),
'IsExists' => $this->IsExists(),
'IsSelectable' => $this->IsSelectable(),
'Subscribed' => $this->bSubscribed,
'Exists' => $this->bExists,
'Selectable' => $this->IsSelectable(),
'Flags' => $this->FlagsLowerCase()
);
}

View file

@ -59,7 +59,7 @@
</div>
</div>
<div class="controls"
data-bind="visible: additionalCode.visibility(), css: {'error': additionalCode.error, 'animated': additionalCode.errorAnimation}">
data-bind="visible: additionalCodeVisibility(), css: {'error': additionalCodeError, 'animated': additionalCodeErrorAnimation}">
<div class="input-append">
<input type="text" class="i18n input-block-level inputAdditionalCode" autocomplete="off"
autocorrect="off" autocapitalize="off" spellcheck="false" style="padding-right: 35px;"
@ -71,7 +71,7 @@
</div>
</div>
<div class="controls plugin-mark-Login-BottomControlGroup"
data-bind="visible: additionalCode.visibility()">
data-bind="visible: additionalCodeVisibility()">
<div class="additionalCodeSignMeLabel" data-bind="component: {
name: 'CheckboxSimple',
params: {

View file

@ -1,6 +1,6 @@
<div class="e-item" data-bind="visible: visible, css: { 'i-am-inbox-wrapper': isInbox }">
<a class="e-link" data-bind="dropmessages: $data,
css: { 'i-am-inbox': isInbox, 'selected': selected() && !isSystemFolder(), 'selectable': selectableForFolderList, 'hidden' : hidden, 'print-count': hasUnreadMessages, 'unread-sub': hasSubScribedUnreadMessagesSubfolders, 'system': isSystemFolder, 'anim-action-class': actionBlink }">
css: { 'i-am-inbox': isInbox, 'selected': selected() && !isSystemFolder(), 'selectable': selectableForFolderList, 'hidden' : hidden, 'print-count': hasUnreadMessages, 'unread-sub': hasSubscribedUnreadMessagesSubfolders, 'system': isSystemFolder, 'anim-action-class': actionBlink }">
<span class="badge pull-right count" data-bind="text: printableUnreadCount"></span>
<i data-bind="css: collapsedCss()"></i>
<span class="focused-poiner"></span>

View file

@ -7,9 +7,9 @@
</h3>
</div>
<div class="modal-body">
<div class="alert" data-bind="visible: key.error() && key.errorMessage(), text: key.errorMessage"></div>
<div class="alert" data-bind="visible: keyError() && keyErrorMessage(), text: keyErrorMessage"></div>
<div class="form-horizontal">
<div class="control-group" data-bind="css: {'error': key.error}">
<div class="control-group" data-bind="css: {'error': keyError}">
<textarea class="inputKey input-xxlarge" rows="14" autofocus="" autocomplete="off" data-bind="value: key"></textarea>
</div>
</div>

View file

@ -111,7 +111,7 @@
</label>
</div>
<div class="e-cell e-value">
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: to, emailsTagsFocus: to.focused, autoCompleteSource: emailsSource" />
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: to, emailsTagsFocus: toFocused, autoCompleteSource: emailsSource" />
</div>
</div>
<div class="e-row cc-row" data-bind="visible: showCc">
@ -143,7 +143,7 @@
<span class="i18n" data-i18n="COMPOSE/TITLE_SUBJECT"></span>
</div>
<div class="e-cell e-value">
<input type="text" size="70" autocomplete="off" data-bind="textInput: subject, hasFocus: subject.focused" />
<input type="text" size="70" autocomplete="off" data-bind="textInput: subject, hasFocus: subjectFocused" />
</div>
</div>
<div class="e-row">

View file

@ -15,7 +15,7 @@
</label>
<div class="controls">
<input type="text" class="uiInput inputName" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: folderName, hasfocus: folderName.focused, onEnter: createFolderCommand" />
data-bind="textInput: folderName, hasfocus: folderNameFocused, onEnter: createFolderCommand" />
</div>
</div>
<div class="control-group">

View file

@ -19,7 +19,7 @@
<div class="controls">
<input type="email" class="inputEmail input-xlarge" autofocus=""
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: email, onEnter: addOrEditIdentityCommand, hasfocus: email.focused" />
data-bind="value: email, onEnter: addOrEditIdentityCommand, hasfocus: emailFocused" />
</div>
</div>
<div class="control-group" data-bind="visible: owner">
@ -41,7 +41,7 @@
<div class="controls">
<input type="text" class="inputReplyTo input-xlarge"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: replyTo, onEnter: addOrEditIdentityCommand, hasfocus: replyTo.focused" />
data-bind="value: replyTo, onEnter: addOrEditIdentityCommand, hasfocus: replyToFocused" />
</div>
</div>
<div class="control-group" data-bind="visible: showBcc, css: {'error': bcc.hasError}">
@ -49,7 +49,7 @@
<div class="controls">
<input type="text" class="inputBcc input-xlarge"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: bcc, onEnter: addOrEditIdentityCommand, hasfocus: bcc.focused" />
data-bind="value: bcc, onEnter: addOrEditIdentityCommand, hasfocus: bccFocused" />
</div>
</div>
<div class="control-group" data-bind="visible: !showReplyTo() || !showBcc()">

View file

@ -13,12 +13,12 @@
<span data-bind="text: submitError"></span>
</div>
<br />
<div class="control-group" data-bind="css: {'error': email.error}">
<div class="control-group" data-bind="css: {'error': emailError}">
<label class="i18n control-label" data-i18n="POPUPS_GENERATE_OPEN_PGP_KEYS/LABEL_EMAIL"></label>
<div class="controls">
<input type="email" class="inputEmail input-large"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: email, hasfocus: email.focus" />
data-bind="value: email, hasfocus: emailFocus" />
</div>
</div>
<div class="control-group">

View file

@ -14,17 +14,17 @@
<span data-bind="text: submitError"></span>
</div>
<br />
<div class="control-group" data-bind="css: {'error': name.error}">
<div class="control-group" data-bind="css: {'error': nameError}">
<label class="i18n control-label" data-i18n="POPUPS_ADD_TEMPLATE/LABEL_NAME"></label>
<div class="controls">
<input type="text" class="inputName input-xlarge" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: name, onEnter: addTemplateCommand, hasfocus: name.focus" />
data-bind="textInput: name, onEnter: addTemplateCommand, hasfocus: nameFocus" />
</div>
</div>
</div>
<hr />
<div class="form-horizontal">
<div class="control-group" data-bind="css: {'error': body.error}">
<div class="control-group" data-bind="css: {'error': bodyError}">
<div class="e-template-place" data-bind="initDom: signatureDom"></div>
</div>
</div>

View file

@ -16,14 +16,14 @@
<div class="controls">
<input type="text" class="uiInput inputName"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: code, hasfocus: code.focused, onEnter: testCodeCommand" />
data-bind="textInput: code, hasfocus: codeFocused, onEnter: testCodeCommand" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn" data-bind="command: testCodeCommand, css: { 'btn-success': true === code.status(), 'btn-danger': false === code.status() }">
<i data-bind="css: {'icon-ok': !testing(), 'icon-spinner animated': testing(), 'icon-white': true === code.status() || false === code.status() }"></i>
<a class="btn" data-bind="command: testCodeCommand, css: { 'btn-success': true === codeStatus(), 'btn-danger': false === codeStatus() }">
<i data-bind="css: {'icon-ok': !testing(), 'icon-spinner animated': testing(), 'icon-white': true === codeStatus() || false === codeStatus() }"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_TWO_FACTOR_TEST/BUTTON_TEST"></span>
</a>

View file

@ -18,20 +18,20 @@
</span>
</td>
<td class="subscribe-folder-parent">
<span class="unsubscribe-folder" data-bind="visible: canBeSubScribed() && !subScribed(), click: function(oFolder) { $root.subscribeFolder(oFolder); }">
<span class="unsubscribe-folder" data-bind="visible: canBeSubscribed() && !subscribed(), click: function(oFolder) { $root.subscribeFolder(oFolder); }">
<i class="icon-eye"></i>
</span>
<span class="subscribe-folder" data-bind="visible: canBeSubScribed() && subScribed(), click: function(oFolder) { $root.unSubscribeFolder(oFolder); }">
<span class="subscribe-folder" data-bind="visible: canBeSubscribed() && subscribed(), click: function(oFolder) { $root.unSubscribeFolder(oFolder); }">
<i class="icon-eye"></i>
</span>
</td>
<td class="check-folder-parent" data-bind="visible: $root.displaySpecSetting">
<span class="uncheck-folder" data-bind="visible: canBeChecked() && subScribed() && !checkable(), click: function(oFolder) { $root.checkableTrueFolder(oFolder); }">
<span class="uncheck-folder" data-bind="visible: canBeChecked() && subscribed() && !checkable(), click: function(oFolder) { $root.checkableTrueFolder(oFolder); }">
<i class="icon-check-mark-circle-two"></i>
</span>
<span class="check-folder" data-bind="visible: canBeChecked() && subScribed() && checkable(), click: function(oFolder) { $root.checkableFalseFolder(oFolder); }">
<span class="check-folder" data-bind="visible: canBeChecked() && subscribed() && checkable(), click: function(oFolder) { $root.checkableFalseFolder(oFolder); }">
<i class="icon-check-mark-circle-two"></i>
</span>
</td>
</tr>
<!-- ko template: { name: 'SettingsFolderItem', foreach: subFolders } --><!-- /ko -->
<!-- ko template: { name: 'SettingsFolderItem', foreach: subFolders } --><!-- /ko -->