1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-03 17:48:30 +00:00
* Fixed: Clicking emotes in the FFZ Emote Menu. (Broken by a Twitch update.)
This commit is contained in:
SirStendec 2020-03-05 18:21:11 -05:00
parent aedfcecc14
commit 40cae9f115
6 changed files with 57 additions and 7 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "frankerfacez", "name": "frankerfacez",
"author": "Dan Salvato LLC", "author": "Dan Salvato LLC",
"version": "4.18.6", "version": "4.18.7",
"description": "FrankerFaceZ is a Twitch enhancement suite.", "description": "FrankerFaceZ is a Twitch enhancement suite.",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View file

@ -645,7 +645,7 @@ export default class Badges extends Module {
async loadGlobalBadges(tries = 0) { async loadGlobalBadges(tries = 0) {
let response, data; let response, data;
if ( this.experiments.getAssignment('api_load') ) if ( this.experiments.getAssignment('api_load') && tries < 1 )
try { try {
fetch(`${NEW_API}/v1/badges`).catch(() => {}); fetch(`${NEW_API}/v1/badges`).catch(() => {});
} catch(err) { /* do nothing */ } } catch(err) { /* do nothing */ }

View file

@ -542,7 +542,7 @@ export default class Emotes extends Module {
async loadGlobalSets(tries = 0) { async loadGlobalSets(tries = 0) {
let response, data; let response, data;
if ( this.experiments.getAssignment('api_load') ) if ( this.experiments.getAssignment('api_load') && tries < 1 )
try { try {
fetch(`${NEW_API}/v1/set/global`).catch(() => {}); fetch(`${NEW_API}/v1/set/global`).catch(() => {});
} catch(err) { /* do nothing */ } } catch(err) { /* do nothing */ }

View file

@ -188,7 +188,8 @@ Twilight.KNOWN_MODULES = {
'chat-types': n => n.b && has(n.b, 'Message') && has(n.b, 'RoomMods'), 'chat-types': n => n.b && has(n.b, 'Message') && has(n.b, 'RoomMods'),
'gql-printer': n => n !== window && n.print, 'gql-printer': n => n !== window && n.print,
mousetrap: n => n.bindGlobal && n.unbind && n.handleKey, mousetrap: n => n.bindGlobal && n.unbind && n.handleKey,
'algolia-search': n => n.a && n.a.prototype && n.a.prototype.queryTopResults && n.a.prototype.queryForType 'algolia-search': n => n.a && n.a.prototype && n.a.prototype.queryTopResults && n.a.prototype.queryForType,
highlightstack: n => n.b && has(n.b, '_calculateChangedBits') && n.c && has(n.c, '_calculateChangedBits')
} }

View file

@ -316,7 +316,7 @@ export default class EmoteMenu extends Module {
channel_id={this.props.channelOwnerID} channel_id={this.props.channelOwnerID}
loading={this.state.gqlLoading} loading={this.state.gqlLoading}
error={this.state.gqlError} error={this.state.gqlError}
onClickEmote={this.props.onClickEmote} onClickToken={this.props.onClickToken}
/> />
</t.MenuErrorWrapper>) </t.MenuErrorWrapper>)
} }
@ -520,7 +520,7 @@ export default class EmoteMenu extends Module {
if ( t.emotes.handleClick(event) ) if ( t.emotes.handleClick(event) )
return; return;
this.props.onClickEmote(event.currentTarget.dataset.name) this.props.onClickToken(event.currentTarget.dataset.name)
} }
clickHeading() { clickHeading() {
@ -1835,7 +1835,7 @@ export default class EmoteMenu extends Module {
key: data.key, key: data.key,
data, data,
filtered: this.state.filtered, filtered: this.state.filtered,
onClickEmote: this.props.onClickEmote, onClickToken: this.props.onClickToken,
startObserving: this.startObserving, startObserving: this.startObserving,
stopObserving: this.stopObserving stopObserving: this.stopObserving
} }

View file

@ -621,7 +621,9 @@ export default class ChatHook extends Module {
onEnable() { onEnable() {
this.on('site.web_munch:loaded', this.grabTypes); this.on('site.web_munch:loaded', this.grabTypes);
this.on('site.web_munch:loaded', this.defineClasses);
this.grabTypes(); this.grabTypes();
this.defineClasses();
this.chat.context.on('changed:chat.points.show-callouts', () => { this.chat.context.on('changed:chat.points.show-callouts', () => {
this.InlineCallout.forceUpdate(); this.InlineCallout.forceUpdate();
@ -974,8 +976,29 @@ export default class ChatHook extends Module {
this.ChatContainer.ready((cls, instances) => { this.ChatContainer.ready((cls, instances) => {
const t = this, const t = this,
old_render = cls.prototype.render,
old_catch = cls.prototype.componentDidCatch; old_catch = cls.prototype.componentDidCatch;
cls.prototype.render = function() {
//try {
if ( t.CommunityStackHandler ) {
const React = t.web_munch.getModule('react'),
out = old_render.call(this),
thing = out?.props?.children?.props?.children;
if ( React && Array.isArray(thing) )
thing.push(React.createElement(t.CommunityStackHandler));
return out;
}
/*} catch(err) {
// No op
}*/
return old_render.call(this);
}
// Try catching errors. With any luck, maybe we can // Try catching errors. With any luck, maybe we can
// recover from the error when we re-build? // recover from the error when we re-build?
cls.prototype.componentDidCatch = function(err, info) { cls.prototype.componentDidCatch = function(err, info) {
@ -1006,6 +1029,32 @@ export default class ChatHook extends Module {
} }
defineClasses() {
if ( this.CommunityStackHandler )
return true;
const t = this,
React = this.web_munch.getModule('react'),
Stack = this.web_munch.getModule('highlightstack'),
createElement = React && React.createElement;
if ( ! createElement || ! Stack || ! Stack.b )
return false;
this.CommunityStackHandler = function() {
const stack = React.useContext(Stack.b),
dispatch = React.useContext(Stack.c);
t.community_stack = stack;
t.community_dispatch = dispatch;
return null;
}
this.ChatContainer.forceUpdate();
}
updatePinnedCallouts() { updatePinnedCallouts() {
for(const inst of this.PinnedCallout.instances) for(const inst of this.PinnedCallout.instances)
this.onPinnedCallout(inst); this.onPinnedCallout(inst);