mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-23 00:06:18 -04:00
Fix: notify user that "Selected peer left." only if dialog is shown.
This commit is contained in:
parent
8d640be3a2
commit
7606fb398b
2 changed files with 26 additions and 16 deletions
|
@ -573,6 +573,10 @@ class Dialog {
|
|||
if (this.$autoFocus) this.$autoFocus.focus();
|
||||
}
|
||||
|
||||
isShown() {
|
||||
return !!this.$el.attributes["show"];
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.$el.removeAttribute('show');
|
||||
if (this.$autoFocus) {
|
||||
|
@ -581,10 +585,11 @@ class Dialog {
|
|||
}
|
||||
document.title = 'PairDrop';
|
||||
document.changeFavicon("images/favicon-96x96.png");
|
||||
this.correspondingPeerId = undefined;
|
||||
}
|
||||
|
||||
_onPeerDisconnected(peerId) {
|
||||
if (this.correspondingPeerId === peerId) {
|
||||
if (this.isShown() && this.correspondingPeerId === peerId) {
|
||||
this.hide();
|
||||
Events.fire('notify-user', 'Selected peer left.')
|
||||
}
|
||||
|
@ -850,14 +855,14 @@ class ReceiveRequestDialog extends ReceiveDialog {
|
|||
}
|
||||
|
||||
_onKeyDown(e) {
|
||||
if (this.$el.attributes["show"] && e.code === "Escape") {
|
||||
if (this.isShown() && e.code === "Escape") {
|
||||
this._respondToFileTransferRequest(false);
|
||||
}
|
||||
}
|
||||
|
||||
_onRequestFileTransfer(request, peerId) {
|
||||
this._filesTransferRequestQueue.push({request: request, peerId: peerId});
|
||||
if (this.$el.attributes["show"]) return;
|
||||
if (this.isShown()) return;
|
||||
this._dequeueRequests();
|
||||
}
|
||||
|
||||
|
@ -959,7 +964,7 @@ class PairDeviceDialog extends Dialog {
|
|||
}
|
||||
|
||||
_onKeyDown(e) {
|
||||
if (this.$el.attributes["show"] && e.code === "Escape") {
|
||||
if (this.isShown() && e.code === "Escape") {
|
||||
// Timeout to prevent paste mode from getting cancelled simultaneously
|
||||
setTimeout(_ => this._pairDeviceCancel(), 50);
|
||||
}
|
||||
|
@ -1152,7 +1157,7 @@ class EditPairedDevicesDialog extends Dialog {
|
|||
}
|
||||
|
||||
_onKeyDown(e) {
|
||||
if (this.$el.attributes["show"] && e.code === "Escape") {
|
||||
if (this.isShown() && e.code === "Escape") {
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
|
@ -1252,7 +1257,7 @@ class SendTextDialog extends Dialog {
|
|||
}
|
||||
|
||||
async _onKeyDown(e) {
|
||||
if (this.$el.attributes["show"]) {
|
||||
if (this.isShown()) {
|
||||
if (e.code === "Escape") {
|
||||
this.hide();
|
||||
} else if (e.code === "Enter" && (e.ctrlKey || e.metaKey)) {
|
||||
|
@ -1321,7 +1326,7 @@ class ReceiveTextDialog extends Dialog {
|
|||
}
|
||||
|
||||
async _onKeyDown(e) {
|
||||
if (this.$el.attributes["show"]) {
|
||||
if (this.isShown()) {
|
||||
if (e.code === "KeyC" && (e.ctrlKey || e.metaKey)) {
|
||||
await this._onCopy()
|
||||
this.hide();
|
||||
|
@ -1335,7 +1340,7 @@ class ReceiveTextDialog extends Dialog {
|
|||
window.blop.play();
|
||||
this._receiveTextQueue.push({text: text, peerId: peerId});
|
||||
this._setDocumentTitleMessages();
|
||||
if (this.$el.attributes["show"]) return;
|
||||
if (this.isShown()) return;
|
||||
this._dequeueRequests();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue