1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-08 23:30:53 +00:00
* Added: Add a `Reset` button to the headers of the badge visibility controls.
* Changed: Move some Twitch badges into a new `Twitch: Other` category.
* Changed: Do not display the badges in a category when the category is hidden to save space.
* Changed: Expose more data on emotes/emoji to tab completion.
* Fixed: Missing localization for certain items in Chat > Actions > Rooms.
* API Fixed: Ensure that emote set and badge IDs are cast to strings for consistent comparisons.
* API Fixed: Fix reference counting issues for emote sets when a set or badge is added from multiple providers.
* API Changed: Newly loaded emote sets are automatically scheduled for garbage collection if they have no users.
* API Changed: Added `removeAllSets(provider)` method to `Room`s and `Users`s.
* API Changed: Standardize `addSet(provider, set_id, data)` to allow passing set data in `Room` and `User`.
* API Changed: `addSet(...)` and `removeSet(...)` now return a boolean of whether or not the set was added or removed.
This commit is contained in:
SirStendec 2021-06-10 18:53:16 -04:00
parent a74faa95d3
commit 2a57ecb8a7
9 changed files with 188 additions and 59 deletions

View file

@ -306,13 +306,10 @@ export default class Room {
this.data = d;
if ( d.set ) {
if ( ! this.emote_sets )
this.emote_sets = new SourcedSet;
this.emote_sets.set('main', d.set);
} else if ( this.emote_sets )
this.emote_sets.delete('main');
if ( d.set )
this.addSet('main', d.set);
else
this.removeAllSets('main');
if ( data.sets )
for(const set_id in data.sets)
@ -349,29 +346,59 @@ export default class Room {
if ( ! this.emote_sets )
this.emote_sets = new SourcedSet;
let changed = false;
if ( typeof set_id === 'number' )
set_id = `${set_id}`;
let changed = false, added = false;
if ( ! this.emote_sets.sourceIncludes(provider, set_id) ) {
changed = ! this.emote_sets.includes(set_id);
this.emote_sets.push(provider, set_id);
this.manager.emotes.refSet(set_id);
changed = true;
added = true;
}
if ( data )
this.manager.emotes.loadSetData(set_id, data);
if ( changed )
if ( changed ) {
this.manager.emotes.refSet(set_id);
this.manager.emotes.emit(':update-room-sets', this, provider, set_id, true);
}
return added;
}
removeAllSets(provider) {
if ( this.destroyed || ! this.emote_sets )
return false;
const sets = this.emote_sets.get(provider);
if ( ! Array.isArray(sets) || ! sets.length )
return false;
for(const set_id of sets)
this.removeSet(provider, set_id);
return true;
}
removeSet(provider, set_id) {
if ( this.destroyed || ! this.emote_sets )
return;
if ( typeof set_id === 'number' )
set_id = `${set_id}`;
if ( this.emote_sets.sourceIncludes(provider, set_id) ) {
this.emote_sets.remove(provider, set_id);
this.manager.emotes.unrefSet(set_id);
this.manager.emotes.emit(':update-room-sets', this, provider, set_id, false);
if ( ! this.emote_sets.includes(set_id) ) {
this.manager.emotes.unrefSet(set_id);
this.manager.emotes.emit(':update-room-sets', this, provider, set_id, false);
}
return true;
}
return false;
}