mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-20 15:06:15 -04:00
show displayName on UI
This commit is contained in:
parent
0c7abfbf1d
commit
e7c484f428
4 changed files with 13 additions and 1 deletions
|
@ -61,6 +61,7 @@
|
||||||
<svg class="icon logo">
|
<svg class="icon logo">
|
||||||
<use xlink:href="#wifi-tethering" />
|
<use xlink:href="#wifi-tethering" />
|
||||||
</svg>
|
</svg>
|
||||||
|
<div id="displayName" class="font-body2">[ ... ]</div>
|
||||||
<div>The easiest way to transfer data across devices.</div>
|
<div>The easiest way to transfer data across devices.</div>
|
||||||
<div class="font-body2">Allow me to be discovered by: Everyone in this network.</div>
|
<div class="font-body2">Allow me to be discovered by: Everyone in this network.</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -41,6 +41,9 @@ class ServerConnection {
|
||||||
case 'ping':
|
case 'ping':
|
||||||
this.send({ type: 'pong' });
|
this.send({ type: 'pong' });
|
||||||
break;
|
break;
|
||||||
|
case 'displayName':
|
||||||
|
Events.fire('displayName', msg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.error('WS: unkown message type', msg);
|
console.error('WS: unkown message type', msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,7 +491,12 @@ class Snapdrop {
|
||||||
const notifications = new Notifications();
|
const notifications = new Notifications();
|
||||||
const networkStatusUI = new NetworkStatusUI();
|
const networkStatusUI = new NetworkStatusUI();
|
||||||
const webShareTargetUI = new WebShareTargetUI();
|
const webShareTargetUI = new WebShareTargetUI();
|
||||||
})
|
});
|
||||||
|
|
||||||
|
// set display name
|
||||||
|
Events.on('displayName', e => {
|
||||||
|
$("displayName").textContent = "[ " + e.detail.message + " ]";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,9 @@ class SnapdropServer {
|
||||||
this._joinRoom(peer);
|
this._joinRoom(peer);
|
||||||
peer.socket.on('message', message => this._onMessage(peer, message));
|
peer.socket.on('message', message => this._onMessage(peer, message));
|
||||||
this._keepAlive(peer);
|
this._keepAlive(peer);
|
||||||
|
|
||||||
|
// send displayName
|
||||||
|
this._send(peer, { type: 'displayName', message: peer.name.displayName });
|
||||||
}
|
}
|
||||||
|
|
||||||
_onHeaders(headers, response) {
|
_onHeaders(headers, response) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue