Skip to content

Commit

Permalink
Parse from options
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindgamesnl committed Jun 13, 2024
1 parent 82cdfc4 commit eaa16f3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions client/src/client/services/voice/peers/VoicePeer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class VoicePeer {
if (options.displayOverride) {
// override display name and uuid
displayName = options.displayOverride.name || peerName;
displayUuid = options.displayOverride.uuid || peerUuid;
displayUuid = options.displayOverride.displayUuid || peerUuid;
}

// register in global state
Expand All @@ -39,6 +39,8 @@ export class VoicePeer {

this.peerName = peerName;
this.peerUuid = peerUuid;
this.displayName = displayName;
this.displayUuid = displayUuid;
this.peerStreamKey = peerStreamKey;
this.location = location;
this.killed = false;
Expand Down Expand Up @@ -73,9 +75,17 @@ export class VoicePeer {
}
}

let { displayUuid, displayName } = this;

if (changedOptions.displayOverride) {
// override display name and uuid
displayName = changedOptions.displayOverride.name || this.peerName;
displayUuid = changedOptions.displayOverride.displayUuid || this.peerUuid;
}

this.options = changedOptions;
// update global state
setGlobalState({ voiceState: { peers: { [this.peerStreamKey]: { options: this.options } } } });
setGlobalState({ voiceState: { peers: { [this.peerStreamKey]: { options: this.options, displayName, displayUuid } } } });
}

updateLocation(x, y, z) {
Expand Down

0 comments on commit eaa16f3

Please sign in to comment.