Skip to content

Commit f799e5f

Browse files
authored
fix missing emotes on channels that don't have 7tv enabled (#426)
* fix wrong type * fix missing emotes caused by wrong `catchError` handler
1 parent f711004 commit f799e5f

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

lib/screens/channel/chat/stores/chat_assets_store.dart

+18-18
Original file line numberDiff line numberDiff line change
@@ -141,22 +141,6 @@ abstract class ChatAssetsStoreBase with Store {
141141
//
142142
// Emotes
143143
Future.wait([
144-
twitchApi
145-
.getSharedChatSession(
146-
broadcasterId: channelId,
147-
headers: headers,
148-
)
149-
.then((sharedChatSession) {
150-
if (sharedChatSession == null) return;
151-
152-
for (final participant in sharedChatSession.participants) {
153-
twitchApi
154-
.getUser(id: participant.broadcasterId, headers: headers)
155-
.then((user) {
156-
channelIdToUserTwitch[participant.broadcasterId] = user;
157-
});
158-
}
159-
}).catchError(onBadgeError),
160144
Future.wait([
161145
if (showTwitchEmotes) ...[
162146
twitchApi
@@ -180,7 +164,7 @@ abstract class ChatAssetsStoreBase with Store {
180164
final (setId, emotes) = data;
181165
sevenTvEmoteSetId = setId;
182166
return emotes;
183-
}).catchError(onBadgeError),
167+
}).catchError(onEmoteError),
184168
],
185169
if (showBTTVEmotes) ...[
186170
bttvApi.getEmotesGlobal().catchError(onEmoteError),
@@ -200,8 +184,24 @@ abstract class ChatAssetsStoreBase with Store {
200184
for (final emote in emotes) emote.name: emote,
201185
}.asObservable(),
202186
),
203-
//Emotes
187+
// Badges
204188
Future.wait([
189+
twitchApi
190+
.getSharedChatSession(
191+
broadcasterId: channelId,
192+
headers: headers,
193+
)
194+
.then((sharedChatSession) {
195+
if (sharedChatSession == null) return;
196+
197+
for (final participant in sharedChatSession.participants) {
198+
twitchApi
199+
.getUser(id: participant.broadcasterId, headers: headers)
200+
.then((user) {
201+
channelIdToUserTwitch[participant.broadcasterId] = user;
202+
});
203+
}
204+
}).catchError(onBadgeError),
205205
// Get global badges first, then channel badges to avoid badge conflicts.
206206
// We want the channel badges to override the global badges.
207207
if (showTwitchBadges)

lib/screens/channel/chat/stores/chat_store.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'dart:convert';
33

44
import 'package:flutter/material.dart';
55
import 'package:frosty/apis/twitch_api.dart';
6+
import 'package:frosty/models/badges.dart';
67
import 'package:frosty/models/emotes.dart';
78
import 'package:frosty/models/events.dart';
89
import 'package:frosty/models/irc.dart';
@@ -435,7 +436,7 @@ abstract class ChatStoreBase with Store {
435436
},
436437
onBadgeError: (error) {
437438
debugPrint(error.toString());
438-
return <Badge>[];
439+
return <ChatBadge>[];
439440
},
440441
showTwitchEmotes: settings.showTwitchEmotes,
441442
showTwitchBadges: settings.showTwitchBadges,

0 commit comments

Comments
 (0)