mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-20 15:06:15 -04:00
do not hide ReceiveDialogs on disconnect
This commit is contained in:
parent
8d2bbc795d
commit
bef7459019
2 changed files with 5 additions and 7 deletions
|
@ -8,9 +8,7 @@ class ServerConnection {
|
||||||
Events.on('beforeunload', _ => this._disconnect());
|
Events.on('beforeunload', _ => this._disconnect());
|
||||||
Events.on('pagehide', _ => this._disconnect());
|
Events.on('pagehide', _ => this._disconnect());
|
||||||
document.addEventListener('visibilitychange', _ => this._onVisibilityChange());
|
document.addEventListener('visibilitychange', _ => this._onVisibilityChange());
|
||||||
if (navigator.connection) {
|
if (navigator.connection) navigator.connection.addEventListener('change', _ => this._disconnect());
|
||||||
navigator.connection.addEventListener('change', _ => this._disconnect());
|
|
||||||
}
|
|
||||||
Events.on('reconnect', _ => this._reconnect());
|
Events.on('reconnect', _ => this._reconnect());
|
||||||
Events.on('room-secrets', e => this._sendRoomSecrets(e.detail));
|
Events.on('room-secrets', e => this._sendRoomSecrets(e.detail));
|
||||||
Events.on('room-secret-deleted', e => this.send({ type: 'room-secret-deleted', roomSecret: e.detail}));
|
Events.on('room-secret-deleted', e => this.send({ type: 'room-secret-deleted', roomSecret: e.detail}));
|
||||||
|
|
|
@ -391,11 +391,11 @@ class PeerUI {
|
||||||
|
|
||||||
|
|
||||||
class Dialog {
|
class Dialog {
|
||||||
constructor(id) {
|
constructor(id, hideOnDisconnect = true) {
|
||||||
this.$el = $(id);
|
this.$el = $(id);
|
||||||
this.$el.querySelectorAll('[close]').forEach(el => el.addEventListener('click', _ => this.hide()))
|
this.$el.querySelectorAll('[close]').forEach(el => el.addEventListener('click', _ => this.hide()))
|
||||||
this.$autoFocus = this.$el.querySelector('[autofocus]');
|
this.$autoFocus = this.$el.querySelector('[autofocus]');
|
||||||
Events.on('ws-disconnected', _ => this.hide());
|
if (hideOnDisconnect) Events.on('ws-disconnected', _ => this.hide());
|
||||||
}
|
}
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
|
@ -415,7 +415,7 @@ class Dialog {
|
||||||
class ReceiveDialog extends Dialog {
|
class ReceiveDialog extends Dialog {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('receiveDialog');
|
super('receiveDialog', false);
|
||||||
Events.on('file-received', e => {
|
Events.on('file-received', e => {
|
||||||
this._nextFile(e.detail);
|
this._nextFile(e.detail);
|
||||||
window.blop.play();
|
window.blop.play();
|
||||||
|
@ -802,7 +802,7 @@ class SendTextDialog extends Dialog {
|
||||||
|
|
||||||
class ReceiveTextDialog extends Dialog {
|
class ReceiveTextDialog extends Dialog {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('receiveTextDialog');
|
super('receiveTextDialog', false);
|
||||||
Events.on('text-received', e => this._onText(e.detail))
|
Events.on('text-received', e => this._onText(e.detail))
|
||||||
this.$text = this.$el.querySelector('#text');
|
this.$text = this.$el.querySelector('#text');
|
||||||
const copy = this.$el.querySelector('#copy');
|
const copy = this.$el.querySelector('#copy');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue