diff --git a/avia_core/VCSounds.js b/avia_core/VCSounds.js index 32623e4..4860b7a 100644 --- a/avia_core/VCSounds.js +++ b/avia_core/VCSounds.js @@ -60,6 +60,7 @@ let globalObserver = null; let refreshTimer = null; let lastVoiceState = null; + let lastMemberIdentityKey = ""; let leaveWatchdog = null; const recentRowActivity = new Map(); @@ -87,6 +88,7 @@ leaveWatchdog = null; recentRowActivity.clear(); lastVoiceState = null; + lastMemberIdentityKey = ""; playLeave(); console.debug("[VCSounds] self left"); const overlayApi = window.native?.overlay; @@ -508,6 +510,18 @@ }; } + function memberIdentityKey(members) { + return members + .map((member) => + [ + String(member?.name || "").trim().toLowerCase(), + String(member?.avatarUrl || "").trim().toLowerCase(), + ].join(":"), + ) + .sort() + .join("|"); + } + function publishVoiceState() { const overlayApi = window.native?.overlay; if (!overlayApi || typeof overlayApi.setVoiceState !== "function") return; @@ -515,7 +529,28 @@ pruneRowActivity(); const next = collectVoiceState(); const voiceState = inVoice ? next : null; + const nextMemberKey = memberIdentityKey(next.members); const nextKey = JSON.stringify(voiceState); + const memberChanged = nextMemberKey !== lastMemberIdentityKey; + if (memberChanged && inVoice && !initialising && lastMemberIdentityKey) { + const previousMembers = new Set( + lastMemberIdentityKey + .split("|") + .map((entry) => entry.trim()) + .filter(Boolean), + ); + const currentMembers = new Set( + nextMemberKey + .split("|") + .map((entry) => entry.trim()) + .filter(Boolean), + ); + const added = [...currentMembers].some((entry) => !previousMembers.has(entry)); + const removed = [...previousMembers].some((entry) => !currentMembers.has(entry)); + if (added) playJoin(); + if (removed) playLeave(); + } + lastMemberIdentityKey = nextMemberKey; if (nextKey === lastVoiceState) return; lastVoiceState = nextKey; diff --git a/cloud.mithraic.sanctum.metainfo.xml b/cloud.mithraic.sanctum.metainfo.xml index 6b86a82..fb63fc7 100644 --- a/cloud.mithraic.sanctum.metainfo.xml +++ b/cloud.mithraic.sanctum.metainfo.xml @@ -27,9 +27,9 @@ pointing - + - Gameplay overlay and improved game presence support. + Fixed VC sounds and tightened game presence to catalog entries plus user allowlists. diff --git a/package.json b/package.json index 93854a8..9d3d4ce 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "sanctum", "productName": "Sanctum", - "version": "1.0.5", - "aviaVersion": "1.0.5", + "version": "1.0.6", + "aviaVersion": "1.0.6", "main": ".vite/build/main.js", "repository": "https://git.mithraic.cloud/ad3laid3/sanctum", "scripts": {
Gameplay overlay and improved game presence support.
Fixed VC sounds and tightened game presence to catalog entries plus user allowlists.