Format remaining files to 120 line limit
This commit is contained in:
parent
aadac3e484
commit
25e6bc478b
5 changed files with 30 additions and 15 deletions
|
|
@ -97,8 +97,8 @@ class TwitchApi {
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final result = <String, Badge>{};
|
final result = <String, Badge>{};
|
||||||
final decoded = jsonDecode(response.body)['badge_sets'] as Map;
|
final decoded = jsonDecode(response.body)['badge_sets'] as Map;
|
||||||
decoded.forEach((id, versions) =>
|
decoded.forEach((id, versions) => (versions['versions'] as Map).forEach(
|
||||||
(versions['versions'] as Map).forEach((version, badgeInfo) => result['$id/$version'] = Badge.fromTwitch(BadgeInfoTwitch.fromJson(badgeInfo))));
|
(version, badgeInfo) => result['$id/$version'] = Badge.fromTwitch(BadgeInfoTwitch.fromJson(badgeInfo))));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -114,8 +114,8 @@ class TwitchApi {
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final result = <String, Badge>{};
|
final result = <String, Badge>{};
|
||||||
final decoded = jsonDecode(response.body)['badge_sets'] as Map;
|
final decoded = jsonDecode(response.body)['badge_sets'] as Map;
|
||||||
decoded.forEach((id, versions) =>
|
decoded.forEach((id, versions) => (versions['versions'] as Map).forEach(
|
||||||
(versions['versions'] as Map).forEach((version, badgeInfo) => result['$id/$version'] = Badge.fromTwitch(BadgeInfoTwitch.fromJson(badgeInfo))));
|
(version, badgeInfo) => result['$id/$version'] = Badge.fromTwitch(BadgeInfoTwitch.fromJson(badgeInfo))));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -175,7 +175,8 @@ class TwitchApi {
|
||||||
required Map<String, String> headers,
|
required Map<String, String> headers,
|
||||||
String? cursor,
|
String? cursor,
|
||||||
}) async {
|
}) async {
|
||||||
final url = Uri.parse(cursor == null ? 'https://api.twitch.tv/helix/streams' : 'https://api.twitch.tv/helix/streams?after=$cursor');
|
final url = Uri.parse(
|
||||||
|
cursor == null ? 'https://api.twitch.tv/helix/streams' : 'https://api.twitch.tv/helix/streams?after=$cursor');
|
||||||
|
|
||||||
final response = await _client.get(url, headers: headers);
|
final response = await _client.get(url, headers: headers);
|
||||||
final decoded = jsonDecode(response.body);
|
final decoded = jsonDecode(response.body);
|
||||||
|
|
@ -192,8 +193,9 @@ class TwitchApi {
|
||||||
required Map<String, String> headers,
|
required Map<String, String> headers,
|
||||||
String? cursor,
|
String? cursor,
|
||||||
}) async {
|
}) async {
|
||||||
final url = Uri.parse(
|
final url = Uri.parse(cursor == null
|
||||||
cursor == null ? 'https://api.twitch.tv/helix/streams/followed?user_id=$id' : 'https://api.twitch.tv/helix/streams/followed?user_id=$id&after=$cursor');
|
? 'https://api.twitch.tv/helix/streams/followed?user_id=$id'
|
||||||
|
: 'https://api.twitch.tv/helix/streams/followed?user_id=$id&after=$cursor');
|
||||||
|
|
||||||
final response = await _client.get(url, headers: headers);
|
final response = await _client.get(url, headers: headers);
|
||||||
final decoded = jsonDecode(response.body);
|
final decoded = jsonDecode(response.body);
|
||||||
|
|
@ -210,8 +212,9 @@ class TwitchApi {
|
||||||
required Map<String, String> headers,
|
required Map<String, String> headers,
|
||||||
String? cursor,
|
String? cursor,
|
||||||
}) async {
|
}) async {
|
||||||
final url =
|
final url = Uri.parse(cursor == null
|
||||||
Uri.parse(cursor == null ? 'https://api.twitch.tv/helix/streams?game_id=$gameId' : 'https://api.twitch.tv/helix/streams?game_id=$gameId&after=$cursor');
|
? 'https://api.twitch.tv/helix/streams?game_id=$gameId'
|
||||||
|
: 'https://api.twitch.tv/helix/streams?game_id=$gameId&after=$cursor');
|
||||||
|
|
||||||
final response = await _client.get(url, headers: headers);
|
final response = await _client.get(url, headers: headers);
|
||||||
final decoded = jsonDecode(response.body);
|
final decoded = jsonDecode(response.body);
|
||||||
|
|
@ -250,7 +253,8 @@ class TwitchApi {
|
||||||
String? id,
|
String? id,
|
||||||
required Map<String, String> headers,
|
required Map<String, String> headers,
|
||||||
}) async {
|
}) async {
|
||||||
final url = Uri.parse(id != null ? 'https://api.twitch.tv/helix/users?id=$id' : 'https://api.twitch.tv/helix/users?login=$userLogin');
|
final url = Uri.parse(
|
||||||
|
id != null ? 'https://api.twitch.tv/helix/users?id=$id' : 'https://api.twitch.tv/helix/users?login=$userLogin');
|
||||||
|
|
||||||
final response = await _client.get(url, headers: headers);
|
final response = await _client.get(url, headers: headers);
|
||||||
final decoded = jsonDecode(response.body);
|
final decoded = jsonDecode(response.body);
|
||||||
|
|
@ -312,7 +316,9 @@ class TwitchApi {
|
||||||
required Map<String, String> headers,
|
required Map<String, String> headers,
|
||||||
String? cursor,
|
String? cursor,
|
||||||
}) async {
|
}) async {
|
||||||
final url = Uri.parse(cursor == null ? 'https://api.twitch.tv/helix/games/top' : 'https://api.twitch.tv/helix/games/top?after=$cursor');
|
final url = Uri.parse(cursor == null
|
||||||
|
? 'https://api.twitch.tv/helix/games/top'
|
||||||
|
: 'https://api.twitch.tv/helix/games/top?after=$cursor');
|
||||||
|
|
||||||
final response = await _client.get(url, headers: headers);
|
final response = await _client.get(url, headers: headers);
|
||||||
final decoded = jsonDecode(response.body);
|
final decoded = jsonDecode(response.body);
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,8 @@ abstract class ListStoreBase with Store {
|
||||||
/// The list of the fetched streams with blocked users filtered out.
|
/// The list of the fetched streams with blocked users filtered out.
|
||||||
@computed
|
@computed
|
||||||
ObservableList<StreamTwitch> get streams => _allStreams
|
ObservableList<StreamTwitch> get streams => _allStreams
|
||||||
.where((streamInfo) => !authStore.user.blockedUsers.map((blockedUser) => blockedUser.userId).contains(streamInfo.userId))
|
.where((streamInfo) =>
|
||||||
|
!authStore.user.blockedUsers.map((blockedUser) => blockedUser.userId).contains(streamInfo.userId))
|
||||||
.toList()
|
.toList()
|
||||||
.asObservable();
|
.asObservable();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@ abstract class UserStoreBase with Store {
|
||||||
// Get and update the current user's list of blocked users.
|
// Get and update the current user's list of blocked users.
|
||||||
// Don't use await because having a huge list of blocked users will block the UI.
|
// Don't use await because having a huge list of blocked users will block the UI.
|
||||||
if (_details?.id != null) {
|
if (_details?.id != null) {
|
||||||
twitchApi.getUserBlockedList(id: _details!.id, headers: headers).then((blockedUsers) => _blockedUsers = blockedUsers.asObservable());
|
twitchApi
|
||||||
|
.getUserBlockedList(id: _details!.id, headers: headers)
|
||||||
|
.then((blockedUsers) => _blockedUsers = blockedUsers.asObservable());
|
||||||
}
|
}
|
||||||
|
|
||||||
_disposeReaction = autorun((_) => _blockedUsers.sort((a, b) => a.userLogin.compareTo(b.userLogin)));
|
_disposeReaction = autorun((_) => _blockedUsers.sort((a, b) => a.userLogin.compareTo(b.userLogin)));
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,12 @@ void main() {
|
||||||
final List<EmoteBTTV> emotes = decoded.map((emote) => EmoteBTTV.fromJson(emote)).toList();
|
final List<EmoteBTTV> emotes = decoded.map((emote) => EmoteBTTV.fromJson(emote)).toList();
|
||||||
expect(emotes.length, 4);
|
expect(emotes.length, 4);
|
||||||
|
|
||||||
final emoteIds = ['54fa903b01e468494b85b53f', '54fa909b01e468494b85b542', '54fa90ba01e468494b85b543', '54fa90f201e468494b85b545'];
|
final emoteIds = [
|
||||||
|
'54fa903b01e468494b85b53f',
|
||||||
|
'54fa909b01e468494b85b542',
|
||||||
|
'54fa90ba01e468494b85b543',
|
||||||
|
'54fa90f201e468494b85b545'
|
||||||
|
];
|
||||||
final emoteCodes = ['DatSauce', 'ForeverAlone', 'GabeN', 'HailHelix'];
|
final emoteCodes = ['DatSauce', 'ForeverAlone', 'GabeN', 'HailHelix'];
|
||||||
|
|
||||||
emotes.asMap().forEach((index, emote) {
|
emotes.asMap().forEach((index, emote) {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ void main() {
|
||||||
expect(user.id, '88888888');
|
expect(user.id, '88888888');
|
||||||
expect(user.login, 'bob');
|
expect(user.login, 'bob');
|
||||||
expect(user.displayName, 'Bob');
|
expect(user.displayName, 'Bob');
|
||||||
expect(user.profileImageUrl, 'https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png');
|
expect(user.profileImageUrl,
|
||||||
|
'https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue