diff --git a/lib/application/participation/participation_bloc.dart b/lib/application/participation/participation_bloc.dart index 6716d617..c9befcf7 100644 --- a/lib/application/participation/participation_bloc.dart +++ b/lib/application/participation/participation_bloc.dart @@ -31,12 +31,12 @@ class ParticipationBloc extends Bloc { checkIn: () { // TODO: Implement once the backend has implemented it }, - toggleParticipation: (crowdActionId, commitmentOptions) async { + toggleParticipation: (crowdActionId, commitments) async { emit(const ParticipationState.loading()); await participationRepository.toggleParticipation( crowdActionId: crowdActionId, - commitmentOptions: commitmentOptions, + commitments: commitments, ); add( diff --git a/lib/application/participation/participation_event.dart b/lib/application/participation/participation_event.dart index a2306840..587341b2 100644 --- a/lib/application/participation/participation_event.dart +++ b/lib/application/participation/participation_event.dart @@ -8,6 +8,6 @@ class ParticipationEvent with _$ParticipationEvent { const factory ParticipationEvent.checkIn() = _CheckIn; const factory ParticipationEvent.toggleParticipation({ required String crowdActionId, - List? commitmentOptions, + List? commitments, }) = _ToggleParticipation; } diff --git a/lib/domain/crowdaction/crowdaction.dart b/lib/domain/crowdaction/crowdaction.dart index 08a25339..bb75439c 100644 --- a/lib/domain/crowdaction/crowdaction.dart +++ b/lib/domain/crowdaction/crowdaction.dart @@ -14,12 +14,11 @@ class CrowdAction with _$CrowdAction { const factory CrowdAction({ required String id, - required String type, required String title, required String description, required String category, required Location location, - required List commitmentOptions, + required List commitments, required Images images, required int participantCount, required Status status, @@ -93,18 +92,17 @@ enum JoinStatus { } @freezed -class CommitmentOption with _$CommitmentOption { - const CommitmentOption._(); +class Commitment with _$Commitment { + const Commitment._(); - factory CommitmentOption({ + factory Commitment({ required String id, - required String type, required String label, required int points, required List blocks, String? description, String? iconId, - }) = _CommitmentOption; + }) = _Commitment; IconData get icon => iconId != null ? IconUtil.fromString(iconId!) diff --git a/lib/domain/participation/i_participation_repository.dart b/lib/domain/participation/i_participation_repository.dart index 23e7dea4..1e8280d9 100644 --- a/lib/domain/participation/i_participation_repository.dart +++ b/lib/domain/participation/i_participation_repository.dart @@ -10,7 +10,7 @@ abstract class IParticipationRepository { Future> toggleParticipation({ required String crowdActionId, - List? commitmentOptions, + List? commitments, }); Future> diff --git a/lib/domain/participation/participation.dart b/lib/domain/participation/participation.dart index 26a55751..c0f88547 100644 --- a/lib/domain/participation/participation.dart +++ b/lib/domain/participation/participation.dart @@ -14,7 +14,7 @@ class Participation with _$Participation { required String fullName, required String avatar, required String userId, - required List commitmentOptions, + required List commitments, required DateTime joinDate, required int dailyCheckIns, }) = _Participation; diff --git a/lib/infrastructure/crowdaction/crowdaction_dto.dart b/lib/infrastructure/crowdaction/crowdaction_dto.dart index f97dcf17..d3f53167 100644 --- a/lib/infrastructure/crowdaction/crowdaction_dto.dart +++ b/lib/infrastructure/crowdaction/crowdaction_dto.dart @@ -14,12 +14,11 @@ class CrowdActionDto with _$CrowdActionDto { const factory CrowdActionDto({ required String id, - required String type, required String title, required String description, required String category, required LocationDto location, - required List commitmentOptions, + required List commitments, required ImagesDto images, required int participantCount, required Status status, @@ -32,13 +31,11 @@ class CrowdActionDto with _$CrowdActionDto { CrowdAction toDomain() { return CrowdAction( id: id, - type: type, title: title, description: description, category: category, location: location.toDomain(), - commitmentOptions: - commitmentOptions.map((option) => option.toDomain()).toList(), + commitments: commitments.map((c) => c.toDomain()).toList(), images: images.toDomain(), participantCount: participantCount, status: status, @@ -94,23 +91,22 @@ class LocationDto with _$LocationDto { } @freezed -class CommitmentOptionDto with _$CommitmentOptionDto { - const CommitmentOptionDto._(); +class CommitmentDto with _$CommitmentDto { + const CommitmentDto._(); - factory CommitmentOptionDto({ - required String id, - required String type, + factory CommitmentDto({ + // ignore: invalid_annotation_target + @JsonKey(name: '_id') required String id, required String label, required int points, required List blocks, String? description, String? icon, - }) = _CommitmentOptionDto; + }) = _CommitmentDto; - CommitmentOption toDomain() { - return CommitmentOption( + Commitment toDomain() { + return Commitment( id: id, - type: type, label: label, points: points, blocks: blocks, @@ -119,6 +115,6 @@ class CommitmentOptionDto with _$CommitmentOptionDto { ); } - factory CommitmentOptionDto.fromJson(Map json) => - _$CommitmentOptionDtoFromJson(json); + factory CommitmentDto.fromJson(Map json) => + _$CommitmentDtoFromJson(json); } diff --git a/lib/infrastructure/participation/participation_dto.dart b/lib/infrastructure/participation/participation_dto.dart index 905312fc..145c3485 100644 --- a/lib/infrastructure/participation/participation_dto.dart +++ b/lib/infrastructure/participation/participation_dto.dart @@ -15,7 +15,7 @@ class ParticipationDto with _$ParticipationDto { required String userId, required String fullName, required String avatar, - required List commitmentOptions, + required List commitments, required String joinDate, required int dailyCheckIns, }) = _ParticipationDto; @@ -27,7 +27,7 @@ class ParticipationDto with _$ParticipationDto { userId: userId, fullName: fullName, avatar: avatar, - commitmentOptions: commitmentOptions, + commitments: commitments, joinDate: DateTime.parse(joinDate), dailyCheckIns: dailyCheckIns, ); diff --git a/lib/infrastructure/participation/participation_repository.dart b/lib/infrastructure/participation/participation_repository.dart index 00498cbb..6701331f 100644 --- a/lib/infrastructure/participation/participation_repository.dart +++ b/lib/infrastructure/participation/participation_repository.dart @@ -67,7 +67,7 @@ class ParticipationRepository implements IParticipationRepository { @override Future> toggleParticipation({ required String crowdActionId, - List? commitmentOptions, + List? commitments, }) async { try { final user = (await authRepository.getSignedInUser()) @@ -82,7 +82,7 @@ class ParticipationRepository implements IParticipationRepository { uri, body: json.encode({ 'crowdActionId': crowdActionId, - 'commitmentOptions': commitmentOptions, + 'commitments': commitments, }), headers: { 'Content-Type': 'application/json', diff --git a/lib/presentation/crowdaction/crowdaction_details/crowdaction_details_screen.dart b/lib/presentation/crowdaction/crowdaction_details/crowdaction_details_screen.dart index d1da17dd..0cc56950 100644 --- a/lib/presentation/crowdaction/crowdaction_details/crowdaction_details_screen.dart +++ b/lib/presentation/crowdaction/crowdaction_details/crowdaction_details_screen.dart @@ -36,7 +36,7 @@ class CrowdActionDetailsPage extends StatefulWidget { } class CrowdActionDetailsPageState extends State { - final List selectedCommitments = []; + final List selectedCommitments = []; CrowdAction? crowdAction; late final ParticipationBloc participationBloc; late Function(BuildContext) participate; @@ -86,10 +86,9 @@ class CrowdActionDetailsPageState extends State { participating: (p) { setState(() { selectedCommitments.clear(); - for (final id in p.commitmentOptions) { + for (final id in p.commitments) { selectedCommitments.add( - crowdAction!.commitmentOptions - .firstWhere((c) => c.id == id), + crowdAction!.commitments.firstWhere((c) => c.id == id), ); } }); @@ -231,7 +230,7 @@ class CrowdActionDetailsPageState extends State { ), CommitmentCardList( isEnded: crowdAction?.isClosed ?? true, - commitmentOptions: crowdAction?.commitmentOptions, + commitments: crowdAction?.commitments, selectedCommitments: selectedCommitments, ), diff --git a/lib/presentation/crowdaction/crowdaction_details/widgets/confirm_participation.dart b/lib/presentation/crowdaction/crowdaction_details/widgets/confirm_participation.dart index 38b39bfa..d6cbf014 100644 --- a/lib/presentation/crowdaction/crowdaction_details/widgets/confirm_participation.dart +++ b/lib/presentation/crowdaction/crowdaction_details/widgets/confirm_participation.dart @@ -10,7 +10,7 @@ import '../../../themes/constants.dart'; class ConfirmParticipation extends StatelessWidget { final CrowdAction crowdAction; - final List selectedCommitments; + final List selectedCommitments; const ConfirmParticipation({ super.key, @@ -116,7 +116,7 @@ class ParticipationSuccess extends StatelessWidget { class ParticipationDialog extends StatelessWidget { final CrowdAction crowdAction; - final List selectedCommitments; + final List selectedCommitments; final bool isLoading; const ParticipationDialog({ @@ -213,8 +213,7 @@ class ParticipationDialog extends StatelessWidget { BlocProvider.of(context).add( ParticipationEvent.toggleParticipation( crowdActionId: crowdAction.id, - commitmentOptions: - selectedCommitments.map((c) => c.id).toList(), + commitments: selectedCommitments.map((c) => c.id).toList(), ), ); }, diff --git a/lib/presentation/demo/components_demo/components_demo_screen.dart b/lib/presentation/demo/components_demo/components_demo_screen.dart index 965b3899..c89d83b6 100644 --- a/lib/presentation/demo/components_demo/components_demo_screen.dart +++ b/lib/presentation/demo/components_demo/components_demo_screen.dart @@ -50,7 +50,6 @@ class ComponentsDemoPageState extends State { CrowdActionCard( crowdAction: CrowdAction( id: "", - type: "", title: "This is the headline for a crowdaction with three lines", images: const Images( @@ -59,18 +58,16 @@ class ComponentsDemoPageState extends State { ), category: "Sustainability", subcategory: "Community", - commitmentOptions: [ - CommitmentOption( + commitments: [ + Commitment( id: "", - type: "food", label: "no-beef", description: "Don't eat beef for 30 days!", points: 0, blocks: [], ), - CommitmentOption( + Commitment( id: "", - type: "food", label: "vegetarian", description: "Don't eat meat for 30 days!", points: 0, @@ -92,7 +89,6 @@ class ComponentsDemoPageState extends State { CrowdActionCard( crowdAction: CrowdAction( id: "", - type: "", title: "This is the headline for a crowdaction with three lines", images: const Images( @@ -101,18 +97,16 @@ class ComponentsDemoPageState extends State { ), category: "Sustainability", subcategory: "Community", - commitmentOptions: [ - CommitmentOption( + commitments: [ + Commitment( id: "", - type: "food", label: "no-beef", description: "Don't eat beef for 30 days!", points: 0, blocks: [], ), - CommitmentOption( + Commitment( id: "", - type: "food", label: "vegetarian", description: "Don't eat meat for 30 days!", points: 0, diff --git a/lib/presentation/profile/widget/commitments_tab.dart b/lib/presentation/profile/widget/commitments_tab.dart index bebbaa24..39eb9ced 100644 --- a/lib/presentation/profile/widget/commitments_tab.dart +++ b/lib/presentation/profile/widget/commitments_tab.dart @@ -59,7 +59,7 @@ class CommitmentsTab extends StatelessWidget { fontWeight: FontWeight.w500, ), ), - ...crowdAction.commitmentOptions.map( + ...crowdAction.commitments.map( (co) => CommitmentCard( commitment: co, viewOnly: true, diff --git a/lib/presentation/shared_widgets/commitment_card.dart b/lib/presentation/shared_widgets/commitment_card.dart index 30eae687..7a1d4941 100644 --- a/lib/presentation/shared_widgets/commitment_card.dart +++ b/lib/presentation/shared_widgets/commitment_card.dart @@ -80,9 +80,6 @@ class _CommitmentCardState extends State<_CommitmentCard> { @override Widget build(BuildContext context) { - print( - 'Commitment: ${widget.commitment.title} - Icon: ${widget.commitment.icon}'); - final textTheme = Theme.of(context).textTheme; return GestureDetector( onTap: () { diff --git a/lib/presentation/shared_widgets/commitments/commitment_card.dart b/lib/presentation/shared_widgets/commitments/commitment_card.dart index d1923f87..f3bf6376 100644 --- a/lib/presentation/shared_widgets/commitments/commitment_card.dart +++ b/lib/presentation/shared_widgets/commitments/commitment_card.dart @@ -10,9 +10,9 @@ import '../../themes/constants.dart'; /// [onSelected] Callback function for when the card is selected, /// returns the id of the selected commitment class CommitmentCard extends StatelessWidget { - final CommitmentOption commitment; - final Function(CommitmentOption)? onSelected; - final Function(CommitmentOption)? onDeSelected; + final Commitment commitment; + final Function(Commitment)? onSelected; + final Function(Commitment)? onDeSelected; final bool active; final bool deactivated; final bool viewOnly; diff --git a/lib/presentation/shared_widgets/commitments/commitment_card_list.dart b/lib/presentation/shared_widgets/commitments/commitment_card_list.dart index f74db7fb..606901ad 100644 --- a/lib/presentation/shared_widgets/commitments/commitment_card_list.dart +++ b/lib/presentation/shared_widgets/commitments/commitment_card_list.dart @@ -8,14 +8,14 @@ import 'commitment_card.dart'; class CommitmentCardList extends StatefulWidget { final bool isEnded; - final List? commitmentOptions; - final List selectedCommitments; + final List? commitments; + final List selectedCommitments; /// Widget for easily creating a list of CommitmentCard(s) const CommitmentCardList({ super.key, this.isEnded = false, - required this.commitmentOptions, + required this.commitments, required this.selectedCommitments, }); @@ -28,7 +28,7 @@ class _CommitmentCardListState extends State { Widget build(BuildContext context) { return BlocBuilder( builder: (context, state) { - if (widget.commitmentOptions == null) { + if (widget.commitments == null) { return ListView( shrinkWrap: true, padding: const EdgeInsets.symmetric(horizontal: 20), @@ -51,7 +51,7 @@ class _CommitmentCardListState extends State { padding: const EdgeInsets.symmetric(horizontal: 20), physics: const BouncingScrollPhysics(), itemBuilder: (ctx, index) { - final option = widget.commitmentOptions![index]; + final option = widget.commitments![index]; return CommitmentCard( key: Key(option.id), commitment: option, @@ -62,14 +62,14 @@ class _CommitmentCardListState extends State { viewOnly: widget.isEnded, ); }, - itemCount: widget.commitmentOptions!.length, + itemCount: widget.commitments!.length, shrinkWrap: true, ); }, ); } - void selectCommitment(CommitmentOption commitment) { + void selectCommitment(Commitment commitment) { setState(() { widget.selectedCommitments.add(commitment); for (final id in commitment.blocks) { @@ -78,13 +78,13 @@ class _CommitmentCardListState extends State { }); } - void deselectCommitment(CommitmentOption commitment) { + void deselectCommitment(Commitment commitment) { setState(() { widget.selectedCommitments.removeWhere((c) => c.id == commitment.id); }); } - bool isBlocked(CommitmentOption commitment) { + bool isBlocked(Commitment commitment) { return widget.selectedCommitments .any((c) => c.blocks.contains(commitment.id)); } diff --git a/pubspec.lock b/pubspec.lock index bbb6d5a5..1767e4ce 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,10 +13,10 @@ packages: dependency: transitive description: name: _flutterfire_internals - sha256: "3ff770dfff04a67b0863dff205a0936784de1b87a5e99b11c693fc10e66a9ce3" + sha256: "64fcb0dbca4386356386c085142fa6e79c00a3326ceaa778a2d25f5d9ba61441" url: "https://pub.dev" source: hosted - version: "1.0.12" + version: "1.0.16" adaptive_number: dependency: transitive description: @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: args - sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611" + sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.0" async: dependency: transitive description: @@ -117,10 +117,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "6bc5544ea6ce4428266e7ea680e945c68806c4aae2da0eb5e9ccf38df8d6acbf" + sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.1" build_resolvers: dependency: transitive description: @@ -133,10 +133,10 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: b0a8a7b8a76c493e85f1b84bffa0588859a06197863dba8c9036b15581fd9727 + sha256: "93f05c041932674be039b0a2323d6cf57e5f2bbf884a3c0382f9e53fc45ebace" url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "2.3.0" build_runner_core: dependency: transitive description: @@ -413,10 +413,10 @@ packages: dependency: transitive description: name: firebase_auth_platform_interface - sha256: "325d934e21826b3e7030f5018ef61927e2083b4c4fb25218ddef6ffc0012b717" + sha256: c645fec50b0391aa878288f58fa4fe9762c271380c457aedf5c7c9b718604f68 url: "https://pub.dev" source: hosted - version: "6.11.7" + version: "6.11.11" firebase_auth_web: dependency: transitive description: @@ -429,50 +429,50 @@ packages: dependency: "direct main" description: name: firebase_core - sha256: c129209ba55f3d4272c89fb4a4994c15bea77fb6de63a82d45fb6bc5c94e4355 + sha256: fe30ac230f12f8836bb97e6e09197340d3c584526825b1746ea362a82e1e43f7 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.7.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface - sha256: "5fab93f5b354648efa62e7cc829c90efb68c8796eecf87e0888cae2d5f3accd4" + sha256: "5615b30c36f55b2777d0533771deda7e5730e769e5d3cb7fda79e9bed86cfa55" url: "https://pub.dev" source: hosted - version: "4.5.2" + version: "4.5.3" firebase_core_web: dependency: transitive description: name: firebase_core_web - sha256: "18b35ce111b0a4266abf723c825bcf9d4e2519d13638cc7f06f2a8dd960c75bc" + sha256: "291fbcace608aca6c860652e1358ef89752be8cc3ef227f8bbcd1e62775b833a" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.2.1" firebase_crashlytics: dependency: "direct main" description: name: firebase_crashlytics - sha256: "9a73325afa984d2f6599a96b4b076f27a4e571172eb0056151522e3daace43ce" + sha256: "816bbb920316c8fe257b460b8856b01e274e867a729961bf7a3be6322cdf13e1" url: "https://pub.dev" source: hosted - version: "3.0.11" + version: "3.0.15" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface - sha256: bccde26b6d63447c4f1f3d0ae5d78c958eb7bcef48239eb3aa8844675684c055 + sha256: "120e47b9bac3654848d1bdc60b8027f3574b53ee0b81b1a2e5e76ddaa58f6645" url: "https://pub.dev" source: hosted - version: "3.3.11" + version: "3.3.15" fixnum: dependency: transitive description: name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + sha256: "04be3e934c52e082558cc9ee21f42f5c1cd7a1262f4c63cd0357c08d5bba81ec" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.0.1" flutter: dependency: "direct main" description: flutter @@ -538,10 +538,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "60fc7b78455b94e6de2333d2f95196d32cf5c22f4b0b0520a628804cb463503b" + sha256: "4bef634684b2c7f3468c77c766c831229af829a0cd2d4ee6c1b99558bd14e5d2" url: "https://pub.dev" source: hosted - version: "2.0.7" + version: "2.0.8" flutter_test: dependency: "direct dev" description: flutter @@ -572,10 +572,10 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + sha256: "4f4a162323c86ffc1245765cfe138872b8f069deb42f7dbb36115fa27f31469b" url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "2.1.3" get_it: dependency: "direct main" description: @@ -668,42 +668,42 @@ packages: dependency: "direct main" description: name: image_picker - sha256: f98d76672d309c8b7030c323b3394669e122d52b307d2bbd8d06bd70f5b2aabe + sha256: "22207768556b82d55ec70166824350fee32298732d5efa4d6e756f848f51f66a" url: "https://pub.dev" source: hosted - version: "0.8.6+1" + version: "0.8.6+3" image_picker_android: dependency: transitive description: name: image_picker_android - sha256: b1cbfec0f5aef427a18eb573f5445af8c9c568626bf3388553e40c263d3f7368 + sha256: "68d067baf7f6e401b1124ee83dd6967e67847314250fd68012aab34a69beb344" url: "https://pub.dev" source: hosted - version: "0.8.5+5" + version: "0.8.5+7" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - sha256: "7d319fb74955ca46d9bf7011497860e3923bb67feebcf068f489311065863899" + sha256: "66fc6e3877bbde82c33d122f3588777c3784ac5bd7d1cdd79213ef7aecb85b34" url: "https://pub.dev" source: hosted - version: "2.1.10" + version: "2.1.11" image_picker_ios: dependency: transitive description: name: image_picker_ios - sha256: "8ffb14b43713d7c43fb21299cc18181cc5b39bd3ea1cc427a085c6400fe5aa52" + sha256: "39aa70b5f1e5e7c94585b9738632d5fdb764a5655e40cd9e7b95fbd2fc50c519" url: "https://pub.dev" source: hosted - version: "0.8.6+7" + version: "0.8.6+9" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface - sha256: "7cef2f28f4f2fef99180f636c3d446b4ccbafd6ba0fad2adc9a80c4040f656b8" + sha256: "1991219d9dbc42a99aff77e663af8ca51ced592cd6685c9485e3458302d3d4f8" url: "https://pub.dev" source: hosted - version: "2.6.2" + version: "2.6.3" infinite_scroll_pagination: dependency: "direct main" description: @@ -724,10 +724,10 @@ packages: dependency: "direct dev" description: name: injectable_generator - sha256: "9a3bbd2c3ba821e31ef6cea3fc535c17e3a25c74e173b6cefa05f466c8338bc8" + sha256: b206de637c1960007b0beebe447a6ee3cf30c9e5f14542083024a9d0c49a7a09 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" intl: dependency: "direct main" description: @@ -884,10 +884,10 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: f619162573096d428ccde2e33f92e05b5a179cd6f0e3120c1005f181bee8ed16 + sha256: "8df5ab0a481d7dc20c0e63809e90a588e496d276ba53358afc4c4443d0a00697" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" package_info_plus_platform_interface: dependency: transitive description: @@ -908,50 +908,50 @@ packages: dependency: transitive description: name: path_provider - sha256: dcea5feb97d8abf90cab9e9030b497fb7c3cbf26b7a1fe9e3ef7dcb0a1ddec95 + sha256: "04890b994ee89bfa80bf3080bfec40d5a92c5c7a785ebb02c13084a099d2b6f9" url: "https://pub.dev" source: hosted - version: "2.0.12" + version: "2.0.13" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: a776c088d671b27f6e3aa8881d64b87b3e80201c64e8869b811325de7a76c15e + sha256: "7623b7d4be0f0f7d9a8b5ee6879fc13e4522d4c875ab86801dee4af32b54b83e" url: "https://pub.dev" source: hosted - version: "2.0.22" + version: "2.0.23" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "62a68e7e1c6c459f9289859e2fae58290c981ce21d1697faf54910fe1faa4c74" + sha256: eec003594f19fe2456ea965ae36b3fc967bc5005f508890aafe31fa75e41d972 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_linux: dependency: transitive description: name: path_provider_linux - sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379 + sha256: "525ad5e07622d19447ad740b1ed5070031f7a5437f44355ae915ff56e986429a" url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.1.9" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76 + sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "2.0.6" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c + sha256: "642ddf65fde5404f83267e8459ddb4556316d3ee6d511ed193357e25caa3632d" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" pedantic: dependency: transitive description: @@ -988,10 +988,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" pointycastle: dependency: transitive description: @@ -1052,10 +1052,10 @@ packages: dependency: "direct main" description: name: rive - sha256: c4293ea52f9bf45edeebad3b1eb0bddc284bd11f14ede54780bf5efa1c491b4a + sha256: "21b9364d578d3f55f36e18da0235f58adf26edc328505e9bac1824f1bb297f33" url: "https://pub.dev" source: hosted - version: "0.10.1" + version: "0.10.2" rive_common: dependency: transitive description: @@ -1076,10 +1076,10 @@ packages: dependency: "direct main" description: name: share_plus - sha256: e387077716f80609bb979cd199331033326033ecd1c8f200a90c5f57b1c9f55e + sha256: "8c6892037b1824e2d7e8f59d54b3105932899008642e6372e5079c6939b4b625" url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.3.1" share_plus_platform_interface: dependency: transitive description: @@ -1092,58 +1092,58 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: "5949029e70abe87f75cfe59d17bf5c397619c4b74a099b10116baeb34786fad9" + sha256: ee6257848f822b8481691f20c3e6d2bfee2e9eccb2a3d249907fcfb198c55b41 url: "https://pub.dev" source: hosted - version: "2.0.17" + version: "2.0.18" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "955e9736a12ba776bdd261cf030232b30eadfcd9c79b32a3250dd4a494e8c8f7" + sha256: a51a4f9375097f94df1c6e0a49c0374440d31ab026b59d58a7e7660675879db4 url: "https://pub.dev" source: hosted - version: "2.0.15" + version: "2.0.16" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "2b55c18636a4edc529fa5cd44c03d3f3100c00513f518c5127c951978efcccd0" + sha256: "6b84fdf06b32bb336f972d373cd38b63734f3461ba56ac2ba01b56d052796259" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: f8ea038aa6da37090093974ebdcf4397010605fd2ff65c37a66f9d28394cb874 + sha256: d7fb71e6e20cd3dfffcc823a28da3539b392e53ed5fc5c2b90b55fdaa8a7e8fa url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: da9431745ede5ece47bc26d5d73a9d3c6936ef6945c101a5aca46f62e52c1cf3 + sha256: "824bfd02713e37603b2bdade0842e47d56e7db32b1dcdd1cae533fb88e2913fc" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: a4b5bc37fe1b368bbc81f953197d55e12f49d0296e7e412dfe2d2d77d6929958 + sha256: "6737b757e49ba93de2a233df229d0b6a87728cea1684da828cbc718b65dcf9d7" url: "https://pub.dev" source: hosted - version: "2.0.4" + version: "2.0.5" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "5eaf05ae77658d3521d0e993ede1af962d4b326cd2153d312df716dc250f00c9" + sha256: bd014168e8484837c39ef21065b78f305810ceabc1d4f90be6e3b392ce81b46d url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" shelf: dependency: transitive description: @@ -1225,10 +1225,10 @@ packages: dependency: transitive description: name: source_maps - sha256: "490098075234dcedb83c5d949b4c93dad5e6b7702748de000be2b57b8e6b2427" + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" url: "https://pub.dev" source: hosted - version: "0.10.11" + version: "0.10.12" source_span: dependency: transitive description: @@ -1241,10 +1241,10 @@ packages: dependency: transitive description: name: sqflite - sha256: "78324387dc81df14f78df06019175a86a2ee0437624166c382e145d0a7fd9a4f" + sha256: "851d5040552cf911f4cabda08d003eca76b27da3ed0002978272e27c8fbf8ecc" url: "https://pub.dev" source: hosted - version: "2.2.4+1" + version: "2.2.5" sqflite_common: dependency: transitive description: @@ -1345,66 +1345,66 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: e8f2efc804810c0f2f5b485f49e7942179f56eabcfe81dce3387fec4bb55876b + sha256: "75f2846facd11168d007529d6cd8fcb2b750186bea046af9711f10b907e1587e" url: "https://pub.dev" source: hosted - version: "6.1.9" + version: "6.1.10" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "3e2f6dfd2c7d9cd123296cab8ef66cfc2c1a13f5845f42c7a0f365690a8a7dd1" + sha256: "1f4d9ebe86f333c15d318f81dcdc08b01d45da44af74552608455ebdc08d9732" url: "https://pub.dev" source: hosted - version: "6.0.23" + version: "6.0.24" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "0a5af0aefdd8cf820dd739886efb1637f1f24489900204f50984634c07a54815" + sha256: c9cd648d2f7ab56968e049d4e9116f96a85517f1dd806b96a86ea1018a3a82e5 url: "https://pub.dev" source: hosted - version: "6.1.0" + version: "6.1.1" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "318c42cba924e18180c029be69caf0a1a710191b9ec49bb42b5998fdcccee3cc" + sha256: e29039160ab3730e42f3d811dc2a6d5f2864b90a70fb765ea60144b03307f682 url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: "41988b55570df53b3dd2a7fc90c76756a963de6a8c5f8e113330cb35992e2094" + sha256: "2dddb3291a57b074dade66b5e07e64401dd2487caefd4e9e2f467138d8c7eb06" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6" + sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "44d79408ce9f07052095ef1f9a693c258d6373dc3944249374e30eff7219ccb0" + sha256: "574cfbe2390666003c3a1d129bdc4574aaa6728f0c00a4829a81c316de69dd9b" url: "https://pub.dev" source: hosted - version: "2.0.14" + version: "2.0.15" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: b6217370f8eb1fd85c8890c539f5a639a01ab209a36db82c921ebeacefc7a615 + sha256: "97c9067950a0d09cbd93e2e3f0383d1403989362b97102fbf446473a48079a4b" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.4" uuid: dependency: transitive description: @@ -1457,34 +1457,34 @@ packages: dependency: "direct main" description: name: webview_flutter - sha256: f7ec234830f86d0ef2bd664e8460b0038b8c1a83ff076035cad74ac70273753c + sha256: "9ba213434f13e760ea0f175fbc4d6bb6aeafd7dfc6c7d973f15d3e47a5d6686e" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.5" webview_flutter_android: dependency: transitive description: name: webview_flutter_android - sha256: "5f49a6e5fc59e21fcec5e1bbcd401afbee9792a24a4f3d9cef9b5bb0cd1e3767" + sha256: "48c8cfb023168473c0a3a4c21ffea6c23a32cc7156701c39f618b303c6a3c96e" url: "https://pub.dev" source: hosted - version: "3.2.4" + version: "3.3.1" webview_flutter_platform_interface: dependency: transitive description: name: webview_flutter_platform_interface - sha256: "8b2262dda5d26eabc600a7282a8c16a9473a0c765526afb0ffc33eef912f7968" + sha256: df6472164b3f4eaf3280422227f361dc8424b106726b7f21d79a8656ba53f71f url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.0.2" webview_flutter_wkwebview: dependency: transitive description: name: webview_flutter_wkwebview - sha256: "92e7e7fa468f1df597fb9d37bcf1f303175cbe147c4dbdf06ecc323d950116eb" + sha256: "283a38c2a2544768033864c698e0133aa9eee0f2c800f494b538a3d1044f7ecb" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.1.1" widgetbook: dependency: "direct dev" description: @@ -1529,18 +1529,18 @@ packages: dependency: transitive description: name: xdg_directories - sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86 + sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 url: "https://pub.dev" source: hosted - version: "0.2.0+3" + version: "1.0.0" xml: dependency: transitive description: name: xml - sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5" + sha256: ac0e3f4bf00ba2708c33fbabbbe766300e509f8c82dbd4ab6525039813f7e2fb url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.1.0" yaml: dependency: transitive description: @@ -1550,5 +1550,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.19.0 <3.0.0" + dart: ">=2.18.6 <3.0.0" flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 9d472b2e..f9bced27 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,16 +5,6 @@ description: The CollAction app # pub.dev using `pub publish`. This is preferred for private packages. publish_to: "none" -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.2.0+1 environment: diff --git a/test/domain/crowdaction/crowdaction_test_fixtures.dart b/test/domain/crowdaction/crowdaction_test_fixtures.dart index bfe38eb8..52005f04 100644 --- a/test/domain/crowdaction/crowdaction_test_fixtures.dart +++ b/test/domain/crowdaction/crowdaction_test_fixtures.dart @@ -2,7 +2,7 @@ import 'package:collaction_app/domain/crowdaction/crowdaction.dart'; import '../../test_utilities.dart'; -final List tListCommitmentOptions = [tCommitmentOption]; +final List tListCommitments = [tCommitment]; const Images tImage = Images(card: 'tCard', banner: 'tBanner'); @@ -16,12 +16,11 @@ CrowdAction generateDummyCrowdaction({ }) { return CrowdAction( id: 'tID', - type: 'tType', title: 'tTitle', description: 'tDescription', category: 'tCategory', location: tLocation, - commitmentOptions: tListCommitmentOptions, + commitments: tListCommitments, endAt: endDate ?? DateTime(2022, 1, 31), images: tImage, participantCount: participantCnt, diff --git a/test/infrastructure/crowdaction/commitment_option_dto_fixtures.dart b/test/infrastructure/crowdaction/commitment_option_dto_fixtures.dart index 06b85038..97195ccf 100644 --- a/test/infrastructure/crowdaction/commitment_option_dto_fixtures.dart +++ b/test/infrastructure/crowdaction/commitment_option_dto_fixtures.dart @@ -1,9 +1,8 @@ import 'package:collaction_app/infrastructure/crowdaction/crowdaction_dto.dart'; import 'package:collaction_app/domain/crowdaction/crowdaction.dart'; -final tCommitmentOption = CommitmentOption( +final tCommitment = Commitment( id: 'id', - type: 'type', label: 'label', points: 0, blocks: ['blocks'], @@ -11,9 +10,8 @@ final tCommitmentOption = CommitmentOption( iconId: 'iconId', ); -final tCommitmentOptionDto = CommitmentOptionDto( +final tCommitmentDto = CommitmentDto( id: 'id', - type: 'type', label: 'label', points: 0, blocks: ['blocks'], @@ -21,9 +19,8 @@ final tCommitmentOptionDto = CommitmentOptionDto( icon: 'iconId', ); -final tCommitmentOptionJson = { - 'id': 'id', - 'type': 'type', +final tCommitmentJson = { + '_id': 'id', 'label': 'label', 'points': 0, 'blocks': ['blocks'], diff --git a/test/infrastructure/crowdaction/commitment_option_dto_test.dart b/test/infrastructure/crowdaction/commitment_option_dto_test.dart index 5a34c917..87f955ed 100644 --- a/test/infrastructure/crowdaction/commitment_option_dto_test.dart +++ b/test/infrastructure/crowdaction/commitment_option_dto_test.dart @@ -3,17 +3,17 @@ import 'package:collaction_app/infrastructure/crowdaction/crowdaction_dto.dart'; import 'commitment_option_dto_fixtures.dart'; void main() { - group('unit tests for CommitmentOptionDto', () { + group('unit tests for CommitmentDto', () { test('toDomain() test', () { - final commitmentOption = tCommitmentOptionDto.toDomain(); + final commitment = tCommitmentDto.toDomain(); - expect(commitmentOption, tCommitmentOption); + expect(commitment, tCommitment); }); + test('fromJson() test', () { - final commitmentOptionDto = - CommitmentOptionDto.fromJson(tCommitmentOptionJson); + final commitmentDto = CommitmentDto.fromJson(tCommitmentJson); - expect(commitmentOptionDto, tCommitmentOptionDto); + expect(commitmentDto, tCommitmentDto); }); }); } diff --git a/test/infrastructure/crowdaction/crowdaction_dto_fixtures.dart b/test/infrastructure/crowdaction/crowdaction_dto_fixtures.dart index d289ecdf..ffc4d00e 100644 --- a/test/infrastructure/crowdaction/crowdaction_dto_fixtures.dart +++ b/test/infrastructure/crowdaction/crowdaction_dto_fixtures.dart @@ -7,7 +7,7 @@ final crowdActionDto = CrowdActionDto( description: 'crowdaction-description', category: 'crowdaction-category', location: LocationDto(code: 'NL', name: 'Netherlands'), - commitmentOptions: [], + commitments: [], images: ImagesDto(card: 'crowdaction-card', banner: 'crowdaction-banner'), participantCount: 0, status: Status.waiting, @@ -15,12 +15,10 @@ final crowdActionDto = CrowdActionDto( endAt: '2024-01-01T00:00:00.000+00:00', password: 'crowdaction-password', subcategory: 'crowdaction-subcategory', - type: 'crowdaction-type', ); final crowdActionDomain = CrowdAction( id: 'crowdaction-id', - type: 'crowdaction-type', title: 'crowdaction-title', description: 'crowdaction-description', category: 'crowdaction-category', @@ -32,7 +30,7 @@ final crowdActionDomain = CrowdAction( status: Status.waiting, joinStatus: JoinStatus.open, endAt: DateTime.parse("2024-01-01T00:00:00.000+00:00"), - commitmentOptions: [], + commitments: [], ); final crowdActionJson = { @@ -49,5 +47,5 @@ final crowdActionJson = { "status": "WAITING", "joinStatus": "OPEN", "endAt": "2024-01-01T00:00:00.000+00:00", - "commitmentOptions": [], + "commitments": [], }; diff --git a/test/infrastructure/crowdaction/crowdaction_repository_fixtures.dart b/test/infrastructure/crowdaction/crowdaction_repository_fixtures.dart index 5e417623..75e8cca0 100644 --- a/test/infrastructure/crowdaction/crowdaction_repository_fixtures.dart +++ b/test/infrastructure/crowdaction/crowdaction_repository_fixtures.dart @@ -1,6 +1,5 @@ final crowdActionRaw = """{ "id": "12345678", - "type": "TYPE", "title": "Veganuary", "description": "description...", "category": "CATEGORY", @@ -8,10 +7,9 @@ final crowdActionRaw = """{ "code": "NL", "name": "Netherlands" }, - "commitmentOptions": [ + "commitments": [ { - "id": "12345678", - "type": "TYPE", + "_id": "12345678", "label": "label", "points": 50, "blocks": [ @@ -20,8 +18,7 @@ final crowdActionRaw = """{ "description": "description..." }, { - "id": "123456789", - "type": "TYPE", + "_id": "123456789", "label": "label", "points": 50, "blocks": [], @@ -49,7 +46,6 @@ final crowdActionsRaw = """{ "items": [ { "id": "123456789", - "type": "TYPE", "title": "Veganuary", "description": "description...", "category": "CATEGORY", @@ -57,10 +53,9 @@ final crowdActionsRaw = """{ "code": "NL", "name": "Netherlands" }, - "commitmentOptions": [ + "commitments": [ { - "id": "12345678", - "type": "TYPE", + "_id": "12345678", "label": "label", "points": 50, "blocks": [ @@ -69,8 +64,7 @@ final crowdActionsRaw = """{ "description": "description..." }, { - "id": "123456789", - "type": "TYPE", + "_id": "123456789", "label": "label", "points": 50, "blocks": [], @@ -89,7 +83,6 @@ final crowdActionsRaw = """{ }, { "id": "123456789", - "type": "TYPE", "title": "Veganuary", "description": "description...", "category": "CATEGORY", @@ -97,10 +90,9 @@ final crowdActionsRaw = """{ "code": "NL", "name": "Netherlands" }, - "commitmentOptions": [ + "commitments": [ { - "id": "12345678", - "type": "TYPE", + "_id": "12345678", "label": "label", "points": 50, "blocks": [ @@ -109,8 +101,7 @@ final crowdActionsRaw = """{ "description": "description..." }, { - "id": "123456789", - "type": "TYPE", + "_id": "123456789", "label": "label", "points": 50, "blocks": [], diff --git a/test/infrastructure/participation/participation_dto_fixtures.dart b/test/infrastructure/participation/participation_dto_fixtures.dart index 04d7a2a3..4a4ea752 100644 --- a/test/infrastructure/participation/participation_dto_fixtures.dart +++ b/test/infrastructure/participation/participation_dto_fixtures.dart @@ -7,7 +7,7 @@ final tParticipation = Participation( fullName: 'fullName', avatar: 'avatar', userId: 'userId', - commitmentOptions: ['commitmentOptions'], + commitments: ['commitments'], joinDate: DateTime.parse('20221120'), dailyCheckIns: 0, ); @@ -18,7 +18,7 @@ final tParticipationDto = ParticipationDto( fullName: 'fullName', avatar: 'avatar', userId: 'userId', - commitmentOptions: ['commitmentOptions'], + commitments: ['commitments'], joinDate: '20221120', dailyCheckIns: 0, ); @@ -29,7 +29,7 @@ const tParticipationJson = { 'fullName': 'fullName', 'avatar': 'avatar', 'userId': 'userId', - 'commitmentOptions': ['commitmentOptions'], + 'commitments': ['commitments'], 'joinDate': '20221120', 'dailyCheckIns': 0, }; diff --git a/test/infrastructure/participation/participation_repository_fixtures.dart b/test/infrastructure/participation/participation_repository_fixtures.dart index a1e56ee7..fa47e711 100644 --- a/test/infrastructure/participation/participation_repository_fixtures.dart +++ b/test/infrastructure/participation/participation_repository_fixtures.dart @@ -4,7 +4,7 @@ final participationRaw = """{ "fullName": "John Doe", "avatar": "/avatar/123456.png", "userId": "1234-1234-1234-1234", - "commitmentOptions": ["1234"], + "commitments": ["1234"], "joinDate": "2024-01-01T00:00:00.000+00:00", "dailyCheckIns": 10 }"""; @@ -23,7 +23,7 @@ final participationsRaw = """{ "fullName": "John Doe", "avatar": "/avatar/123456.png", "userId": "1234-1234-1234-1234", - "commitmentOptions": ["1234"], + "commitments": ["1234"], "joinDate": "2024-01-01T00:00:00.000+00:00", "dailyCheckIns": 10 }, @@ -33,7 +33,7 @@ final participationsRaw = """{ "fullName": "John Doe", "avatar": "/avatar/123456.png", "userId": "1234-1234-1234-1234", - "commitmentOptions": ["1234"], + "commitments": ["1234"], "joinDate": "2024-01-01T00:00:00.000+00:00", "dailyCheckIns": 10 } diff --git a/test/presentation/crowdaction/crowdaction_details/confirm_participation_test.dart b/test/presentation/crowdaction/crowdaction_details/confirm_participation_test.dart index 168d6202..fc1e4820 100644 --- a/test/presentation/crowdaction/crowdaction_details/confirm_participation_test.dart +++ b/test/presentation/crowdaction/crowdaction_details/confirm_participation_test.dart @@ -88,7 +88,7 @@ void main() { stackRouter, participationBloc, tCrowdaction, - [tCommitmentOption], + [tCommitment], ); await tester.pumpAndSettle(); @@ -111,7 +111,7 @@ void main() { stackRouter, participationBloc, tCrowdaction, - List.filled(3, tCommitmentOption), + List.filled(3, tCommitment), ); await tester.pumpAndSettle(); @@ -128,7 +128,7 @@ void main() { testWidgets( 'on Confirm, adds toggleParticipation event to Participation Bloc', (WidgetTester tester) async { - final selectedCommitments = List.filled(3, tCommitmentOption); + final selectedCommitments = List.filled(3, tCommitment); await tester.pumpConfirmParticipation( stackRouter, @@ -142,7 +142,7 @@ void main() { () => participationBloc.add( ParticipationEvent.toggleParticipation( crowdActionId: tCrowdaction.id, - commitmentOptions: selectedCommitments.map((c) => c.id).toList(), + commitments: selectedCommitments.map((c) => c.id).toList(), ), ), ); diff --git a/test/presentation/crowdaction/crowdaction_details/confirm_participation_test.ext.dart b/test/presentation/crowdaction/crowdaction_details/confirm_participation_test.ext.dart index f8584292..45ea656f 100644 --- a/test/presentation/crowdaction/crowdaction_details/confirm_participation_test.ext.dart +++ b/test/presentation/crowdaction/crowdaction_details/confirm_participation_test.ext.dart @@ -5,7 +5,7 @@ extension WidgetX on WidgetTester { StackRouter stackRouter, ParticipationBloc participationBloc, CrowdAction crowdAction, - List selectedCommitments) async { + List selectedCommitments) async { await pumpWidget( BlocProvider( create: (_) => participationBloc, diff --git a/test/presentation/profile/commitments_tab_fixtures.dart b/test/presentation/profile/commitments_tab_fixtures.dart index 499df5c2..3c22518c 100644 --- a/test/presentation/profile/commitments_tab_fixtures.dart +++ b/test/presentation/profile/commitments_tab_fixtures.dart @@ -8,15 +8,13 @@ final user = User( final crowdAction = CrowdAction( id: 'id', - type: 'type', title: 'title', description: 'description', category: 'category', location: Location(code: 'NL', name: 'The Netherlands'), - commitmentOptions: [ - CommitmentOption( + commitments: [ + Commitment( id: 'id', - type: 'type', label: 'label', points: 10, blocks: [], diff --git a/test/presentation/shared_widgets/commitment_card_fixtures.dart b/test/presentation/shared_widgets/commitment_card_fixtures.dart index 2530ccc8..e83b1933 100644 --- a/test/presentation/shared_widgets/commitment_card_fixtures.dart +++ b/test/presentation/shared_widgets/commitment_card_fixtures.dart @@ -1,8 +1,7 @@ import 'package:collaction_app/domain/crowdaction/crowdaction.dart'; -final commitmentOption = CommitmentOption( +final commitment = Commitment( id: 'id', - type: 'type', description: 'description', label: 'label', points: 10, diff --git a/test/presentation/shared_widgets/commitment_card_list_test.dart b/test/presentation/shared_widgets/commitment_card_list_test.dart index 393ccd72..7d29494c 100644 --- a/test/presentation/shared_widgets/commitment_card_list_test.dart +++ b/test/presentation/shared_widgets/commitment_card_list_test.dart @@ -31,7 +31,7 @@ void main() { }); group('CommitmentCardList tests:', () { - testWidgets('can render with commitmentOptions = null', + testWidgets('can render with commitments = null', (WidgetTester tester) async { await tester.pumpCommitmentCardList(false, null, [], participationBloc); await tester.pump(); @@ -41,8 +41,7 @@ void main() { expect(find.byType(CommitmentCardShimmer), findsNWidgets(3)); }); - testWidgets('can render with 0 commitmentOptions', - (WidgetTester tester) async { + testWidgets('can render with 0 commitments', (WidgetTester tester) async { await tester.pumpCommitmentCardList(false, [], [], participationBloc); await tester.pumpAndSettle(); @@ -51,11 +50,10 @@ void main() { expect(find.byType(CommitmentCardShimmer), findsNothing); }); - testWidgets('can render with 1 commitmentOptions', - (WidgetTester tester) async { + testWidgets('can render with 1 commitments', (WidgetTester tester) async { await tester.pumpCommitmentCardList( false, - [tCommitmentOption], + [tCommitment], [], participationBloc, ); @@ -68,11 +66,10 @@ void main() { expect(find.byType(CommitmentCardShimmer), findsNothing); }); - testWidgets('can render with 5 commitmentOptions', - (WidgetTester tester) async { + testWidgets('can render with 5 commitments', (WidgetTester tester) async { await tester.pumpCommitmentCardList( false, - List.filled(5, tCommitmentOption), + List.filled(5, tCommitment), [], participationBloc, ); @@ -88,7 +85,7 @@ void main() { (WidgetTester tester) async { await tester.pumpCommitmentCardList( false, - [tCommitmentOption], + [tCommitment], [], participationBloc, ); @@ -118,7 +115,7 @@ void main() { testWidgets('blocking commitments', (WidgetTester tester) async { await tester.pumpCommitmentCardList( false, - [tCommitmentOption, tBlockingCommitmentOption], + [tCommitment, tBlockingCommitment], [], participationBloc, ); @@ -138,8 +135,8 @@ void main() { testWidgets('preselected commitments', (WidgetTester tester) async { await tester.pumpCommitmentCardList( false, - [tCommitmentOption], - [tCommitmentOption], + [tCommitment], + [tCommitment], participationBloc, ); await tester.pumpAndSettle(); @@ -156,8 +153,8 @@ void main() { testWidgets('commitment is over', (WidgetTester tester) async { await tester.pumpCommitmentCardList( true, - [tCommitmentOption], - [tCommitmentOption], + [tCommitment], + [tCommitment], participationBloc, ); await tester.pumpAndSettle(); @@ -178,7 +175,7 @@ void main() { await tester.pumpCommitmentCardList( true, - [tCommitmentOption], + [tCommitment], [], participationBloc, ); @@ -203,8 +200,8 @@ void main() { await tester.pumpCommitmentCardList( true, - [tCommitmentOption], - [tCommitmentOption], + [tCommitment], + [tCommitment], participationBloc, ); await tester.pumpAndSettle(); diff --git a/test/presentation/shared_widgets/commitment_card_list_test.ext.dart b/test/presentation/shared_widgets/commitment_card_list_test.ext.dart index 33175219..427bc5da 100644 --- a/test/presentation/shared_widgets/commitment_card_list_test.ext.dart +++ b/test/presentation/shared_widgets/commitment_card_list_test.ext.dart @@ -3,8 +3,8 @@ part of 'commitment_card_list_test.dart'; extension WidgetX on WidgetTester { Future pumpCommitmentCardList( bool isEnded, - List? commitmentOptions, - List selectedCommitments, + List? commitments, + List selectedCommitments, ParticipationBloc participationBloc, ) async { await pumpWidget( @@ -18,7 +18,7 @@ extension WidgetX on WidgetTester { home: Scaffold( body: CommitmentCardList( isEnded: isEnded, - commitmentOptions: commitmentOptions, + commitments: commitments, selectedCommitments: selectedCommitments, ), ), diff --git a/test/presentation/shared_widgets/commitment_card_test.dart b/test/presentation/shared_widgets/commitment_card_test.dart index 66032697..569a5d57 100644 --- a/test/presentation/shared_widgets/commitment_card_test.dart +++ b/test/presentation/shared_widgets/commitment_card_test.dart @@ -10,7 +10,7 @@ void main() { await buildAndPump( tester: tester, widget: CommitmentCard( - commitment: commitmentOption, + commitment: commitment, ), ); await tester.pumpAndSettle(); @@ -22,7 +22,7 @@ void main() { await buildAndPump( tester: tester, widget: CommitmentCard( - commitment: commitmentOption, + commitment: commitment, deactivated: true, ), ); @@ -40,7 +40,7 @@ void main() { onSelected: (_) => counter++, onDeSelected: (_) => counter--, active: false, - commitment: commitmentOption, + commitment: commitment, ), ); await tester.pumpAndSettle(); @@ -64,7 +64,7 @@ void main() { onSelected: (_) => counter++, onDeSelected: (_) => counter--, active: true, - commitment: commitmentOption, + commitment: commitment, ), ); await tester.pumpAndSettle(); @@ -83,7 +83,7 @@ void main() { await buildAndPump( tester: tester, widget: CommitmentCard( - commitment: commitmentOption, + commitment: commitment, viewOnly: true, ), ); diff --git a/test/test_utilities.dart b/test/test_utilities.dart index 73b88766..03305cd1 100644 --- a/test/test_utilities.dart +++ b/test/test_utilities.dart @@ -84,12 +84,11 @@ class TestUtilities { static CrowdAction crowdActionWithNParticipants(int participantCount) { return CrowdAction( id: 'tID', - type: '', title: 'tTitle', description: 'tDescription', category: 'tCategory', location: tLocation, - commitmentOptions: [tCommitmentOption], + commitments: [tCommitment], endAt: DateTime(2022, 1, 31), images: const Images(card: 'tCard', banner: 'tBanner'), participantCount: participantCount, @@ -110,12 +109,11 @@ BASE_STATIC_ENDPOINT_URL = http://collaction.org final tCrowdaction = CrowdAction( id: 'tID', - type: '', title: 'tTitle', description: 'tDescription', category: 'tCategory', location: tLocation, - commitmentOptions: [tCommitmentOption], + commitments: [tCommitment], endAt: DateTime(2022, 1, 31), images: const Images(card: 'tCard', banner: 'tBanner'), participantCount: 10, @@ -126,12 +124,11 @@ final tCrowdaction = CrowdAction( final tCrowdactionNoPassword = CrowdAction( id: 'tID', - type: '', title: 'tTitle', description: 'tDescription', category: 'tCategory', location: tLocation, - commitmentOptions: [tCommitmentOption], + commitments: [tCommitment], endAt: DateTime(2022, 1, 31), images: const Images(card: 'tCard', banner: 'tBanner'), participantCount: 10, @@ -139,25 +136,23 @@ final tCrowdactionNoPassword = CrowdAction( joinStatus: JoinStatus.closed, ); -final tCommitmentOption = CommitmentOption( +final tCommitment = Commitment( id: 'no-beef', - type: 'food', label: 'tLabel', description: 'tDescription', points: 0, blocks: [], ); -final tBlockingCommitmentOption = CommitmentOption( +final tBlockingCommitment = Commitment( id: 'no-meat', - type: 'food', label: 'tLabel', description: 'tDescription', points: 0, blocks: ['no-beef'], ); -final List tCommitment = ['tCommitment']; +final List tCommitments = ['tCommitment']; final Participation tParticipation = Participation( id: 'tID', @@ -165,7 +160,7 @@ final Participation tParticipation = Participation( fullName: 'John Doe', avatar: 'tAvatar', userId: 'tID', - commitmentOptions: tCommitment, + commitments: tCommitments, joinDate: DateTime.now(), dailyCheckIns: 5, ); diff --git a/test/utils/crowdaction.fixtures.dart b/test/utils/crowdaction.fixtures.dart index 34fc819f..f5d22c8a 100644 --- a/test/utils/crowdaction.fixtures.dart +++ b/test/utils/crowdaction.fixtures.dart @@ -3,12 +3,11 @@ import 'package:collaction_app/domain/crowdaction/crowdaction.dart'; /// Reusable crowdaction fixtures final testCrowdAction = CrowdAction( id: 'id', - type: 'type', title: 'title', description: 'description', category: 'category', location: const Location(code: 'code', name: 'name'), - commitmentOptions: [], + commitments: [], images: const Images(banner: 'banner.png', card: 'card.png'), participantCount: 1, status: Status.started, diff --git a/test/utils/crowdactions.dart b/test/utils/crowdactions.dart index 8a5b8992..9c891a40 100644 --- a/test/utils/crowdactions.dart +++ b/test/utils/crowdactions.dart @@ -3,7 +3,6 @@ import 'package:collaction_app/infrastructure/crowdaction/crowdaction_dto.dart'; final _crowdActionsRawData = [ { "id": "62ceb7110b5e88ce294628a1", - "type": "FOOD", "title": "Veganuary", "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam varius ac ligula quis aliquet. Donec nisi leo, rhoncus ac nulla quis, egestas ornare quam. Nunc nibh ex, venenatis quis maximus vitae, elementum sed urna. Morbi sagittis metus nibh, non lacinia ipsum faucibus eu. Nulla vehicula purus eget congue auctor.", @@ -17,17 +16,15 @@ final _crowdActionsRawData = [ "card": "crowdaction-cards/628a7fa741b5aa3af6582a07.png", "banner": "crowdaction-banners/628a7fa741b5aa3af6582a07.png" }, - "commitmentOptions": [ + "commitments": [ { - "type": "FOOD", "label": "5/7 Days a week", "description": "In case you prefer to exclude weekends", "points": -10, "blocks": [], - "id": "62b637e0c5d78b613a3cc6d2" + "_id": "62b637e0c5d78b613a3cc6d2" }, { - "type": "FOOD", "label": "Vegan", "description": "Commit to eating no product or by-product from any and all animals", @@ -38,42 +35,38 @@ final _crowdActionsRawData = [ "62b638c8c5d78b613a3cc6da", "62b638d9c5d78b613a3cc6dc" ], - "id": "62b6381fc5d78b613a3cc6d4" + "_id": "62b6381fc5d78b613a3cc6d4" }, { - "type": "FOOD", "label": "Vegetarian", "description": "Commit to eating no meat product or by-product of any and all animals", "points": 40, "blocks": ["62b638a6c5d78b613a3cc6d8", "62b638c8c5d78b613a3cc6da"], - "id": "62b63863c5d78b613a3cc6d6" + "_id": "62b63863c5d78b613a3cc6d6" }, { - "type": "FOOD", "label": "Pescatarian", "description": "Commit to eating no meat or poultry from animals, except fish and other seafood", "points": 30, "blocks": ["62b638c8c5d78b613a3cc6da"], - "id": "62b638a6c5d78b613a3cc6d8" + "_id": "62b638a6c5d78b613a3cc6d8" }, { - "type": "FOOD", "label": "No Beef", "description": "Commit to eating no beef", "points": 20, "blocks": [], - "id": "62b638c8c5d78b613a3cc6da" + "_id": "62b638c8c5d78b613a3cc6da" }, { - "type": "FOOD", "label": "No Dairy", "description": "Commit to eating no dairy products such as cheese and milk", "points": 10, "blocks": [], - "id": "62b638d9c5d78b613a3cc6dc" + "_id": "62b638d9c5d78b613a3cc6dc" } ], "status": "STARTED", @@ -87,7 +80,6 @@ final _crowdActionsRawData = [ }, { "id": "6364ca939d4f5dffc3fe8e25", - "type": "ENERGY", "title": "Steun je School", "description": "Tijdens deze campagne staat het thema energiebesparing centraal, in het bijzonder op scholen. We bevinden ons in een energiecrisis en alleen samen komen we eruit! Voor meer informatie, neem een kijkje op collaction.org/steunschool.", @@ -101,14 +93,13 @@ final _crowdActionsRawData = [ "card": "crowdaction-cards/education_january.jpg", "banner": "crowdaction-banners/education_january.jpg" }, - "commitmentOptions": [ + "commitments": [ { - "type": "ENERGY", "label": "SUSTAINABILITY", "description": "", "points": 10, "blocks": [], - "id": "6364bcbf9d4f5dffc3fe8e19" + "_id": "6364bcbf9d4f5dffc3fe8e19" } ], "status": "STARTED", @@ -122,7 +113,6 @@ final _crowdActionsRawData = [ }, { "id": "6364d440187f67b3798ca86e", - "type": "FOOD", "title": "The Food Initiative", "description": "Improve your eating habits, and downscale your CO2 footprint!", @@ -135,18 +125,16 @@ final _crowdActionsRawData = [ "card": "crowdaction-cards/placeholder.png", "banner": "crowdaction-banners/placeholder.png" }, - "commitmentOptions": [ + "commitments": [ { - "type": "FOOD", "label": "5/7 Days a week", "description": "In case you prefer to exclude weekends", "points": -10, "blocks": [], "icon": "working-days-only", - "id": "62b637e0c5d78b613a3cc6d2" + "_id": "62b637e0c5d78b613a3cc6d2" }, { - "type": "FOOD", "label": "Vegan", "description": "Commit to eating no product or by-product from animals", "points": 50, @@ -157,46 +145,42 @@ final _crowdActionsRawData = [ "62b638d9c5d78b613a3cc6dc" ], "icon": "vegan", - "id": "62b6381fc5d78b613a3cc6d4" + "_id": "62b6381fc5d78b613a3cc6d4" }, { - "type": "FOOD", "label": "Vegetarian", "description": "Commit to eating no meat product or by-product from animals", "points": 40, "blocks": ["62b638a6c5d78b613a3cc6d8", "62b638c8c5d78b613a3cc6da"], "icon": "vegetarian", - "id": "62b63863c5d78b613a3cc6d6" + "_id": "62b63863c5d78b613a3cc6d6" }, { - "type": "FOOD", "label": "Pescatarian", "description": "Commit to eating no meat or poultry from animals, except fish and other seafood", "points": 30, "blocks": ["62b638c8c5d78b613a3cc6da"], "icon": "pescatarian", - "id": "62b638a6c5d78b613a3cc6d8" + "_id": "62b638a6c5d78b613a3cc6d8" }, { - "type": "FOOD", "label": "No Beef", "description": "Commit to eating no beef", "points": 20, "blocks": [], "icon": "no-beef", - "id": "62b638c8c5d78b613a3cc6da" + "_id": "62b638c8c5d78b613a3cc6da" }, { - "type": "FOOD", "label": "No Dairy", "description": "Commit to eating no dairy products such as cheese and milk", "points": 10, "blocks": [], "icon": "no-dairy", - "id": "62b638d9c5d78b613a3cc6dc" + "_id": "62b638d9c5d78b613a3cc6dc" } ], "status": "WAITING", diff --git a/test/utils/participation.fixtures.dart b/test/utils/participation.fixtures.dart index 1727bad9..c9255633 100644 --- a/test/utils/participation.fixtures.dart +++ b/test/utils/participation.fixtures.dart @@ -10,7 +10,7 @@ final testParticipation = Participation( fullName: testProfile.fullName, avatar: testProfile.avatar, userId: testUser.id, - commitmentOptions: [], + commitments: [], joinDate: DateTime.now(), dailyCheckIns: 2, );