diff --git a/.github/workflows/licence.yml b/.github/workflows/licence.yml index ec822c68f..3e6bd418b 100644 --- a/.github/workflows/licence.yml +++ b/.github/workflows/licence.yml @@ -64,3 +64,9 @@ jobs: cd tools/sz_repo_cli dart pub get lic_ck check-licenses --config ../../licenses_config.yaml --problematic + + - name: Check licenses in website + run: | + cd website + flutter pub get + lic_ck check-licenses --config ../licenses_config.yaml --problematic diff --git a/app/lib/blackboard/blackboard_item.dart b/app/lib/blackboard/blackboard_item.dart index dc47e3fd5..2e7bffc7f 100644 --- a/app/lib/blackboard/blackboard_item.dart +++ b/app/lib/blackboard/blackboard_item.dart @@ -6,6 +6,7 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore_helper/cloud_firestore_helper.dart'; @@ -64,7 +65,7 @@ class BlackboardItem { title: "", text: null, pictureURL: "", - createdOn: DateTime.now(), + createdOn: clock.now(), attachments: [], sendNotification: true, forUsers: {}, diff --git a/app/lib/calendrical_events/models/calendrical_event.dart b/app/lib/calendrical_events/models/calendrical_event.dart index 9f3feb22d..6b3db9d5a 100644 --- a/app/lib/calendrical_events/models/calendrical_event.dart +++ b/app/lib/calendrical_events/models/calendrical_event.dart @@ -13,7 +13,25 @@ import 'package:sharezone/timetable/src/models/lesson.dart'; import 'package:sharezone/timetable/src/models/lesson_length/lesson_length.dart'; import 'package:time/time.dart'; -import 'calendrical_event_types.dart'; +enum EventType { + event('meeting'), + exam('exam'); + + /// Database key for the event type. + final String key; + + const EventType(this.key); + + static EventType fromString(String s) { + switch (s) { + case 'meeting': + return event; + case 'exam': + return exam; + } + throw ArgumentError("Couldn't parse $EventType from unkown event type: $s"); + } +} class CalendricalEvent { /// The date and time when the event was created. @@ -25,7 +43,7 @@ class CalendricalEvent { final String eventID, groupID, authorID; final GroupType groupType; - final CalendricalEventType eventType; + final EventType eventType; final Date date; final Time startTime, endTime; final String title; @@ -64,7 +82,7 @@ class CalendricalEvent { endTime: Time.parse(data['endTime'] as String), title: data['title'] as String, groupType: GroupType.values.byName(data['groupType'] as String), - eventType: getEventTypeFromString(data['eventType'] as String), + eventType: EventType.fromString(data['eventType'] as String), detail: data['detail'] as String?, place: data['place'] as String?, sendNotification: (data['sendNotification'] as bool?) ?? false, @@ -77,7 +95,7 @@ class CalendricalEvent { 'createdOn': createdOn, 'groupID': groupID, 'groupType': groupType.name, - 'eventType': getEventTypeToString(eventType), + 'eventType': eventType.key, 'authorID': authorID, 'date': date.toDateString, 'startTime': startTime.time, @@ -95,7 +113,7 @@ class CalendricalEvent { String? groupID, String? authorID, GroupType? groupType, - CalendricalEventType? eventType, + EventType? eventType, Date? date, Time? startTime, Time? endTime, diff --git a/app/lib/calendrical_events/models/calendrical_event_types.dart b/app/lib/calendrical_events/models/calendrical_event_types.dart deleted file mode 100644 index eda312293..000000000 --- a/app/lib/calendrical_events/models/calendrical_event_types.dart +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2022 Sharezone UG (haftungsbeschränkt) -// Licensed under the EUPL-1.2-or-later. -// -// You may obtain a copy of the Licence at: -// https://joinup.ec.europa.eu/software/page/eupl -// -// SPDX-License-Identifier: EUPL-1.2 - -import 'package:flutter/material.dart'; - -abstract class CalendricalEventType { - String get key; - String get name; - IconData get iconData; - Color get color; - - @override - bool operator ==(Object? other) { - if (identical(this, other)) return true; - return other is CalendricalEventType && other.key == key; - } - - @override - int get hashCode { - return key.hashCode; - } -} - -CalendricalEventType getEventTypeFromString(String data) { - switch (data) { - case 'excursion': - return Excursion(); - case 'exam': - return Exam(); - case 'meeting': - return Meeting(); - case 'other': - return OtherEventType(); - default: - return OtherEventType(); - } -} - -String getEventTypeToString(CalendricalEventType? eventType) { - return (eventType ?? OtherEventType()).key; -} - -class Excursion extends CalendricalEventType { - @override - Color color = Colors.blue; - - @override - IconData iconData = Icons.trip_origin; - - @override - String key = "excursion"; - - @override - String name = "Ausflug"; -} - -class Exam extends CalendricalEventType { - @override - Color color = Colors.red; - - @override - IconData iconData = Icons.note; - - @override - String key = "exam"; - - @override - String name = "Prüfung"; -} - -class Meeting extends CalendricalEventType { - @override - Color color = Colors.orange; - - @override - IconData iconData = Icons.note; - - @override - String key = "meeting"; - - @override - String name = "Veranstaltung"; -} - -class OtherEventType extends CalendricalEventType { - @override - Color color = Colors.purple; - - @override - IconData iconData = Icons.more_vert; - - @override - String key = "other"; - - @override - String name = "Anderes"; -} diff --git a/app/lib/calendrical_events/page/past_calendrical_events_page.dart b/app/lib/calendrical_events/page/past_calendrical_events_page.dart index 973952bb9..1ba48aad9 100644 --- a/app/lib/calendrical_events/page/past_calendrical_events_page.dart +++ b/app/lib/calendrical_events/page/past_calendrical_events_page.dart @@ -15,7 +15,6 @@ import 'package:flutter/material.dart'; import 'package:group_domain_models/group_domain_models.dart'; import 'package:provider/provider.dart'; import 'package:sharezone/calendrical_events/models/calendrical_event.dart'; -import 'package:sharezone/calendrical_events/models/calendrical_event_types.dart'; import 'package:sharezone/calendrical_events/provider/past_calendrical_events_page_controller.dart'; import 'package:sharezone/calendrical_events/provider/past_calendrical_events_page_controller_factory.dart'; import 'package:sharezone/sharezone_plus/page/sharezone_plus_page.dart'; @@ -176,7 +175,7 @@ class _SharezonePlusAd extends StatelessWidget { detail: null, endTime: Time(hour: 12, minute: 0), eventID: 'eventId', - eventType: Exam(), + eventType: EventType.exam, groupType: GroupType.course, latestEditor: null, place: null, diff --git a/app/lib/changelog/change_database_model.dart b/app/lib/changelog/change_database_model.dart index 02989a534..0dca75e9f 100644 --- a/app/lib/changelog/change_database_model.dart +++ b/app/lib/changelog/change_database_model.dart @@ -6,9 +6,10 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:sharezone/changelog/change.dart'; import 'package:cloud_firestore_helper/cloud_firestore_helper.dart'; +import 'package:sharezone/changelog/change.dart'; class ChangeDatabaseModel { final String id; @@ -32,7 +33,7 @@ class ChangeDatabaseModel { return ChangeDatabaseModel._( id: "", version: "", - releaseDate: DateTime.now(), + releaseDate: clock.now(), newFeatures: [], improvements: [], fixes: [], diff --git a/app/lib/comments/comment.dart b/app/lib/comments/comment.dart index 631f2d6f4..b8d0e53c5 100644 --- a/app/lib/comments/comment.dart +++ b/app/lib/comments/comment.dart @@ -6,6 +6,8 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; + import 'misc.dart'; class Comment { @@ -66,7 +68,7 @@ class CommentAge extends Duration { int get inApproximateYears => (inDays / approximateDaysPerMonth).round(); - DateTime get writtenOnDateTime => DateTime.now().subtract(this); + DateTime get writtenOnDateTime => clock.now().subtract(this); } class CommentAuthor { diff --git a/app/lib/comments/comment_data_models.dart b/app/lib/comments/comment_data_models.dart index ec4e1ea54..50254763b 100644 --- a/app/lib/comments/comment_data_models.dart +++ b/app/lib/comments/comment_data_models.dart @@ -6,9 +6,10 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:sharezone/comments/comment.dart'; import 'package:cloud_firestore_helper/cloud_firestore_helper.dart'; +import 'package:sharezone/comments/comment.dart'; class CommentDataModel { final String? id; @@ -73,8 +74,7 @@ class CommentDataModel { author: author.toModel(), content: comment, ratings: _createRatings(), - age: CommentAge.fromDuration( - DateTime.now().difference(writtenOn!.toDate())), + age: CommentAge.fromDuration(clock.now().difference(writtenOn!.toDate())), id: id, ); } diff --git a/app/lib/dashboard/bloc/dashboard_bloc.dart b/app/lib/dashboard/bloc/dashboard_bloc.dart index 54e165a97..dd2043af2 100644 --- a/app/lib/dashboard/bloc/dashboard_bloc.dart +++ b/app/lib/dashboard/bloc/dashboard_bloc.dart @@ -9,6 +9,7 @@ import 'dart:async'; import 'package:bloc_base/bloc_base.dart'; +import 'package:clock/clock.dart'; import 'package:date/date.dart'; import 'package:design/design.dart'; import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart'; @@ -52,7 +53,7 @@ extension RepeatEveryExtension on Stream { class DashboardBloc extends BlocBase { final String _uid; final todayDateTimeWithoutTime = - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day); + DateTime(clock.now().year, clock.now().month, clock.now().day); final _unreadBlackboardViewsSubject = BehaviorSubject>(); final _unreadBlackboardItemsEmptySubject = BehaviorSubject(); @@ -152,7 +153,7 @@ class DashboardBloc extends BlocBase { List _filterUrgentHomeworks( List allHomeworks, TypeOfUser typeOfUser) { - final now = DateTime.now(); + final now = clock.now(); final dayAfterTomorrow = DateTime(now.year, now.month, now.day + 2); // Was passiert, wenn der 30. Oktober ist und 2 Tage dazu gezählt werden? Springt es dann auf den 1. November um? // Antwort: Springt um auf den 1.November, gechekt, auf wenn der Code unschön ist, besser wäre dayAfterTomorrow = now.add(Duration(days:2)) @@ -286,7 +287,7 @@ extension on DateTime { bool get isDayAfterTomorrow => dayAfterTomorrow == withoutTime; static DateTime get today => - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day); + DateTime(clock.now().year, clock.now().month, clock.now().day); static DateTime get tomorrow => DateTime(today.year, today.month, today.day + 1); static DateTime get dayAfterTomorrow => diff --git a/app/lib/dashboard/dashboard_page.dart b/app/lib/dashboard/dashboard_page.dart index 7cd53a19b..1771d73e2 100644 --- a/app/lib/dashboard/dashboard_page.dart +++ b/app/lib/dashboard/dashboard_page.dart @@ -10,6 +10,7 @@ import 'dart:developer'; import 'package:analytics/analytics.dart'; import 'package:bloc_provider/bloc_provider.dart'; +import 'package:clock/clock.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; diff --git a/app/lib/dashboard/models/homework_view.dart b/app/lib/dashboard/models/homework_view.dart index 6c058537f..2a6486b57 100644 --- a/app/lib/dashboard/models/homework_view.dart +++ b/app/lib/dashboard/models/homework_view.dart @@ -6,6 +6,7 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart'; import 'package:flutter/material.dart'; import 'package:group_domain_models/group_domain_models.dart'; @@ -39,7 +40,7 @@ class HomeworkView { } final todayDateTimeWithoutTime = - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day); + DateTime(clock.now().year, clock.now().month, clock.now().day); if (dateTime.isBefore(todayDateTimeWithoutTime)) { return "Überfällig!"; } else if (dateTime.isAtSameMomentAs(todayDateTimeWithoutTime)) { @@ -62,8 +63,8 @@ class HomeworkView { final defaultColor = Colors.grey[400]!; if (!withUrgentColor) return defaultColor; - final dayAfterTomorrow = DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day + 2); + final dayAfterTomorrow = + DateTime(clock.now().year, clock.now().month, clock.now().day + 2); return dateTime.isBefore(dayAfterTomorrow) ? Colors.redAccent : defaultColor; diff --git a/app/lib/dashboard/sections/holiday_countdown_section.dart b/app/lib/dashboard/sections/holiday_countdown_section.dart index dfe601eec..612e4dcab 100644 --- a/app/lib/dashboard/sections/holiday_countdown_section.dart +++ b/app/lib/dashboard/sections/holiday_countdown_section.dart @@ -123,8 +123,7 @@ class _HolidayText extends StatelessWidget { } // For each Holiday create a Widget and add to the list. for (var holiday in holidayList) { - int daysTillHolidayBeginn = - holiday!.start.difference(DateTime.now()).inDays; + int daysTillHolidayBeginn = holiday!.start.difference(clock.now()).inDays; String holidayTitle = capitalize(holiday.name); String emoji; @@ -139,7 +138,7 @@ class _HolidayText extends StatelessWidget { emoji = "🎉🎉🙌"; textWidget = Text("$holidayTitle: JETZT, WOOOOOOO! $emoji"); } else { - int daysTillHolidayEnd = holiday.end.difference(DateTime.now()).inDays; + int daysTillHolidayEnd = holiday.end.difference(clock.now()).inDays; if (daysTillHolidayEnd == 0) { textWidget = Text("$holidayTitle: Letzer Tag 😱"); } else { diff --git a/app/lib/dashboard/update_reminder/update_reminder_bloc.dart b/app/lib/dashboard/update_reminder/update_reminder_bloc.dart index 795a589c9..b29abf79b 100644 --- a/app/lib/dashboard/update_reminder/update_reminder_bloc.dart +++ b/app/lib/dashboard/update_reminder/update_reminder_bloc.dart @@ -7,6 +7,7 @@ // SPDX-License-Identifier: EUPL-1.2 import 'package:bloc_base/bloc_base.dart'; +import 'package:clock/clock.dart'; import 'package:crash_analytics/crash_analytics.dart'; import 'package:meta/meta.dart'; import 'package:sharezone/changelog/change.dart'; @@ -41,7 +42,7 @@ class UpdateReminderBloc extends BlocBase { getCurrentVersion: () => platformInformationRetriever.init().then( (_) => Version.parse(name: platformInformationRetriever.version)), updateGracePeriod: updateGracePeriod, - getCurrentDateTime: () => DateTime.now(), + getCurrentDateTime: () => clock.now(), crashAnalytics: crashAnalytics, ); } diff --git a/app/lib/feedback/src/cache/feedback_cache.dart b/app/lib/feedback/src/cache/feedback_cache.dart index 8b8e7cf9e..5bf026bf0 100644 --- a/app/lib/feedback/src/cache/feedback_cache.dart +++ b/app/lib/feedback/src/cache/feedback_cache.dart @@ -8,6 +8,7 @@ import 'dart:developer'; +import 'package:clock/clock.dart'; import 'package:key_value_store/key_value_store.dart'; import 'package:meta/meta.dart'; @@ -37,13 +38,13 @@ class FeedbackCache { } final durationPassedFromLastSubmit = - lastSubmit.difference(DateTime.now()).abs(); + lastSubmit.difference(clock.now()).abs(); if (durationPassedFromLastSubmit < feedbackCooldown) return true; return false; } Future setLastSubmit() async { - _cache.setString(lastSubmitCacheKey, DateTime.now().toIso8601String()); + _cache.setString(lastSubmitCacheKey, clock.now().toIso8601String()); } Future _getLastSubmitTime() async { diff --git a/app/lib/filesharing/logic/firebase_file_uploader/implementation/firebase_file_uploader_impl.dart b/app/lib/filesharing/logic/firebase_file_uploader/implementation/firebase_file_uploader_impl.dart index d0925a325..d04f6c265 100644 --- a/app/lib/filesharing/logic/firebase_file_uploader/implementation/firebase_file_uploader_impl.dart +++ b/app/lib/filesharing/logic/firebase_file_uploader/implementation/firebase_file_uploader_impl.dart @@ -6,6 +6,7 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:files_basics/files_models.dart'; import 'package:files_basics/local_file.dart'; @@ -45,7 +46,7 @@ class FirebaseFileUploaderImplementation { ChangeActivity( authorID: creatorID, authorName: creatorName, - changedOn: DateTime.now(), + changedOn: clock.now(), ) ], name: localFile.getName(), diff --git a/app/lib/holidays/holiday_bloc.dart b/app/lib/holidays/holiday_bloc.dart index 1a2ac2fd2..88e61305d 100644 --- a/app/lib/holidays/holiday_bloc.dart +++ b/app/lib/holidays/holiday_bloc.dart @@ -9,6 +9,7 @@ import 'dart:async'; import 'package:bloc_base/bloc_base.dart'; +import 'package:clock/clock.dart'; import 'package:holidays/holidays.dart'; import 'package:rxdart/subjects.dart'; import 'package:sharezone/util/api/user_api.dart'; @@ -34,7 +35,7 @@ class HolidayBloc extends BlocBase { {required this.holidayManager, required this.stateGateway, this.getCurrentTime}) { - getCurrentTime ??= () => DateTime.now(); + getCurrentTime ??= () => clock.now(); final holidaysStream = userState // StateEnum.notSelected would result into an UnsupportedStateException diff --git a/app/lib/homework/parent/homework_page.dart b/app/lib/homework/parent/homework_page.dart index eb97cf75b..fbf77efb9 100644 --- a/app/lib/homework/parent/homework_page.dart +++ b/app/lib/homework/parent/homework_page.dart @@ -11,20 +11,21 @@ import 'dart:developer'; import 'package:analytics/analytics.dart'; import 'package:bloc_provider/bloc_provider.dart'; +import 'package:clock/clock.dart'; import 'package:common_domain_models/common_domain_models.dart'; import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; -import 'package:sharezone/main/application_bloc.dart'; -import 'package:sharezone/homework/parent/src/homework_page_bloc.dart'; +import 'package:sharezone/homework/homework_dialog/homework_dialog.dart'; import 'package:sharezone/homework/homework_page_new.dart'; +import 'package:sharezone/homework/parent/src/homework_page_bloc.dart'; +import 'package:sharezone/homework/shared/homework_archived.dart'; +import 'package:sharezone/homework/shared/homework_card.dart'; +import 'package:sharezone/main/application_bloc.dart'; import 'package:sharezone/navigation/logic/navigation_bloc.dart'; import 'package:sharezone/navigation/models/navigation_item.dart'; import 'package:sharezone/navigation/scaffold/app_bar_configuration.dart'; import 'package:sharezone/navigation/scaffold/sharezone_main_scaffold.dart'; -import 'package:sharezone/homework/shared/homework_archived.dart'; -import 'package:sharezone/homework/homework_dialog/homework_dialog.dart'; -import 'package:sharezone/homework/shared/homework_card.dart'; import 'package:sharezone_common/translations.dart'; import 'package:sharezone_widgets/sharezone_widgets.dart'; import 'package:user/user.dart'; @@ -59,7 +60,7 @@ Future openHomeworkDialogAndShowConfirmationIfSuccessful( List getNotArchived(List homeworkList) { final List notArchivedHomeworks = []; for (var homework in homeworkList) { - final int dif = homework.todoUntil.difference(DateTime.now()).inDays; + final int dif = homework.todoUntil.difference(clock.now()).inDays; if (dif > -1) { notArchivedHomeworks.add(homework); } @@ -572,8 +573,8 @@ class _HomeworkListWithCards extends StatelessWidget { final List dayAfterTomorrowList = []; final List severalDaysList = []; - DateTime today = DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day); + DateTime today = + DateTime(clock.now().year, clock.now().month, clock.now().day); for (var homework in homeworkList!) { DateTime homeworkDate = DateTime(homework.todoUntil.year, homework.todoUntil.month, homework.todoUntil.day); diff --git a/app/lib/homework/parent/src/homework_page_bloc.dart b/app/lib/homework/parent/src/homework_page_bloc.dart index c2ed3f4be..5ce3a3284 100644 --- a/app/lib/homework/parent/src/homework_page_bloc.dart +++ b/app/lib/homework/parent/src/homework_page_bloc.dart @@ -10,6 +10,7 @@ import 'dart:async'; import 'dart:developer'; import 'package:bloc_base/bloc_base.dart'; +import 'package:clock/clock.dart'; import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart'; import 'package:rxdart/subjects.dart'; import 'package:sharezone/util/api.dart'; @@ -116,8 +117,8 @@ class HomeworkPageBloc extends BlocBase { for (HomeworkDto homework in homeworkNotDone) { final DateTime homeworkDateTime = DateTime(homework.todoUntil.year, homework.todoUntil.month, homework.todoUntil.day); - final DateTime todayDateTime = DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day); + final DateTime todayDateTime = + DateTime(clock.now().year, clock.now().month, clock.now().day); if (homeworkDateTime.isBefore(todayDateTime)) { api.homework.changeIsHomeworkDoneTo(homework.id, true); } diff --git a/app/lib/homework/shared/homework_archived.dart b/app/lib/homework/shared/homework_archived.dart index 76f86829a..cc2195ee4 100644 --- a/app/lib/homework/shared/homework_archived.dart +++ b/app/lib/homework/shared/homework_archived.dart @@ -9,12 +9,13 @@ import 'dart:developer'; import 'package:bloc_provider/bloc_provider.dart'; +import 'package:clock/clock.dart'; import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart'; import 'package:flutter/material.dart'; -import 'package:sharezone/main/application_bloc.dart'; -import 'package:sharezone/homework/parent/src/homework_page_bloc.dart'; import 'package:sharezone/homework/parent/homework_page.dart'; +import 'package:sharezone/homework/parent/src/homework_page_bloc.dart'; import 'package:sharezone/homework/shared/homework_card.dart'; +import 'package:sharezone/main/application_bloc.dart'; import 'package:sharezone_widgets/sharezone_widgets.dart'; import 'package:user/user.dart'; @@ -63,8 +64,8 @@ class _HomeworkArchivedPageState extends State { return ShowCenteredError(error: snapshot.error.toString()); } - DateTime today = DateTime(DateTime.now().year, - DateTime.now().month, DateTime.now().day); + DateTime today = DateTime( + clock.now().year, clock.now().month, clock.now().day); List homeworkList = snapshot.data!.where((HomeworkDto homework) { DateTime todoUntil = DateTime(homework.todoUntil.year, diff --git a/app/lib/homework/shared/homework_card.dart b/app/lib/homework/shared/homework_card.dart index 79f377440..a58a63b8c 100644 --- a/app/lib/homework/shared/homework_card.dart +++ b/app/lib/homework/shared/homework_card.dart @@ -8,27 +8,28 @@ import 'package:analytics/analytics.dart'; import 'package:bloc_provider/bloc_provider.dart'; +import 'package:clock/clock.dart'; import 'package:common_domain_models/common_domain_models.dart'; import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart'; import 'package:flutter/material.dart'; import 'package:group_domain_models/group_domain_models.dart'; import 'package:intl/intl.dart'; -import 'package:sharezone/main/application_bloc.dart'; -import 'package:sharezone/homework/parent/src/homework_card_bloc.dart'; import 'package:sharezone/dashboard/models/homework_view.dart'; import 'package:sharezone/groups/src/pages/course/course_card.dart'; -import 'package:sharezone/homework/teacher/homework_done_by_users_list/homework_completion_user_list_page.dart'; import 'package:sharezone/homework/homework_details/homework_details.dart'; import 'package:sharezone/homework/homework_details/homework_details_view_factory.dart'; -import 'package:sharezone/homework/shared/homework_permissions.dart'; import 'package:sharezone/homework/parent/homework_page.dart'; +import 'package:sharezone/homework/parent/src/homework_card_bloc.dart'; +import 'package:sharezone/homework/shared/delete_homework.dart'; +import 'package:sharezone/homework/shared/homework_permissions.dart'; +import 'package:sharezone/homework/teacher/homework_done_by_users_list/homework_completion_user_list_page.dart'; +import 'package:sharezone/main/application_bloc.dart'; import 'package:sharezone/report/page/report_page.dart'; import 'package:sharezone/report/report_icon.dart'; import 'package:sharezone/report/report_item.dart'; import 'package:sharezone/submissions/homework_list_submissions_page.dart'; import 'package:sharezone/util/api/connections_gateway.dart'; import 'package:sharezone/util/navigation_service.dart'; -import 'package:sharezone/homework/shared/delete_homework.dart'; import 'package:sharezone_widgets/sharezone_widgets.dart'; import 'package:user/user.dart'; @@ -52,8 +53,8 @@ class HomeworkCard extends StatelessWidget { final bloc = HomeworkCardBloc(api, homework!); final analytics = BlocProvider.of(context).analytics; - DateTime tomorrowWithoutTime = DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day + 1); + DateTime tomorrowWithoutTime = + DateTime(clock.now().year, clock.now().month, clock.now().day + 1); DateTime todoUntilWithoutTime = DateTime(homework!.todoUntil.year, homework!.todoUntil.month, homework!.todoUntil.day); diff --git a/app/lib/main/sharezone_bloc_providers.dart b/app/lib/main/sharezone_bloc_providers.dart index 9bb0b2338..b2c3b5838 100644 --- a/app/lib/main/sharezone_bloc_providers.dart +++ b/app/lib/main/sharezone_bloc_providers.dart @@ -546,7 +546,7 @@ class _SharezoneBlocProvidersState extends State { holidayManager: HolidayService( HolidayApi( holidayApiClient, - getCurrentTime: () => DateTime.now(), + getCurrentTime: () => clock.now(), ), HolidayCache( FlutterKeyValueStore(widget.blocDependencies.sharedPreferences), diff --git a/app/lib/report/report_factory.dart b/app/lib/report/report_factory.dart index 5e862b406..835f782e2 100644 --- a/app/lib/report/report_factory.dart +++ b/app/lib/report/report_factory.dart @@ -7,6 +7,7 @@ // SPDX-License-Identifier: EUPL-1.2 import 'package:bloc_base/bloc_base.dart'; +import 'package:clock/clock.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'report.dart'; @@ -26,7 +27,7 @@ class ReportFactory extends BlocBase { String description, ReportReason reason, ui.ReportItemReference item) { validatePath(item.path); return Report( - createdOn: DateTime.now(), + createdOn: clock.now(), creatorID: uid, description: description, reason: reason, diff --git a/app/lib/settings/src/subpages/timetable/timetable_settings_page.dart b/app/lib/settings/src/subpages/timetable/timetable_settings_page.dart index 4984636f1..59000d2e0 100644 --- a/app/lib/settings/src/subpages/timetable/timetable_settings_page.dart +++ b/app/lib/settings/src/subpages/timetable/timetable_settings_page.dart @@ -7,20 +7,21 @@ // SPDX-License-Identifier: EUPL-1.2 import 'package:bloc_provider/bloc_provider.dart'; +import 'package:clock/clock.dart'; import 'package:date/date.dart'; import 'package:date/weektype.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:numberpicker/numberpicker.dart'; +import 'package:platform_check/platform_check.dart'; +import 'package:sharezone/settings/src/bloc/user_settings_bloc.dart'; import 'package:sharezone/settings/src/subpages/timetable/bloc/timetable_settings_bloc.dart'; import 'package:sharezone/settings/src/subpages/timetable/bloc/timetable_settings_bloc_factory.dart'; import 'package:sharezone/settings/src/subpages/timetable/periods/periods_edit_page.dart'; -import 'package:sharezone/settings/src/bloc/user_settings_bloc.dart'; import 'package:sharezone/settings/src/subpages/timetable/weekdays/weekdays_edit_page.dart'; import 'package:sharezone/timetable/src/edit_time.dart'; import 'package:sharezone/timetable/src/edit_weektype.dart'; import 'package:sharezone/timetable/src/models/lesson_length/lesson_length.dart'; -import 'package:platform_check/platform_check.dart'; import 'package:sharezone_widgets/sharezone_widgets.dart'; import 'package:time/time.dart'; import 'package:user/user.dart'; @@ -112,7 +113,7 @@ class _ABWeekField extends StatelessWidget { Padding( padding: const EdgeInsets.fromLTRB(16, 0, 16, 12), child: Text( - "Diese Woche ist Kalenderwoche ${getWeekNumber(DateTime.now()).toString()}. A-Wochen sind ${_getAWeekIsEvenOrOddName(userSettings.isAWeekEvenWeek)} Kalenderwochen und somit ist aktuell eine ${_getCurrentWeekTypeName(userSettings.isAWeekEvenWeek)}.", + "Diese Woche ist Kalenderwoche ${getWeekNumber(clock.now()).toString()}. A-Wochen sind ${_getAWeekIsEvenOrOddName(userSettings.isAWeekEvenWeek)} Kalenderwochen und somit ist aktuell eine ${_getCurrentWeekTypeName(userSettings.isAWeekEvenWeek)}.", textAlign: TextAlign.left, style: const TextStyle(fontSize: 12, color: Colors.grey), @@ -137,7 +138,7 @@ class _ABWeekField extends StatelessWidget { } WeekType _getCurrentWeekType(bool isAWeekEvenWeek) { - final isCurrentWeekEven = getWeekNumber(DateTime.now()).isEven; + final isCurrentWeekEven = getWeekNumber(clock.now()).isEven; if (isCurrentWeekEven) { return isAWeekEvenWeek ? WeekType.a : WeekType.b; } else { diff --git a/app/lib/submissions/homework_list_submissions_page.dart b/app/lib/submissions/homework_list_submissions_page.dart index 828efa15f..32ddf6a0f 100644 --- a/app/lib/submissions/homework_list_submissions_page.dart +++ b/app/lib/submissions/homework_list_submissions_page.dart @@ -8,6 +8,7 @@ import 'package:abgabe_client_lib/abgabe_client_lib.dart'; import 'package:bloc_provider/bloc_provider.dart'; +import 'package:clock/clock.dart'; import 'package:files_basics/files_models.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; @@ -136,14 +137,14 @@ class _LoadingPlaceholder extends StatelessWidget { abbreviation: 'A', username: 'Patrick Star', submittedFiles: [], - lastActionDateTime: DateTime.now(), + lastActionDateTime: clock.now(), wasEditedAfterwards: false, ), CreatedSubmissionView( abbreviation: 'S', username: 'Spongebob Schwammkopf', submittedFiles: [], - lastActionDateTime: DateTime.now(), + lastActionDateTime: clock.now(), wasEditedAfterwards: false, ), ], afterDeadlineSubmissions: [ @@ -151,7 +152,7 @@ class _LoadingPlaceholder extends StatelessWidget { abbreviation: 'B', username: 'Thaddäus Tentakel', submittedFiles: [], - lastActionDateTime: DateTime.now(), + lastActionDateTime: clock.now(), wasEditedAfterwards: false, ), ], missingSubmissions: [ diff --git a/app/lib/timetable/src/edit_date.dart b/app/lib/timetable/src/edit_date.dart index 25de58e95..c04c4f324 100644 --- a/app/lib/timetable/src/edit_date.dart +++ b/app/lib/timetable/src/edit_date.dart @@ -6,6 +6,7 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:date/date.dart'; import 'package:flutter/material.dart'; @@ -76,7 +77,7 @@ Future selectDate( }) async { return showDatePicker( context: context, - initialDate: initialDate?.toDateTime ?? DateTime.now(), + initialDate: initialDate?.toDateTime ?? clock.now(), firstDate: Date("2019-01-01").toDateTime, lastDate: Date("2029-12-31").toDateTime, ).then((newDateTime) { diff --git a/app/lib/timetable/src/widgets/events/calender_event_card.dart b/app/lib/timetable/src/widgets/events/calender_event_card.dart index bf5a6ae5b..1d6a1f789 100644 --- a/app/lib/timetable/src/widgets/events/calender_event_card.dart +++ b/app/lib/timetable/src/widgets/events/calender_event_card.dart @@ -8,10 +8,9 @@ import 'package:bloc_provider/bloc_provider.dart'; import 'package:flutter/material.dart'; -import 'package:sharezone/main/application_bloc.dart'; import 'package:sharezone/calendrical_events/models/calendrical_event.dart'; -import 'package:sharezone/calendrical_events/models/calendrical_event_types.dart'; import 'package:sharezone/groups/src/pages/course/course_edit/design/course_edit_design.dart'; +import 'package:sharezone/main/application_bloc.dart'; import 'package:sharezone/report/page/report_page.dart'; import 'package:sharezone/report/report_icon.dart'; import 'package:sharezone/report/report_item.dart'; @@ -112,7 +111,7 @@ Future onEventLongPress( final isAuthor = api.uID == event.authorID; final hasPermissionsToManageEvents = hasPermissionToManageEvents( api.course.getRoleFromCourseNoSync(event.groupID)!, isAuthor); - final isExam = event.eventType == Exam(); + final isExam = event.eventType == EventType.exam; final result = await showLongPressAdaptiveDialog<_EventLongPressResult>( context: context, title: "${isExam ? "Prüfung" : "Termin"}: ${event.title}", diff --git a/app/lib/timetable/timetable_add_event/src/timetable_add_event_event_dialog_api.dart b/app/lib/timetable/timetable_add_event/src/timetable_add_event_event_dialog_api.dart index f302a4f1e..3d4793eff 100644 --- a/app/lib/timetable/timetable_add_event/src/timetable_add_event_event_dialog_api.dart +++ b/app/lib/timetable/timetable_add_event/src/timetable_add_event_event_dialog_api.dart @@ -11,10 +11,12 @@ import 'package:date/date.dart'; import 'package:equatable/equatable.dart'; import 'package:group_domain_models/group_domain_models.dart'; import 'package:sharezone/calendrical_events/models/calendrical_event.dart'; -import 'package:sharezone/calendrical_events/models/calendrical_event_types.dart'; import 'package:sharezone/util/api.dart'; import 'package:time/time.dart'; +export 'package:sharezone/calendrical_events/models/calendrical_event.dart' + show EventType; + class EventDialogApi { final SharezoneGateway _api; @@ -33,10 +35,7 @@ class EventDialogApi { createdOn: null, groupID: command.courseId.id, groupType: GroupType.course, - eventType: switch (command.eventType) { - EventType.event => Meeting(), - EventType.exam => Exam(), - }, + eventType: command.eventType, date: command.date, place: command.location, startTime: command.startTime, @@ -52,8 +51,6 @@ class EventDialogApi { } } -enum EventType { event, exam } - class CreateEventCommand extends Equatable { final String title; final CourseId courseId; diff --git a/app/lib/timetable/timetable_edit/event/timetable_event_edit_page.dart b/app/lib/timetable/timetable_edit/event/timetable_event_edit_page.dart index 888d5d648..8f4711c55 100644 --- a/app/lib/timetable/timetable_edit/event/timetable_event_edit_page.dart +++ b/app/lib/timetable/timetable_edit/event/timetable_event_edit_page.dart @@ -12,9 +12,8 @@ import 'package:bloc_provider/bloc_provider.dart'; import 'package:date/date.dart'; import 'package:flutter/material.dart'; import 'package:group_domain_models/group_domain_models.dart'; -import 'package:sharezone/main/application_bloc.dart'; import 'package:sharezone/calendrical_events/models/calendrical_event.dart'; -import 'package:sharezone/calendrical_events/models/calendrical_event_types.dart'; +import 'package:sharezone/main/application_bloc.dart'; import 'package:sharezone/markdown/markdown_analytics.dart'; import 'package:sharezone/markdown/markdown_support.dart'; import 'package:sharezone/timetable/src/edit_date.dart'; @@ -90,7 +89,7 @@ class _TimetableEditEventPage extends StatelessWidget { @override Widget build(BuildContext context) { - final isExam = initialEvent.eventType == Exam(); + final isExam = initialEvent.eventType == EventType.exam; return PopScope( canPop: false, onPopInvoked: (didPop) async { @@ -354,7 +353,7 @@ class _DetailField extends StatelessWidget { @override Widget build(BuildContext context) { - final isExam = initialEvent.eventType == Exam(); + final isExam = initialEvent.eventType == EventType.exam; final bloc = BlocProvider.of(context); return Padding( padding: const EdgeInsets.only(top: 10), diff --git a/app/lib/timetable/timetable_page/timetable_event_details.dart b/app/lib/timetable/timetable_page/timetable_event_details.dart index 93df78535..d0924d7b1 100644 --- a/app/lib/timetable/timetable_page/timetable_event_details.dart +++ b/app/lib/timetable/timetable_page/timetable_event_details.dart @@ -13,10 +13,10 @@ import 'package:design/design.dart'; import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:flutter_native_timezone/flutter_native_timezone.dart'; +import 'package:platform_check/platform_check.dart'; import 'package:provider/provider.dart'; -import 'package:sharezone/main/application_bloc.dart'; import 'package:sharezone/calendrical_events/models/calendrical_event.dart'; -import 'package:sharezone/calendrical_events/models/calendrical_event_types.dart'; +import 'package:sharezone/main/application_bloc.dart'; import 'package:sharezone/report/page/report_page.dart'; import 'package:sharezone/report/report_icon.dart'; import 'package:sharezone/report/report_item.dart'; @@ -26,7 +26,6 @@ import 'package:sharezone/timetable/timetable_edit/event/timetable_event_edit_pa import 'package:sharezone/timetable/timetable_permissions.dart'; import 'package:sharezone/util/launch_link.dart'; import 'package:sharezone/util/navigation_service.dart'; -import 'package:platform_check/platform_check.dart'; import 'package:sharezone_widgets/sharezone_widgets.dart'; enum _EventModelSheetAction { edit, delete, report } @@ -152,7 +151,7 @@ class _TimetableEventDetailsPage extends StatelessWidget { final isAuthor = api.uID == event.authorID; final hasPermissionsToManageLessons = hasPermissionToManageEvents( api.course.getRoleFromCourseNoSync(event.groupID)!, isAuthor); - final isExam = event.eventType == Exam(); + final isExam = event.eventType == EventType.exam; final theme = Theme.of(context); return Scaffold( @@ -198,11 +197,6 @@ class _TimetableEventDetailsPage extends StatelessWidget { ), ), ), - if (event.eventType is OtherEventType == false) - ListTile( - leading: const Icon(Icons.label), - title: Text("Art: ${event.eventType.name}"), - ), ListTile( leading: const Icon(Icons.place), title: Text("Raum: ${event.place ?? "-"}"), diff --git a/app/lib/util/api/homework_api.dart b/app/lib/util/api/homework_api.dart index fcdd260e7..b81fbb910 100644 --- a/app/lib/util/api/homework_api.dart +++ b/app/lib/util/api/homework_api.dart @@ -9,6 +9,7 @@ import 'dart:async'; import 'dart:developer'; +import 'package:clock/clock.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:filesharing_logic/filesharing_logic_models.dart'; import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart'; @@ -54,7 +55,7 @@ class HomeworkGateway { Future _setUpStreams( FirebaseFirestore firestore, TypeOfUser typeOfUser) async { - final now = DateTime.now(); + final now = clock.now(); final startOfThisDay = DateTime(now.year, now.month, now.day); if (typeOfUser == TypeOfUser.student) { diff --git a/app/test/feedback/feedback_cache_test.dart b/app/test/feedback/feedback_cache_test.dart index b8886fb9e..3482f1b46 100644 --- a/app/test/feedback/feedback_cache_test.dart +++ b/app/test/feedback/feedback_cache_test.dart @@ -6,6 +6,7 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:key_value_store/in_memory_key_value_store.dart'; import 'package:sharezone/feedback/src/cache/feedback_cache.dart'; @@ -29,7 +30,7 @@ void main() { "Returns no cooldown if cached last send time is more than cooldown range", () async { const cooldownDuration = Duration(minutes: 2); - final lastFeedbackSend = DateTime.now().subtract(cooldownDuration + + final lastFeedbackSend = clock.now().subtract(cooldownDuration + const Duration(seconds: 10)); // So Feedback should get no cooldown dummyKeyValueStore.setString( @@ -44,7 +45,7 @@ void main() { "Returns cooldown if cached last send time is less than cooldown range", () async { const cooldownDuration = Duration(minutes: 2); - final lastFeedbackSend = DateTime.now().subtract(cooldownDuration - + final lastFeedbackSend = clock.now().subtract(cooldownDuration - const Duration(seconds: 10)); // So Feedback should get cooldown await dummyKeyValueStore.setString( diff --git a/app/test/holidays/holiday_bloc_unit_test.dart b/app/test/holidays/holiday_bloc_unit_test.dart index 05379e6a6..ec065701e 100644 --- a/app/test/holidays/holiday_bloc_unit_test.dart +++ b/app/test/holidays/holiday_bloc_unit_test.dart @@ -6,6 +6,7 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:holidays/holidays.dart'; import 'package:mockito/annotations.dart'; @@ -175,7 +176,7 @@ class InMemoryHolidayStateGateway extends HolidayStateGateway { List generateHolidayList(int length) { List holidays = []; for (int i = 0; i < length; i++) { - final start = DateTime.now().add(Duration(days: i + 1)); + final start = clock.now().add(Duration(days: i + 1)); final end = start.add(Duration(days: i + 4)); holidays.add(generateHoliday(start, end)); } diff --git a/app/test/holidays/holiday_cache_test.dart b/app/test/holidays/holiday_cache_test.dart index 94bc2c696..bf0c5eef5 100644 --- a/app/test/holidays/holiday_cache_test.dart +++ b/app/test/holidays/holiday_cache_test.dart @@ -7,6 +7,7 @@ // SPDX-License-Identifier: EUPL-1.2 import 'package:built_collection/built_collection.dart'; +import 'package:clock/clock.dart'; import "package:flutter_test/flutter_test.dart"; import 'package:holidays/holidays.dart'; import 'package:key_value_store/in_memory_key_value_store.dart'; @@ -37,14 +38,14 @@ void main() { State state = const NordrheinWestfalen(); Holiday holidayInTheFuture = generateHoliday( - DateTime.now().add(const Duration(days: 1)), - DateTime.now().add(const Duration(days: 5))); + clock.now().add(const Duration(days: 1)), + clock.now().add(const Duration(days: 5))); Holiday holidayInThePast = generateHoliday( - DateTime.now().subtract(const Duration(days: 10)), - DateTime.now().subtract(const Duration(days: 5))); + clock.now().subtract(const Duration(days: 10)), + clock.now().subtract(const Duration(days: 5))); holidayCacheData = HolidayCacheData((b) => b ..holidays = ListBuilder([holidayInThePast, holidayInTheFuture]) - ..saved = DateTime.now()); + ..saved = clock.now()); kVstore.setString( HolidayCache.getKeyString(state), holidayCacheData.toJson()); @@ -66,8 +67,8 @@ void main() { expect(cacheResponse.inValidTimeframe, true); }); test("Correctly returns false", () async { - final sixtyDaysBefore = DateTime.now().subtract(const Duration(days: 60)); - final now = DateTime.now(); + final sixtyDaysBefore = clock.now().subtract(const Duration(days: 60)); + final now = clock.now(); var currentTimeReturnedToCache = sixtyDaysBefore; HolidayCache cache = HolidayCache(kVstore, getCurrentTime: () => currentTimeReturnedToCache); diff --git a/app/test/holidays/integration_test.dart b/app/test/holidays/integration_test.dart index ef379590c..68fd2bcb6 100644 --- a/app/test/holidays/integration_test.dart +++ b/app/test/holidays/integration_test.dart @@ -74,7 +74,7 @@ HolidayBloc setupBloc(MockSharezoneAppFunctions szAppFunctions, HolidayApi api = HolidayApi( CloudFunctionHolidayApiClient(szAppFunctions), getCurrentTime: () => currentTime, - ); // Return ended Holidays, as I can't manipulate DateTime.now(). This would lead to flaky tests. + ); // Return ended Holidays, as I can't manipulate clock.now(). This would lead to flaky tests. InMemoryKeyValueStore keyValueStore = InMemoryKeyValueStore(); HolidayCache cache = HolidayCache(keyValueStore, getCurrentTime: () => currentTime); diff --git a/app/test/timetable/timetable_bloc_test.dart b/app/test/timetable/timetable_bloc_test.dart index d1e5c1a3c..7d33f05e6 100644 --- a/app/test/timetable/timetable_bloc_test.dart +++ b/app/test/timetable/timetable_bloc_test.dart @@ -6,6 +6,7 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:common_domain_models/common_domain_models.dart'; import 'package:date/src/date.dart'; import 'package:date/weekday.dart'; @@ -13,7 +14,6 @@ import 'package:date/weektype.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:group_domain_models/group_domain_models.dart'; import 'package:sharezone/calendrical_events/models/calendrical_event.dart'; -import 'package:sharezone/calendrical_events/models/calendrical_event_types.dart'; import 'package:sharezone/timetable/src/bloc/timetable_bloc.dart'; import 'package:sharezone/timetable/src/models/lesson.dart'; import 'package:sharezone/timetable/timetable_page/school_class_filter/school_class_filter_view.dart'; @@ -54,8 +54,8 @@ void main() { teacher: "", weekday: WeekDay.monday, weektype: WeekType.always, - startDate: Date.fromDateTime(DateTime.now()), - endDate: Date.fromDateTime(DateTime.now()), + startDate: Date.fromDateTime(clock.now()), + endDate: Date.fromDateTime(clock.now()), ); } @@ -71,7 +71,7 @@ void main() { date: Date.today(), detail: '', eventID: 'eventId', - eventType: Meeting(), + eventType: EventType.event, latestEditor: '', sendNotification: false, title: 'title', diff --git a/app/test_goldens/calendrical_events/page/past_calendrical_events_page_test.dart b/app/test_goldens/calendrical_events/page/past_calendrical_events_page_test.dart index bdfe013f8..ba2048341 100644 --- a/app/test_goldens/calendrical_events/page/past_calendrical_events_page_test.dart +++ b/app/test_goldens/calendrical_events/page/past_calendrical_events_page_test.dart @@ -104,11 +104,15 @@ void main() { group('without Sharezone Plus', () { setUp(() { - when(controller.state).thenReturn( - const PastCalendricalEventsPageNotUnlockedState( - sortingOrder: EventsSortingOrder.descending, - ), + const state = PastCalendricalEventsPageNotUnlockedState( + sortingOrder: EventsSortingOrder.descending, ); + // Mockito does not support mocking sealed classes yet, so we have to + // provide a dummy implementation of the state. + // + // Ticket: https://github.com/dart-lang/mockito/issues/675 + provideDummy(state); + when(controller.state).thenReturn(state); }); testGoldens('renders correctly (light theme)', (tester) async { diff --git a/app/test_goldens/calendrical_events/page/past_calendrical_events_page_test.mocks.dart b/app/test_goldens/calendrical_events/page/past_calendrical_events_page_test.mocks.dart index 51d60888c..ebf2ee136 100644 --- a/app/test_goldens/calendrical_events/page/past_calendrical_events_page_test.mocks.dart +++ b/app/test_goldens/calendrical_events/page/past_calendrical_events_page_test.mocks.dart @@ -3,31 +3,29 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:ui' as _i16; +import 'dart:ui' as _i15; import 'package:clock/clock.dart' as _i6; -import 'package:date/date.dart' as _i10; -import 'package:group_domain_models/group_domain_models.dart' as _i17; +import 'package:date/date.dart' as _i9; +import 'package:group_domain_models/group_domain_models.dart' as _i16; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i15; +import 'package:mockito/src/dummies.dart' as _i14; import 'package:sharezone/calendrical_events/analytics/past_calendrical_events_page_analytics.dart' as _i7; import 'package:sharezone/calendrical_events/models/calendrical_event.dart' - as _i13; -import 'package:sharezone/calendrical_events/models/calendrical_event_types.dart' - as _i9; + as _i12; import 'package:sharezone/calendrical_events/provider/past_calendrical_events_page_controller.dart' as _i8; import 'package:sharezone/calendrical_events/provider/past_calendrical_events_page_controller_factory.dart' - as _i14; + as _i13; import 'package:sharezone/sharezone_plus/subscription_service/subscription_service.dart' as _i2; import 'package:sharezone/timetable/src/models/lesson_length/lesson_length.dart' - as _i12; + as _i11; import 'package:sharezone/util/api/course_gateway.dart' as _i4; import 'package:sharezone/util/api/school_class_gateway.dart' as _i5; import 'package:sharezone/util/api/timetable_gateway.dart' as _i3; -import 'package:time/time.dart' as _i11; +import 'package:time/time.dart' as _i10; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -117,19 +115,8 @@ class _FakePastCalendricalEventsPageController_6 extends _i1.SmartFake ); } -class _FakeCalendricalEventType_7 extends _i1.SmartFake - implements _i9.CalendricalEventType { - _FakeCalendricalEventType_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeDate_8 extends _i1.SmartFake implements _i10.Date { - _FakeDate_8( +class _FakeDate_7 extends _i1.SmartFake implements _i9.Date { + _FakeDate_7( Object parent, Invocation parentInvocation, ) : super( @@ -138,8 +125,8 @@ class _FakeDate_8 extends _i1.SmartFake implements _i10.Date { ); } -class _FakeTime_9 extends _i1.SmartFake implements _i11.Time { - _FakeTime_9( +class _FakeTime_8 extends _i1.SmartFake implements _i10.Time { + _FakeTime_8( Object parent, Invocation parentInvocation, ) : super( @@ -148,8 +135,8 @@ class _FakeTime_9 extends _i1.SmartFake implements _i11.Time { ); } -class _FakeLessonLength_10 extends _i1.SmartFake implements _i12.LessonLength { - _FakeLessonLength_10( +class _FakeLessonLength_9 extends _i1.SmartFake implements _i11.LessonLength { + _FakeLessonLength_9( Object parent, Invocation parentInvocation, ) : super( @@ -158,8 +145,8 @@ class _FakeLessonLength_10 extends _i1.SmartFake implements _i12.LessonLength { ); } -class _FakeDateTime_11 extends _i1.SmartFake implements DateTime { - _FakeDateTime_11( +class _FakeDateTime_10 extends _i1.SmartFake implements DateTime { + _FakeDateTime_10( Object parent, Invocation parentInvocation, ) : super( @@ -168,9 +155,9 @@ class _FakeDateTime_11 extends _i1.SmartFake implements DateTime { ); } -class _FakeCalendricalEvent_12 extends _i1.SmartFake - implements _i13.CalendricalEvent { - _FakeCalendricalEvent_12( +class _FakeCalendricalEvent_11 extends _i1.SmartFake + implements _i12.CalendricalEvent { + _FakeCalendricalEvent_11( Object parent, Invocation parentInvocation, ) : super( @@ -183,7 +170,7 @@ class _FakeCalendricalEvent_12 extends _i1.SmartFake /// /// See the documentation for Mockito's code generation for more information. class MockPastCalendricalEventsPageControllerFactory extends _i1.Mock - implements _i14.PastCalendricalEventsPageControllerFactory { + implements _i13.PastCalendricalEventsPageControllerFactory { @override _i2.SubscriptionService get subscriptionService => (super.noSuchMethod( Invocation.getter(#subscriptionService), @@ -287,12 +274,12 @@ class MockPastCalendricalEventsPageController extends _i1.Mock @override _i8.PastCalendricalEventsPageState get state => (super.noSuchMethod( Invocation.getter(#state), - returnValue: _i15.dummyValue<_i8.PastCalendricalEventsPageState>( + returnValue: _i14.dummyValue<_i8.PastCalendricalEventsPageState>( this, Invocation.getter(#state), ), returnValueForMissingStub: - _i15.dummyValue<_i8.PastCalendricalEventsPageState>( + _i14.dummyValue<_i8.PastCalendricalEventsPageState>( this, Invocation.getter(#state), ), @@ -376,7 +363,7 @@ class MockPastCalendricalEventsPageController extends _i1.Mock returnValueForMissingStub: null, ); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -384,7 +371,7 @@ class MockPastCalendricalEventsPageController extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -404,15 +391,15 @@ class MockPastCalendricalEventsPageController extends _i1.Mock /// A class which mocks [CalendricalEvent]. /// /// See the documentation for Mockito's code generation for more information. -class MockCalendricalEvent extends _i1.Mock implements _i13.CalendricalEvent { +class MockCalendricalEvent extends _i1.Mock implements _i12.CalendricalEvent { @override String get eventID => (super.noSuchMethod( Invocation.getter(#eventID), - returnValue: _i15.dummyValue( + returnValue: _i14.dummyValue( this, Invocation.getter(#eventID), ), - returnValueForMissingStub: _i15.dummyValue( + returnValueForMissingStub: _i14.dummyValue( this, Invocation.getter(#eventID), ), @@ -420,11 +407,11 @@ class MockCalendricalEvent extends _i1.Mock implements _i13.CalendricalEvent { @override String get groupID => (super.noSuchMethod( Invocation.getter(#groupID), - returnValue: _i15.dummyValue( + returnValue: _i14.dummyValue( this, Invocation.getter(#groupID), ), - returnValueForMissingStub: _i15.dummyValue( + returnValueForMissingStub: _i14.dummyValue( this, Invocation.getter(#groupID), ), @@ -432,77 +419,71 @@ class MockCalendricalEvent extends _i1.Mock implements _i13.CalendricalEvent { @override String get authorID => (super.noSuchMethod( Invocation.getter(#authorID), - returnValue: _i15.dummyValue( + returnValue: _i14.dummyValue( this, Invocation.getter(#authorID), ), - returnValueForMissingStub: _i15.dummyValue( + returnValueForMissingStub: _i14.dummyValue( this, Invocation.getter(#authorID), ), ) as String); @override - _i17.GroupType get groupType => (super.noSuchMethod( + _i16.GroupType get groupType => (super.noSuchMethod( Invocation.getter(#groupType), - returnValue: _i17.GroupType.course, - returnValueForMissingStub: _i17.GroupType.course, - ) as _i17.GroupType); + returnValue: _i16.GroupType.course, + returnValueForMissingStub: _i16.GroupType.course, + ) as _i16.GroupType); @override - _i9.CalendricalEventType get eventType => (super.noSuchMethod( + _i12.EventType get eventType => (super.noSuchMethod( Invocation.getter(#eventType), - returnValue: _FakeCalendricalEventType_7( - this, - Invocation.getter(#eventType), - ), - returnValueForMissingStub: _FakeCalendricalEventType_7( - this, - Invocation.getter(#eventType), - ), - ) as _i9.CalendricalEventType); + returnValue: _i12.EventType.event, + returnValueForMissingStub: _i12.EventType.event, + ) as _i12.EventType); @override - _i10.Date get date => (super.noSuchMethod( + _i9.Date get date => (super.noSuchMethod( Invocation.getter(#date), - returnValue: _FakeDate_8( + returnValue: _FakeDate_7( this, Invocation.getter(#date), ), - returnValueForMissingStub: _FakeDate_8( + returnValueForMissingStub: _FakeDate_7( this, Invocation.getter(#date), ), - ) as _i10.Date); + ) as _i9.Date); @override - _i11.Time get startTime => (super.noSuchMethod( + _i10.Time get startTime => (super.noSuchMethod( Invocation.getter(#startTime), - returnValue: _FakeTime_9( + returnValue: _FakeTime_8( this, Invocation.getter(#startTime), ), - returnValueForMissingStub: _FakeTime_9( + returnValueForMissingStub: _FakeTime_8( this, Invocation.getter(#startTime), ), - ) as _i11.Time); + ) as _i10.Time); @override - _i11.Time get endTime => (super.noSuchMethod( + _i10.Time get endTime => (super.noSuchMethod( Invocation.getter(#endTime), - returnValue: _FakeTime_9( + returnValue: _FakeTime_8( this, Invocation.getter(#endTime), ), - returnValueForMissingStub: _FakeTime_9( + returnValueForMissingStub: _FakeTime_8( this, Invocation.getter(#endTime), ), - ) as _i11.Time); + ) as _i10.Time); @override String get title => (super.noSuchMethod( Invocation.getter(#title), - returnValue: _i15.dummyValue( + returnValue: _i14.dummyValue( this, Invocation.getter(#title), ), - returnValueForMissingStub: _i15.dummyValue( + returnValueForMissingStub: _i14.dummyValue( this, Invocation.getter(#title), ), @@ -514,25 +495,25 @@ class MockCalendricalEvent extends _i1.Mock implements _i13.CalendricalEvent { returnValueForMissingStub: false, ) as bool); @override - _i12.LessonLength get length => (super.noSuchMethod( + _i11.LessonLength get length => (super.noSuchMethod( Invocation.getter(#length), - returnValue: _FakeLessonLength_10( + returnValue: _FakeLessonLength_9( this, Invocation.getter(#length), ), - returnValueForMissingStub: _FakeLessonLength_10( + returnValueForMissingStub: _FakeLessonLength_9( this, Invocation.getter(#length), ), - ) as _i12.LessonLength); + ) as _i11.LessonLength); @override DateTime get startDateTime => (super.noSuchMethod( Invocation.getter(#startDateTime), - returnValue: _FakeDateTime_11( + returnValue: _FakeDateTime_10( this, Invocation.getter(#startDateTime), ), - returnValueForMissingStub: _FakeDateTime_11( + returnValueForMissingStub: _FakeDateTime_10( this, Invocation.getter(#startDateTime), ), @@ -540,11 +521,11 @@ class MockCalendricalEvent extends _i1.Mock implements _i13.CalendricalEvent { @override DateTime get endDateTime => (super.noSuchMethod( Invocation.getter(#endDateTime), - returnValue: _FakeDateTime_11( + returnValue: _FakeDateTime_10( this, Invocation.getter(#endDateTime), ), - returnValueForMissingStub: _FakeDateTime_11( + returnValueForMissingStub: _FakeDateTime_10( this, Invocation.getter(#endDateTime), ), @@ -559,15 +540,15 @@ class MockCalendricalEvent extends _i1.Mock implements _i13.CalendricalEvent { returnValueForMissingStub: {}, ) as Map); @override - _i13.CalendricalEvent copyWith({ + _i12.CalendricalEvent copyWith({ String? eventID, String? groupID, String? authorID, - _i17.GroupType? groupType, - _i9.CalendricalEventType? eventType, - _i10.Date? date, - _i11.Time? startTime, - _i11.Time? endTime, + _i16.GroupType? groupType, + _i12.EventType? eventType, + _i9.Date? date, + _i10.Time? startTime, + _i10.Time? endTime, String? title, String? detail, String? place, @@ -594,7 +575,7 @@ class MockCalendricalEvent extends _i1.Mock implements _i13.CalendricalEvent { #latestEditor: latestEditor, }, ), - returnValue: _FakeCalendricalEvent_12( + returnValue: _FakeCalendricalEvent_11( this, Invocation.method( #copyWith, @@ -616,7 +597,7 @@ class MockCalendricalEvent extends _i1.Mock implements _i13.CalendricalEvent { }, ), ), - returnValueForMissingStub: _FakeCalendricalEvent_12( + returnValueForMissingStub: _FakeCalendricalEvent_11( this, Invocation.method( #copyWith, @@ -638,5 +619,5 @@ class MockCalendricalEvent extends _i1.Mock implements _i13.CalendricalEvent { }, ), ), - ) as _i13.CalendricalEvent); + ) as _i12.CalendricalEvent); } diff --git a/app/test_goldens/dashboard/dashboard_page_test.dart b/app/test_goldens/dashboard/dashboard_page_test.dart index 87bb96918..5b1612e96 100644 --- a/app/test_goldens/dashboard/dashboard_page_test.dart +++ b/app/test_goldens/dashboard/dashboard_page_test.dart @@ -10,13 +10,14 @@ import 'dart:async'; import 'dart:convert'; import 'package:bloc_provider/bloc_provider.dart'; +import 'package:clock/clock.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:golden_toolkit/golden_toolkit.dart'; import 'package:holidays/holidays.dart'; import 'package:intl/intl.dart'; -import 'package:sharezone/holidays/holiday_bloc.dart'; import 'package:sharezone/dashboard/dashboard_page.dart'; +import 'package:sharezone/holidays/holiday_bloc.dart'; import 'package:sharezone_widgets/sharezone_widgets.dart'; class FakeHolidayBloc extends Fake implements HolidayBloc { @@ -42,7 +43,7 @@ void main() { final holidayBloc = FakeHolidayBloc(); addTearDown(holidayBloc.dispose); - final now = DateTime.now(); + final now = clock.now(); final firstHolidays = Holiday.fromJson(jsonEncode({ "start": DateFormat('yyyy-MM-dd').format(now), "end": "${now.year + 1}-02-01", diff --git a/lib/abgabe/abgabe_client_lib/lib/src/erstellung/bloc/homework_user_create_submissions_bloc_factory.dart b/lib/abgabe/abgabe_client_lib/lib/src/erstellung/bloc/homework_user_create_submissions_bloc_factory.dart index a84c59a35..31ce580f8 100644 --- a/lib/abgabe/abgabe_client_lib/lib/src/erstellung/bloc/homework_user_create_submissions_bloc_factory.dart +++ b/lib/abgabe/abgabe_client_lib/lib/src/erstellung/bloc/homework_user_create_submissions_bloc_factory.dart @@ -16,6 +16,7 @@ import 'package:abgabe_client_lib/src/erstellung/use_cases/datei_loescher.dart'; import 'package:abgabe_client_lib/src/erstellung/use_cases/datei_umbenenner.dart'; import 'package:abgabe_http_api/api.dart'; import 'package:bloc_base/bloc_base.dart'; +import 'package:clock/clock.dart'; import 'package:common_domain_models/common_domain_models.dart'; class HomeworkUserCreateSubmissionsBlocFactory extends BlocBase { @@ -59,7 +60,7 @@ class HomeworkUserCreateSubmissionsBlocFactory extends BlocBase { umbenenner, veroeffentlicher, gateway.streamAbgabezeitpunktFuerHausaufgabe(id), - () => DateTime.now(), + () => clock.now(), ); } diff --git a/lib/abgabe/abgabe_client_lib/lib/src/erstellung/cloud_storage_abgabedatei_uploader.dart b/lib/abgabe/abgabe_client_lib/lib/src/erstellung/cloud_storage_abgabedatei_uploader.dart index 82f0f8914..fda44a91c 100644 --- a/lib/abgabe/abgabe_client_lib/lib/src/erstellung/cloud_storage_abgabedatei_uploader.dart +++ b/lib/abgabe/abgabe_client_lib/lib/src/erstellung/cloud_storage_abgabedatei_uploader.dart @@ -12,7 +12,7 @@ import 'package:abgabe_client_lib/src/erstellung/datei_upload_prozess.dart'; import 'package:abgabe_client_lib/src/erstellung/local_file_saver.dart'; import 'package:abgabe_client_lib/src/models/models.dart'; import 'package:abgabe_http_api/api/abgabedatei_api.dart'; - +import 'package:clock/clock.dart'; import 'package:crash_analytics/crash_analytics.dart'; import 'package:files_basics/local_file.dart'; import 'package:filesharing_logic/file_uploader.dart'; @@ -20,7 +20,7 @@ import 'package:filesharing_logic/file_uploader.dart'; import 'uploader/abgabedatei_uploader.dart'; import 'use_cases/abgabedatei_hinzufueger.dart'; -DateTime _lastUploaded = DateTime.now(); +DateTime _lastUploaded = clock.now(); class CloudStorageAbgabedateiUploader extends AbgabedateiUploader { final FileUploader fileUploader; @@ -57,11 +57,11 @@ class CloudStorageAbgabedateiUploader extends AbgabedateiUploader { /// passieren kann, dass das hinzufügen einer Datei "überschrieben" /// also sozusagen rückgängig gemacht wird, wenn die Anfragen parallel /// verarbeitet werden. - while (DateTime.now().difference(_lastUploaded).abs() < + while (clock.now().difference(_lastUploaded).abs() < const Duration(milliseconds: 900)) { await Future.delayed(const Duration(milliseconds: 300)); } - _lastUploaded = DateTime.now(); + _lastUploaded = clock.now(); await _fuegeAbgabedateireferenzZuAbgabeHinzu(befehl); } catch (e, s) { await _logAbgabedateireferenzHinzufuegeError(e, s); diff --git a/lib/abgabe/abgabe_client_lib/pubspec.lock b/lib/abgabe/abgabe_client_lib/pubspec.lock index cd73207ed..da2893ade 100644 --- a/lib/abgabe/abgabe_client_lib/pubspec.lock +++ b/lib/abgabe/abgabe_client_lib/pubspec.lock @@ -142,7 +142,7 @@ packages: source: hosted version: "1.7.0" clock: - dependency: transitive + dependency: "direct main" description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf diff --git a/lib/abgabe/abgabe_client_lib/pubspec.yaml b/lib/abgabe/abgabe_client_lib/pubspec.yaml index 81772cf59..090c7ea31 100644 --- a/lib/abgabe/abgabe_client_lib/pubspec.yaml +++ b/lib/abgabe/abgabe_client_lib/pubspec.yaml @@ -39,6 +39,7 @@ dependencies: meta: ^1.1.8 rxdart: ^0.27.1 collection: ^1.17.2 + clock: ^1.1.1 dev_dependencies: flutter_test: diff --git a/lib/abgabe/abgabe_client_lib/test/bloc_test.dart b/lib/abgabe/abgabe_client_lib/test/bloc_test.dart index e44629070..c7724e5a2 100644 --- a/lib/abgabe/abgabe_client_lib/test/bloc_test.dart +++ b/lib/abgabe/abgabe_client_lib/test/bloc_test.dart @@ -19,15 +19,14 @@ import 'package:abgabe_client_lib/src/erstellung/use_cases/datei_loescher.dart'; import 'package:abgabe_client_lib/src/erstellung/use_cases/datei_umbenenner.dart'; import 'package:abgabe_client_lib/src/erstellung/views.dart'; import 'package:abgabe_client_lib/src/models/models.dart'; - import 'package:async/async.dart'; +import 'package:clock/clock.dart'; import 'package:common_domain_models/common_domain_models.dart'; import 'package:files_basics/files_models.dart'; import 'package:files_basics/local_file.dart'; - -import 'package:test_randomness/test_randomness.dart'; -import 'package:rxdart/subjects.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:rxdart/subjects.dart'; +import 'package:test_randomness/test_randomness.dart'; void main() { group( @@ -753,9 +752,9 @@ void main() { }); test('Die Dateien werden nach hinzufuegedatum sortiert.', () async { - final now = DateTime.now(); + final now = clock.now(); abgabezeitpunktStream.add(now.add(const Duration(days: 20))); - kriegeAktuelleZeit = () => DateTime.now(); + kriegeAktuelleZeit = () => clock.now(); useCases.abgabe.add( erstelleAbgabenModelSnapshot(abgegeben: false, abgabedateien: [ @@ -853,7 +852,7 @@ HochgeladeneAbgabedatei hochgeladeneAbgabedatei({ groesse: Dateigroesse(12345), downloadUrl: DateiDownloadUrl('https://some-url.com'), // Sollte letzte sein (auch wenn es eigentlich nicht sein) - erstellungsdatum: erstellungsdatum ?? DateTime.now(), + erstellungsdatum: erstellungsdatum ?? clock.now(), ); } @@ -864,7 +863,7 @@ ErstellerAbgabeModelSnapshot erstelleAbgabenModelSnapshot( abgabeId: AbgabeId( AbgabezielId.homework(HomeworkId('ValidHomeworkId')), UserId('ValidUserId')), - abgegebenUm: abgegeben ? DateTime.now() : null, + abgegebenUm: abgegeben ? clock.now() : null, abgabedateien: abgabedateien) .toSnapshot(); } diff --git a/lib/authentification/authentification_qrcode/lib/src/logic/qr_code_user_authenticator.dart b/lib/authentification/authentification_qrcode/lib/src/logic/qr_code_user_authenticator.dart index b0b311c50..5c1e513e9 100644 --- a/lib/authentification/authentification_qrcode/lib/src/logic/qr_code_user_authenticator.dart +++ b/lib/authentification/authentification_qrcode/lib/src/logic/qr_code_user_authenticator.dart @@ -7,7 +7,9 @@ // SPDX-License-Identifier: EUPL-1.2 import 'package:app_functions/sharezone_app_functions.dart'; +import 'package:clock/clock.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; + import '../models/qr_sign_in_document.dart'; import '../models/qr_sign_in_state.dart'; @@ -48,7 +50,7 @@ class QrCodeUserAuthenticator { final qrSignInDocument = QrSignInDocument( qrId: qrId, publicKey: publicKey, - created: DateTime.now(), + created: clock.now(), ); _qrSignInCollection.doc(qrId).set(qrSignInDocument.toData()); return qrId; diff --git a/lib/authentification/authentification_qrcode/pubspec.lock b/lib/authentification/authentification_qrcode/pubspec.lock index 6d85126eb..7bcf2d604 100644 --- a/lib/authentification/authentification_qrcode/pubspec.lock +++ b/lib/authentification/authentification_qrcode/pubspec.lock @@ -101,7 +101,7 @@ packages: source: hosted version: "1.3.0" clock: - dependency: transitive + dependency: "direct main" description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf diff --git a/lib/authentification/authentification_qrcode/pubspec.yaml b/lib/authentification/authentification_qrcode/pubspec.yaml index 7c0883ec7..7373cdd09 100644 --- a/lib/authentification/authentification_qrcode/pubspec.yaml +++ b/lib/authentification/authentification_qrcode/pubspec.yaml @@ -35,6 +35,7 @@ dependencies: fast_rsa: ^3.6.1 firebase_auth: ^4.7.3 rxdart: ^0.27.1 + clock: ^1.1.1 dev_dependencies: flutter_test: diff --git a/lib/cloud_firestore_helper/lib/src/cloud_firestore_helper.dart b/lib/cloud_firestore_helper/lib/src/cloud_firestore_helper.dart index d8d6b968a..8e8c3ca27 100644 --- a/lib/cloud_firestore_helper/lib/src/cloud_firestore_helper.dart +++ b/lib/cloud_firestore_helper/lib/src/cloud_firestore_helper.dart @@ -6,6 +6,8 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; + typedef ObjectMapBuilder = T Function(String key, dynamic decodedMapValue); typedef ObjectListBuilder = T Function(dynamic decodedMapValue); @@ -42,7 +44,7 @@ List decodeList(dynamic data, ObjectListBuilder builder) { /// behavior is legacy and shouldn't be used anymore. DateTime dateTimeFromTimestamp(dynamic timestamp) { final dateTime = dateTimeFromTimestampOrNull(timestamp); - return dateTime ?? DateTime.now(); + return dateTime ?? clock.now(); } DateTime? dateTimeFromTimestampOrNull(dynamic timestamp) { diff --git a/lib/cloud_firestore_helper/pubspec.lock b/lib/cloud_firestore_helper/pubspec.lock index 60a125941..b1201c533 100644 --- a/lib/cloud_firestore_helper/pubspec.lock +++ b/lib/cloud_firestore_helper/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + clock: + dependency: "direct main" + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" flutter_lints: dependency: transitive description: diff --git a/lib/cloud_firestore_helper/pubspec.yaml b/lib/cloud_firestore_helper/pubspec.yaml index 266976927..b46649772 100644 --- a/lib/cloud_firestore_helper/pubspec.yaml +++ b/lib/cloud_firestore_helper/pubspec.yaml @@ -20,3 +20,6 @@ environment: dev_dependencies: sharezone_lints: path: ../sharezone_lints + +dependencies: + clock: ^1.1.1 diff --git a/lib/date/lib/src/date.dart b/lib/date/lib/src/date.dart index f782ed740..664a4f00f 100644 --- a/lib/date/lib/src/date.dart +++ b/lib/date/lib/src/date.dart @@ -6,7 +6,9 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:intl/intl.dart'; + import 'weekday.dart'; class Date { @@ -31,7 +33,7 @@ class Date { return Date._(dateTime.toIso8601String().substring(0, 10)); } - factory Date.today() => Date.fromDateTime(DateTime.now()); + factory Date.today() => Date.fromDateTime(clock.now()); /// Gibt das aktuelle [Date] als Stream zurück. /// diff --git a/lib/date/pubspec.lock b/lib/date/pubspec.lock index ae3524d2f..e6e271e78 100644 --- a/lib/date/pubspec.lock +++ b/lib/date/pubspec.lock @@ -10,7 +10,7 @@ packages: source: hosted version: "1.3.0" clock: - dependency: transitive + dependency: "direct main" description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf diff --git a/lib/date/pubspec.yaml b/lib/date/pubspec.yaml index d2e193fd2..020f1fc04 100644 --- a/lib/date/pubspec.yaml +++ b/lib/date/pubspec.yaml @@ -19,6 +19,7 @@ dependencies: rxdart: ^0.27.1 flutter: sdk: flutter + clock: ^1.1.1 dev_dependencies: sharezone_lints: diff --git a/lib/filesharing/filesharing_logic/lib/src/models/cloud_file.dart b/lib/filesharing/filesharing_logic/lib/src/models/cloud_file.dart index ae1416d05..a9f8217eb 100644 --- a/lib/filesharing/filesharing_logic/lib/src/models/cloud_file.dart +++ b/lib/filesharing/filesharing_logic/lib/src/models/cloud_file.dart @@ -6,9 +6,10 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:files_basics/files_models.dart'; import 'package:cloud_firestore_helper/cloud_firestore_helper.dart'; +import 'package:files_basics/files_models.dart'; import 'change_activity.dart'; import 'folder_path.dart'; @@ -83,7 +84,7 @@ class CloudFile { name: '', downloadURL: null, thumbnailURL: null, - createdOn: DateTime.now(), + createdOn: clock.now(), sizeBytes: null, fileFormat: FileFormat.unknown, forUsers: {}, diff --git a/lib/filesharing/filesharing_logic/pubspec.lock b/lib/filesharing/filesharing_logic/pubspec.lock index 6a09a158d..730287124 100644 --- a/lib/filesharing/filesharing_logic/pubspec.lock +++ b/lib/filesharing/filesharing_logic/pubspec.lock @@ -64,7 +64,7 @@ packages: source: hosted version: "1.7.0" clock: - dependency: transitive + dependency: "direct main" description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf diff --git a/lib/filesharing/filesharing_logic/pubspec.yaml b/lib/filesharing/filesharing_logic/pubspec.yaml index 6dd03310f..97a6c03fc 100644 --- a/lib/filesharing/filesharing_logic/pubspec.yaml +++ b/lib/filesharing/filesharing_logic/pubspec.yaml @@ -33,6 +33,7 @@ dependencies: permission_handler: ^11.1.0 helper_functions: path: ../../helper_functions + clock: ^1.1.1 dev_dependencies: flutter_test: diff --git a/lib/firebase_hausaufgabenheft_logik/lib/src/homework_dto.dart b/lib/firebase_hausaufgabenheft_logik/lib/src/homework_dto.dart index f36ba3d13..aba542866 100644 --- a/lib/firebase_hausaufgabenheft_logik/lib/src/homework_dto.dart +++ b/lib/firebase_hausaufgabenheft_logik/lib/src/homework_dto.dart @@ -6,9 +6,10 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:collection/collection.dart'; import 'package:cloud_firestore_helper/cloud_firestore_helper.dart'; +import 'package:collection/collection.dart'; class HomeworkDto { final String id; @@ -128,7 +129,7 @@ class HomeworkDto { description: "", withSubmissions: false, submitters: [], - todoUntil: DateTime.now(), + todoUntil: clock.now(), createdOn: null, attachments: [], private: false, diff --git a/lib/firebase_hausaufgabenheft_logik/pubspec.lock b/lib/firebase_hausaufgabenheft_logik/pubspec.lock index baadf80a5..75545d957 100644 --- a/lib/firebase_hausaufgabenheft_logik/pubspec.lock +++ b/lib/firebase_hausaufgabenheft_logik/pubspec.lock @@ -65,7 +65,7 @@ packages: source: hosted version: "1.3.0" clock: - dependency: transitive + dependency: "direct main" description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf diff --git a/lib/firebase_hausaufgabenheft_logik/pubspec.yaml b/lib/firebase_hausaufgabenheft_logik/pubspec.yaml index 4d7832a02..5fc1a355b 100644 --- a/lib/firebase_hausaufgabenheft_logik/pubspec.yaml +++ b/lib/firebase_hausaufgabenheft_logik/pubspec.yaml @@ -27,6 +27,7 @@ dependencies: cloud_firestore: ^4.8.5 flutter: sdk: flutter + clock: ^1.1.1 dev_dependencies: rxdart: ^0.27.1 diff --git a/lib/firebase_hausaufgabenheft_logik/test/lazy_loading_controller_test.dart b/lib/firebase_hausaufgabenheft_logik/test/lazy_loading_controller_test.dart index bec652661..11c176af8 100644 --- a/lib/firebase_hausaufgabenheft_logik/test/lazy_loading_controller_test.dart +++ b/lib/firebase_hausaufgabenheft_logik/test/lazy_loading_controller_test.dart @@ -8,11 +8,13 @@ import 'dart:async'; +import 'package:clock/clock.dart'; import 'package:common_domain_models/common_domain_models.dart'; import 'package:firebase_hausaufgabenheft_logik/src/realtime_updating_lazy_loading_controller.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:rxdart/subjects.dart' as rx; import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart'; +import 'package:rxdart/subjects.dart' as rx; + import 'in_memory_homework_loader.dart'; class ReportingInMemoryHomeworkLoader extends InMemoryHomeworkLoader { @@ -31,7 +33,7 @@ List listOfHomeworksWithLength(int length) => List.generate( length, (index) => HomeworkReadModel( id: HomeworkId("$index"), - todoDate: DateTime.now(), + todoDate: clock.now(), status: CompletionStatus.completed, subject: Subject("Mathe", abbreviation: 'Ma'), title: const Title("ABC"), diff --git a/lib/group_domain_models/lib/src/models/member.dart b/lib/group_domain_models/lib/src/models/member.dart index 4474fbeb5..b848a23a5 100644 --- a/lib/group_domain_models/lib/src/models/member.dart +++ b/lib/group_domain_models/lib/src/models/member.dart @@ -6,9 +6,10 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; +import 'package:cloud_firestore_helper/cloud_firestore_helper.dart'; import 'package:common_domain_models/common_domain_models.dart'; import 'package:flutter/foundation.dart'; -import 'package:cloud_firestore_helper/cloud_firestore_helper.dart'; import 'package:user/user.dart'; import 'member_role.dart'; @@ -41,7 +42,7 @@ class MemberData { abbreviation: generateAbbreviation(user.name), role: role, typeOfUser: user.typeOfUser, - joinedOn: DateTime.now(), + joinedOn: clock.now(), ); } diff --git a/lib/group_domain_models/pubspec.lock b/lib/group_domain_models/pubspec.lock index 74dbd539f..011f5c53f 100644 --- a/lib/group_domain_models/pubspec.lock +++ b/lib/group_domain_models/pubspec.lock @@ -64,7 +64,7 @@ packages: source: hosted version: "1.3.0" clock: - dependency: transitive + dependency: "direct main" description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf diff --git a/lib/group_domain_models/pubspec.yaml b/lib/group_domain_models/pubspec.yaml index 212775cd9..ce2748f3c 100644 --- a/lib/group_domain_models/pubspec.yaml +++ b/lib/group_domain_models/pubspec.yaml @@ -27,6 +27,7 @@ dependencies: path: ../design flutter: sdk: flutter + clock: ^1.1.1 dev_dependencies: flutter_test: diff --git a/lib/hausaufgabenheft_logik/lib/src/models/date.dart b/lib/hausaufgabenheft_logik/lib/src/models/date.dart index 91730749b..d0f1896e6 100644 --- a/lib/hausaufgabenheft_logik/lib/src/models/date.dart +++ b/lib/hausaufgabenheft_logik/lib/src/models/date.dart @@ -6,6 +6,8 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; + class Date implements Comparable { final int day; final int month; @@ -18,7 +20,7 @@ class Date implements Comparable { }); factory Date.now() { - final now = DateTime.now(); + final now = clock.now(); return Date(day: now.day, month: now.month, year: now.year); } diff --git a/lib/hausaufgabenheft_logik/lib/src/setup/create_homework_page_bloc.dart b/lib/hausaufgabenheft_logik/lib/src/setup/create_homework_page_bloc.dart index a4a61d01f..cfac84e32 100644 --- a/lib/hausaufgabenheft_logik/lib/src/setup/create_homework_page_bloc.dart +++ b/lib/hausaufgabenheft_logik/lib/src/setup/create_homework_page_bloc.dart @@ -6,19 +6,20 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:hausaufgabenheft_logik/src/homework_completion/homework_page_completion_dispatcher.dart'; -import 'package:hausaufgabenheft_logik/src/student_homework_page_bloc/homework_sorting_cache.dart'; import 'package:hausaufgabenheft_logik/src/open_homeworks/open_homework_list_bloc/open_homework_list_bloc.dart'; import 'package:hausaufgabenheft_logik/src/open_homeworks/open_homework_view_bloc/open_homework_view_bloc.dart'; +import 'package:hausaufgabenheft_logik/src/student_homework_page_bloc/homework_sorting_cache.dart'; import '../completed_homeworks/completed_homeworks_view_bloc/completed_homeworks_view_bloc.dart'; import '../completed_homeworks/lazy_loading_completed_homeworks_bloc/lazy_loading_completed_homeworks_bloc.dart'; import '../completed_homeworks/views/completed_homework_list_view_factory.dart'; -import '../student_homework_page_bloc/student_homework_page_bloc.dart'; import '../models/homework/models_used_by_homework.dart'; import '../open_homeworks/sort_and_subcategorization/sort_and_subcategorizer.dart'; import '../open_homeworks/sort_and_subcategorization/subcategorizer_factory.dart'; import '../open_homeworks/views/open_homework_list_view_factory.dart'; +import '../student_homework_page_bloc/student_homework_page_bloc.dart'; import '../views/student_homework_view_factory.dart'; import 'config.dart'; import 'dependencies.dart'; @@ -54,6 +55,6 @@ HomeworkPageBloc createHomeworkPageBloc( completedHomeworksViewBloc: completedHomeworksViewBloc, homeworkCompletionReceiver: homeworkPageCompletionReceiver, homeworkSortingCache: HomeworkSortingCache(dependencies.keyValueStore), - getCurrentDateTime: dependencies.getCurrentDateTime ?? () => DateTime.now(), + getCurrentDateTime: dependencies.getCurrentDateTime ?? () => clock.now(), ); } diff --git a/lib/hausaufgabenheft_logik/pubspec.lock b/lib/hausaufgabenheft_logik/pubspec.lock index bbf0aabd0..af545a917 100644 --- a/lib/hausaufgabenheft_logik/pubspec.lock +++ b/lib/hausaufgabenheft_logik/pubspec.lock @@ -65,7 +65,7 @@ packages: source: hosted version: "2.1.1" clock: - dependency: transitive + dependency: "direct main" description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf diff --git a/lib/hausaufgabenheft_logik/pubspec.yaml b/lib/hausaufgabenheft_logik/pubspec.yaml index e4584efb8..a39969ea1 100644 --- a/lib/hausaufgabenheft_logik/pubspec.yaml +++ b/lib/hausaufgabenheft_logik/pubspec.yaml @@ -30,6 +30,7 @@ dependencies: # https://gitlab.com/codingbrain/sharezone/sharezone-app/-/issues/1460 test_randomness: path: ../test_randomness + clock: ^1.1.1 dev_dependencies: async: ^2.11.0 diff --git a/lib/hausaufgabenheft_logik/test/date/date_test.dart b/lib/hausaufgabenheft_logik/test/date/date_test.dart index 3b5751b71..f1b3db911 100644 --- a/lib/hausaufgabenheft_logik/test/date/date_test.dart +++ b/lib/hausaufgabenheft_logik/test/date/date_test.dart @@ -6,6 +6,7 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:clock/clock.dart'; import 'package:hausaufgabenheft_logik/src/models/date.dart'; import 'package:test/test.dart'; @@ -50,7 +51,7 @@ void main() { test('Date.now', () { final now = Date.now(); - var nowDateTime = DateTime.now(); + var nowDateTime = clock.now(); expect(now.year, nowDateTime.year); expect(now.month, nowDateTime.month); expect(now.day, nowDateTime.day); diff --git a/lib/hausaufgabenheft_logik/test/homework_page_bloc_test.dart b/lib/hausaufgabenheft_logik/test/homework_page_bloc_test.dart index 815ce3a43..a1652b449 100644 --- a/lib/hausaufgabenheft_logik/test/homework_page_bloc_test.dart +++ b/lib/hausaufgabenheft_logik/test/homework_page_bloc_test.dart @@ -10,6 +10,7 @@ import 'dart:async'; import 'dart:developer'; import 'package:bloc/bloc.dart'; +import 'package:clock/clock.dart'; import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart'; import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik_setup.dart'; import 'package:hausaufgabenheft_logik/src/completed_homeworks/completed_homeworks_view_bloc/completed_homeworks_view_bloc.dart' @@ -338,7 +339,7 @@ void main() { 'should show dialog to check all completed homework when more than 2 open overdue homeworks', () async { final yesterday = - Date.fromDateTime(DateTime.now().subtract(const Duration(days: 1))); + Date.fromDateTime(clock.now().subtract(const Duration(days: 1))); final homeworks = List.generate( 3, (_) => createHomework(done: false, todoDate: yesterday)); @@ -352,9 +353,9 @@ void main() { 'does not show dialog to check all completed homework with less than 3 overdue homeworks', () async { final yesterday = - Date.fromDateTime(DateTime.now().subtract(const Duration(days: 1))); + Date.fromDateTime(clock.now().subtract(const Duration(days: 1))); final tomorrow = - Date.fromDateTime(DateTime.now().add(const Duration(days: 1))); + Date.fromDateTime(clock.now().add(const Duration(days: 1))); final homeworks = [ ...List.generate( diff --git a/lib/holidays/lib/src/holiday_cache.dart b/lib/holidays/lib/src/holiday_cache.dart index 853536a46..f2c1e159f 100644 --- a/lib/holidays/lib/src/holiday_cache.dart +++ b/lib/holidays/lib/src/holiday_cache.dart @@ -7,7 +7,9 @@ // SPDX-License-Identifier: EUPL-1.2 import 'package:built_collection/built_collection.dart'; +import 'package:clock/clock.dart'; import 'package:key_value_store/key_value_store.dart'; + import 'api/holiday.dart'; import 'state.dart'; @@ -21,7 +23,7 @@ class HolidayCache { HolidayCache(this.cache, {this.maxValidDurationTillLastSaved = const Duration(days: 30), this.getCurrentTime}) { - getCurrentTime ??= () => DateTime.now(); + getCurrentTime ??= () => clock.now(); } CacheResponse? load(State state) { diff --git a/lib/holidays/pubspec.lock b/lib/holidays/pubspec.lock index 87635c68d..1c7332ce7 100644 --- a/lib/holidays/pubspec.lock +++ b/lib/holidays/pubspec.lock @@ -144,7 +144,7 @@ packages: source: hosted version: "2.0.3" clock: - dependency: transitive + dependency: "direct main" description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf diff --git a/lib/holidays/pubspec.yaml b/lib/holidays/pubspec.yaml index c0fd2c953..3a806cd80 100644 --- a/lib/holidays/pubspec.yaml +++ b/lib/holidays/pubspec.yaml @@ -23,6 +23,7 @@ dependencies: cloud_functions: ^4.4.0 app_functions: path: ../app_functions + clock: ^1.1.1 dev_dependencies: # We need to add the `flutter` package as dev dependency as workaround for the diff --git a/lib/sharezone_widgets/lib/src/widgets.dart b/lib/sharezone_widgets/lib/src/widgets.dart index 8e014cae1..630708dc5 100644 --- a/lib/sharezone_widgets/lib/src/widgets.dart +++ b/lib/sharezone_widgets/lib/src/widgets.dart @@ -9,9 +9,10 @@ import 'dart:async'; import 'dart:developer'; +import 'package:clock/clock.dart'; import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; import 'package:helper_functions/helper_functions.dart'; +import 'package:intl/intl.dart'; import 'package:sharezone_widgets/sharezone_widgets.dart'; export 'prefilled_text_field.dart'; @@ -66,7 +67,7 @@ class DatePicker extends StatelessWidget { Future _selectDate(BuildContext context) async { FocusManager.instance.primaryFocus?.unfocus(); final DateTime tomorrow = - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day) + DateTime(clock.now().year, clock.now().month, clock.now().day) .add(const Duration(days: 1)); final DateTime? picked = await showDatePicker( context: context, diff --git a/lib/sharezone_widgets/pubspec.lock b/lib/sharezone_widgets/pubspec.lock index 9ec132a39..7bfe6c06c 100644 --- a/lib/sharezone_widgets/pubspec.lock +++ b/lib/sharezone_widgets/pubspec.lock @@ -41,7 +41,7 @@ packages: source: hosted version: "1.3.0" clock: - dependency: transitive + dependency: "direct main" description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf diff --git a/lib/sharezone_widgets/pubspec.yaml b/lib/sharezone_widgets/pubspec.yaml index 554673a67..07f19a6d3 100644 --- a/lib/sharezone_widgets/pubspec.yaml +++ b/lib/sharezone_widgets/pubspec.yaml @@ -29,6 +29,7 @@ dependencies: rxdart: ^0.27.1 flutter: sdk: flutter + clock: ^1.1.1 dev_dependencies: flutter_test: diff --git a/tools/sz_repo_cli/lib/src/common/src/concurrent_command.dart b/tools/sz_repo_cli/lib/src/common/src/concurrent_command.dart index a0151f3eb..541d78d0d 100644 --- a/tools/sz_repo_cli/lib/src/common/src/concurrent_command.dart +++ b/tools/sz_repo_cli/lib/src/common/src/concurrent_command.dart @@ -9,6 +9,7 @@ import 'dart:async'; import 'dart:io'; +import 'package:clock/clock.dart'; import 'package:sz_repo_cli/src/common/common.dart'; /// Run a task via [runTaskForPackage] for many [Package] concurrently. @@ -91,7 +92,7 @@ abstract class ConcurrentCommand extends CommandBase { : null; final taskRunner = ConcurrentPackageTaskRunner( - getCurrentDateTime: () => DateTime.now(), + getCurrentDateTime: () => clock.now(), ); final res = taskRunner diff --git a/tools/sz_repo_cli/lib/src/common/src/concurrent_package_task_runner.dart b/tools/sz_repo_cli/lib/src/common/src/concurrent_package_task_runner.dart index 5a647a8cb..5f651cd1d 100644 --- a/tools/sz_repo_cli/lib/src/common/src/concurrent_package_task_runner.dart +++ b/tools/sz_repo_cli/lib/src/common/src/concurrent_package_task_runner.dart @@ -10,6 +10,7 @@ import 'dart:async'; import 'dart:collection'; import 'dart:io'; +import 'package:clock/clock.dart'; import 'package:rxdart/subjects.dart'; import 'package:rxdart/transformers.dart'; import 'package:sz_repo_cli/src/common/common.dart'; @@ -20,7 +21,7 @@ class ConcurrentPackageTaskRunner { ConcurrentPackageTaskRunner({ DateTime Function()? getCurrentDateTime, }) { - _getCurrentDateTime = getCurrentDateTime ?? () => DateTime.now(); + _getCurrentDateTime = getCurrentDateTime ?? () => clock.now(); } /// Run [runTask] for every [Package] emitted by the [packageStream]. diff --git a/tools/sz_repo_cli/pubspec.lock b/tools/sz_repo_cli/pubspec.lock index c7019dd11..fc669c965 100644 --- a/tools/sz_repo_cli/pubspec.lock +++ b/tools/sz_repo_cli/pubspec.lock @@ -57,6 +57,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.0" + clock: + dependency: "direct main" + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" collection: dependency: transitive description: diff --git a/tools/sz_repo_cli/pubspec.yaml b/tools/sz_repo_cli/pubspec.yaml index 40cadc575..576be3455 100644 --- a/tools/sz_repo_cli/pubspec.yaml +++ b/tools/sz_repo_cli/pubspec.yaml @@ -34,6 +34,7 @@ dependencies: process: ^5.0.1 process_runner: ^4.1.4 file: ^7.0.0 + clock: ^1.1.1 dev_dependencies: sharezone_lints: