mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-21 15:26:17 -04:00
Merge branch 'sw_digester' into add_transfer_notes
This commit is contained in:
commit
f103f37e16
7 changed files with 102 additions and 50 deletions
|
@ -2060,8 +2060,8 @@ class PublicRoomDialog extends Dialog {
|
|||
|
||||
Events.on('keydown', e => this._onKeyDown(e));
|
||||
Events.on('public-room-created', e => this._onPublicRoomCreated(e.detail));
|
||||
Events.on('peers', e => this._onPeers(e.detail));
|
||||
Events.on('peer-joined', e => this._onPeerJoined(e.detail.peer, e.detail.roomId));
|
||||
Events.on('peers', e => this._onPeers(e.detail.peers, e.detail.roomId));
|
||||
Events.on('peer-joined', e => this._onPeerJoined(e.detail.roomId));
|
||||
Events.on('public-room-id-invalid', e => this._onPublicRoomIdInvalid(e.detail));
|
||||
Events.on('public-room-left', _ => this._onPublicRoomLeft());
|
||||
this.$el.addEventListener('paste', e => this._onPaste(e));
|
||||
|
@ -2191,29 +2191,30 @@ class PublicRoomDialog extends Dialog {
|
|||
}
|
||||
}
|
||||
|
||||
_onPeers(message) {
|
||||
message.peers.forEach(messagePeer => {
|
||||
this._evaluateJoinedPeer(messagePeer.id, message.roomId);
|
||||
});
|
||||
_onPeers(peers, roomId) {
|
||||
// Do not evaluate if creating new room
|
||||
if (this.roomId && !peers.length) return;
|
||||
|
||||
this._evaluateJoinedPeer(roomId);
|
||||
}
|
||||
|
||||
_onPeerJoined(peer, roomId) {
|
||||
this._evaluateJoinedPeer(peer.id, roomId);
|
||||
_onPeerJoined(roomId) {
|
||||
this._evaluateJoinedPeer(roomId);
|
||||
}
|
||||
|
||||
_evaluateJoinedPeer(peerId, roomId) {
|
||||
const isInitiatedRoomId = roomId === this.roomId;
|
||||
const isJoinedRoomId = roomId === this.roomIdJoin;
|
||||
_evaluateJoinedPeer(roomId) {
|
||||
const peerJoinedThisRoom = roomId === this.roomId;
|
||||
const switchedToOtherRoom = roomId === this.roomIdJoin;
|
||||
|
||||
if (!peerId || !roomId || (!isInitiatedRoomId && !isJoinedRoomId)) return;
|
||||
if (!roomId || (!peerJoinedThisRoom && !switchedToOtherRoom)) return;
|
||||
|
||||
this.hide();
|
||||
|
||||
sessionStorage.setItem('public_room_id', roomId);
|
||||
|
||||
if (isJoinedRoomId) {
|
||||
if (switchedToOtherRoom) {
|
||||
this.roomIdJoin = null;
|
||||
this.roomId = roomId;
|
||||
this.roomIdJoin = false;
|
||||
this._setKeyAndQrCode();
|
||||
}
|
||||
}
|
||||
|
@ -2226,7 +2227,7 @@ class PublicRoomDialog extends Dialog {
|
|||
}
|
||||
|
||||
_leavePublicRoom() {
|
||||
Events.fire('leave-public-room', this.roomId);
|
||||
Events.fire('leave-public-room');
|
||||
}
|
||||
|
||||
_onPublicRoomLeft() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue