Update analysis_options.yaml

This commit is contained in:
Tommy Chow 2022-03-23 20:13:45 -04:00
parent 3f0a076a40
commit 6718ee180a
9 changed files with 110 additions and 112 deletions

View file

@ -26,8 +26,7 @@ linter:
# producing the lint.
rules:
- directives_ordering
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
- prefer_single_quotes
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View file

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 51;
objects = {
/* Begin PBXBuildFile section */
@ -113,7 +113,6 @@
95D7E205EE04D01F6996ECFC /* Pods-Runner.release.xcconfig */,
1282DADB4DD304DDC4BC6DDE /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};

View file

@ -9,14 +9,14 @@ const sampleRate = 1.0;
/// BTTV emotes with zero width to allow for overlaying other emotes.
const zeroWidthEmotes = [
"SoSnowy",
"IceCold",
"SantaHat",
"TopHat",
"ReinDeer",
"CandyCane",
"cvMask",
"cvHazmat",
'SoSnowy',
'IceCold',
'SantaHat',
'TopHat',
'ReinDeer',
'CandyCane',
'cvMask',
'cvHazmat',
];
// Regex for matching strings that contain lower or upper case English characters.

View file

@ -299,7 +299,7 @@ class Emote {
name: emote.name,
width: emote.width.first,
height: emote.height.first,
zeroWidth: emote.visibilitySimple.isNotEmpty ? emote.visibilitySimple.first == "ZERO_WIDTH" : false,
zeroWidth: emote.visibilitySimple.isNotEmpty ? emote.visibilitySimple.first == 'ZERO_WIDTH' : false,
url: emote.urls[3][1],
type: type,
);

View file

@ -25,11 +25,11 @@ class _EmoteMenuState extends State<EmoteMenu> {
@override
Widget build(BuildContext context) {
const sections = [
"Recent",
"Twitch",
"BTTV",
"FFZ",
"7TV",
'Recent',
'Twitch',
'BTTV',
'FFZ',
'7TV',
];
return Column(

View file

@ -51,7 +51,7 @@ class ChatBottomBar extends StatelessWidget {
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(15.0)),
),
hintText: chatStore.auth.isLoggedIn ? 'Send a message' : "Log in to chat",
hintText: chatStore.auth.isLoggedIn ? 'Send a message' : 'Log in to chat',
),
controller: chatStore.textController,
onSubmitted: chatStore.sendMessage,

View file

@ -33,7 +33,7 @@ class Settings extends StatelessWidget {
IconButton(
tooltip: 'Support the App',
onPressed: () => launch('https://www.buymeacoffee.com/tommychow'),
icon: const FaIcon(FontAwesomeIcons.donate),
icon: const FaIcon(FontAwesomeIcons.circleDollarToSlot),
),
IconButton(
tooltip: 'View Source on GitHub',

View file

@ -1,11 +1,11 @@
import "dart:convert";
import "package:flutter_test/flutter_test.dart";
import "package:frosty/models/emotes.dart";
import 'dart:convert';
import 'package:flutter_test/flutter_test.dart';
import 'package:frosty/models/emotes.dart';
void main() {
group("Twitch", () {
test("emote should parse correctly", () {
const sampleJson = """
group('Twitch', () {
test('emote should parse correctly', () {
const sampleJson = '''
{
"id": "304456832",
"name": "twitchdevPitchfork",
@ -30,47 +30,47 @@ void main() {
"dark"
]
}
""";
''';
final decoded = jsonDecode(sampleJson);
final emote = EmoteTwitch.fromJson(decoded);
expect(emote.id, "304456832");
expect(emote.name, "twitchdevPitchfork");
expect(emote.images.url1x, "https://static-cdn.jtvnw.net/emoticons/v2/304456832/static/light/1.0");
expect(emote.images.url2x, "https://static-cdn.jtvnw.net/emoticons/v2/304456832/static/light/2.0");
expect(emote.images.url4x, "https://static-cdn.jtvnw.net/emoticons/v2/304456832/static/light/3.0");
expect(emote.tier, "1000");
expect(emote.emoteType, "subscriptions");
expect(emote.emoteSetId, "301590448");
expect(emote.format, ["static"]);
expect(emote.scale, ["1.0", "2.0", "3.0"]);
expect(emote.themeMode, ["light", "dark"]);
expect(emote.id, '304456832');
expect(emote.name, 'twitchdevPitchfork');
expect(emote.images.url1x, 'https://static-cdn.jtvnw.net/emoticons/v2/304456832/static/light/1.0');
expect(emote.images.url2x, 'https://static-cdn.jtvnw.net/emoticons/v2/304456832/static/light/2.0');
expect(emote.images.url4x, 'https://static-cdn.jtvnw.net/emoticons/v2/304456832/static/light/3.0');
expect(emote.tier, '1000');
expect(emote.emoteType, 'subscriptions');
expect(emote.emoteSetId, '301590448');
expect(emote.format, ['static']);
expect(emote.scale, ['1.0', '2.0', '3.0']);
expect(emote.themeMode, ['light', 'dark']);
});
});
group("BTTV", () {
test("emote should parse correctly", () {
const emoteTrollFace = """
group('BTTV', () {
test('emote should parse correctly', () {
const emoteTrollFace = '''
{
"id":"54fa8f1401e468494b85b537",
"code":":tf:",
"imageType":"png",
"userId":"5561169bd6b9d206222a8c19"
}
""";
''';
final json = jsonDecode(emoteTrollFace);
final emote = EmoteBTTV.fromJson(json);
expect(emote.id, "54fa8f1401e468494b85b537");
expect(emote.code, ":tf:");
expect(emote.imageType, "png");
expect(emote.userId, "5561169bd6b9d206222a8c19");
expect(emote.id, '54fa8f1401e468494b85b537');
expect(emote.code, ':tf:');
expect(emote.imageType, 'png');
expect(emote.userId, '5561169bd6b9d206222a8c19');
});
test("shared emote should parse correctly", () {
const emoteEZ = """
test('shared emote should parse correctly', () {
const emoteEZ = '''
{
"id": "5590b223b344e2c42a9e28e3",
"code": "EZ",
@ -82,48 +82,48 @@ void main() {
"providerId": "39819556"
}
}
""";
''';
final decoded = jsonDecode(emoteEZ);
final emote = EmoteBTTV.fromJson(decoded);
expect(emote.id, "5590b223b344e2c42a9e28e3");
expect(emote.code, "EZ");
expect(emote.imageType, "png");
expect(emote.user?.id, "558f7862b344e2c42a9e2822");
expect(emote.user?.name, "helloboat");
expect(emote.user?.displayName, "helloboat");
expect(emote.user?.providerId, "39819556");
expect(emote.id, '5590b223b344e2c42a9e28e3');
expect(emote.code, 'EZ');
expect(emote.imageType, 'png');
expect(emote.user?.id, '558f7862b344e2c42a9e2822');
expect(emote.user?.name, 'helloboat');
expect(emote.user?.displayName, 'helloboat');
expect(emote.user?.providerId, '39819556');
});
test("global emotes should parse correctly", () {
const sampleJson = """
test('global emotes should parse correctly', () {
const sampleJson = '''
[
{"id":"54fa903b01e468494b85b53f","code":"DatSauce","imageType":"png","userId":"5561169bd6b9d206222a8c19"},
{"id":"54fa909b01e468494b85b542","code":"ForeverAlone","imageType":"png","userId":"5561169bd6b9d206222a8c19"},
{"id":"54fa90ba01e468494b85b543","code":"GabeN","imageType":"png","userId":"5561169bd6b9d206222a8c19"},
{"id":"54fa90f201e468494b85b545","code":"HailHelix","imageType":"png","userId":"5561169bd6b9d206222a8c19"}
]
""";
''';
final decoded = jsonDecode(sampleJson) as List;
final List<EmoteBTTV> emotes = decoded.map((emote) => EmoteBTTV.fromJson(emote)).toList();
expect(emotes.length, 4);
final emoteIds = ["54fa903b01e468494b85b53f", "54fa909b01e468494b85b542", "54fa90ba01e468494b85b543", "54fa90f201e468494b85b545"];
final emoteCodes = ["DatSauce", "ForeverAlone", "GabeN", "HailHelix"];
final userIds = ["5561169bd6b9d206222a8c19", "5561169bd6b9d206222a8c19", "5561169bd6b9d206222a8c19", "5561169bd6b9d206222a8c19"];
final emoteIds = ['54fa903b01e468494b85b53f', '54fa909b01e468494b85b542', '54fa90ba01e468494b85b543', '54fa90f201e468494b85b545'];
final emoteCodes = ['DatSauce', 'ForeverAlone', 'GabeN', 'HailHelix'];
final userIds = ['5561169bd6b9d206222a8c19', '5561169bd6b9d206222a8c19', '5561169bd6b9d206222a8c19', '5561169bd6b9d206222a8c19'];
emotes.asMap().forEach((index, emote) {
expect(emote.id, emoteIds[index]);
expect(emote.code, emoteCodes[index]);
expect(emote.imageType, "png");
expect(emote.imageType, 'png');
expect(emote.userId, userIds[index]);
});
});
test("channel emotes should parse correctly", () {
const sampleJson = """
test('channel emotes should parse correctly', () {
const sampleJson = '''
{"id":"5509bd19a607044d1a3dd1bb",
"bots":[
"emotestats",
@ -151,36 +151,36 @@ void main() {
}
]
}
""";
''';
final decoded = jsonDecode(sampleJson);
final result = EmoteBTTVChannel.fromJson(decoded);
expect(result.id, "5509bd19a607044d1a3dd1bb");
expect(result.bots, ["emotestats", "hnlbot"]);
expect(result.id, '5509bd19a607044d1a3dd1bb');
expect(result.bots, ['emotestats', 'hnlbot']);
final channelEmote = result.channelEmotes.first;
expect(channelEmote.id, "5509bd3ba607044d1a3dd1bc");
expect(channelEmote.code, "sodaTP");
expect(channelEmote.imageType, "png");
expect(channelEmote.userId, "5509bd19a607044d1a3dd1bb");
expect(channelEmote.id, '5509bd3ba607044d1a3dd1bc');
expect(channelEmote.code, 'sodaTP');
expect(channelEmote.imageType, 'png');
expect(channelEmote.userId, '5509bd19a607044d1a3dd1bb');
final sharedEmote = result.sharedEmotes.first;
expect(sharedEmote.id, "5ed3bde8f54be95e2a838279");
expect(sharedEmote.code, "pugPls");
expect(sharedEmote.imageType, "gif");
expect(sharedEmote.user?.id, "5c5510a1c0a5642a696190d9");
expect(sharedEmote.user?.name, "wolfabelle");
expect(sharedEmote.user?.displayName, "Wolfabelle");
expect(sharedEmote.user?.providerId, "190146087");
expect(sharedEmote.id, '5ed3bde8f54be95e2a838279');
expect(sharedEmote.code, 'pugPls');
expect(sharedEmote.imageType, 'gif');
expect(sharedEmote.user?.id, '5c5510a1c0a5642a696190d9');
expect(sharedEmote.user?.name, 'wolfabelle');
expect(sharedEmote.user?.displayName, 'Wolfabelle');
expect(sharedEmote.user?.providerId, '190146087');
});
});
group("FFZ", () {
test("emote should parse correctly", () {
const sampleJson = """
group('FFZ', () {
test('emote should parse correctly', () {
const sampleJson = '''
{
"id": 27081,
"name": "ZreknarF",
@ -207,7 +207,7 @@ void main() {
"created_at": "2015-06-01T05:52:57.770Z",
"last_updated": "2015-06-01T05:53:03.744Z"
}
""";
''';
final json = jsonDecode(sampleJson);
final emote = EmoteFFZ.fromJson(json);
@ -225,9 +225,9 @@ void main() {
});
});
group("7TV", () {
test("global emote should parse correctly", () {
const sampleGlobal7TVEmote = """
group('7TV', () {
test('global emote should parse correctly', () {
const sampleGlobal7TVEmote = '''
{
"id": "603ca884faf3a00014dff0ab",
"name": "gachiBASS",
@ -272,34 +272,34 @@ void main() {
]
]
}
""";
''';
final json = jsonDecode(sampleGlobal7TVEmote);
final emote = Emote7TV.fromJson(json);
expect(emote.id, "603ca884faf3a00014dff0ab");
expect(emote.name, "gachiBASS");
expect(emote.id, '603ca884faf3a00014dff0ab');
expect(emote.name, 'gachiBASS');
expect(emote.owner, null);
expect(emote.visibility, 2);
expect(emote.visibilitySimple, ["GLOBAL"]);
expect(emote.mime, "image/gif");
expect(emote.visibilitySimple, ['GLOBAL']);
expect(emote.mime, 'image/gif');
expect(emote.status, 3);
expect(emote.tags, []);
expect(emote.width, [32, 48, 76, 128]);
expect(emote.height, [32, 48, 76, 128]);
final urls = [
["1", "https://cdn.7tv.app/emote/603ca884faf3a00014dff0ab/1x"],
["2", "https://cdn.7tv.app/emote/603ca884faf3a00014dff0ab/2x"],
["3", "https://cdn.7tv.app/emote/603ca884faf3a00014dff0ab/3x"],
["4", "https://cdn.7tv.app/emote/603ca884faf3a00014dff0ab/4x"],
['1', 'https://cdn.7tv.app/emote/603ca884faf3a00014dff0ab/1x'],
['2', 'https://cdn.7tv.app/emote/603ca884faf3a00014dff0ab/2x'],
['3', 'https://cdn.7tv.app/emote/603ca884faf3a00014dff0ab/3x'],
['4', 'https://cdn.7tv.app/emote/603ca884faf3a00014dff0ab/4x'],
];
expect(emote.urls, urls);
});
test("channel emote should parse correctly", () {
const sampleEmote = """
test('channel emote should parse correctly', () {
const sampleEmote = '''
{
"id": "603caea243b9e100141caf4f",
"name": "TrollDespair",
@ -358,21 +358,21 @@ void main() {
]
]
}
""";
''';
final json = jsonDecode(sampleEmote);
final emote = Emote7TV.fromJson(json);
expect(emote.id, "603caea243b9e100141caf4f");
expect(emote.name, "TrollDespair");
expect(emote.id, '603caea243b9e100141caf4f');
expect(emote.name, 'TrollDespair');
expect(emote.owner, isNotNull);
expect(emote.owner?.id, "603cae2496832ffa78c758cd");
expect(emote.owner?.twitchId, "");
expect(emote.owner?.login, "swyfty_");
expect(emote.owner?.displayName, "swyfty_");
expect(emote.owner?.role.id, "000000000000000000000000");
expect(emote.owner?.role.name, "");
expect(emote.owner?.id, '603cae2496832ffa78c758cd');
expect(emote.owner?.twitchId, '');
expect(emote.owner?.login, 'swyfty_');
expect(emote.owner?.displayName, 'swyfty_');
expect(emote.owner?.role.id, '000000000000000000000000');
expect(emote.owner?.role.name, '');
expect(emote.owner?.role.position, 0);
expect(emote.owner?.role.color, 0);
expect(emote.owner?.role.allowed, 523);
@ -381,17 +381,17 @@ void main() {
expect(emote.visibility, 0);
expect(emote.visibilitySimple, []);
expect(emote.mime, "image/png");
expect(emote.mime, 'image/png');
expect(emote.status, 3);
expect(emote.tags, []);
expect(emote.width, [32, 48, 76, 128]);
expect(emote.height, [32, 48, 76, 128]);
final urls = [
["1", "https://cdn.7tv.app/emote/603caea243b9e100141caf4f/1x"],
["2", "https://cdn.7tv.app/emote/603caea243b9e100141caf4f/2x"],
["3", "https://cdn.7tv.app/emote/603caea243b9e100141caf4f/3x"],
["4", "https://cdn.7tv.app/emote/603caea243b9e100141caf4f/4x"],
['1', 'https://cdn.7tv.app/emote/603caea243b9e100141caf4f/1x'],
['2', 'https://cdn.7tv.app/emote/603caea243b9e100141caf4f/2x'],
['3', 'https://cdn.7tv.app/emote/603caea243b9e100141caf4f/3x'],
['4', 'https://cdn.7tv.app/emote/603caea243b9e100141caf4f/4x'],
];
expect(emote.urls, urls);

View file

@ -42,7 +42,7 @@ void main() {
expect(stream.startedAt, '2021-09-23T20:06:22Z');
expect(stream.language, 'en');
expect(stream.thumbnailUrl, 'https://static-cdn.jtvnw.net/previews-ttv/live_user_xqcow-{width}x{height}.jpg');
expect(stream.tagIds, ["e6bb8b34-4c28-4b5f-94ed-12c1ebf2d0e4", "6ea6bca4-4712-4ab9-a906-e3336a9d8039", "6606e54c-f92d-40f6-8257-74977889ccdd"]);
expect(stream.tagIds, ['e6bb8b34-4c28-4b5f-94ed-12c1ebf2d0e4', '6ea6bca4-4712-4ab9-a906-e3336a9d8039', '6606e54c-f92d-40f6-8257-74977889ccdd']);
expect(stream.isMature, false);
});
}