Skip to content

Commit

Permalink
Fix inner text being cleared when viewing next received text from que…
Browse files Browse the repository at this point in the history
…ue + prevent skipping of queue entry when timing is bad by checking for existing timeout

Co-authored-by: klmkyo <[email protected]>
  • Loading branch information
schlagmichdoch and klmkyo committed Apr 17, 2024
1 parent be46e7d commit 35f47d9
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions public/scripts/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2017,6 +2017,7 @@ class ReceiveTextDialog extends Dialog {

this.$displayName = this.$el.querySelector('.display-name');
this._receiveTextQueue = [];
this._hideTimeout = null;
}

selectionEmpty() {
Expand All @@ -2040,17 +2041,12 @@ class ReceiveTextDialog extends Dialog {
this._setDocumentTitleMessages();
changeFavicon("images/favicon-96x96-notification.png");

if (this.isShown()) return;
if (this.isShown() || this._hideTimeout) return;

this._dequeueRequests();
}

_dequeueRequests() {
if (!this._receiveTextQueue.length) {
this.$text.innerHTML = "";
return;
}

this._setDocumentTitleMessages();
changeFavicon("images/favicon-96x96-notification.png");

Expand Down Expand Up @@ -2145,9 +2141,16 @@ class ReceiveTextDialog extends Dialog {

hide() {
super.hide();
setTimeout(() => {
this._dequeueRequests();
this.$text.innerHTML = "";

// If queue is empty -> clear text field | else -> open next message
this._hideTimeout = setTimeout(() => {
if (!this._receiveTextQueue.length) {
this.$text.innerHTML = "";
}
else {
this._dequeueRequests();
}
this._hideTimeout = null;
}, 500);
}
}
Expand Down

0 comments on commit 35f47d9

Please sign in to comment.