Remove deprecated 7TV badges request

This commit is contained in:
Tommy Chow 2023-11-21 01:33:27 -05:00
parent f2a54b4398
commit 7c1fb1cd58
2 changed files with 0 additions and 34 deletions

View file

@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:frosty/models/badges.dart';
import 'package:frosty/models/emotes.dart';
import 'package:http/http.dart';
@ -43,33 +42,4 @@ class SevenTVApi {
return Future.error('Failed to get 7TV channel emotes');
}
}
/// Returns a map of user IDS to a list of their 7TV badges.
Future<Map<String, List<ChatBadge>>> getBadges() async {
final url =
Uri.parse('https://api.7tv.app/v2/badges?user_identifier=twitch_id');
final response = await _client.get(url);
if (response.statusCode == 200) {
final decoded = jsonDecode(response.body)['badges'] as List;
final badges = decoded.map((emote) => BadgeInfo7TV.fromJson(emote));
final result = <String, List<ChatBadge>>{};
for (final badge in badges) {
for (final userId in badge.users) {
final entry = result[userId];
final normalBadge = ChatBadge.from7TV(badge);
if (entry == null) {
result[userId] = [normalBadge];
} else {
entry.add(normalBadge);
}
}
}
return result;
} else {
return Future.error('Failed to get 7TV badges');
}
}
}

View file

@ -200,10 +200,6 @@ abstract class ChatAssetsStoreBase with Store {
.getBadges()
.then((badges) => _userToFFZBadges = badges)
.catchError(onError),
sevenTVApi
.getBadges()
.then((badges) => _userTo7TVBadges = badges)
.catchError(onError),
bttvApi
.getBadges()
.then((badges) => _userToBTTVBadges = badges)