diff --git a/CHANGELOG-nightly.md b/CHANGELOG-nightly.md index 659a4b9c0..8b1578a7a 100644 --- a/CHANGELOG-nightly.md +++ b/CHANGELOG-nightly.md @@ -1,3 +1,7 @@ +### 3.1.8.2000 + +- Added loading emote sets from Twitch's shared chat channels + ### 3.1.8.1000 - Tomfoolery diff --git a/src/app/chat/ChatData.vue b/src/app/chat/ChatData.vue index dee4ed9df..9a568ae84 100644 --- a/src/app/chat/ChatData.vue +++ b/src/app/chat/ChatData.vue @@ -15,6 +15,7 @@ import { v4 as uuidv4 } from "uuid"; const { target } = useWorker(); const ctx = useChannelContext(); const channelID = toRef(ctx, "id"); +const peerChannelIDs = toRef(ctx, "peerChannelIds"); const messages = useChatMessages(ctx); const emotes = useChatEmotes(ctx); const { providers } = useStore(); @@ -24,12 +25,12 @@ const channelSets = useLiveQuery( () => db.channels .where("id") - .equals(ctx.id) - .first() - .then((c) => c?.set_ids ?? []), + .anyOf([ctx.id, ...ctx.peerChannelIds]) + .toArray() + .then((res) => res.flatMap((c) => c?.set_ids ?? [])), undefined, { - reactives: [channelID], + reactives: [channelID, peerChannelIDs], }, ); diff --git a/src/composable/channel/useChannelContext.ts b/src/composable/channel/useChannelContext.ts index 1da6287d6..ffaa78ea6 100644 --- a/src/composable/channel/useChannelContext.ts +++ b/src/composable/channel/useChannelContext.ts @@ -13,6 +13,7 @@ export class ChannelContext implements CurrentChannel { id = ""; username = ""; displayName = ""; + peerChannelIds: string[] = []; user?: SevenTV.User; loaded = false; setsFetched = false; @@ -56,6 +57,10 @@ export class ChannelContext implements CurrentChannel { return true; } + setPeerChannelIds(ids: string[]) { + this.peerChannelIds = ids; + } + leave(): void { this.active = false; diff --git a/src/site/twitch.tv/modules/chat/ChatController.vue b/src/site/twitch.tv/modules/chat/ChatController.vue index 90b7c204e..4545d2ca6 100644 --- a/src/site/twitch.tv/modules/chat/ChatController.vue +++ b/src/site/twitch.tv/modules/chat/ChatController.vue @@ -298,6 +298,9 @@ watch( sharedChannels.set(channelID, useChannelContext(channelID, true)); } } + + // Update host channel context + ctx.setPeerChannelIds([...sharedChannels.keys()]); }, }); },