diff --git a/package.json b/package.json index 659a1125..ab7be1a0 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.14.10", + "version": "4.14.11", "description": "FrankerFaceZ is a Twitch enhancement suite.", "license": "Apache-2.0", "scripts": { diff --git a/src/settings/components/category.vue b/src/settings/components/category.vue new file mode 100644 index 00000000..4009c91e --- /dev/null +++ b/src/settings/components/category.vue @@ -0,0 +1,138 @@ + + + \ No newline at end of file diff --git a/src/settings/filters.js b/src/settings/filters.js index 86ccf865..41a0a257 100644 --- a/src/settings/filters.js +++ b/src/settings/filters.js @@ -142,7 +142,6 @@ export const Time = { editor: () => import(/* webpackChunkName: 'main-menu' */ './components/time.vue') } - export const TheaterMode = { createTest(config) { return ctx => ctx.ui && ctx.ui.theatreModeEnabled === config; @@ -261,4 +260,26 @@ export const Channel = { id: null }), editor: () => import(/* webpackChunkName: 'main-menu' */ './components/channel.vue') -}; \ No newline at end of file +}; + +export const Category = { + createTest(config = {}) { + const name = config.name, + id = config.id; + + if ( ! id || ! name ) + return () => false; + + return ctx => ctx.categoryID === id || (ctx.categoryID == null && ctx.category === name); + }, + + title: 'Current Category', + i18n: 'settings.filter.category', + + default: () => ({ + name: null, + id: null + }), + + editor: () => import(/* webpackChunkName: 'main-menu' */ './components/category.vue') +} \ No newline at end of file diff --git a/src/sites/twitch-twilight/modules/channel.js b/src/sites/twitch-twilight/modules/channel.js index 2c091186..821dfd9b 100644 --- a/src/sites/twitch-twilight/modules/channel.js +++ b/src/sites/twitch-twilight/modules/channel.js @@ -85,23 +85,36 @@ export default class Channel extends Module { }); this.ChannelPage.on('mount', inst => { + const category = get('state.video.game', inst) || get('state.clip.game', inst) || get('state.channel.broadcastSettings.game', inst); + this.settings.updateContext({ channel: get('state.channel.login', inst), - channelID: get('state.channel.id', inst) + channelID: get('state.channel.id', inst), + channelColor: get('state.primaryColorHex', inst), + category: category?.name, + categoryID: category?.id }); }); this.ChannelPage.on('unmount', () => { this.settings.updateContext({ channel: null, - channelID: null + channelID: null, + channelColor: null, + category: null, + categoryID: null }); }); this.ChannelPage.on('update', inst => { + const category = get('state.video.game', inst) || get('state.clip.game', inst) || get('state.channel.broadcastSettings.game', inst); + this.settings.updateContext({ channel: get('state.channel.login', inst), - channelID: get('state.channel.id', inst) + channelID: get('state.channel.id', inst), + channelColor: get('state.primaryColorHex', inst), + category: category?.name, + categoryID: category?.id }); if ( this.settings.get('channel.hosting.enable') || has(inst.state, 'hostMode') || has(inst.state, 'hostedChannel') ) diff --git a/src/sites/twitch-twilight/modules/chat/index.js b/src/sites/twitch-twilight/modules/chat/index.js index 21df5e46..1aac871b 100644 --- a/src/sites/twitch-twilight/modules/chat/index.js +++ b/src/sites/twitch-twilight/modules/chat/index.js @@ -110,6 +110,8 @@ const CHAT_TYPES = make_enum( 'RewardGift', 'SubMysteryGift', 'AnonSubMysteryGift', + 'StandardPayForward', + 'CommunityPayForward', 'FirstCheerMessage', 'BitsBadgeTierMessage', 'InlinePrivateCallout', diff --git a/src/sites/twitch-twilight/modules/chat/input.jsx b/src/sites/twitch-twilight/modules/chat/input.jsx index 7de1e8a9..6449a0d2 100644 --- a/src/sites/twitch-twilight/modules/chat/input.jsx +++ b/src/sites/twitch-twilight/modules/chat/input.jsx @@ -85,7 +85,7 @@ export default class Input extends Module { this.ChatInput = this.fine.define( 'chat-input', - n => n && n.setChatInputRef && n.setLocalAutocompleteInputRef, + n => n && n.setLocalChatInputRef && n.setLocalAutocompleteInputRef, Twilight.CHAT_ROUTES ); diff --git a/src/sites/twitch-twilight/modules/chat/settings_menu.jsx b/src/sites/twitch-twilight/modules/chat/settings_menu.jsx index 2e0d17f4..714f8bc8 100644 --- a/src/sites/twitch-twilight/modules/chat/settings_menu.jsx +++ b/src/sites/twitch-twilight/modules/chat/settings_menu.jsx @@ -110,7 +110,7 @@ export default class SettingsMenu extends Module { if ( ! this.ffzPauseClick ) this.ffzPauseClick = () => this.setState({ffzPauseMenu: ! this.state.ffzPauseMenu}); - return (
+ return (
diff --git a/src/utilities/data/category-fetch.gql b/src/utilities/data/category-fetch.gql new file mode 100644 index 00000000..b7e9deee --- /dev/null +++ b/src/utilities/data/category-fetch.gql @@ -0,0 +1,8 @@ +query FFZ_GetGame($id: ID, $name: String) { + game(name: $name, id: $id) { + id + name + displayName + boxArtURL(width: 40, height: 56) + } +} \ No newline at end of file diff --git a/src/utilities/twitch-data.js b/src/utilities/twitch-data.js index 311a92f5..d8c2c3fd 100644 --- a/src/utilities/twitch-data.js +++ b/src/utilities/twitch-data.js @@ -141,6 +141,15 @@ export default class TwitchData extends Module { }; } + async getCategory(id, name) { + const data = await this.queryApollo( + require('./data/category-fetch.gql'), + { id, name } + ); + + return get('data.game', data); + } + // ======================================================================== // Users