forked from KickTalkOrg/KickTalk
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Problem
Personal emote sets are only loaded once at login via validateSessionToken(). If the current user subscribes to 7TV or gains/loses access to a personal emote set while the app is running, the entitlement.create or entitlement.delete event is received but not processed.
Current Behavior
- ✅ Personal emote sets loaded at login for current user
- ✅ Personal emote set updates handled (
emote_set.updateevents) - ❌ Personal emote set grants not handled (
entitlement.createwithkind: EMOTE_SET) - ❌ Personal emote set revocations not handled (
entitlement.deletewithkind: EMOTE_SET)
Expected Behavior
When the current user gains or loses access to a personal emote set while the app is running, the app should:
-
For
entitlement.create:- Check if the event is for the current user (compare
body.object.user.idwith storedstvId) - Fetch the emote set details using
getPersonalEmoteSet(userId) - Add to
personalEmoteSetsstate - Update
localStorage.setItem('stvPersonalEmoteSets', ...)
- Check if the event is for the current user (compare
-
For
entitlement.delete:- Check if the event is for the current user
- Remove the emote set with matching
ref_idfrompersonalEmoteSets - Update localStorage
Implementation Notes
Placeholder Handler Location
src/renderer/src/providers/ChatProvider.jsx:3363
handlePersonalEmoteSetEntitlement: (body, action) => {
const emoteSetId = body?.object?.ref_id;
const userId = body?.object?.user?.id;
const username = body?.object?.user?.connections?.find((c) => c.platform === "KICK")?.username;
// TODO: Check if this is the current user
const currentUserStvId = localStorage.getItem('stvId');
if (userId !== currentUserStvId) {
return; // Ignore other users' entitlements
}
if (action === 'create') {
// Fetch and add emote set
} else if (action === 'delete') {
// Remove emote set
}
}Current User Identification
localStorage.getItem('stvId')- current user's 7TV IDlocalStorage.getItem('kickUsername')- current user's Kick username
Available Functions
utils/services/seventv/stvAPI.js:getPersonalEmoteSet(userId)exists- Need to expose via preload as
window.app.stv.getPersonalEmoteSet
Related Files
src/renderer/src/providers/ChatProvider.jsx- handler locationutils/services/seventv/stvAPI.js-getPersonalEmoteSetfunctionsrc/preload/index.js- initial load at login, needs to expose API
Scope
This issue is only for handling the current user's personal emote sets. Tracking other users' personal emote sets (for rendering their emotes in chat) is a separate feature request.
Branch
Related changes on perf/seventv-cosmetics-performance-optimization
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels