From c0b7b59973307426e19dc89b94b80ee946f4180c Mon Sep 17 00:00:00 2001 From: Jaime <52668514+jsgalarraga@users.noreply.github.com> Date: Fri, 1 Mar 2024 12:24:32 +0100 Subject: [PATCH] feat: word axis (#17) * chore: get dependencies * feat: add axis to word * chore: do not analyze generated files --- .../game_domain/analysis_options.yaml | 4 + .../game_domain/lib/src/models/word.dart | 15 ++ .../game_domain/lib/src/models/word.g.dart | 7 + .../test/src/models/board_section_test.dart | 4 + .../test/src/models/word_test.dart | 6 + macos/Flutter/GeneratedPluginRegistrant.swift | 4 + pubspec.lock | 220 +++++++++++++++++- 7 files changed, 258 insertions(+), 2 deletions(-) diff --git a/api/packages/game_domain/analysis_options.yaml b/api/packages/game_domain/analysis_options.yaml index 799268d3e..cb15b9bfb 100644 --- a/api/packages/game_domain/analysis_options.yaml +++ b/api/packages/game_domain/analysis_options.yaml @@ -1 +1,5 @@ include: package:very_good_analysis/analysis_options.5.1.0.yaml + +analyzer: + exclude: + - '**/*.g.dart' \ No newline at end of file diff --git a/api/packages/game_domain/lib/src/models/word.dart b/api/packages/game_domain/lib/src/models/word.dart index 08e56a349..3ca24ceb2 100644 --- a/api/packages/game_domain/lib/src/models/word.dart +++ b/api/packages/game_domain/lib/src/models/word.dart @@ -13,6 +13,7 @@ class Word extends Equatable { const Word({ required this.id, required this.position, + required this.axis, required this.answer, required this.clue, required this.hints, @@ -32,6 +33,10 @@ class Word extends Equatable { @PointConverter() final Point position; + /// The axis of the word in the board. + @JsonKey() + final Axis axis; + /// The word answer to display in the crossword when solved. @JsonKey() final String answer; @@ -62,6 +67,7 @@ class Word extends Equatable { List get props => [ id, position, + axis, answer, clue, hints, @@ -69,3 +75,12 @@ class Word extends Equatable { solvedTimestamp, ]; } + +/// The two possible axis for a word in the board. +enum Axis { + /// From left to right. + horizontal, + + /// From top to bottom. + vertical, +} diff --git a/api/packages/game_domain/lib/src/models/word.g.dart b/api/packages/game_domain/lib/src/models/word.g.dart index 4ad00c40b..e1b97c049 100644 --- a/api/packages/game_domain/lib/src/models/word.g.dart +++ b/api/packages/game_domain/lib/src/models/word.g.dart @@ -10,6 +10,7 @@ Word _$WordFromJson(Map json) => Word( id: json['id'] as String, position: const PointConverter() .fromJson(json['position'] as Map), + axis: $enumDecode(_$AxisEnumMap, json['axis']), answer: json['answer'] as String, clue: json['clue'] as String, hints: (json['hints'] as List).map((e) => e as String).toList(), @@ -20,9 +21,15 @@ Word _$WordFromJson(Map json) => Word( Map _$WordToJson(Word instance) => { 'id': instance.id, 'position': const PointConverter().toJson(instance.position), + 'axis': _$AxisEnumMap[instance.axis]!, 'answer': instance.answer, 'clue': instance.clue, 'hints': instance.hints, 'visible': instance.visible, 'solvedTimestamp': instance.solvedTimestamp, }; + +const _$AxisEnumMap = { + Axis.horizontal: 'horizontal', + Axis.vertical: 'vertical', +}; diff --git a/api/packages/game_domain/test/src/models/board_section_test.dart b/api/packages/game_domain/test/src/models/board_section_test.dart index 9ddd1a6e6..5c61970e2 100644 --- a/api/packages/game_domain/test/src/models/board_section_test.dart +++ b/api/packages/game_domain/test/src/models/board_section_test.dart @@ -16,6 +16,7 @@ void main() { Word( id: 'id', position: Point(1, 2), + axis: Axis.horizontal, answer: 'answer', clue: 'clue', hints: ['hints'], @@ -37,6 +38,7 @@ void main() { { 'id': 'id', 'position': {'x': 1, 'y': 2}, + 'axis': 'horizontal', 'answer': 'answer', 'clue': 'clue', 'hints': ['hints'], @@ -58,6 +60,7 @@ void main() { { 'id': 'id', 'position': {'x': 1, 'y': 2}, + 'axis': 'horizontal', 'answer': 'answer', 'clue': 'clue', 'hints': ['hints'], @@ -79,6 +82,7 @@ void main() { Word( id: 'id', position: Point(1, 2), + axis: Axis.horizontal, answer: 'answer', clue: 'clue', hints: ['hints'], diff --git a/api/packages/game_domain/test/src/models/word_test.dart b/api/packages/game_domain/test/src/models/word_test.dart index f1dfbe182..4ede4cda8 100644 --- a/api/packages/game_domain/test/src/models/word_test.dart +++ b/api/packages/game_domain/test/src/models/word_test.dart @@ -9,6 +9,7 @@ void main() { final word = Word( id: 'id', position: Point(1, 2), + axis: Axis.horizontal, answer: 'test', clue: 'clue', hints: const ['hint'], @@ -22,6 +23,7 @@ void main() { equals({ 'id': 'id', 'position': {'x': 1, 'y': 2}, + 'axis': 'horizontal', 'answer': 'test', 'clue': 'clue', 'hints': ['hint'], @@ -35,6 +37,7 @@ void main() { final json = { 'id': 'id', 'position': {'x': 1, 'y': 2}, + 'axis': 'horizontal', 'answer': 'test', 'clue': 'clue', 'hints': ['hint'], @@ -47,6 +50,7 @@ void main() { Word( id: 'id', position: Point(1, 2), + axis: Axis.horizontal, answer: 'test', clue: 'clue', hints: const ['hint'], @@ -61,6 +65,7 @@ void main() { final firstWord = Word( id: 'id', position: Point(1, 2), + axis: Axis.horizontal, answer: 'test', clue: 'clue', hints: const ['hint'], @@ -70,6 +75,7 @@ void main() { final secondWord = Word( id: 'id', position: Point(1, 2), + axis: Axis.horizontal, answer: 'test', clue: 'clue', hints: const ['hint'], diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 7b9be2038..11e500007 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,10 +5,14 @@ import FlutterMacOS import Foundation +import audioplayers_darwin import firebase_auth import firebase_core +import path_provider_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin")) FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index b8d651ebb..b3e2620f7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -41,6 +41,62 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" + audioplayers: + dependency: transitive + description: + name: audioplayers + sha256: c05c6147124cd63e725e861335a8b4d57300b80e6e92cea7c145c739223bbaef + url: "https://pub.dev" + source: hosted + version: "5.2.1" + audioplayers_android: + dependency: transitive + description: + name: audioplayers_android + sha256: b00e1a0e11365d88576320ec2d8c192bc21f1afb6c0e5995d1c57ae63156acb5 + url: "https://pub.dev" + source: hosted + version: "4.0.3" + audioplayers_darwin: + dependency: transitive + description: + name: audioplayers_darwin + sha256: "3034e99a6df8d101da0f5082dcca0a2a99db62ab1d4ddb3277bed3f6f81afe08" + url: "https://pub.dev" + source: hosted + version: "5.0.2" + audioplayers_linux: + dependency: transitive + description: + name: audioplayers_linux + sha256: "60787e73fefc4d2e0b9c02c69885402177e818e4e27ef087074cf27c02246c9e" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + audioplayers_platform_interface: + dependency: transitive + description: + name: audioplayers_platform_interface + sha256: "365c547f1bb9e77d94dd1687903a668d8f7ac3409e48e6e6a3668a1ac2982adb" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + audioplayers_web: + dependency: transitive + description: + name: audioplayers_web + sha256: "22cd0173e54d92bd9b2c80b1204eb1eb159ece87475ab58c9788a70ec43c2a62" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + audioplayers_windows: + dependency: transitive + description: + name: audioplayers_windows + sha256: "9536812c9103563644ada2ef45ae523806b0745f7a78e89d1b5fb1951de90e1a" + url: "https://pub.dev" + source: hosted + version: "3.1.0" authentication_repository: dependency: "direct main" description: @@ -129,7 +185,7 @@ packages: source: hosted version: "0.4.1" equatable: - dependency: transitive + dependency: "direct main" description: name: equatable sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 @@ -144,6 +200,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + url: "https://pub.dev" + source: hosted + version: "2.1.2" file: dependency: transitive description: @@ -200,6 +264,38 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.5" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flame: + dependency: "direct main" + description: + name: flame + sha256: bb42a35fa5dabdea535daebe5b020e21a2fce8192b67b7e55cd30fed86d29f69 + url: "https://pub.dev" + source: hosted + version: "1.16.0" + flame_audio: + dependency: "direct main" + description: + name: flame_audio + sha256: "0551a01a0beb10bb54dc014c51b4b8ccd5ff69c7535fd60e7ce93fab00cdf5f4" + url: "https://pub.dev" + source: hosted + version: "2.10.0" + flame_behaviors: + dependency: "direct main" + description: + name: flame_behaviors + sha256: "177aa671df88ecdaf01c28e8f6fbdb83a69ce923dc7c1b551cfc1b34df0386c7" + url: "https://pub.dev" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -244,6 +340,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + http: + dependency: transitive + description: + name: http + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + url: "https://pub.dev" + source: hosted + version: "1.2.0" http_multi_server: dependency: transitive description: @@ -348,6 +452,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" + mockingjay: + dependency: "direct dev" + description: + name: mockingjay + sha256: "04beab95a415cda5bd4efa2681ee76eb92bb9377acaf1a0c08cd58efbae70d83" + url: "https://pub.dev" + source: hosted + version: "0.5.0" mocktail: dependency: "direct dev" description: @@ -372,6 +484,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + ordered_set: + dependency: transitive + description: + name: ordered_set + sha256: "3858c7d84619edfab87c3e367584648020903187edb70b52697646f4b2a93022" + url: "https://pub.dev" + source: hosted + version: "5.0.2" package_config: dependency: transitive description: @@ -388,6 +508,62 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + platform: + dependency: transitive + description: + name: platform + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + url: "https://pub.dev" + source: hosted + version: "3.1.4" plugin_platform_interface: dependency: transitive description: @@ -481,6 +657,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: @@ -505,6 +689,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" term_glyph: dependency: transitive description: @@ -545,6 +737,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + uuid: + dependency: transitive + description: + name: uuid + sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 + url: "https://pub.dev" + source: hosted + version: "4.3.3" vector_math: dependency: transitive description: @@ -601,6 +801,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" + win32: + dependency: transitive + description: + name: win32 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + url: "https://pub.dev" + source: hosted + version: "5.2.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" + source: hosted + version: "1.0.4" yaml: dependency: transitive description: @@ -610,5 +826,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.3.0-279.1.beta <4.0.0" flutter: ">=3.19.0"