Fix twitch emotes tooltips

This commit is contained in:
Tommy Chow 2022-02-03 21:43:59 -05:00
parent 9997313ce7
commit 00972e13cd
5 changed files with 21 additions and 5 deletions

View file

@ -44,7 +44,18 @@ class TwitchApi {
final decoded = jsonDecode(response.body)['data'] as List;
final emotes = decoded.map((emote) => EmoteTwitch.fromJson(emote)).toList();
return emotes.map((emote) => Emote.fromTwitch(emote, EmoteType.twitchChannel)).toList();
return emotes.map((emote) {
switch (emote.emoteType) {
case 'bitstier':
return Emote.fromTwitch(emote, EmoteType.twitchBits);
case 'follower':
return Emote.fromTwitch(emote, EmoteType.twitchFollower);
case 'subscriptions':
return Emote.fromTwitch(emote, EmoteType.twitchChannel);
default:
return Emote.fromTwitch(emote, EmoteType.twitchChannel);
}
}).toList();
} else {
return Future.error('Failed to get Twitch channel emotes.');
}

View file

@ -181,7 +181,6 @@ class OwnerFFZ {
}
// * 7TV Emotes *
@JsonSerializable(createToJson: false)
class Role7TV {
final String id;
@ -310,6 +309,8 @@ class Emote {
}
enum EmoteType {
twitchBits,
twitchFollower,
twitchSub,
twitchGlobal,
twitchUnlocked,

View file

@ -143,6 +143,8 @@ Map<String, dynamic> _$EmoteToJson(Emote instance) => <String, dynamic>{
};
const _$EmoteTypeEnumMap = {
EmoteType.twitchBits: 'twitchBits',
EmoteType.twitchFollower: 'twitchFollower',
EmoteType.twitchSub: 'twitchSub',
EmoteType.twitchGlobal: 'twitchGlobal',
EmoteType.twitchUnlocked: 'twitchUnlocked',

View file

@ -522,7 +522,9 @@ class IRCMessage {
required double height,
}) {
const emoteType = [
'Twitch (Sub)',
'Twitch (Bits Tier)',
'Twitch (Follower)',
'Twitch (Subscriber)',
'Twitch (Global)',
'Twitch (Unlocked)',
'Twitch (Channel)',
@ -677,7 +679,7 @@ class IRCMessage {
name: emoteWord,
zeroWidth: false,
url: 'https://static-cdn.jtvnw.net/emoticons/v2/$emoteId/default/dark/3.0',
type: EmoteType.bttvChannel,
type: EmoteType.twitchSub,
);
}
}

View file

@ -65,7 +65,7 @@ class EmoteMenuPanel extends StatelessWidget {
],
if (subEmotes.isNotEmpty) ...[
const SliverToBoxAdapter(
child: SectionHeader('Subbed Emotes'),
child: SectionHeader('Subscribed Emotes'),
),
EmoteMenuSection(
assetsStore: assetsStore,