do not hide ReceiveDialogs on disconnect

This commit is contained in:
schlagmichdoch 2023-01-10 16:10:35 +01:00
parent 8d2bbc795d
commit bef7459019
2 changed files with 5 additions and 7 deletions

View file

@ -8,9 +8,7 @@ class ServerConnection {
Events.on('beforeunload', _ => this._disconnect());
Events.on('pagehide', _ => this._disconnect());
document.addEventListener('visibilitychange', _ => this._onVisibilityChange());
if (navigator.connection) {
navigator.connection.addEventListener('change', _ => this._disconnect());
}
if (navigator.connection) navigator.connection.addEventListener('change', _ => this._disconnect());
Events.on('reconnect', _ => this._reconnect());
Events.on('room-secrets', e => this._sendRoomSecrets(e.detail));
Events.on('room-secret-deleted', e => this.send({ type: 'room-secret-deleted', roomSecret: e.detail}));

View file

@ -391,11 +391,11 @@ class PeerUI {
class Dialog {
constructor(id) {
constructor(id, hideOnDisconnect = true) {
this.$el = $(id);
this.$el.querySelectorAll('[close]').forEach(el => el.addEventListener('click', _ => this.hide()))
this.$autoFocus = this.$el.querySelector('[autofocus]');
Events.on('ws-disconnected', _ => this.hide());
if (hideOnDisconnect) Events.on('ws-disconnected', _ => this.hide());
}
show() {
@ -415,7 +415,7 @@ class Dialog {
class ReceiveDialog extends Dialog {
constructor() {
super('receiveDialog');
super('receiveDialog', false);
Events.on('file-received', e => {
this._nextFile(e.detail);
window.blop.play();
@ -802,7 +802,7 @@ class SendTextDialog extends Dialog {
class ReceiveTextDialog extends Dialog {
constructor() {
super('receiveTextDialog');
super('receiveTextDialog', false);
Events.on('text-received', e => this._onText(e.detail))
this.$text = this.$el.querySelector('#text');
const copy = this.$el.querySelector('#copy');