feat(platform): screen share refresh and presence stale reaper

Add refreshScreenSharePreview for frozen stream recovery and invoke
presence.reapStalePeers during view() so ghost peers are cleared.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-06-02 16:32:16 -04:00
co-authored by Cursor
parent fc344fac87
commit ca50f20639
+23
View File
@@ -13728,6 +13728,22 @@ class PearcordPlatform extends EventEmitter {
}
}
/** Restart local share or drop stale remote preview tile (Phase 408 P408-34). */
async refreshScreenSharePreview (userId = null) {
const uid = userId || this.identity?.user?.id
if (!uid || !this.screenShare) return null
if (uid === this.identity?.user?.id && this.screenShare.active) {
const label = this.screenShare.label || 'Screen'
await this.stopScreenShare()
return this.startScreenShare(label)
}
if (this.screenShare.previews?.delete) {
this.screenShare.previews.delete(uid)
}
this.emit('screen-share')
return { refreshed: uid }
}
async _firstViewableChannel (channels, preferType) {
const list = channels || []
if (preferType) {
@@ -22506,6 +22522,13 @@ class PearcordPlatform extends EventEmitter {
!dismissedRekeys.has(this._dmSessionRekeyNotice.channelId)
? this._dmSessionRekeyNotice
: null
if (this.presence?.reapStalePeers) {
try {
this.presence.reapStalePeers()
} catch {
/* presence optional during teardown */
}
}
const activityFeed = buildActivityFeed({
selfUserId: user?.id,
presence: this.presence?.snapshot() || null,