feat(platform): self voice roster mute, prefs explore baseline (v0.8.103)
Phase 138 platform changes: - Apply local voiceMedia mute/deafen to self roster row via myVoiceChannelId (no protomux roundtrip required for sidebar indicators). - Persist discoveryExploreBaseline through updateUserPrefs on Explore open. - Ingest discoveryExploreBaseline from USER_PREFS on boot and prefs events. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -384,8 +384,10 @@ class PearcordPlatform extends EventEmitter {
|
||||
await this.userSettings.ready()
|
||||
const sessionPrefs = await this.userSettings.getPrefs()
|
||||
this._ingestGuildPresenceCacheFromPrefs(sessionPrefs)
|
||||
this._ingestDiscoveryExploreBaselineFromPrefs(sessionPrefs)
|
||||
this.userSettings.on('prefs', (prefs) => {
|
||||
this._ingestGuildPresenceCacheFromPrefs(prefs)
|
||||
this._ingestDiscoveryExploreBaselineFromPrefs(prefs)
|
||||
this.emit('user-prefs')
|
||||
})
|
||||
this.profileCosmetics = new PearcordProfileCosmetics({
|
||||
@@ -482,8 +484,10 @@ class PearcordPlatform extends EventEmitter {
|
||||
await this.userSettings.ready()
|
||||
const bootPrefs = await this.userSettings.getPrefs()
|
||||
this._ingestGuildPresenceCacheFromPrefs(bootPrefs)
|
||||
this._ingestDiscoveryExploreBaselineFromPrefs(bootPrefs)
|
||||
this.userSettings.on('prefs', (prefs) => {
|
||||
this._ingestGuildPresenceCacheFromPrefs(prefs)
|
||||
this._ingestDiscoveryExploreBaselineFromPrefs(prefs)
|
||||
this.emit('user-prefs')
|
||||
})
|
||||
this.profileCosmetics = new PearcordProfileCosmetics({
|
||||
@@ -1215,10 +1219,19 @@ class PearcordPlatform extends EventEmitter {
|
||||
return this._voiceMuteMesh[channelId]?.[userId] || null
|
||||
}
|
||||
|
||||
_ingestDiscoveryExploreBaselineFromPrefs (prefs) {
|
||||
if (!prefs || prefs.discoveryExploreBaseline == null) return
|
||||
const n = Math.max(0, Math.floor(Number(prefs.discoveryExploreBaseline) || 0))
|
||||
this._discoveryExploreBaseline = n
|
||||
}
|
||||
|
||||
async markDiscoveryExploreOpened () {
|
||||
const listings = this.discovery ? await this.discovery.listPublicListings() : []
|
||||
const n = listings.length
|
||||
this._discoveryExploreBaseline = n
|
||||
if (this.userSettings) {
|
||||
await this.updateUserPrefs({ discoveryExploreBaseline: n })
|
||||
}
|
||||
this.emit('discovery')
|
||||
return { baseline: n, newSinceExplore: 0 }
|
||||
}
|
||||
@@ -8668,13 +8681,14 @@ class PearcordPlatform extends EventEmitter {
|
||||
voiceStatesByChannel[ch.id] = rows.map((r) => {
|
||||
const meshMute = this._meshUserVoiceMute(ch.id, r.userId)
|
||||
const mediaMute = inMediaChannel ? peerMute[r.userId] : null
|
||||
const isSelf = r.userId === selfId && inMediaChannel
|
||||
const isSelf = r.userId === selfId
|
||||
const selfInRow = isSelf && ch.id === myVoiceChannelId
|
||||
const muted =
|
||||
isSelf && this.voiceMedia
|
||||
selfInRow && this.voiceMedia
|
||||
? !!this.voiceMedia.muted
|
||||
: !!(mediaMute?.muted ?? meshMute?.muted)
|
||||
const deafened =
|
||||
isSelf && this.voiceMedia
|
||||
selfInRow && this.voiceMedia
|
||||
? !!this.voiceMedia.deafened
|
||||
: !!(mediaMute?.deafened ?? meshMute?.deafened)
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user