From 54b02b32522aca419438436b4e5492c59e6e15ae Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Sun, 24 Dec 2023 17:42:09 +0000 Subject: [PATCH 01/10] Implement auto-serialization --- .../all_course_units_fetcher.dart | 2 + uni/lib/controller/fetchers/exam_fetcher.dart | 6 +- .../local_storage/app_calendar_database.dart | 2 +- .../app_course_units_database.dart | 2 +- .../local_storage/app_courses_database.dart | 2 +- .../local_storage/app_database.dart | 1 - .../local_storage/app_exams_database.dart | 4 +- .../local_storage/app_lectures_database.dart | 2 +- .../app_library_occupation_database.dart | 2 +- .../app_references_database.dart | 2 +- .../app_restaurant_database.dart | 2 +- .../local_storage/app_shared_preferences.dart | 1 - uni/lib/model/entities/bug_report.dart | 34 ++- uni/lib/model/entities/bug_report.g.dart | 23 ++ uni/lib/model/entities/bus.dart | 20 +- uni/lib/model/entities/bus.g.dart | 19 ++ uni/lib/model/entities/bus_stop.dart | 9 + uni/lib/model/entities/bus_stop.g.dart | 25 +++ uni/lib/model/entities/calendar_event.dart | 17 +- uni/lib/model/entities/calendar_event.g.dart | 19 ++ uni/lib/model/entities/course.dart | 48 ++--- uni/lib/model/entities/course.g.dart | 33 +++ .../entities/course_units/course_unit.dart | 75 +++---- .../entities/course_units/course_unit.g.dart | 44 ++++ uni/lib/model/entities/exam.dart | 85 ++++++-- uni/lib/model/entities/exam.g.dart | 27 +++ uni/lib/model/entities/lecture.dart | 60 +++--- uni/lib/model/entities/lecture.g.dart | 31 +++ .../model/entities/library_occupation.dart | 24 ++- .../model/entities/library_occupation.g.dart | 36 ++++ uni/lib/model/entities/location_group.dart | 17 +- uni/lib/model/entities/location_group.g.dart | 21 ++ uni/lib/model/entities/meal.dart | 37 +++- uni/lib/model/entities/meal.g.dart | 31 +++ uni/lib/model/entities/profile.dart | 5 +- uni/lib/model/entities/reference.dart | 35 ++- uni/lib/model/entities/reference.g.dart | 23 ++ uni/lib/model/entities/restaurant.dart | 29 ++- uni/lib/model/entities/restaurant.g.dart | 35 +++ uni/lib/model/entities/trip.dart | 18 +- uni/lib/model/entities/trip.g.dart | 19 ++ .../model/providers/lazy/exam_provider.dart | 2 +- uni/lib/view/bug_report/widgets/form.dart | 4 +- .../view/bug_report/widgets/text_field.dart | 1 + uni/lib/view/exams/widgets/exam_row.dart | 4 +- uni/lib/view/home/widgets/exam_card.dart | 2 +- uni/pubspec.lock | 200 ++++++++++-------- uni/pubspec.yaml | 4 +- .../src/exams_page_test.mocks.dart | 14 ++ .../src/schedule_page_test.mocks.dart | 43 +++- .../providers/exams_provider_test.mocks.dart | 15 ++ .../lecture_provider_test.mocks.dart | 16 ++ 52 files changed, 914 insertions(+), 318 deletions(-) create mode 100644 uni/lib/model/entities/bug_report.g.dart create mode 100644 uni/lib/model/entities/bus.g.dart create mode 100644 uni/lib/model/entities/bus_stop.g.dart create mode 100644 uni/lib/model/entities/calendar_event.g.dart create mode 100644 uni/lib/model/entities/course.g.dart create mode 100644 uni/lib/model/entities/course_units/course_unit.g.dart create mode 100644 uni/lib/model/entities/exam.g.dart create mode 100644 uni/lib/model/entities/lecture.g.dart create mode 100644 uni/lib/model/entities/library_occupation.g.dart create mode 100644 uni/lib/model/entities/location_group.g.dart create mode 100644 uni/lib/model/entities/meal.g.dart create mode 100644 uni/lib/model/entities/reference.g.dart create mode 100644 uni/lib/model/entities/restaurant.g.dart create mode 100644 uni/lib/model/entities/trip.g.dart diff --git a/uni/lib/controller/fetchers/course_units_fetcher/all_course_units_fetcher.dart b/uni/lib/controller/fetchers/course_units_fetcher/all_course_units_fetcher.dart index c84932de1..02d2f18d3 100644 --- a/uni/lib/controller/fetchers/course_units_fetcher/all_course_units_fetcher.dart +++ b/uni/lib/controller/fetchers/course_units_fetcher/all_course_units_fetcher.dart @@ -1,3 +1,5 @@ + +import 'package:logger/logger.dart'; import 'package:uni/controller/networking/network_router.dart'; import 'package:uni/controller/parsers/parser_course_units.dart'; import 'package:uni/model/entities/course.dart'; diff --git a/uni/lib/controller/fetchers/exam_fetcher.dart b/uni/lib/controller/fetchers/exam_fetcher.dart index 9231eff88..a9d0d5a09 100644 --- a/uni/lib/controller/fetchers/exam_fetcher.dart +++ b/uni/lib/controller/fetchers/exam_fetcher.dart @@ -42,11 +42,11 @@ class ExamFetcher implements SessionDependantFetcher { final exams = {}; for (final courseExam in courseExams) { for (final uc in userUcs) { - if (!courseExam.type.contains( + if (!courseExam.examType.contains( '''Exames ao abrigo de estatutos especiais - Port.Est.Especiais''', ) && - courseExam.type != 'EE' && - courseExam.type != 'EAE' && + courseExam.examType != 'EE' && + courseExam.examType != 'EAE' && courseExam.subject == uc.abbreviation && uc.enrollmentIsValid() && !courseExam.hasEnded()) { diff --git a/uni/lib/controller/local_storage/app_calendar_database.dart b/uni/lib/controller/local_storage/app_calendar_database.dart index b8674e2b9..7bfec4b97 100644 --- a/uni/lib/controller/local_storage/app_calendar_database.dart +++ b/uni/lib/controller/local_storage/app_calendar_database.dart @@ -16,7 +16,7 @@ class CalendarDatabase extends AppDatabase { await db.transaction((txn) async { await txn.delete('CALENDAR'); for (final event in calendar) { - await txn.insert('CALENDAR', event.toMap()); + await txn.insert('CALENDAR', event.toJson()); } }); } diff --git a/uni/lib/controller/local_storage/app_course_units_database.dart b/uni/lib/controller/local_storage/app_course_units_database.dart index c9968845a..97d735291 100644 --- a/uni/lib/controller/local_storage/app_course_units_database.dart +++ b/uni/lib/controller/local_storage/app_course_units_database.dart @@ -46,7 +46,7 @@ class AppCourseUnitsDatabase extends AppDatabase { for (final courseUnit in courseUnits) { await insertInDatabase( 'course_units', - courseUnit.toMap(), + courseUnit.toJson(), conflictAlgorithm: ConflictAlgorithm.replace, ); } diff --git a/uni/lib/controller/local_storage/app_courses_database.dart b/uni/lib/controller/local_storage/app_courses_database.dart index db7d9ac6a..6af4640bc 100644 --- a/uni/lib/controller/local_storage/app_courses_database.dart +++ b/uni/lib/controller/local_storage/app_courses_database.dart @@ -51,7 +51,7 @@ class AppCoursesDatabase extends AppDatabase { for (final course in courses) { await insertInDatabase( 'courses', - course.toMap(), + course.toJson(), conflictAlgorithm: ConflictAlgorithm.replace, ); } diff --git a/uni/lib/controller/local_storage/app_database.dart b/uni/lib/controller/local_storage/app_database.dart index bcb3b56c5..2b9af3c51 100644 --- a/uni/lib/controller/local_storage/app_database.dart +++ b/uni/lib/controller/local_storage/app_database.dart @@ -48,7 +48,6 @@ class AppDatabase { await lock.synchronized( () async { final db = await getDatabase(); - await db.insert( table, values, diff --git a/uni/lib/controller/local_storage/app_exams_database.dart b/uni/lib/controller/local_storage/app_exams_database.dart index 6d86a01c7..eb9bb05cb 100644 --- a/uni/lib/controller/local_storage/app_exams_database.dart +++ b/uni/lib/controller/local_storage/app_exams_database.dart @@ -59,9 +59,11 @@ CREATE TABLE exams(id TEXT, subject TEXT, begin TEXT, end TEXT, /// If a row with the same data is present, it will be replaced. Future _insertExams(List exams) async { for (final exam in exams) { + final examJson = exam.toJson(); + examJson['rooms'] = (examJson['rooms'] as List).join(','); await insertInDatabase( 'exams', - exam.toMap(), + examJson, conflictAlgorithm: ConflictAlgorithm.replace, ); } diff --git a/uni/lib/controller/local_storage/app_lectures_database.dart b/uni/lib/controller/local_storage/app_lectures_database.dart index 7430020e5..d1cec76d3 100644 --- a/uni/lib/controller/local_storage/app_lectures_database.dart +++ b/uni/lib/controller/local_storage/app_lectures_database.dart @@ -54,7 +54,7 @@ CREATE TABLE lectures(subject TEXT, typeClass TEXT, for (final lec in lecs) { await insertInDatabase( 'lectures', - lec.toMap(), + lec.toJson(), conflictAlgorithm: ConflictAlgorithm.replace, ); } diff --git a/uni/lib/controller/local_storage/app_library_occupation_database.dart b/uni/lib/controller/local_storage/app_library_occupation_database.dart index a4ab4b35a..01ebbcb9d 100644 --- a/uni/lib/controller/local_storage/app_library_occupation_database.dart +++ b/uni/lib/controller/local_storage/app_library_occupation_database.dart @@ -19,7 +19,7 @@ CREATE TABLE FLOOR_OCCUPATION( await db.transaction((txn) async { await txn.delete('FLOOR_OCCUPATION'); for (final floor in occupation.floors) { - await txn.insert('FLOOR_OCCUPATION', floor.toMap()); + await txn.insert('FLOOR_OCCUPATION', floor.toJson()); } }); } diff --git a/uni/lib/controller/local_storage/app_references_database.dart b/uni/lib/controller/local_storage/app_references_database.dart index 2693357a7..83ad089b5 100644 --- a/uni/lib/controller/local_storage/app_references_database.dart +++ b/uni/lib/controller/local_storage/app_references_database.dart @@ -50,7 +50,7 @@ class AppReferencesDatabase extends AppDatabase { for (final reference in references) { await insertInDatabase( 'refs', - reference.toMap(), + reference.toJson(), conflictAlgorithm: ConflictAlgorithm.replace, ); } diff --git a/uni/lib/controller/local_storage/app_restaurant_database.dart b/uni/lib/controller/local_storage/app_restaurant_database.dart index 56663b513..91ace246d 100644 --- a/uni/lib/controller/local_storage/app_restaurant_database.dart +++ b/uni/lib/controller/local_storage/app_restaurant_database.dart @@ -112,7 +112,7 @@ class RestaurantDatabase extends AppDatabase { /// Insert restaurant and meals in database Future insertRestaurant(Transaction txn, Restaurant restaurant) async { - final id = await txn.insert('RESTAURANTS', restaurant.toMap()); + final id = await txn.insert('RESTAURANTS', restaurant.toJson()); restaurant.meals.forEach((dayOfWeak, meals) async { for (final meal in meals) { await txn.insert('MEALS', meal.toMap(id)); diff --git a/uni/lib/controller/local_storage/app_shared_preferences.dart b/uni/lib/controller/local_storage/app_shared_preferences.dart index e2b60e5d7..61236ff10 100644 --- a/uni/lib/controller/local_storage/app_shared_preferences.dart +++ b/uni/lib/controller/local_storage/app_shared_preferences.dart @@ -294,7 +294,6 @@ class AppSharedPreferences { final prefs = await SharedPreferences.getInstance(); await prefs.setBool(tuitionNotificationsToggleKey, value); } - static Future getUsageStatsToggle() async { final prefs = await SharedPreferences.getInstance(); return prefs.getBool(usageStatsToggleKey) ?? true; diff --git a/uni/lib/model/entities/bug_report.dart b/uni/lib/model/entities/bug_report.dart index adf9673ba..8b110aca5 100644 --- a/uni/lib/model/entities/bug_report.dart +++ b/uni/lib/model/entities/bug_report.dart @@ -1,19 +1,39 @@ + +// Stores information about Bug Report +import 'package:json_annotation/json_annotation.dart'; import 'package:tuple/tuple.dart'; +part 'bug_report.g.dart'; + +class TupleConverter extends JsonConverter?, String?> { + const TupleConverter(); + + @override + Tuple2? fromJson(String? json) { + if (json == null) return null; + return Tuple2('', json); + } + + @override + String? toJson(Tuple2? object) { + if (object == null) return null; + return object.item2; + } +} + +@TupleConverter() +@JsonSerializable() class BugReport { BugReport(this.title, this.text, this.email, this.bugLabel, this.faculties); + factory BugReport.fromJson(Map json) => + _$BugReportFromJson(json); + final String title; final String text; final String email; final Tuple2? bugLabel; final List faculties; - Map toMap() => { - 'title': title, - 'text': text, - 'email': email, - 'bugLabel': bugLabel!.item2, - 'faculties': faculties, - }; + Map toJson() => _$BugReportToJson(this); } diff --git a/uni/lib/model/entities/bug_report.g.dart b/uni/lib/model/entities/bug_report.g.dart new file mode 100644 index 000000000..291316fcc --- /dev/null +++ b/uni/lib/model/entities/bug_report.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bug_report.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BugReport _$BugReportFromJson(Map json) => BugReport( + json['title'] as String, + json['text'] as String, + json['email'] as String, + const TupleConverter().fromJson(json['bugLabel'] as String?), + (json['faculties'] as List).map((e) => e as String).toList(), + ); + +Map _$BugReportToJson(BugReport instance) => { + 'title': instance.title, + 'text': instance.text, + 'email': instance.email, + 'bugLabel': const TupleConverter().toJson(instance.bugLabel), + 'faculties': instance.faculties, + }; diff --git a/uni/lib/model/entities/bus.dart b/uni/lib/model/entities/bus.dart index fd26f8215..30ca9dc33 100644 --- a/uni/lib/model/entities/bus.dart +++ b/uni/lib/model/entities/bus.dart @@ -1,26 +1,22 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'bus.g.dart'; + /// Stores information about a bus. /// /// Stores the bus code (`busCode`), the `destination` of the bus /// and its `direction`. +@JsonSerializable() class Bus { Bus({ required this.busCode, required this.destination, this.direction = false, }); + + factory Bus.fromJson(Map json) => _$BusFromJson(json); String busCode; String destination; bool direction; - - /// Converts a [Bus] instance to a map. - /// - /// The map contents are the `busCode`, - /// the bus `destination` and its `direction`. - Map toMap() { - return { - 'busCode': busCode, - 'destination': destination, - 'direction': direction, - }; - } + Map toJson() => _$BusToJson(this); } diff --git a/uni/lib/model/entities/bus.g.dart b/uni/lib/model/entities/bus.g.dart new file mode 100644 index 000000000..5d6b5461d --- /dev/null +++ b/uni/lib/model/entities/bus.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bus.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Bus _$BusFromJson(Map json) => Bus( + busCode: json['busCode'] as String, + destination: json['destination'] as String, + direction: json['direction'] as bool? ?? false, + ); + +Map _$BusToJson(Bus instance) => { + 'busCode': instance.busCode, + 'destination': instance.destination, + 'direction': instance.direction, + }; diff --git a/uni/lib/model/entities/bus_stop.dart b/uni/lib/model/entities/bus_stop.dart index ba79553b2..b443f66c1 100644 --- a/uni/lib/model/entities/bus_stop.dart +++ b/uni/lib/model/entities/bus_stop.dart @@ -1,13 +1,22 @@ +import 'package:json_annotation/json_annotation.dart'; import 'package:uni/model/entities/trip.dart'; +part 'bus_stop.g.dart'; + /// Stores information about a bus stop. +@JsonSerializable() class BusStopData { BusStopData({ required this.configuredBuses, this.favorited = false, this.trips = const [], }); + + + factory BusStopData.fromJson(Map json) => + _$BusStopDataFromJson(json); final Set configuredBuses; bool favorited; List trips; + Map toJson() => _$BusStopDataToJson(this); } diff --git a/uni/lib/model/entities/bus_stop.g.dart b/uni/lib/model/entities/bus_stop.g.dart new file mode 100644 index 000000000..824966d5c --- /dev/null +++ b/uni/lib/model/entities/bus_stop.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bus_stop.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BusStopData _$BusStopDataFromJson(Map json) => BusStopData( + configuredBuses: (json['configuredBuses'] as List) + .map((e) => e as String) + .toSet(), + favorited: json['favorited'] as bool? ?? false, + trips: (json['trips'] as List?) + ?.map((e) => Trip.fromJson(e as Map)) + .toList() ?? + const [], + ); + +Map _$BusStopDataToJson(BusStopData instance) => + { + 'configuredBuses': instance.configuredBuses.toList(), + 'favorited': instance.favorited, + 'trips': instance.trips, + }; diff --git a/uni/lib/model/entities/calendar_event.dart b/uni/lib/model/entities/calendar_event.dart index 733a3909a..6ece8c2f3 100644 --- a/uni/lib/model/entities/calendar_event.dart +++ b/uni/lib/model/entities/calendar_event.dart @@ -1,12 +1,17 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'calendar_event.g.dart'; + /// An event in the school calendar +@JsonSerializable() class CalendarEvent { - /// Creates an instance of the class [CalendarEvent] CalendarEvent(this.name, this.date); + factory CalendarEvent.fromJson(Map json) => + _$CalendarEventFromJson(json); + + /// Creates an instance of the class [CalendarEvent] + /// String name; String date; - - /// Converts the event into a map - Map toMap() { - return {'name': name, 'date': date}; - } + Map toJson() => _$CalendarEventToJson(this); } diff --git a/uni/lib/model/entities/calendar_event.g.dart b/uni/lib/model/entities/calendar_event.g.dart new file mode 100644 index 000000000..41711a27c --- /dev/null +++ b/uni/lib/model/entities/calendar_event.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'calendar_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CalendarEvent _$CalendarEventFromJson(Map json) => + CalendarEvent( + json['name'] as String, + json['date'] as String, + ); + +Map _$CalendarEventToJson(CalendarEvent instance) => + { + 'name': instance.name, + 'date': instance.date, + }; diff --git a/uni/lib/model/entities/course.dart b/uni/lib/model/entities/course.dart index ef861730f..a99d2ced4 100644 --- a/uni/lib/model/entities/course.dart +++ b/uni/lib/model/entities/course.dart @@ -1,3 +1,7 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'course.g.dart'; + /// Stores information about a course. /// /// The information stored is: @@ -7,10 +11,11 @@ /// - The course current `year` /// - The date of the `firstEnrollment` /// - The course `state` +@JsonSerializable() class Course { Course({ required this.id, - this.festId, + this.festId = 0, this.name, this.abbreviation, this.currYear, @@ -21,46 +26,23 @@ class Course { this.currentAverage, }); - static Course? fromJson(Map data) { - if (data['cur_id'] == null || data['fest_id'] == 0) { - return null; - } - - return Course( - id: data['cur_id'] as int, - festId: data['fest_id'] as int, - name: data['cur_nome'] as String?, - currYear: data['ano_curricular'] as String?, - firstEnrollment: data['fest_a_lect_1_insc'] as int?, - abbreviation: data['abbreviation'] as String?, - faculty: data['inst_sigla']?.toString().toLowerCase(), - ); - } - + factory Course.fromJson(Map json) => _$CourseFromJson(json); + @JsonKey(name: 'cur_id') final int id; + @JsonKey(name: 'fest_id') final int? festId; + @JsonKey(name: 'cur_nome') final String? name; + @JsonKey(name: 'abbreviation') final String? abbreviation; + @JsonKey(name: 'ano_curricular') final String? currYear; + @JsonKey(name: 'fest_a_lect_1_insc') final int? firstEnrollment; + @JsonKey(name: 'inst_sigla') final String? faculty; String? state; num? finishedEcts; num? currentAverage; - - /// Converts this course to a map. - Map toMap() { - return { - 'id': id, - 'fest_id': festId, - 'name': name, - 'abbreviation': abbreviation, - 'currYear': currYear, - 'firstEnrollment': firstEnrollment, - 'state': state, - 'faculty': faculty, - 'currentAverage': currentAverage, - 'finishedEcts': finishedEcts, - }; - } + Map toJson() => _$CourseToJson(this); } diff --git a/uni/lib/model/entities/course.g.dart b/uni/lib/model/entities/course.g.dart new file mode 100644 index 000000000..3ec8df2f4 --- /dev/null +++ b/uni/lib/model/entities/course.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'course.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Course _$CourseFromJson(Map json) => Course( + id: json['cur_id'] as int, + festId: json['fest_id'] as int? ?? 0, + name: json['cur_nome'] as String?, + abbreviation: json['abbreviation'] as String?, + currYear: json['ano_curricular'] as String?, + firstEnrollment: json['fest_a_lect_1_insc'] as int?, + state: json['state'] as String?, + faculty: json['inst_sigla'] as String?, + finishedEcts: json['finishedEcts'] as num?, + currentAverage: json['currentAverage'] as num?, + ); + +Map _$CourseToJson(Course instance) => { + 'cur_id': instance.id, + 'fest_id': instance.festId, + 'cur_nome': instance.name, + 'abbreviation': instance.abbreviation, + 'ano_curricular': instance.currYear, + 'fest_a_lect_1_insc': instance.firstEnrollment, + 'inst_sigla': instance.faculty, + 'state': instance.state, + 'finishedEcts': instance.finishedEcts, + 'currentAverage': instance.currentAverage, + }; diff --git a/uni/lib/model/entities/course_units/course_unit.dart b/uni/lib/model/entities/course_units/course_unit.dart index cf8a0193d..f89b07e40 100644 --- a/uni/lib/model/entities/course_units/course_unit.dart +++ b/uni/lib/model/entities/course_units/course_unit.dart @@ -1,4 +1,10 @@ + +import 'package:json_annotation/json_annotation.dart'; + +part 'course_unit.g.dart'; + /// Stores information about a course unit. +@JsonSerializable() class CourseUnit { CourseUnit({ required this.abbreviation, @@ -16,70 +22,41 @@ class CourseUnit { this.result, this.ects, this.schoolYear, - }); + }); // e.g. 2020/2021 + factory CourseUnit.fromJson(Map json) => + _$CourseUnitFromJson(json); + + @JsonKey(name: 'ucurr_id') int id; + @JsonKey(name: 'ucurr_codigo') String code; + @JsonKey(name: 'ucurr_sigla') String abbreviation; + @JsonKey(name: 'ucurr_nome') String name; + @JsonKey(name: 'ano') int? curricularYear; + @JsonKey(name: 'ocorr_id') int occurrId; + @JsonKey(name: 'per_codigo') String? semesterCode; + @JsonKey(name: 'per_nome') String? semesterName; + @JsonKey(name: 'tipo') String? type; + @JsonKey(name: 'estado') String? status; + @JsonKey(name: 'resultado_melhor') String? grade; + @JsonKey(name: 'resultado_ects') String? ectsGrade; + @JsonKey(name: 'resultado_insc') String? result; + @JsonKey(name: 'creditos_ects') num? ects; - String? schoolYear; // e.g. 2020/2021 - - /// Creates a new instance from a JSON object. - static CourseUnit? fromJson(Map data) { - if (data['ucurr_id'] == null) { - return null; - } - - return CourseUnit( - id: data['ucurr_id'] as int, - code: data['ucurr_codigo'] as String, - abbreviation: data['ucurr_sigla'] as String, - name: data['ucurr_nome'] as String, - curricularYear: data['ano'] as int?, - occurrId: data['ocorr_id'] as int, - semesterCode: data['per_codigo'] as String?, - semesterName: data['per_nome'] as String?, - type: data['tipo'] as String?, - status: data['estado'] as String?, - grade: data['resultado_melhor'] as String?, - ectsGrade: data['resultado_ects'] as String?, - result: data['resultado_insc'] as String?, - ects: data['creditos_ects'] as num?, - schoolYear: data['a_lectivo'] == null - ? null - : toSchoolYear(data['a_lectivo'] as int), - ); - } - - Map toMap() { - return { - 'id': id, - 'code': code, - 'abbreviation': abbreviation, - 'name': name, - 'curricularYear': curricularYear, - 'occurrId': occurrId, - 'semesterCode': semesterCode, - 'semesterName': semesterName, - 'type': type, - 'status': status, - 'grade': grade, - 'ectsGrade': ectsGrade, - 'result': result, - 'ects': ects, - 'schoolYear': schoolYear, - }; - } + String? schoolYear; + Map toJson() => _$CourseUnitToJson(this); bool enrollmentIsValid() { return status == 'V' || status == 'C'; diff --git a/uni/lib/model/entities/course_units/course_unit.g.dart b/uni/lib/model/entities/course_units/course_unit.g.dart new file mode 100644 index 000000000..84171d103 --- /dev/null +++ b/uni/lib/model/entities/course_units/course_unit.g.dart @@ -0,0 +1,44 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'course_unit.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CourseUnit _$CourseUnitFromJson(Map json) => CourseUnit( + abbreviation: json['ucurr_sigla'] as String, + name: json['ucurr_nome'] as String, + occurrId: json['ocorr_id'] as int, + id: json['ucurr_id'] as int? ?? 0, + code: json['ucurr_codigo'] as String? ?? '', + curricularYear: json['ano'] as int?, + semesterCode: json['per_codigo'] as String?, + semesterName: json['per_nome'] as String?, + type: json['tipo'] as String?, + status: json['estado'] as String?, + grade: json['resultado_melhor'] as String?, + ectsGrade: json['resultado_ects'] as String?, + result: json['resultado_insc'] as String?, + ects: json['creditos_ects'] as num?, + schoolYear: json['schoolYear'] as String?, + ); + +Map _$CourseUnitToJson(CourseUnit instance) => + { + 'ucurr_id': instance.id, + 'ucurr_codigo': instance.code, + 'ucurr_sigla': instance.abbreviation, + 'ucurr_nome': instance.name, + 'ano': instance.curricularYear, + 'ocorr_id': instance.occurrId, + 'per_codigo': instance.semesterCode, + 'per_nome': instance.semesterName, + 'tipo': instance.type, + 'estado': instance.status, + 'resultado_melhor': instance.grade, + 'resultado_ects': instance.ectsGrade, + 'resultado_insc': instance.result, + 'creditos_ects': instance.ects, + 'schoolYear': instance.schoolYear, + }; diff --git a/uni/lib/model/entities/exam.dart b/uni/lib/model/entities/exam.dart index 0d27cb1bc..eafe2b68f 100644 --- a/uni/lib/model/entities/exam.dart +++ b/uni/lib/model/entities/exam.dart @@ -1,5 +1,58 @@ import 'package:intl/intl.dart'; import 'package:uni/model/entities/app_locale.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:logger/logger.dart'; + +part 'exam.g.dart'; + +enum WeekDays { + monday('Segunda'), + tuesday('Terça'), + wednesday('Quarta'), + thursday('Quinta'), + friday('Sexta'), + saturday('Sábado'), + sunday('Domingo'); + + const WeekDays(this.day); + + final String day; +} + +enum Months { + january('janeiro'), + february('fevereiro'), + march('março'), + april('abril'), + may('maio'), + june('junho'), + july('julho'), + august('agosto'), + september('setembro'), + october('outubro'), + november('novembro'), + december('dezembro'); + + const Months(this.month); + + final String month; +} + +class DateTimeConverter extends JsonConverter { + const DateTimeConverter(); + + @override + DateTime fromJson(String json) { + final format = DateFormat('d-M-y'); + return format.parse(json); + } + + @override + String toJson(DateTime object) { + final format = DateFormat('d-M-y'); + return format.format(object); + } +} /// Manages a generic Exam. /// @@ -8,6 +61,9 @@ import 'package:uni/model/entities/app_locale.dart'; /// - The Exam `subject` /// - A List with the `rooms` in which the Exam takes place /// - The Exam `type` + +@DateTimeConverter() +@JsonSerializable() class Exam { Exam( this.id, @@ -15,17 +71,19 @@ class Exam { this.end, this.subject, this.rooms, - this.type, + this.examType, this.faculty, ); + factory Exam.fromJson(Map json) => _$ExamFromJson(json); + Exam.secConstructor( this.id, this.subject, this.begin, this.end, String rooms, - this.type, + this.examType, this.faculty, ) : rooms = rooms.split(','); @@ -34,7 +92,7 @@ class Exam { final String id; final String subject; final List rooms; - final String type; + final String examType; final String faculty; static Map types = { @@ -46,19 +104,7 @@ class Exam { 'Exames ao abrigo de estatutos especiais': 'EAE', }; static List displayedTypes = types.keys.toList().sublist(0, 4); - - /// Converts this exam to a map. - Map toMap() { - return { - 'id': id, - 'subject': subject, - 'begin': DateFormat('yyyy-MM-dd HH:mm:ss').format(begin), - 'end': DateFormat('yyyy-MM-dd HH:mm:ss').format(end), - 'rooms': rooms.join(','), - 'examType': type, - 'faculty': faculty, - }; - } + Map toJson() => _$ExamToJson(this); /// Returns whether or not this exam has already ended. bool hasEnded() => DateTime.now().compareTo(end) >= 0; @@ -83,7 +129,12 @@ class Exam { @override String toString() { - return '''$id - $subject - ${begin.year} - $month - ${begin.day} - $beginTime-$endTime - $type - $rooms - $weekDay'''; + return '''$id - $subject - ${begin.year} - $month - ${begin.day} - $beginTime-$endTime - $examType - $rooms - $weekDay'''; + } + + /// Prints the data in this exam to the [Logger] with an INFO level. + void printExam() { + Logger().i(toString()); } @override diff --git a/uni/lib/model/entities/exam.g.dart b/uni/lib/model/entities/exam.g.dart new file mode 100644 index 000000000..5677cf7a7 --- /dev/null +++ b/uni/lib/model/entities/exam.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'exam.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Exam _$ExamFromJson(Map json) => Exam( + json['id'] as String, + const DateTimeConverter().fromJson(json['begin'] as String), + const DateTimeConverter().fromJson(json['end'] as String), + json['subject'] as String, + (json['rooms'] as List).map((e) => e as String).toList(), + json['examType'] as String, + json['faculty'] as String, + ); + +Map _$ExamToJson(Exam instance) => { + 'begin': const DateTimeConverter().toJson(instance.begin), + 'end': const DateTimeConverter().toJson(instance.end), + 'id': instance.id, + 'subject': instance.subject, + 'rooms': instance.rooms, + 'examType': instance.examType, + 'faculty': instance.faculty, + }; diff --git a/uni/lib/model/entities/lecture.dart b/uni/lib/model/entities/lecture.dart index 70f2c1251..ce3ea8766 100644 --- a/uni/lib/model/entities/lecture.dart +++ b/uni/lib/model/entities/lecture.dart @@ -1,6 +1,25 @@ +import 'package:json_annotation/json_annotation.dart'; import 'package:logger/logger.dart'; +part 'lecture.g.dart'; + +class DateTimeConverter extends JsonConverter { + const DateTimeConverter(); + + @override + DateTime fromJson(String json) { + return DateTime.parse(json); + } + + @override + String toJson(DateTime object) { + return object.toIso8601String(); + } +} + /// Stores information about a lecture. +@DateTimeConverter() +@JsonSerializable() class Lecture { /// Creates an instance of the class [Lecture]. Lecture( @@ -15,6 +34,9 @@ class Lecture { this.occurrId, ); + factory Lecture.fromJson(Map json) => + _$LectureFromJson(json); + factory Lecture.fromApi( String subject, String typeClass, @@ -51,19 +73,22 @@ class Lecture { String classNumber, int occurrId, ) { - final startTimeList = startTimeString.split(':'); - final startTime = day.add( - Duration( - hours: int.parse(startTimeList[0]), - minutes: int.parse(startTimeList[1]), - ), - ); - final endTime = startTime.add(Duration(minutes: 30 * blocks)); + + final startTimeHours = int.parse(startTimeString.substring(0, 2)); + final startTimeMinutes = int.parse(startTimeString.substring(3, 5)); + final endTimeHours = + (startTimeMinutes + (blocks * 30)) ~/ 60 + startTimeHours; + final endTimeMinutes = (startTimeMinutes + (blocks * 30)) % 60; return Lecture( subject, typeClass, - startTime, - endTime, + day.add(Duration(hours: startTimeHours, minutes: startTimeMinutes)), + day.add( + Duration( + hours: startTimeMinutes + endTimeHours, + minutes: startTimeMinutes + endTimeMinutes, + ), + ), blocks, room, teacher, @@ -100,20 +125,7 @@ class Lecture { DateTime endTime; int blocks; int occurrId; - - /// Converts this lecture to a map. - Map toMap() { - return { - 'subject': subject, - 'typeClass': typeClass, - 'startDateTime': startTime.toIso8601String(), - 'blocks': blocks, - 'room': room, - 'teacher': teacher, - 'classNumber': classNumber, - 'occurrId': occurrId, - }; - } + Map toJson() => _$LectureToJson(this); /// Prints the data in this lecture to the [Logger] with an INFO level. void printLecture() { diff --git a/uni/lib/model/entities/lecture.g.dart b/uni/lib/model/entities/lecture.g.dart new file mode 100644 index 000000000..eef0aac70 --- /dev/null +++ b/uni/lib/model/entities/lecture.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'lecture.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Lecture _$LectureFromJson(Map json) => Lecture( + json['subject'] as String, + json['typeClass'] as String, + const DateTimeConverter().fromJson(json['startTime'] as String), + const DateTimeConverter().fromJson(json['endTime'] as String), + json['blocks'] as int, + json['room'] as String, + json['teacher'] as String, + json['classNumber'] as String, + json['occurrId'] as int, + ); + +Map _$LectureToJson(Lecture instance) => { + 'subject': instance.subject, + 'typeClass': instance.typeClass, + 'room': instance.room, + 'teacher': instance.teacher, + 'classNumber': instance.classNumber, + 'startTime': const DateTimeConverter().toJson(instance.startTime), + 'endTime': const DateTimeConverter().toJson(instance.endTime), + 'blocks': instance.blocks, + 'occurrId': instance.occurrId, + }; diff --git a/uni/lib/model/entities/library_occupation.dart b/uni/lib/model/entities/library_occupation.dart index 79e739c77..6d76cdfc4 100644 --- a/uni/lib/model/entities/library_occupation.dart +++ b/uni/lib/model/entities/library_occupation.dart @@ -1,6 +1,11 @@ import 'dart:math'; +import 'package:json_annotation/json_annotation.dart'; + +part 'library_occupation.g.dart'; + /// Overall occupation of the library +@JsonSerializable() class LibraryOccupation { LibraryOccupation(this.occupation, this.capacity) { floors = []; @@ -9,6 +14,9 @@ class LibraryOccupation { late int capacity; late List floors; + factory LibraryOccupation.fromJson(Map json) => + _$LibraryOccupationFromJson(json); + void addFloor(FloorOccupation floor) { floors.add(floor); occupation += floor.occupation; @@ -24,11 +32,18 @@ class LibraryOccupation { if (floors.length < number || number < 0) return FloorOccupation(0, 0, 0); return floors[number - 1]; } + + Map toJson() => _$LibraryOccupationToJson(this); } /// Occupation values of a single floor +@JsonSerializable() class FloorOccupation { FloorOccupation(this.number, this.occupation, this.capacity); + + + factory FloorOccupation.fromJson(Map json) => + _$FloorOccupationFromJson(json); final int number; final int occupation; final int capacity; @@ -38,12 +53,5 @@ class FloorOccupation { return min(100, (occupation * 100 / capacity).round()); } - Map toMap() { - final map = { - 'number': number, - 'occupation': occupation, - 'capacity': capacity, - }; - return map; - } + Map toJson() => _$FloorOccupationToJson(this); } diff --git a/uni/lib/model/entities/library_occupation.g.dart b/uni/lib/model/entities/library_occupation.g.dart new file mode 100644 index 000000000..b1cf5dadc --- /dev/null +++ b/uni/lib/model/entities/library_occupation.g.dart @@ -0,0 +1,36 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'library_occupation.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +LibraryOccupation _$LibraryOccupationFromJson(Map json) => + LibraryOccupation( + json['occupation'] as int, + json['capacity'] as int, + )..floors = (json['floors'] as List) + .map((e) => FloorOccupation.fromJson(e as Map)) + .toList(); + +Map _$LibraryOccupationToJson(LibraryOccupation instance) => + { + 'occupation': instance.occupation, + 'capacity': instance.capacity, + 'floors': instance.floors, + }; + +FloorOccupation _$FloorOccupationFromJson(Map json) => + FloorOccupation( + json['number'] as int, + json['occupation'] as int, + json['capacity'] as int, + ); + +Map _$FloorOccupationToJson(FloorOccupation instance) => + { + 'number': instance.number, + 'occupation': instance.occupation, + 'capacity': instance.capacity, + }; diff --git a/uni/lib/model/entities/location_group.dart b/uni/lib/model/entities/location_group.dart index 6ba918095..5a1008a84 100644 --- a/uni/lib/model/entities/location_group.dart +++ b/uni/lib/model/entities/location_group.dart @@ -1,9 +1,13 @@ import 'package:collection/collection.dart'; +import 'package:json_annotation/json_annotation.dart'; import 'package:latlong2/latlong.dart'; import 'package:uni/model/entities/location.dart'; +part 'location_group.g.dart'; + /// Store information about a location marker. /// What's located in each floor, like vending machines, rooms, etc... +@JsonSerializable() class LocationGroup { LocationGroup( this.latlng, { @@ -13,6 +17,10 @@ class LocationGroup { }) : floors = locations != null ? groupBy(locations, (location) => location.floor) : Map.identity(); + + + factory LocationGroup.fromJson(Map json) => + _$LocationGroupFromJson(json); final Map> floors; final bool isFloorless; final LatLng latlng; @@ -26,12 +34,5 @@ class LocationGroup { ); } - Map toMap() { - return { - 'id': id, - 'lat': latlng.latitude, - 'lng': latlng.longitude, - 'is_floorless': isFloorless ? 1 : 0, - }; - } + Map toJson() => _$LocationGroupToJson(this); } diff --git a/uni/lib/model/entities/location_group.g.dart b/uni/lib/model/entities/location_group.g.dart new file mode 100644 index 000000000..05f3e5d3a --- /dev/null +++ b/uni/lib/model/entities/location_group.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'location_group.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +LocationGroup _$LocationGroupFromJson(Map json) => + LocationGroup( + LatLng.fromJson(json['latlng'] as Map), + isFloorless: json['isFloorless'] as bool? ?? false, + id: json['id'] as int?, + ); + +Map _$LocationGroupToJson(LocationGroup instance) => + { + 'isFloorless': instance.isFloorless, + 'latlng': instance.latlng, + 'id': instance.id, + }; diff --git a/uni/lib/model/entities/meal.dart b/uni/lib/model/entities/meal.dart index 217bc8b44..5684e36eb 100644 --- a/uni/lib/model/entities/meal.dart +++ b/uni/lib/model/entities/meal.dart @@ -1,22 +1,41 @@ import 'package:intl/intl.dart'; +import 'package:json_annotation/json_annotation.dart'; import 'package:uni/model/utils/day_of_week.dart'; +part 'meal.g.dart'; + +class DateTimeConverter extends JsonConverter { + const DateTimeConverter(); + + @override + DateTime fromJson(String json) { + final format = DateFormat('d-M-y'); + return format.parse(json); + } + + @override + String toJson(DateTime object) { + final format = DateFormat('d-M-y'); + return format.format(object); + } +} + +@DateTimeConverter() +@JsonSerializable() class Meal { Meal(this.type, this.name, this.dayOfWeek, this.date); + + factory Meal.fromJson(Map json) => _$MealFromJson(json); final String type; final String name; final DayOfWeek dayOfWeek; final DateTime date; + Map toJson() => _$MealToJson(this); + Map toMap(int restaurantId) { - final format = DateFormat('d-M-y'); - return { - 'id': null, - 'day': toString(dayOfWeek), - 'type': type, - 'name': name, - 'date': format.format(date), - 'id_restaurant': restaurantId, - }; + final map = toJson(); + map['id_restaurant'] = restaurantId; + return map; } } diff --git a/uni/lib/model/entities/meal.g.dart b/uni/lib/model/entities/meal.g.dart new file mode 100644 index 000000000..c62cf495e --- /dev/null +++ b/uni/lib/model/entities/meal.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'meal.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Meal _$MealFromJson(Map json) => Meal( + json['type'] as String, + json['name'] as String, + $enumDecode(_$DayOfWeekEnumMap, json['dayOfWeek']), + const DateTimeConverter().fromJson(json['date'] as String), + ); + +Map _$MealToJson(Meal instance) => { + 'type': instance.type, + 'name': instance.name, + 'dayOfWeek': _$DayOfWeekEnumMap[instance.dayOfWeek]!, + 'date': const DateTimeConverter().toJson(instance.date), + }; + +const _$DayOfWeekEnumMap = { + DayOfWeek.monday: 'monday', + DayOfWeek.tuesday: 'tuesday', + DayOfWeek.wednesday: 'wednesday', + DayOfWeek.thursday: 'thursday', + DayOfWeek.friday: 'friday', + DayOfWeek.saturday: 'saturday', + DayOfWeek.sunday: 'sunday', +}; diff --git a/uni/lib/model/entities/profile.dart b/uni/lib/model/entities/profile.dart index 0085f0955..59fecf190 100644 --- a/uni/lib/model/entities/profile.dart +++ b/uni/lib/model/entities/profile.dart @@ -23,10 +23,7 @@ class Profile { responseBody = responseBody as Map; final courses = []; for (final c in responseBody['cursos'] as List) { - final course = Course.fromJson(c as Map); - if (course != null) { - courses.add(course); - } + courses.add(Course.fromJson(c as Map)); } return Profile( diff --git a/uni/lib/model/entities/reference.dart b/uni/lib/model/entities/reference.dart index 3c038ead3..5e002f32d 100644 --- a/uni/lib/model/entities/reference.dart +++ b/uni/lib/model/entities/reference.dart @@ -1,3 +1,23 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'reference.g.dart'; + +class DateTimeConverter extends JsonConverter { + const DateTimeConverter(); + + @override + DateTime fromJson(String json) { + return DateTime.parse(json); + } + + @override + String toJson(DateTime object) { + return object.toString(); + } +} + +@DateTimeConverter() +@JsonSerializable() class Reference { Reference( this.description, @@ -6,20 +26,15 @@ class Reference { this.reference, this.amount, ); + + + factory Reference.fromJson(Map json) => + _$ReferenceFromJson(json); final String description; final DateTime limitDate; final int entity; final int reference; final double amount; - /// Converts this reference to a map. - Map toMap() { - return { - 'description': description, - 'limitDate': limitDate.toString(), - 'entity': entity, - 'reference': reference, - 'amount': amount, - }; - } + Map toJson() => _$ReferenceToJson(this); } diff --git a/uni/lib/model/entities/reference.g.dart b/uni/lib/model/entities/reference.g.dart new file mode 100644 index 000000000..ce66670bf --- /dev/null +++ b/uni/lib/model/entities/reference.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reference.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Reference _$ReferenceFromJson(Map json) => Reference( + json['description'] as String, + const DateTimeConverter().fromJson(json['limitDate'] as String), + json['entity'] as int, + json['reference'] as int, + (json['amount'] as num).toDouble(), + ); + +Map _$ReferenceToJson(Reference instance) => { + 'description': instance.description, + 'limitDate': const DateTimeConverter().toJson(instance.limitDate), + 'entity': instance.entity, + 'reference': instance.reference, + 'amount': instance.amount, + }; diff --git a/uni/lib/model/entities/restaurant.dart b/uni/lib/model/entities/restaurant.dart index a48786314..3dd89d0b2 100644 --- a/uni/lib/model/entities/restaurant.dart +++ b/uni/lib/model/entities/restaurant.dart @@ -1,33 +1,44 @@ import 'package:collection/collection.dart'; +import 'package:json_annotation/json_annotation.dart'; import 'package:uni/model/entities/meal.dart'; import 'package:uni/model/utils/day_of_week.dart'; +part 'restaurant.g.dart'; + +@JsonSerializable() class Restaurant { Restaurant(this.id, this.name, this.reference, {required List meals}) : meals = groupBy(meals, (meal) => meal.dayOfWeek); factory Restaurant.fromMap(Map map, List meals) { - return Restaurant( - map['id'] as int?, - map['name'] as String, - map['ref'] as String, - meals: meals, - ); + final object = Restaurant.fromJson(map); + object.meals = object.groupMealsByDayOfWeek(meals); + return object; } + + factory Restaurant.fromJson(Map json) => + _$RestaurantFromJson(json); + @JsonKey(name: 'id') final int? id; + @JsonKey(name: 'name') final String name; + @JsonKey(name: 'ref') final String reference; // Used only in html parser - final Map> meals; + @JsonKey(includeToJson:true) + late final Map> meals; bool get isNotEmpty { return meals.isNotEmpty; } + + Map toJson() => _$RestaurantToJson(this); + List getMealsOfDay(DayOfWeek dayOfWeek) { return meals[dayOfWeek] ?? []; } - Map toMap() { - return {'id': id, 'name': name, 'ref': reference}; + Map> groupMealsByDayOfWeek(List meals) { + return groupBy(meals, (meal) => meal.dayOfWeek); } } diff --git a/uni/lib/model/entities/restaurant.g.dart b/uni/lib/model/entities/restaurant.g.dart new file mode 100644 index 000000000..51a622eae --- /dev/null +++ b/uni/lib/model/entities/restaurant.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'restaurant.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Restaurant _$RestaurantFromJson(Map json) => Restaurant( + json['id'] as int?, + json['name'] as String, + json['ref'] as String, + meals: (json['meals'] as List) + .map((e) => Meal.fromJson(e as Map)) + .toList(), + ); + +Map _$RestaurantToJson(Restaurant instance) => + { + 'id': instance.id, + 'name': instance.name, + 'ref': instance.reference, + 'meals': + instance.meals.map((k, e) => MapEntry(_$DayOfWeekEnumMap[k]!, e)), + }; + +const _$DayOfWeekEnumMap = { + DayOfWeek.monday: 'monday', + DayOfWeek.tuesday: 'tuesday', + DayOfWeek.wednesday: 'wednesday', + DayOfWeek.thursday: 'thursday', + DayOfWeek.friday: 'friday', + DayOfWeek.saturday: 'saturday', + DayOfWeek.sunday: 'sunday', +}; diff --git a/uni/lib/model/entities/trip.dart b/uni/lib/model/entities/trip.dart index 459a90446..528445986 100644 --- a/uni/lib/model/entities/trip.dart +++ b/uni/lib/model/entities/trip.dart @@ -1,22 +1,22 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'trip.g.dart'; + /// Stores information about a bus trip. +@JsonSerializable() class Trip { Trip({ required this.line, required this.destination, required this.timeRemaining, }); + + + factory Trip.fromJson(Map json) => _$TripFromJson(json); final String line; final String destination; final int timeRemaining; - - /// Converts this trip to a map. - Map toMap() { - return { - 'line': line, - 'destination': destination, - 'timeRemaining': timeRemaining, - }; - } + Map toJson() => _$TripToJson(this); /// Compares the remaining time of two trips. int compare(Trip other) { diff --git a/uni/lib/model/entities/trip.g.dart b/uni/lib/model/entities/trip.g.dart new file mode 100644 index 000000000..bd82550aa --- /dev/null +++ b/uni/lib/model/entities/trip.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'trip.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Trip _$TripFromJson(Map json) => Trip( + line: json['line'] as String, + destination: json['destination'] as String, + timeRemaining: json['timeRemaining'] as int, + ); + +Map _$TripToJson(Trip instance) => { + 'line': instance.line, + 'destination': instance.destination, + 'timeRemaining': instance.timeRemaining, + }; diff --git a/uni/lib/model/providers/lazy/exam_provider.dart b/uni/lib/model/providers/lazy/exam_provider.dart index 5f93c548a..be6d9aad5 100644 --- a/uni/lib/model/providers/lazy/exam_provider.dart +++ b/uni/lib/model/providers/lazy/exam_provider.dart @@ -82,7 +82,7 @@ class ExamProvider extends StateProviderNotifier { List getFilteredExams() { return exams .where( - (exam) => filteredExamsTypes[Exam.getExamTypeLong(exam.type)] ?? true, + (exam) => filteredExamsTypes[Exam.getExamTypeLong(exam.examType)] ?? true, ) .toList(); } diff --git a/uni/lib/view/bug_report/widgets/form.dart b/uni/lib/view/bug_report/widgets/form.dart index 672d7d8b3..2c65027df 100644 --- a/uni/lib/view/bug_report/widgets/form.dart +++ b/uni/lib/view/bug_report/widgets/form.dart @@ -8,6 +8,7 @@ import 'package:uni/controller/local_storage/app_shared_preferences.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/app_locale.dart'; import 'package:uni/model/entities/bug_report.dart'; +import 'package:uni/utils/drawer_items.dart'; import 'package:uni/view/bug_report/widgets/text_field.dart'; import 'package:uni/view/common_widgets/page_title.dart'; import 'package:uni/view/common_widgets/toast_message.dart'; @@ -250,7 +251,7 @@ class BugReportFormState extends State { emailController.text, bugDescriptions[_selectedBug], faculties, - ).toMap(); + ).toJson(); var toastMsg = ''; bool status; try { @@ -272,7 +273,6 @@ class BugReportFormState extends State { status ? await ToastMessage.success(context, toastMsg) : await ToastMessage.error(context, toastMsg); - if (context.mounted) { setState(() { _isButtonTapped = false; diff --git a/uni/lib/view/bug_report/widgets/text_field.dart b/uni/lib/view/bug_report/widgets/text_field.dart index d0413ca55..07f36f983 100644 --- a/uni/lib/view/bug_report/widgets/text_field.dart +++ b/uni/lib/view/bug_report/widgets/text_field.dart @@ -72,6 +72,7 @@ class FormTextField extends StatelessWidget { ), ], ), + ], ), ); diff --git a/uni/lib/view/exams/widgets/exam_row.dart b/uni/lib/view/exams/widgets/exam_row.dart index 83457ad84..3d7debd67 100644 --- a/uni/lib/view/exams/widgets/exam_row.dart +++ b/uni/lib/view/exams/widgets/exam_row.dart @@ -53,7 +53,7 @@ class _ExamRowState extends State { ), ExamTitle( subject: widget.exam.subject, - type: widget.exam.type, + type: widget.exam.examType, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -117,7 +117,7 @@ class _ExamRowState extends State { Event createExamEvent() { return Event( - title: '${widget.exam.type} ${widget.exam.subject}', + title: '${widget.exam.examType} ${widget.exam.subject}', location: widget.exam.rooms.toString(), startDate: widget.exam.begin, endDate: widget.exam.end, diff --git a/uni/lib/view/home/widgets/exam_card.dart b/uni/lib/view/home/widgets/exam_card.dart index 0b3199cc4..87216c3e9 100644 --- a/uni/lib/view/home/widgets/exam_card.dart +++ b/uni/lib/view/home/widgets/exam_card.dart @@ -151,7 +151,7 @@ class ExamCard extends GenericCard { ), ExamTitle( subject: exam.subject, - type: exam.type, + type: exam.examType, reverseOrder: true, ), ], diff --git a/uni/pubspec.lock b/uni/pubspec.lock index 3c82202ea..ae33c16e0 100644 --- a/uni/pubspec.lock +++ b/uni/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: archive - sha256: "06a96f1249f38a00435b3b0c9a3246d934d7dbc8183fc7c9e56989860edb99d4" + sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b" url: "https://pub.dev" source: hosted - version: "3.4.4" + version: "3.4.9" args: dependency: transitive description: @@ -93,18 +93,18 @@ packages: dependency: transitive description: name: build_daemon - sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1" build_resolvers: dependency: transitive description: name: build_resolvers - sha256: "64e12b0521812d1684b1917bc80945625391cb9bdd4312536b1d69dcb6133ed8" + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2" build_runner: dependency: "direct dev" description: @@ -133,10 +133,10 @@ packages: dependency: transitive description: name: built_value - sha256: a8de5955205b4d1dbbbc267daddf2178bd737e4bab8987c04a500478c9651e74 + sha256: c9aabae0718ec394e5bc3c7272e6bb0dc0b32201a08fe185ec1d8401d3e39309 url: "https://pub.dev" source: hosted - version: "8.6.3" + version: "8.8.1" cached_network_image: dependency: "direct main" description: @@ -181,10 +181,10 @@ packages: dependency: transitive description: name: cli_util - sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 + sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 url: "https://pub.dev" source: hosted - version: "0.4.0" + version: "0.4.1" clock: dependency: transitive description: @@ -197,18 +197,18 @@ packages: dependency: transitive description: name: code_builder - sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677" + sha256: feee43a5c05e7b3199bb375a86430b8ada1b04104f2923d0e03cc01ca87b6d84 url: "https://pub.dev" source: hosted - version: "4.7.0" + version: "4.9.0" collection: dependency: "direct main" description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" connectivity_plus: dependency: "direct main" description: @@ -285,10 +285,10 @@ packages: dependency: transitive description: name: dbus - sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263" + sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" url: "https://pub.dev" source: hosted - version: "0.7.8" + version: "0.7.10" email_validator: dependency: "direct main" description: @@ -333,10 +333,10 @@ packages: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" fixnum: dependency: transitive description: @@ -423,18 +423,18 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: "8afc9a6aa6d8e8063523192ba837149dbf3d377a37c0b0fc579149a1fbd4a619" + sha256: "35108526a233cc0755664d445f8a6b4b61e6f8fe993b3658b80b4a26827fc196" url: "https://pub.dev" source: hosted - version: "0.6.18" + version: "0.6.18+2" flutter_svg: dependency: "direct main" description: name: flutter_svg - sha256: "8c5d68a82add3ca76d792f058b186a0599414f279f00ece4830b9b231b570338" + sha256: d39e7f95621fc84376bc0f7d504f05c3a41488c562f4a8ad410569127507402c url: "https://pub.dev" source: hosted - version: "2.0.7" + version: "2.0.9" flutter_test: dependency: "direct dev" description: flutter @@ -542,13 +542,21 @@ packages: source: hosted version: "0.6.7" json_annotation: - dependency: transitive + dependency: "direct main" description: name: json_annotation sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 url: "https://pub.dev" source: hosted version: "4.8.1" + json_serializable: + dependency: "direct dev" + description: + name: json_serializable + sha256: aa1f5a8912615733e0fdc7a02af03308933c93235bdc8d50d0b0c8a8ccb0b969 + url: "https://pub.dev" + source: hosted + version: "6.7.1" latlong2: dependency: "direct main" description: @@ -617,10 +625,10 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" mgrs_dart: dependency: transitive description: @@ -690,10 +698,10 @@ packages: dependency: transitive description: name: package_info_plus - sha256: "6ff267fcd9d48cb61c8df74a82680e8b82e940231bb5f68356672fde0397334a" + sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017" url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.2.0" package_info_plus_platform_interface: dependency: transitive description: @@ -730,10 +738,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: "6b8b19bd80da4f11ce91b2d1fb931f3006911477cec227cce23d3253d80df3f1" + sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.2.1" path_provider_foundation: dependency: transitive description: @@ -786,18 +794,18 @@ packages: dependency: transitive description: name: platform - sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 + sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.3" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.1.7" pointycastle: dependency: transitive description: @@ -834,10 +842,10 @@ packages: dependency: "direct main" description: name: provider - sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096" url: "https://pub.dev" source: hosted - version: "6.0.5" + version: "6.1.1" pub_semver: dependency: transitive description: @@ -866,18 +874,18 @@ packages: dependency: transitive description: name: sentry - sha256: e7ded42974bac5f69e4ca4ddc57d30499dd79381838f24b7e8fd9aa4139e7b79 + sha256: "89e426587b0879e53c46a0aae0eb312696d9d2d803ba14b252a65cc24b1416a2" url: "https://pub.dev" source: hosted - version: "7.13.2" + version: "7.14.0" sentry_flutter: dependency: "direct main" description: name: sentry_flutter - sha256: d6f55ec7a1f681784165021f749007712a72ff57eadf91e963331b6ae326f089 + sha256: fd089ee4e75a927be037c56815a0a54af5a519f52b803a5ffecb589bb36e2401 url: "https://pub.dev" source: hosted - version: "7.13.2" + version: "7.14.0" shared_preferences: dependency: "direct main" description: @@ -906,10 +914,10 @@ packages: dependency: transitive description: name: shared_preferences_linux - sha256: c2eb5bf57a2fe9ad6988121609e47d3e07bb3bdca5b6f8444e4cf302428a128a + sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" shared_preferences_platform_interface: dependency: transitive description: @@ -930,10 +938,10 @@ packages: dependency: transitive description: name: shared_preferences_windows - sha256: f763a101313bd3be87edffe0560037500967de9c394a714cd598d945517f694f + sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" shelf: dependency: transitive description: @@ -983,10 +991,18 @@ packages: dependency: transitive description: name: source_gen - sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.3.4" source_map_stack_trace: dependency: transitive description: @@ -1011,6 +1027,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" sqflite: dependency: "direct main" description: @@ -1023,26 +1047,26 @@ packages: dependency: transitive description: name: sqflite_common - sha256: "1b92f368f44b0dee2425bb861cfa17b6f6cf3961f762ff6f941d20b33355660a" + sha256: bb4738f15b23352822f4c42a531677e5c6f522e079461fd240ead29d8d8a54a6 url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.5.0+2" stack_trace: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -1063,10 +1087,10 @@ packages: dependency: "direct main" description: name: synchronized - sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60" + sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.0+1" term_glyph: dependency: transitive description: @@ -1079,26 +1103,26 @@ packages: dependency: "direct dev" description: name: test - sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46" + sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f url: "https://pub.dev" source: hosted - version: "1.24.3" + version: "1.24.9" test_api: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" test_core: dependency: transitive description: name: test_core - sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e" + sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a url: "https://pub.dev" source: hosted - version: "0.5.3" + version: "0.5.9" timelines: dependency: "direct main" description: @@ -1151,98 +1175,98 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "47e208a6711459d813ba18af120d9663c20bdf6985d6ad39fe165d2538378d27" + sha256: e9aa5ea75c84cf46b3db4eea212523591211c3cf2e13099ee4ec147f54201c86 url: "https://pub.dev" source: hosted - version: "6.1.14" + version: "6.2.2" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: b04af59516ab45762b2ca6da40fa830d72d0f6045cd97744450b73493fa76330 + sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def" url: "https://pub.dev" source: hosted - version: "6.1.0" + version: "6.2.0" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "7c65021d5dee51813d652357bc65b8dd4a6177082a9966bc8ba6ee477baa795f" + sha256: bba3373219b7abb6b5e0d071b0fe66dfbe005d07517a68e38d4fc3638f35c6d3 url: "https://pub.dev" source: hosted - version: "6.1.5" + version: "6.2.1" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: b651aad005e0cb06a01dbd84b428a301916dc75f0e7ea6165f80057fee2d8e8e + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.1.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: b55486791f666e62e0e8ff825e58a023fd6b1f71c49926483f1128d3bbd8fe88 + sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 url: "https://pub.dev" source: hosted - version: "3.0.7" + version: "3.1.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "95465b39f83bfe95fcb9d174829d6476216f2d548b79c38ab2506e0458787618" + sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50" url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.2.0" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: ba140138558fcc3eead51a1c42e92a9fb074a1b1149ed3c73e66035b2ccd94f2 + sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" url: "https://pub.dev" source: hosted - version: "2.0.19" + version: "2.2.0" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "95fef3129dc7cfaba2bc3d5ba2e16063bb561fc6d78e63eee16162bc70029069" + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 url: "https://pub.dev" source: hosted - version: "3.0.8" + version: "3.1.1" uuid: dependency: transitive description: name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + sha256: "22c94e5ad1e75f9934b766b53c742572ee2677c56bc871d850a57dad0f82127f" url: "https://pub.dev" source: hosted - version: "3.0.7" + version: "4.2.2" vector_graphics: dependency: transitive description: name: vector_graphics - sha256: "670f6e07aca990b4a2bcdc08a784193c4ccdd1932620244c3a86bb72a0eac67f" + sha256: "0f0c746dd2d6254a0057218ff980fc7f5670fd0fcf5e4db38a490d31eed4ad43" url: "https://pub.dev" source: hosted - version: "1.1.7" + version: "1.1.9+1" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: "7451721781d967db9933b63f5733b1c4533022c0ba373a01bdd79d1a5457f69f" + sha256: "0edf6d630d1bfd5589114138ed8fada3234deacc37966bec033d3047c29248b7" url: "https://pub.dev" source: hosted - version: "1.1.7" + version: "1.1.9+1" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: "80a13c613c8bde758b1464a1755a7b3a8f2b6cec61fbf0f5a53c94c30f03ba2e" + sha256: d24333727332d9bd20990f1483af4e09abdb9b1fc7c3db940b56ab5c42790c26 url: "https://pub.dev" source: hosted - version: "1.1.7" + version: "1.1.9+1" vector_math: dependency: transitive description: @@ -1279,10 +1303,10 @@ packages: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "0.3.0" web_socket_channel: dependency: transitive description: @@ -1303,10 +1327,10 @@ packages: dependency: transitive description: name: win32 - sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3" + sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 url: "https://pub.dev" source: hosted - version: "5.0.9" + version: "5.1.1" wkt_parser: dependency: transitive description: @@ -1348,5 +1372,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.1.2 <4.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" flutter: ">=3.13.7" diff --git a/uni/pubspec.yaml b/uni/pubspec.yaml index 9e2d230f6..5d0d351a7 100644 --- a/uni/pubspec.yaml +++ b/uni/pubspec.yaml @@ -39,6 +39,7 @@ dependencies: http: ^1.1.0 image: ^4.0.13 intl: ^0.18.0 + json_annotation: ^4.8.1 latlong2: ^0.9.0 logger: ^2.0.2+1 material_design_icons_flutter: ^7.0.7296 @@ -63,6 +64,7 @@ dev_dependencies: sdk: flutter # FIXME(luisd): Update mockito to a release version when 5.4.3 or above # is launched + json_serializable: ^6.7.1 mockito: git: url: https://github.com/dart-lang/mockito.git @@ -112,4 +114,4 @@ flutter_icons: adaptive_icon_foreground: "assets/icon/android_icon_foreground.png" flutter_intl: - enabled: true + enabled: true \ No newline at end of file diff --git a/uni/test/mocks/integration/src/exams_page_test.mocks.dart b/uni/test/mocks/integration/src/exams_page_test.mocks.dart index e28b49f59..40a40fedc 100644 --- a/uni/test/mocks/integration/src/exams_page_test.mocks.dart +++ b/uni/test/mocks/integration/src/exams_page_test.mocks.dart @@ -77,6 +77,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> get( Uri? url, { @@ -106,6 +107,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> post( Uri? url, { @@ -149,6 +151,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> put( Uri? url, { @@ -192,6 +195,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> patch( Uri? url, { @@ -235,6 +239,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> delete( Uri? url, { @@ -278,6 +283,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future read( Uri? url, { @@ -292,6 +298,7 @@ class MockClient extends _i1.Mock implements _i2.Client { returnValue: _i3.Future.value(''), returnValueForMissingStub: _i3.Future.value(''), ) as _i3.Future); + @override _i3.Future<_i5.Uint8List> readBytes( Uri? url, { @@ -307,6 +314,7 @@ class MockClient extends _i1.Mock implements _i2.Client { returnValueForMissingStub: _i3.Future<_i5.Uint8List>.value(_i5.Uint8List(0)), ) as _i3.Future<_i5.Uint8List>); + @override _i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod( @@ -331,6 +339,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.StreamedResponse>); + @override void close() => super.noSuchMethod( Invocation.method( @@ -351,30 +360,35 @@ class MockResponse extends _i1.Mock implements _i2.Response { returnValue: _i5.Uint8List(0), returnValueForMissingStub: _i5.Uint8List(0), ) as _i5.Uint8List); + @override String get body => (super.noSuchMethod( Invocation.getter(#body), returnValue: '', returnValueForMissingStub: '', ) as String); + @override int get statusCode => (super.noSuchMethod( Invocation.getter(#statusCode), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override Map get headers => (super.noSuchMethod( Invocation.getter(#headers), returnValue: {}, returnValueForMissingStub: {}, ) as Map); + @override bool get isRedirect => (super.noSuchMethod( Invocation.getter(#isRedirect), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override bool get persistentConnection => (super.noSuchMethod( Invocation.getter(#persistentConnection), diff --git a/uni/test/mocks/integration/src/schedule_page_test.mocks.dart b/uni/test/mocks/integration/src/schedule_page_test.mocks.dart index e5e3b4548..e03c840a2 100644 --- a/uni/test/mocks/integration/src/schedule_page_test.mocks.dart +++ b/uni/test/mocks/integration/src/schedule_page_test.mocks.dart @@ -93,6 +93,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i4.Future<_i2.Response>); + @override _i4.Future<_i2.Response> get( Uri? url, { @@ -122,6 +123,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i4.Future<_i2.Response>); + @override _i4.Future<_i2.Response> post( Uri? url, { @@ -165,6 +167,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i4.Future<_i2.Response>); + @override _i4.Future<_i2.Response> put( Uri? url, { @@ -208,6 +211,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i4.Future<_i2.Response>); + @override _i4.Future<_i2.Response> patch( Uri? url, { @@ -251,6 +255,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i4.Future<_i2.Response>); + @override _i4.Future<_i2.Response> delete( Uri? url, { @@ -294,6 +299,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i4.Future<_i2.Response>); + @override _i4.Future read( Uri? url, { @@ -308,6 +314,7 @@ class MockClient extends _i1.Mock implements _i2.Client { returnValue: _i4.Future.value(''), returnValueForMissingStub: _i4.Future.value(''), ) as _i4.Future); + @override _i4.Future<_i6.Uint8List> readBytes( Uri? url, { @@ -323,6 +330,7 @@ class MockClient extends _i1.Mock implements _i2.Client { returnValueForMissingStub: _i4.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), ) as _i4.Future<_i6.Uint8List>); + @override _i4.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod( @@ -347,6 +355,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i4.Future<_i2.StreamedResponse>); + @override void close() => super.noSuchMethod( Invocation.method( @@ -367,30 +376,35 @@ class MockResponse extends _i1.Mock implements _i2.Response { returnValue: _i6.Uint8List(0), returnValueForMissingStub: _i6.Uint8List(0), ) as _i6.Uint8List); + @override String get body => (super.noSuchMethod( Invocation.getter(#body), returnValue: '', returnValueForMissingStub: '', ) as String); + @override int get statusCode => (super.noSuchMethod( Invocation.getter(#statusCode), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override Map get headers => (super.noSuchMethod( Invocation.getter(#headers), returnValue: {}, returnValueForMissingStub: {}, ) as Map); + @override bool get isRedirect => (super.noSuchMethod( Invocation.getter(#isRedirect), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override bool get persistentConnection => (super.noSuchMethod( Invocation.getter(#persistentConnection), @@ -415,12 +429,14 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { Invocation.getter(#session), ), ) as _i3.Session); + @override bool get dependsOnSession => (super.noSuchMethod( Invocation.getter(#dependsOnSession), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override set dependsOnSession(bool? _dependsOnSession) => super.noSuchMethod( Invocation.setter( @@ -429,6 +445,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { ), returnValueForMissingStub: null, ); + @override set cacheDuration(Duration? _cacheDuration) => super.noSuchMethod( Invocation.setter( @@ -437,18 +454,21 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { ), returnValueForMissingStub: null, ); + @override _i8.RequestStatus get status => (super.noSuchMethod( Invocation.getter(#status), returnValue: _i8.RequestStatus.none, returnValueForMissingStub: _i8.RequestStatus.none, ) as _i8.RequestStatus); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override _i4.Future loadFromStorage() => (super.noSuchMethod( Invocation.method( @@ -458,6 +478,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future loadFromRemote( _i3.Session? session, @@ -474,6 +495,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override void restoreSession( String? username, @@ -491,6 +513,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { ), returnValueForMissingStub: null, ); + @override _i4.Future postAuthentication( _i10.BuildContext? context, @@ -513,22 +536,25 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override - void markAsNotInitialized() => super.noSuchMethod( + void markAsInitialized() => super.noSuchMethod( Invocation.method( - #markAsNotInitialized, + #markAsInitialized, [], ), returnValueForMissingStub: null, ); + @override - void updateStatus(_i8.RequestStatus? status) => super.noSuchMethod( + void markAsNotInitialized() => super.noSuchMethod( Invocation.method( - #updateStatus, - [status], + #markAsNotInitialized, + [], ), returnValueForMissingStub: null, ); + @override _i4.Future forceRefresh(_i10.BuildContext? context) => (super.noSuchMethod( @@ -539,6 +565,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future ensureInitialized(_i10.BuildContext? context) => (super.noSuchMethod( @@ -549,6 +576,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future ensureInitializedFromRemote(_i10.BuildContext? context) => (super.noSuchMethod( @@ -559,6 +587,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future ensureInitializedFromStorage() => (super.noSuchMethod( Invocation.method( @@ -568,6 +597,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -576,6 +606,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { ), returnValueForMissingStub: null, ); + @override void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -584,6 +615,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -592,6 +624,7 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/uni/test/mocks/unit/providers/exams_provider_test.mocks.dart b/uni/test/mocks/unit/providers/exams_provider_test.mocks.dart index fd78853db..9f2e5d8ed 100644 --- a/uni/test/mocks/unit/providers/exams_provider_test.mocks.dart +++ b/uni/test/mocks/unit/providers/exams_provider_test.mocks.dart @@ -80,6 +80,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> get( Uri? url, { @@ -109,6 +110,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> post( Uri? url, { @@ -152,6 +154,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> put( Uri? url, { @@ -195,6 +198,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> patch( Uri? url, { @@ -238,6 +242,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> delete( Uri? url, { @@ -281,6 +286,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future read( Uri? url, { @@ -295,6 +301,7 @@ class MockClient extends _i1.Mock implements _i2.Client { returnValue: _i3.Future.value(''), returnValueForMissingStub: _i3.Future.value(''), ) as _i3.Future); + @override _i3.Future<_i5.Uint8List> readBytes( Uri? url, { @@ -310,6 +317,7 @@ class MockClient extends _i1.Mock implements _i2.Client { returnValueForMissingStub: _i3.Future<_i5.Uint8List>.value(_i5.Uint8List(0)), ) as _i3.Future<_i5.Uint8List>); + @override _i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod( @@ -334,6 +342,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.StreamedResponse>); + @override void close() => super.noSuchMethod( Invocation.method( @@ -357,6 +366,7 @@ class MockParserExams extends _i1.Mock implements _i6.ParserExams { returnValue: '', returnValueForMissingStub: '', ) as String); + @override _i3.Future> parseExams( _i2.Response? response, @@ -386,30 +396,35 @@ class MockResponse extends _i1.Mock implements _i2.Response { returnValue: _i5.Uint8List(0), returnValueForMissingStub: _i5.Uint8List(0), ) as _i5.Uint8List); + @override String get body => (super.noSuchMethod( Invocation.getter(#body), returnValue: '', returnValueForMissingStub: '', ) as String); + @override int get statusCode => (super.noSuchMethod( Invocation.getter(#statusCode), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override Map get headers => (super.noSuchMethod( Invocation.getter(#headers), returnValue: {}, returnValueForMissingStub: {}, ) as Map); + @override bool get isRedirect => (super.noSuchMethod( Invocation.getter(#isRedirect), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override bool get persistentConnection => (super.noSuchMethod( Invocation.getter(#persistentConnection), diff --git a/uni/test/mocks/unit/providers/lecture_provider_test.mocks.dart b/uni/test/mocks/unit/providers/lecture_provider_test.mocks.dart index 3fd2208a6..49010fdd7 100644 --- a/uni/test/mocks/unit/providers/lecture_provider_test.mocks.dart +++ b/uni/test/mocks/unit/providers/lecture_provider_test.mocks.dart @@ -80,6 +80,7 @@ class MockScheduleFetcher extends _i1.Mock implements _i2.ScheduleFetcher { returnValueForMissingStub: _i4.Future>.value(<_i5.Lecture>[]), ) as _i4.Future>); + @override _i2.Dates getDates() => (super.noSuchMethod( Invocation.method( @@ -101,6 +102,7 @@ class MockScheduleFetcher extends _i1.Mock implements _i2.ScheduleFetcher { ), ), ) as _i2.Dates); + @override List getEndpoints(_i6.Session? session) => (super.noSuchMethod( Invocation.method( @@ -145,6 +147,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i4.Future<_i3.Response>); + @override _i4.Future<_i3.Response> get( Uri? url, { @@ -174,6 +177,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i4.Future<_i3.Response>); + @override _i4.Future<_i3.Response> post( Uri? url, { @@ -217,6 +221,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i4.Future<_i3.Response>); + @override _i4.Future<_i3.Response> put( Uri? url, { @@ -260,6 +265,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i4.Future<_i3.Response>); + @override _i4.Future<_i3.Response> patch( Uri? url, { @@ -303,6 +309,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i4.Future<_i3.Response>); + @override _i4.Future<_i3.Response> delete( Uri? url, { @@ -346,6 +353,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i4.Future<_i3.Response>); + @override _i4.Future read( Uri? url, { @@ -360,6 +368,7 @@ class MockClient extends _i1.Mock implements _i3.Client { returnValue: _i4.Future.value(''), returnValueForMissingStub: _i4.Future.value(''), ) as _i4.Future); + @override _i4.Future<_i9.Uint8List> readBytes( Uri? url, { @@ -375,6 +384,7 @@ class MockClient extends _i1.Mock implements _i3.Client { returnValueForMissingStub: _i4.Future<_i9.Uint8List>.value(_i9.Uint8List(0)), ) as _i4.Future<_i9.Uint8List>); + @override _i4.Future<_i3.StreamedResponse> send(_i3.BaseRequest? request) => (super.noSuchMethod( @@ -399,6 +409,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i4.Future<_i3.StreamedResponse>); + @override void close() => super.noSuchMethod( Invocation.method( @@ -419,30 +430,35 @@ class MockResponse extends _i1.Mock implements _i3.Response { returnValue: _i9.Uint8List(0), returnValueForMissingStub: _i9.Uint8List(0), ) as _i9.Uint8List); + @override String get body => (super.noSuchMethod( Invocation.getter(#body), returnValue: '', returnValueForMissingStub: '', ) as String); + @override int get statusCode => (super.noSuchMethod( Invocation.getter(#statusCode), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override Map get headers => (super.noSuchMethod( Invocation.getter(#headers), returnValue: {}, returnValueForMissingStub: {}, ) as Map); + @override bool get isRedirect => (super.noSuchMethod( Invocation.getter(#isRedirect), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override bool get persistentConnection => (super.noSuchMethod( Invocation.getter(#persistentConnection), From c4431796bb097351e372f127f64c5f12aaa8562d Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Sun, 24 Dec 2023 17:50:42 +0000 Subject: [PATCH 02/10] Resolve linting problems --- .../course_units_fetcher/all_course_units_fetcher.dart | 2 -- .../course_units_fetcher/current_course_units_fetcher.dart | 4 +--- .../controller/local_storage/app_shared_preferences.dart | 1 + uni/lib/model/entities/bug_report.dart | 1 - uni/lib/model/entities/bus_stop.dart | 1 - uni/lib/model/entities/course_units/course_unit.dart | 1 - uni/lib/model/entities/exam.dart | 2 +- uni/lib/model/entities/lecture.dart | 1 - uni/lib/model/entities/library_occupation.dart | 7 +++---- uni/lib/model/entities/location_group.dart | 1 - uni/lib/model/entities/reference.dart | 1 - uni/lib/model/entities/restaurant.dart | 3 +-- uni/lib/model/entities/trip.dart | 1 - uni/lib/model/providers/lazy/exam_provider.dart | 3 ++- uni/lib/view/bug_report/widgets/form.dart | 1 - uni/lib/view/bug_report/widgets/text_field.dart | 1 - 16 files changed, 9 insertions(+), 22 deletions(-) diff --git a/uni/lib/controller/fetchers/course_units_fetcher/all_course_units_fetcher.dart b/uni/lib/controller/fetchers/course_units_fetcher/all_course_units_fetcher.dart index 02d2f18d3..c84932de1 100644 --- a/uni/lib/controller/fetchers/course_units_fetcher/all_course_units_fetcher.dart +++ b/uni/lib/controller/fetchers/course_units_fetcher/all_course_units_fetcher.dart @@ -1,5 +1,3 @@ - -import 'package:logger/logger.dart'; import 'package:uni/controller/networking/network_router.dart'; import 'package:uni/controller/parsers/parser_course_units.dart'; import 'package:uni/model/entities/course.dart'; diff --git a/uni/lib/controller/fetchers/course_units_fetcher/current_course_units_fetcher.dart b/uni/lib/controller/fetchers/course_units_fetcher/current_course_units_fetcher.dart index e4250858a..bd291765b 100644 --- a/uni/lib/controller/fetchers/course_units_fetcher/current_course_units_fetcher.dart +++ b/uni/lib/controller/fetchers/course_units_fetcher/current_course_units_fetcher.dart @@ -35,9 +35,7 @@ class CurrentCourseUnitsFetcher implements SessionDependantFetcher { (course as Map)['inscricoes'] as List; for (final uc in enrollments) { final courseUnit = CourseUnit.fromJson(uc as Map); - if (courseUnit != null) { - ucs.add(courseUnit); - } + ucs.add(courseUnit); } } diff --git a/uni/lib/controller/local_storage/app_shared_preferences.dart b/uni/lib/controller/local_storage/app_shared_preferences.dart index 61236ff10..e2b60e5d7 100644 --- a/uni/lib/controller/local_storage/app_shared_preferences.dart +++ b/uni/lib/controller/local_storage/app_shared_preferences.dart @@ -294,6 +294,7 @@ class AppSharedPreferences { final prefs = await SharedPreferences.getInstance(); await prefs.setBool(tuitionNotificationsToggleKey, value); } + static Future getUsageStatsToggle() async { final prefs = await SharedPreferences.getInstance(); return prefs.getBool(usageStatsToggleKey) ?? true; diff --git a/uni/lib/model/entities/bug_report.dart b/uni/lib/model/entities/bug_report.dart index 8b110aca5..b3b5a806a 100644 --- a/uni/lib/model/entities/bug_report.dart +++ b/uni/lib/model/entities/bug_report.dart @@ -1,4 +1,3 @@ - // Stores information about Bug Report import 'package:json_annotation/json_annotation.dart'; import 'package:tuple/tuple.dart'; diff --git a/uni/lib/model/entities/bus_stop.dart b/uni/lib/model/entities/bus_stop.dart index b443f66c1..0a3e873bf 100644 --- a/uni/lib/model/entities/bus_stop.dart +++ b/uni/lib/model/entities/bus_stop.dart @@ -12,7 +12,6 @@ class BusStopData { this.trips = const [], }); - factory BusStopData.fromJson(Map json) => _$BusStopDataFromJson(json); final Set configuredBuses; diff --git a/uni/lib/model/entities/course_units/course_unit.dart b/uni/lib/model/entities/course_units/course_unit.dart index f89b07e40..2af1d78df 100644 --- a/uni/lib/model/entities/course_units/course_unit.dart +++ b/uni/lib/model/entities/course_units/course_unit.dart @@ -1,4 +1,3 @@ - import 'package:json_annotation/json_annotation.dart'; part 'course_unit.g.dart'; diff --git a/uni/lib/model/entities/exam.dart b/uni/lib/model/entities/exam.dart index eafe2b68f..2bfd4ffb0 100644 --- a/uni/lib/model/entities/exam.dart +++ b/uni/lib/model/entities/exam.dart @@ -1,7 +1,7 @@ import 'package:intl/intl.dart'; -import 'package:uni/model/entities/app_locale.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:logger/logger.dart'; +import 'package:uni/model/entities/app_locale.dart'; part 'exam.g.dart'; diff --git a/uni/lib/model/entities/lecture.dart b/uni/lib/model/entities/lecture.dart index ce3ea8766..c1f416fd3 100644 --- a/uni/lib/model/entities/lecture.dart +++ b/uni/lib/model/entities/lecture.dart @@ -73,7 +73,6 @@ class Lecture { String classNumber, int occurrId, ) { - final startTimeHours = int.parse(startTimeString.substring(0, 2)); final startTimeMinutes = int.parse(startTimeString.substring(3, 5)); final endTimeHours = diff --git a/uni/lib/model/entities/library_occupation.dart b/uni/lib/model/entities/library_occupation.dart index 6d76cdfc4..26c049955 100644 --- a/uni/lib/model/entities/library_occupation.dart +++ b/uni/lib/model/entities/library_occupation.dart @@ -10,12 +10,12 @@ class LibraryOccupation { LibraryOccupation(this.occupation, this.capacity) { floors = []; } - late int occupation; - late int capacity; - late List floors; factory LibraryOccupation.fromJson(Map json) => _$LibraryOccupationFromJson(json); + late int occupation; + late int capacity; + late List floors; void addFloor(FloorOccupation floor) { floors.add(floor); @@ -41,7 +41,6 @@ class LibraryOccupation { class FloorOccupation { FloorOccupation(this.number, this.occupation, this.capacity); - factory FloorOccupation.fromJson(Map json) => _$FloorOccupationFromJson(json); final int number; diff --git a/uni/lib/model/entities/location_group.dart b/uni/lib/model/entities/location_group.dart index 5a1008a84..456bf276c 100644 --- a/uni/lib/model/entities/location_group.dart +++ b/uni/lib/model/entities/location_group.dart @@ -18,7 +18,6 @@ class LocationGroup { ? groupBy(locations, (location) => location.floor) : Map.identity(); - factory LocationGroup.fromJson(Map json) => _$LocationGroupFromJson(json); final Map> floors; diff --git a/uni/lib/model/entities/reference.dart b/uni/lib/model/entities/reference.dart index 5e002f32d..fff4fc27c 100644 --- a/uni/lib/model/entities/reference.dart +++ b/uni/lib/model/entities/reference.dart @@ -27,7 +27,6 @@ class Reference { this.amount, ); - factory Reference.fromJson(Map json) => _$ReferenceFromJson(json); final String description; diff --git a/uni/lib/model/entities/restaurant.dart b/uni/lib/model/entities/restaurant.dart index 3dd89d0b2..81d298610 100644 --- a/uni/lib/model/entities/restaurant.dart +++ b/uni/lib/model/entities/restaurant.dart @@ -24,14 +24,13 @@ class Restaurant { final String name; @JsonKey(name: 'ref') final String reference; // Used only in html parser - @JsonKey(includeToJson:true) + @JsonKey(includeToJson: true) late final Map> meals; bool get isNotEmpty { return meals.isNotEmpty; } - Map toJson() => _$RestaurantToJson(this); List getMealsOfDay(DayOfWeek dayOfWeek) { diff --git a/uni/lib/model/entities/trip.dart b/uni/lib/model/entities/trip.dart index 528445986..cc94a73ae 100644 --- a/uni/lib/model/entities/trip.dart +++ b/uni/lib/model/entities/trip.dart @@ -11,7 +11,6 @@ class Trip { required this.timeRemaining, }); - factory Trip.fromJson(Map json) => _$TripFromJson(json); final String line; final String destination; diff --git a/uni/lib/model/providers/lazy/exam_provider.dart b/uni/lib/model/providers/lazy/exam_provider.dart index be6d9aad5..dbf8696d0 100644 --- a/uni/lib/model/providers/lazy/exam_provider.dart +++ b/uni/lib/model/providers/lazy/exam_provider.dart @@ -82,7 +82,8 @@ class ExamProvider extends StateProviderNotifier { List getFilteredExams() { return exams .where( - (exam) => filteredExamsTypes[Exam.getExamTypeLong(exam.examType)] ?? true, + (exam) => + filteredExamsTypes[Exam.getExamTypeLong(exam.examType)] ?? true, ) .toList(); } diff --git a/uni/lib/view/bug_report/widgets/form.dart b/uni/lib/view/bug_report/widgets/form.dart index 2c65027df..6076ff5bd 100644 --- a/uni/lib/view/bug_report/widgets/form.dart +++ b/uni/lib/view/bug_report/widgets/form.dart @@ -8,7 +8,6 @@ import 'package:uni/controller/local_storage/app_shared_preferences.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/app_locale.dart'; import 'package:uni/model/entities/bug_report.dart'; -import 'package:uni/utils/drawer_items.dart'; import 'package:uni/view/bug_report/widgets/text_field.dart'; import 'package:uni/view/common_widgets/page_title.dart'; import 'package:uni/view/common_widgets/toast_message.dart'; diff --git a/uni/lib/view/bug_report/widgets/text_field.dart b/uni/lib/view/bug_report/widgets/text_field.dart index 07f36f983..d0413ca55 100644 --- a/uni/lib/view/bug_report/widgets/text_field.dart +++ b/uni/lib/view/bug_report/widgets/text_field.dart @@ -72,7 +72,6 @@ class FormTextField extends StatelessWidget { ), ], ), - ], ), ); From 75db6bdc1c6acc4498d1cc2b45db709435286888 Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Fri, 29 Dec 2023 17:41:29 +0000 Subject: [PATCH 03/10] Rearrange generated files --- uni/build.yaml | 6 ++- .../model/entities/bug_report.g.dart | 2 +- .../{ => generated}/model/entities/bus.g.dart | 2 +- .../model/entities/bus_stop.g.dart | 2 +- .../model/entities/calendar_event.g.dart | 2 +- .../model/entities/course.g.dart | 17 +------ .../entities/course_units/course_unit.g.dart | 44 +++++++++++++++++++ .../model/entities/exam.g.dart | 2 +- .../model/entities/lecture.g.dart | 2 +- .../model/entities/library_occupation.g.dart | 2 +- .../model/entities/location_group.g.dart | 2 +- .../model/entities/meal.g.dart | 2 +- .../model/entities/reference.g.dart | 2 +- .../model/entities/restaurant.g.dart | 2 +- .../model/entities/trip.g.dart | 2 +- uni/lib/model/entities/bug_report.dart | 2 +- uni/lib/model/entities/bus.dart | 2 +- uni/lib/model/entities/bus_stop.dart | 2 +- uni/lib/model/entities/calendar_event.dart | 2 +- uni/lib/model/entities/course.dart | 23 +++++++--- .../entities/course_units/course_unit.dart | 2 +- uni/lib/model/entities/exam.dart | 34 +------------- uni/lib/model/entities/lecture.dart | 25 +++++------ .../model/entities/library_occupation.dart | 2 +- uni/lib/model/entities/location_group.dart | 2 +- uni/lib/model/entities/meal.dart | 3 +- uni/lib/model/entities/reference.dart | 2 +- uni/lib/model/entities/restaurant.dart | 2 +- uni/lib/model/entities/trip.dart | 2 +- 29 files changed, 106 insertions(+), 90 deletions(-) rename uni/lib/{ => generated}/model/entities/bug_report.g.dart (94%) rename uni/lib/{ => generated}/model/entities/bus.g.dart (93%) rename uni/lib/{ => generated}/model/entities/bus_stop.g.dart (94%) rename uni/lib/{ => generated}/model/entities/calendar_event.g.dart (90%) rename uni/lib/{ => generated}/model/entities/course.g.dart (53%) create mode 100644 uni/lib/generated/model/entities/course_units/course_unit.g.dart rename uni/lib/{ => generated}/model/entities/exam.g.dart (95%) rename uni/lib/{ => generated}/model/entities/lecture.g.dart (95%) rename uni/lib/{ => generated}/model/entities/library_occupation.g.dart (95%) rename uni/lib/{ => generated}/model/entities/location_group.g.dart (92%) rename uni/lib/{ => generated}/model/entities/meal.g.dart (95%) rename uni/lib/{ => generated}/model/entities/reference.g.dart (94%) rename uni/lib/{ => generated}/model/entities/restaurant.g.dart (95%) rename uni/lib/{ => generated}/model/entities/trip.g.dart (93%) diff --git a/uni/build.yaml b/uni/build.yaml index 3fd1459f9..fdf9d6d0d 100644 --- a/uni/build.yaml +++ b/uni/build.yaml @@ -4,4 +4,8 @@ targets: mockito|mockBuilder: options: build_extensions: - '^test/{{}}.dart': 'test/mocks/{{}}.mocks.dart' \ No newline at end of file + '^test/{{}}.dart': 'test/mocks/{{}}.mocks.dart' + source_gen:combining_builder: + options: + build_extensions: + '^lib/{{}}.dart' : 'lib/generated/{{}}.g.dart' \ No newline at end of file diff --git a/uni/lib/model/entities/bug_report.g.dart b/uni/lib/generated/model/entities/bug_report.g.dart similarity index 94% rename from uni/lib/model/entities/bug_report.g.dart rename to uni/lib/generated/model/entities/bug_report.g.dart index 291316fcc..d3ca3cbc3 100644 --- a/uni/lib/model/entities/bug_report.g.dart +++ b/uni/lib/generated/model/entities/bug_report.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'bug_report.dart'; +part of '../../../model/entities/bug_report.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/bus.g.dart b/uni/lib/generated/model/entities/bus.g.dart similarity index 93% rename from uni/lib/model/entities/bus.g.dart rename to uni/lib/generated/model/entities/bus.g.dart index 5d6b5461d..747aed365 100644 --- a/uni/lib/model/entities/bus.g.dart +++ b/uni/lib/generated/model/entities/bus.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'bus.dart'; +part of '../../../model/entities/bus.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/bus_stop.g.dart b/uni/lib/generated/model/entities/bus_stop.g.dart similarity index 94% rename from uni/lib/model/entities/bus_stop.g.dart rename to uni/lib/generated/model/entities/bus_stop.g.dart index 824966d5c..6c5adba1c 100644 --- a/uni/lib/model/entities/bus_stop.g.dart +++ b/uni/lib/generated/model/entities/bus_stop.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'bus_stop.dart'; +part of '../../../model/entities/bus_stop.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/calendar_event.g.dart b/uni/lib/generated/model/entities/calendar_event.g.dart similarity index 90% rename from uni/lib/model/entities/calendar_event.g.dart rename to uni/lib/generated/model/entities/calendar_event.g.dart index 41711a27c..337cd0df8 100644 --- a/uni/lib/model/entities/calendar_event.g.dart +++ b/uni/lib/generated/model/entities/calendar_event.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'calendar_event.dart'; +part of '../../../model/entities/calendar_event.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/course.g.dart b/uni/lib/generated/model/entities/course.g.dart similarity index 53% rename from uni/lib/model/entities/course.g.dart rename to uni/lib/generated/model/entities/course.g.dart index 3ec8df2f4..d51524b13 100644 --- a/uni/lib/model/entities/course.g.dart +++ b/uni/lib/generated/model/entities/course.g.dart @@ -1,27 +1,14 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'course.dart'; +part of '../../../model/entities/course.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -Course _$CourseFromJson(Map json) => Course( - id: json['cur_id'] as int, - festId: json['fest_id'] as int? ?? 0, - name: json['cur_nome'] as String?, - abbreviation: json['abbreviation'] as String?, - currYear: json['ano_curricular'] as String?, - firstEnrollment: json['fest_a_lect_1_insc'] as int?, - state: json['state'] as String?, - faculty: json['inst_sigla'] as String?, - finishedEcts: json['finishedEcts'] as num?, - currentAverage: json['currentAverage'] as num?, - ); - Map _$CourseToJson(Course instance) => { 'cur_id': instance.id, - 'fest_id': instance.festId, + 'fest_id ': instance.festId, 'cur_nome': instance.name, 'abbreviation': instance.abbreviation, 'ano_curricular': instance.currYear, diff --git a/uni/lib/generated/model/entities/course_units/course_unit.g.dart b/uni/lib/generated/model/entities/course_units/course_unit.g.dart new file mode 100644 index 000000000..7244397de --- /dev/null +++ b/uni/lib/generated/model/entities/course_units/course_unit.g.dart @@ -0,0 +1,44 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of '../../../../model/entities/course_units/course_unit.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CourseUnit _$CourseUnitFromJson(Map json) => CourseUnit( + abbreviation: json['ucurr_sigla'] as String, + name: json['ucurr_nome'] as String, + occurrId: json['ocorr_id'] as int, + id: json['ucurr_id'] as int? ?? 0, + code: json['ucurr_codigo'] as String? ?? '', + curricularYear: json['ano'] as int?, + semesterCode: json['per_codigo'] as String?, + semesterName: json['per_nome'] as String?, + type: json['tipo'] as String?, + status: json['estado'] as String?, + grade: json['resultado_melhor'] as String?, + ectsGrade: json['resultado_ects'] as String?, + result: json['resultado_insc'] as String?, + ects: json['creditos_ects'] as num?, + schoolYear: json['schoolYear'] as String?, + ); + +Map _$CourseUnitToJson(CourseUnit instance) => + { + 'ucurr_id': instance.id, + 'ucurr_codigo': instance.code, + 'ucurr_sigla': instance.abbreviation, + 'ucurr_nome': instance.name, + 'ano': instance.curricularYear, + 'ocorr_id': instance.occurrId, + 'per_codigo': instance.semesterCode, + 'per_nome': instance.semesterName, + 'tipo': instance.type, + 'estado': instance.status, + 'resultado_melhor': instance.grade, + 'resultado_ects': instance.ectsGrade, + 'resultado_insc': instance.result, + 'creditos_ects': instance.ects, + 'schoolYear': instance.schoolYear, + }; diff --git a/uni/lib/model/entities/exam.g.dart b/uni/lib/generated/model/entities/exam.g.dart similarity index 95% rename from uni/lib/model/entities/exam.g.dart rename to uni/lib/generated/model/entities/exam.g.dart index 5677cf7a7..7d0b8fe2a 100644 --- a/uni/lib/model/entities/exam.g.dart +++ b/uni/lib/generated/model/entities/exam.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'exam.dart'; +part of '../../../model/entities/exam.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/lecture.g.dart b/uni/lib/generated/model/entities/lecture.g.dart similarity index 95% rename from uni/lib/model/entities/lecture.g.dart rename to uni/lib/generated/model/entities/lecture.g.dart index eef0aac70..f83de3bdd 100644 --- a/uni/lib/model/entities/lecture.g.dart +++ b/uni/lib/generated/model/entities/lecture.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'lecture.dart'; +part of '../../../model/entities/lecture.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/library_occupation.g.dart b/uni/lib/generated/model/entities/library_occupation.g.dart similarity index 95% rename from uni/lib/model/entities/library_occupation.g.dart rename to uni/lib/generated/model/entities/library_occupation.g.dart index b1cf5dadc..fe8e7e4bb 100644 --- a/uni/lib/model/entities/library_occupation.g.dart +++ b/uni/lib/generated/model/entities/library_occupation.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'library_occupation.dart'; +part of '../../../model/entities/library_occupation.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/location_group.g.dart b/uni/lib/generated/model/entities/location_group.g.dart similarity index 92% rename from uni/lib/model/entities/location_group.g.dart rename to uni/lib/generated/model/entities/location_group.g.dart index 05f3e5d3a..4ca96e363 100644 --- a/uni/lib/model/entities/location_group.g.dart +++ b/uni/lib/generated/model/entities/location_group.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'location_group.dart'; +part of '../../../model/entities/location_group.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/meal.g.dart b/uni/lib/generated/model/entities/meal.g.dart similarity index 95% rename from uni/lib/model/entities/meal.g.dart rename to uni/lib/generated/model/entities/meal.g.dart index c62cf495e..eb0ea8a88 100644 --- a/uni/lib/model/entities/meal.g.dart +++ b/uni/lib/generated/model/entities/meal.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'meal.dart'; +part of '../../../model/entities/meal.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/reference.g.dart b/uni/lib/generated/model/entities/reference.g.dart similarity index 94% rename from uni/lib/model/entities/reference.g.dart rename to uni/lib/generated/model/entities/reference.g.dart index ce66670bf..53b2a3150 100644 --- a/uni/lib/model/entities/reference.g.dart +++ b/uni/lib/generated/model/entities/reference.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'reference.dart'; +part of '../../../model/entities/reference.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/restaurant.g.dart b/uni/lib/generated/model/entities/restaurant.g.dart similarity index 95% rename from uni/lib/model/entities/restaurant.g.dart rename to uni/lib/generated/model/entities/restaurant.g.dart index 51a622eae..5471eb4f0 100644 --- a/uni/lib/model/entities/restaurant.g.dart +++ b/uni/lib/generated/model/entities/restaurant.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'restaurant.dart'; +part of '../../../model/entities/restaurant.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/trip.g.dart b/uni/lib/generated/model/entities/trip.g.dart similarity index 93% rename from uni/lib/model/entities/trip.g.dart rename to uni/lib/generated/model/entities/trip.g.dart index bd82550aa..973f9d436 100644 --- a/uni/lib/model/entities/trip.g.dart +++ b/uni/lib/generated/model/entities/trip.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'trip.dart'; +part of '../../../model/entities/trip.dart'; // ************************************************************************** // JsonSerializableGenerator diff --git a/uni/lib/model/entities/bug_report.dart b/uni/lib/model/entities/bug_report.dart index b3b5a806a..022c4e9c3 100644 --- a/uni/lib/model/entities/bug_report.dart +++ b/uni/lib/model/entities/bug_report.dart @@ -2,7 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:tuple/tuple.dart'; -part 'bug_report.g.dart'; +part '../../generated/model/entities/bug_report.g.dart'; class TupleConverter extends JsonConverter?, String?> { const TupleConverter(); diff --git a/uni/lib/model/entities/bus.dart b/uni/lib/model/entities/bus.dart index 30ca9dc33..dfe850de5 100644 --- a/uni/lib/model/entities/bus.dart +++ b/uni/lib/model/entities/bus.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; -part 'bus.g.dart'; +part '../../generated/model/entities/bus.g.dart'; /// Stores information about a bus. /// diff --git a/uni/lib/model/entities/bus_stop.dart b/uni/lib/model/entities/bus_stop.dart index 0a3e873bf..65cc40311 100644 --- a/uni/lib/model/entities/bus_stop.dart +++ b/uni/lib/model/entities/bus_stop.dart @@ -1,7 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:uni/model/entities/trip.dart'; -part 'bus_stop.g.dart'; +part '../../generated/model/entities/bus_stop.g.dart'; /// Stores information about a bus stop. @JsonSerializable() diff --git a/uni/lib/model/entities/calendar_event.dart b/uni/lib/model/entities/calendar_event.dart index 6ece8c2f3..b353332a7 100644 --- a/uni/lib/model/entities/calendar_event.dart +++ b/uni/lib/model/entities/calendar_event.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; -part 'calendar_event.g.dart'; +part '../../generated/model/entities/calendar_event.g.dart'; /// An event in the school calendar @JsonSerializable() diff --git a/uni/lib/model/entities/course.dart b/uni/lib/model/entities/course.dart index a99d2ced4..ca287f149 100644 --- a/uni/lib/model/entities/course.dart +++ b/uni/lib/model/entities/course.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; -part 'course.g.dart'; +part '../../generated/model/entities/course.g.dart'; /// Stores information about a course. /// @@ -11,11 +11,11 @@ part 'course.g.dart'; /// - The course current `year` /// - The date of the `firstEnrollment` /// - The course `state` -@JsonSerializable() +@JsonSerializable(createFactory: false) class Course { Course({ required this.id, - this.festId = 0, + this.festId, this.name, this.abbreviation, this.currYear, @@ -26,10 +26,23 @@ class Course { this.currentAverage, }); - factory Course.fromJson(Map json) => _$CourseFromJson(json); + factory Course.fromJson(Map json) { + return Course( + id: json['cur_id'] as int, + festId: json['fest_id'] as int?, + name: json['cur_nome'] as String?, + abbreviation: json['abbreviation'] as String?, + currYear: json['ano_curricular'] as String?, + firstEnrollment: json['fest_a_lect_1_insc'] as int?, + state: json['state'] as String?, + faculty: json['inst_sigla'].toString().toLowerCase(), + finishedEcts: json['finishedEcts'] as num?, + currentAverage: json['currentAverage'] as num?, + ); + } @JsonKey(name: 'cur_id') final int id; - @JsonKey(name: 'fest_id') + @JsonKey(name: 'fest_id ') final int? festId; @JsonKey(name: 'cur_nome') final String? name; diff --git a/uni/lib/model/entities/course_units/course_unit.dart b/uni/lib/model/entities/course_units/course_unit.dart index 2af1d78df..82846fc79 100644 --- a/uni/lib/model/entities/course_units/course_unit.dart +++ b/uni/lib/model/entities/course_units/course_unit.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; -part 'course_unit.g.dart'; +part '../../../generated/model/entities/course_units/course_unit.g.dart'; /// Stores information about a course unit. @JsonSerializable() diff --git a/uni/lib/model/entities/exam.dart b/uni/lib/model/entities/exam.dart index 2bfd4ffb0..2a242395d 100644 --- a/uni/lib/model/entities/exam.dart +++ b/uni/lib/model/entities/exam.dart @@ -3,40 +3,8 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:logger/logger.dart'; import 'package:uni/model/entities/app_locale.dart'; -part 'exam.g.dart'; +part '../../generated/model/entities/exam.g.dart'; -enum WeekDays { - monday('Segunda'), - tuesday('Terça'), - wednesday('Quarta'), - thursday('Quinta'), - friday('Sexta'), - saturday('Sábado'), - sunday('Domingo'); - - const WeekDays(this.day); - - final String day; -} - -enum Months { - january('janeiro'), - february('fevereiro'), - march('março'), - april('abril'), - may('maio'), - june('junho'), - july('julho'), - august('agosto'), - september('setembro'), - october('outubro'), - november('novembro'), - december('dezembro'); - - const Months(this.month); - - final String month; -} class DateTimeConverter extends JsonConverter { const DateTimeConverter(); diff --git a/uni/lib/model/entities/lecture.dart b/uni/lib/model/entities/lecture.dart index c1f416fd3..d43a81796 100644 --- a/uni/lib/model/entities/lecture.dart +++ b/uni/lib/model/entities/lecture.dart @@ -1,7 +1,8 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:logger/logger.dart'; -part 'lecture.g.dart'; +part '../../generated/model/entities/lecture.g.dart'; + class DateTimeConverter extends JsonConverter { const DateTimeConverter(); @@ -73,21 +74,19 @@ class Lecture { String classNumber, int occurrId, ) { - final startTimeHours = int.parse(startTimeString.substring(0, 2)); - final startTimeMinutes = int.parse(startTimeString.substring(3, 5)); - final endTimeHours = - (startTimeMinutes + (blocks * 30)) ~/ 60 + startTimeHours; - final endTimeMinutes = (startTimeMinutes + (blocks * 30)) % 60; + final startTimeList = startTimeString.split(':'); + final startTime = day.add( + Duration( + hours: int.parse(startTimeList[0]), + minutes: int.parse(startTimeList[1]), + ), + ); + final endTime = startTime.add(Duration(minutes: 30 * blocks)); return Lecture( subject, typeClass, - day.add(Duration(hours: startTimeHours, minutes: startTimeMinutes)), - day.add( - Duration( - hours: startTimeMinutes + endTimeHours, - minutes: startTimeMinutes + endTimeMinutes, - ), - ), + startTime, + endTime, blocks, room, teacher, diff --git a/uni/lib/model/entities/library_occupation.dart b/uni/lib/model/entities/library_occupation.dart index 26c049955..2477149c8 100644 --- a/uni/lib/model/entities/library_occupation.dart +++ b/uni/lib/model/entities/library_occupation.dart @@ -2,7 +2,7 @@ import 'dart:math'; import 'package:json_annotation/json_annotation.dart'; -part 'library_occupation.g.dart'; +part '../../generated/model/entities/library_occupation.g.dart'; /// Overall occupation of the library @JsonSerializable() diff --git a/uni/lib/model/entities/location_group.dart b/uni/lib/model/entities/location_group.dart index 456bf276c..8f946fd1f 100644 --- a/uni/lib/model/entities/location_group.dart +++ b/uni/lib/model/entities/location_group.dart @@ -3,7 +3,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:latlong2/latlong.dart'; import 'package:uni/model/entities/location.dart'; -part 'location_group.g.dart'; +part '../../generated/model/entities/location_group.g.dart'; /// Store information about a location marker. /// What's located in each floor, like vending machines, rooms, etc... diff --git a/uni/lib/model/entities/meal.dart b/uni/lib/model/entities/meal.dart index 5684e36eb..77beb65c9 100644 --- a/uni/lib/model/entities/meal.dart +++ b/uni/lib/model/entities/meal.dart @@ -2,7 +2,8 @@ import 'package:intl/intl.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:uni/model/utils/day_of_week.dart'; -part 'meal.g.dart'; +part '../../generated/model/entities/meal.g.dart'; + class DateTimeConverter extends JsonConverter { const DateTimeConverter(); diff --git a/uni/lib/model/entities/reference.dart b/uni/lib/model/entities/reference.dart index fff4fc27c..e56334fef 100644 --- a/uni/lib/model/entities/reference.dart +++ b/uni/lib/model/entities/reference.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; -part 'reference.g.dart'; +part '../../generated/model/entities/reference.g.dart'; class DateTimeConverter extends JsonConverter { const DateTimeConverter(); diff --git a/uni/lib/model/entities/restaurant.dart b/uni/lib/model/entities/restaurant.dart index 81d298610..74ef474cc 100644 --- a/uni/lib/model/entities/restaurant.dart +++ b/uni/lib/model/entities/restaurant.dart @@ -3,7 +3,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:uni/model/entities/meal.dart'; import 'package:uni/model/utils/day_of_week.dart'; -part 'restaurant.g.dart'; +part '../../generated/model/entities/restaurant.g.dart'; @JsonSerializable() class Restaurant { diff --git a/uni/lib/model/entities/trip.dart b/uni/lib/model/entities/trip.dart index cc94a73ae..dd85dea31 100644 --- a/uni/lib/model/entities/trip.dart +++ b/uni/lib/model/entities/trip.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; -part 'trip.g.dart'; +part '../../generated/model/entities/trip.g.dart'; /// Stores information about a bus trip. @JsonSerializable() From ff7ac5c024030594144f45a5660c57fc9d8f5aa4 Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Thu, 25 Jan 2024 19:29:14 +0000 Subject: [PATCH 04/10] Resolve database naming --- .../database/app_course_units_database.dart | 8 ++-- .../database/app_courses_database.dart | 6 +-- .../entities/course_units/course_unit.g.dart | 44 ------------------- .../src/schedule_page_test.mocks.dart | 2 - 4 files changed, 7 insertions(+), 53 deletions(-) delete mode 100644 uni/lib/model/entities/course_units/course_unit.g.dart diff --git a/uni/lib/controller/local_storage/database/app_course_units_database.dart b/uni/lib/controller/local_storage/database/app_course_units_database.dart index 355e795ab..96f954917 100644 --- a/uni/lib/controller/local_storage/database/app_course_units_database.dart +++ b/uni/lib/controller/local_storage/database/app_course_units_database.dart @@ -7,10 +7,10 @@ import 'package:uni/model/entities/course_units/course_unit.dart'; class AppCourseUnitsDatabase extends AppDatabase { AppCourseUnitsDatabase() : super('course_units.db', [createScript]); static const String createScript = - '''CREATE TABLE course_units(id INTEGER, code TEXT, abbreviation TEXT , ''' - '''name TEXT, curricularYear INTEGER, occurrId INTEGER, semesterCode TEXT, ''' - '''semesterName TEXT, type TEXT, status TEXT, grade TEXT, ectsGrade TEXT, ''' - '''result TEXT, ects REAL, schoolYear TEXT)'''; + '''CREATE TABLE course_units(ucurr_id INTEGER, ucurr_codigo TEXT, ucurr_sigla TEXT , ''' + '''ucurr_nome TEXT, ano INTEGER, ocorr_id INTEGER, per_codigo TEXT, ''' + '''per_nome TEXT, tipo TEXT, estado TEXT, resultado_melhor TEXT, resultado_ects TEXT, ''' + '''resultado_insc TEXT, creditos_ects REAL, schoolYear TEXT)'''; Future saveNewCourseUnits(List courseUnits) async { await deleteCourseUnits(); diff --git a/uni/lib/controller/local_storage/database/app_courses_database.dart b/uni/lib/controller/local_storage/database/app_courses_database.dart index ace09ad74..c924dd444 100644 --- a/uni/lib/controller/local_storage/database/app_courses_database.dart +++ b/uni/lib/controller/local_storage/database/app_courses_database.dart @@ -12,9 +12,9 @@ class AppCoursesDatabase extends AppDatabase { AppCoursesDatabase() : super('courses.db', [createScript], onUpgrade: migrate, version: 3); static const String createScript = - '''CREATE TABLE courses(id INTEGER, fest_id INTEGER, name TEXT, ''' - '''abbreviation TEXT, currYear TEXT, firstEnrollment INTEGER, state TEXT, ''' - '''faculty TEXT, currentAverage REAL, finishedEcts REAL)'''; + '''CREATE TABLE courses(cur_id INTEGER, fest_id INTEGER, cur_nome TEXT, ''' + '''abbreviation TEXT, ano_curricular TEXT, fest_a_lect_1_insc INTEGER, state TEXT, ''' + '''inst_sigla TEXT, currentAverage REAL, finishedEcts REAL)'''; /// Replaces all of the data in this database with the data from [courses]. Future saveNewCourses(List courses) async { diff --git a/uni/lib/model/entities/course_units/course_unit.g.dart b/uni/lib/model/entities/course_units/course_unit.g.dart deleted file mode 100644 index 84171d103..000000000 --- a/uni/lib/model/entities/course_units/course_unit.g.dart +++ /dev/null @@ -1,44 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'course_unit.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -CourseUnit _$CourseUnitFromJson(Map json) => CourseUnit( - abbreviation: json['ucurr_sigla'] as String, - name: json['ucurr_nome'] as String, - occurrId: json['ocorr_id'] as int, - id: json['ucurr_id'] as int? ?? 0, - code: json['ucurr_codigo'] as String? ?? '', - curricularYear: json['ano'] as int?, - semesterCode: json['per_codigo'] as String?, - semesterName: json['per_nome'] as String?, - type: json['tipo'] as String?, - status: json['estado'] as String?, - grade: json['resultado_melhor'] as String?, - ectsGrade: json['resultado_ects'] as String?, - result: json['resultado_insc'] as String?, - ects: json['creditos_ects'] as num?, - schoolYear: json['schoolYear'] as String?, - ); - -Map _$CourseUnitToJson(CourseUnit instance) => - { - 'ucurr_id': instance.id, - 'ucurr_codigo': instance.code, - 'ucurr_sigla': instance.abbreviation, - 'ucurr_nome': instance.name, - 'ano': instance.curricularYear, - 'ocorr_id': instance.occurrId, - 'per_codigo': instance.semesterCode, - 'per_nome': instance.semesterName, - 'tipo': instance.type, - 'estado': instance.status, - 'resultado_melhor': instance.grade, - 'resultado_ects': instance.ectsGrade, - 'resultado_insc': instance.result, - 'creditos_ects': instance.ects, - 'schoolYear': instance.schoolYear, - }; diff --git a/uni/test/mocks/integration/src/schedule_page_test.mocks.dart b/uni/test/mocks/integration/src/schedule_page_test.mocks.dart index 44112a5cc..5be25a598 100644 --- a/uni/test/mocks/integration/src/schedule_page_test.mocks.dart +++ b/uni/test/mocks/integration/src/schedule_page_test.mocks.dart @@ -525,7 +525,6 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); - @override void updateState(_i3.Session? newState) => super.noSuchMethod( Invocation.method( @@ -566,7 +565,6 @@ class MockSessionProvider extends _i1.Mock implements _i7.SessionProvider { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); - @override void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( Invocation.method( From b2da322caec0f6f7e33141a2aca387157b9bbd75 Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Thu, 25 Jan 2024 19:29:14 +0000 Subject: [PATCH 05/10] Resolve database naming --- .../database/app_course_units_database.dart | 27 +++++++++---------- .../database/app_courses_database.dart | 10 +++---- uni/lib/model/entities/exam.dart | 5 ++-- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/uni/lib/controller/local_storage/database/app_course_units_database.dart b/uni/lib/controller/local_storage/database/app_course_units_database.dart index 96f954917..582965304 100644 --- a/uni/lib/controller/local_storage/database/app_course_units_database.dart +++ b/uni/lib/controller/local_storage/database/app_course_units_database.dart @@ -20,23 +20,22 @@ class AppCourseUnitsDatabase extends AppDatabase { Future> courseUnits() async { final db = await getDatabase(); final List> maps = await db.query('course_units'); - return List.generate(maps.length, (i) { return CourseUnit( - id: maps[i]['id'] as int, - code: maps[i]['code'] as String, - abbreviation: maps[i]['abbreviation'] as String, - name: maps[i]['name'] as String, - curricularYear: maps[i]['curricularYear'] as int?, - occurrId: maps[i]['occurrId'] as int, - semesterCode: maps[i]['semesterCode'] as String?, - semesterName: maps[i]['semesterName'] as String?, - type: maps[i]['type'] as String?, - status: maps[i]['status'] as String?, - grade: maps[i]['grade'] as String?, + id: maps[i]['ucurr_id'] as int, + code: maps[i]['ucurr_codigo'] as String, + abbreviation: maps[i]['ucurr_sigla'] as String, + name: maps[i]['ucurr_nome'] as String, + curricularYear: maps[i]['ano'] as int?, + occurrId: maps[i]['ocorr_id'] as int, + semesterCode: maps[i]['per_codigo'] as String?, + semesterName: maps[i]['per_nome'] as String?, + type: maps[i]['tipo'] as String?, + status: maps[i]['estado'] as String?, + grade: maps[i]['resultado_melhor'] as String?, ectsGrade: maps[i]['ectsGrade'] as String?, - result: maps[i]['result'] as String?, - ects: maps[i]['ects'] as double?, + result: maps[i]['resultado_insc'] as String?, + ects: maps[i]['creditos_ects'] as double?, schoolYear: maps[i]['schoolYear'] as String?, ); }); diff --git a/uni/lib/controller/local_storage/database/app_courses_database.dart b/uni/lib/controller/local_storage/database/app_courses_database.dart index c924dd444..ed0ff3894 100644 --- a/uni/lib/controller/local_storage/database/app_courses_database.dart +++ b/uni/lib/controller/local_storage/database/app_courses_database.dart @@ -30,14 +30,14 @@ class AppCoursesDatabase extends AppDatabase { // Convert the List into a List. return List.generate(maps.length, (i) { return Course( - id: maps[i]['id'] as int? ?? 0, + id: maps[i]['cur_id'] as int? ?? 0, festId: maps[i]['fest_id'] as int? ?? 0, - name: maps[i]['name'] as String?, + name: maps[i]['cur_nome'] as String?, abbreviation: maps[i]['abbreviation'] as String?, - currYear: maps[i]['currYear'] as String?, - firstEnrollment: maps[i]['firstEnrollment'] as int? ?? 0, + currYear: maps[i]['ano_curricular'] as String?, + firstEnrollment: maps[i]['fest_a_lect_1_insc'] as int? ?? 0, state: maps[i]['state'] as String?, - faculty: maps[i]['faculty'] as String?, + faculty: maps[i]['inst_sigla'] as String?, finishedEcts: maps[i]['finishedEcts'] as double? ?? 0, currentAverage: maps[i]['currentAverage'] as double? ?? 0, ); diff --git a/uni/lib/model/entities/exam.dart b/uni/lib/model/entities/exam.dart index f8c7b0e50..987d9d72b 100644 --- a/uni/lib/model/entities/exam.dart +++ b/uni/lib/model/entities/exam.dart @@ -10,13 +10,14 @@ class DateTimeConverter extends JsonConverter { @override DateTime fromJson(String json) { - final format = DateFormat('d-M-y'); + final format = DateFormat('yyyy-M-dd'); return format.parse(json); } @override String toJson(DateTime object) { - final format = DateFormat('d-M-y'); + final format = DateFormat('yyyy-MM-dd'); + return format.format(object); } } From a2bd5eafa77a9501bbc2633f9599be61e3aaea55 Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Mon, 29 Jan 2024 11:24:42 +0000 Subject: [PATCH 06/10] Bump db version for changed files --- .../database/app_course_units_database.dart | 19 ++++++++++++++++++- .../database/app_courses_database.dart | 2 +- .../database/app_exams_database.dart | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/uni/lib/controller/local_storage/database/app_course_units_database.dart b/uni/lib/controller/local_storage/database/app_course_units_database.dart index 582965304..e4c0b616a 100644 --- a/uni/lib/controller/local_storage/database/app_course_units_database.dart +++ b/uni/lib/controller/local_storage/database/app_course_units_database.dart @@ -5,7 +5,13 @@ import 'package:uni/controller/local_storage/database/app_database.dart'; import 'package:uni/model/entities/course_units/course_unit.dart'; class AppCourseUnitsDatabase extends AppDatabase { - AppCourseUnitsDatabase() : super('course_units.db', [createScript]); + AppCourseUnitsDatabase() + : super( + 'course_units.db', + [createScript], + onUpgrade: migrate, + version: 2, + ); static const String createScript = '''CREATE TABLE course_units(ucurr_id INTEGER, ucurr_codigo TEXT, ucurr_sigla TEXT , ''' '''ucurr_nome TEXT, ano INTEGER, ocorr_id INTEGER, per_codigo TEXT, ''' @@ -55,4 +61,15 @@ class AppCourseUnitsDatabase extends AppDatabase { final db = await getDatabase(); await db.delete('course_units'); } + + static FutureOr migrate( + Database db, + int oldVersion, + int newVersion, + ) async { + final batch = db.batch() + ..execute('DROP TABLE IF EXISTS courses') + ..execute(createScript); + await batch.commit(); + } } diff --git a/uni/lib/controller/local_storage/database/app_courses_database.dart b/uni/lib/controller/local_storage/database/app_courses_database.dart index ed0ff3894..ec31530bb 100644 --- a/uni/lib/controller/local_storage/database/app_courses_database.dart +++ b/uni/lib/controller/local_storage/database/app_courses_database.dart @@ -10,7 +10,7 @@ import 'package:uni/model/entities/course.dart'; /// See the [Course] class to see what data is stored in this database. class AppCoursesDatabase extends AppDatabase { AppCoursesDatabase() - : super('courses.db', [createScript], onUpgrade: migrate, version: 3); + : super('courses.db', [createScript], onUpgrade: migrate, version: 4); static const String createScript = '''CREATE TABLE courses(cur_id INTEGER, fest_id INTEGER, cur_nome TEXT, ''' '''abbreviation TEXT, ano_curricular TEXT, fest_a_lect_1_insc INTEGER, state TEXT, ''' diff --git a/uni/lib/controller/local_storage/database/app_exams_database.dart b/uni/lib/controller/local_storage/database/app_exams_database.dart index a47d73526..466571d1c 100644 --- a/uni/lib/controller/local_storage/database/app_exams_database.dart +++ b/uni/lib/controller/local_storage/database/app_exams_database.dart @@ -10,7 +10,7 @@ import 'package:uni/model/entities/exam.dart'; /// See the [Exam] class to see what data is stored in this database. class AppExamsDatabase extends AppDatabase { AppExamsDatabase() - : super('exams.db', [_createScript], onUpgrade: migrate, version: 5); + : super('exams.db', [_createScript], onUpgrade: migrate, version: 6); Map months = { 'Janeiro': '01', 'Fevereiro': '02', From 9c91dbcd767d3c88ce88df2f1d7548df228120ef Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Tue, 27 Feb 2024 14:39:49 +0000 Subject: [PATCH 07/10] Resolve remaining issues --- .../database/app_lectures_database.dart | 4 +- uni/lib/model/entities/calendar_event.dart | 24 +- uni/lib/view/home/widgets/exam_card.dart | 11 +- uni/pubspec.lock | 246 ++++++++++-------- uni/pubspec.yaml | 1 + 5 files changed, 160 insertions(+), 126 deletions(-) diff --git a/uni/lib/controller/local_storage/database/app_lectures_database.dart b/uni/lib/controller/local_storage/database/app_lectures_database.dart index 283dc1976..6dcb89ba6 100644 --- a/uni/lib/controller/local_storage/database/app_lectures_database.dart +++ b/uni/lib/controller/local_storage/database/app_lectures_database.dart @@ -16,11 +16,11 @@ class AppLecturesDatabase extends AppDatabase { createScript, ], onUpgrade: migrate, - version: 7, + version: 9, ); static const createScript = ''' CREATE TABLE lectures(subject TEXT, typeClass TEXT, - startDateTime TEXT, blocks INTEGER, room TEXT, teacher TEXT, classNumber TEXT, occurrId INTEGER)'''; + startTime TEXT,endTime TEXT, blocks INTEGER, room TEXT, teacher TEXT, classNumber TEXT, occurrId INTEGER)'''; /// Replaces all of the data in this database with [lectures]. Future saveNewLectures(List lectures) async { diff --git a/uni/lib/model/entities/calendar_event.dart b/uni/lib/model/entities/calendar_event.dart index b33c79564..e5d031432 100644 --- a/uni/lib/model/entities/calendar_event.dart +++ b/uni/lib/model/entities/calendar_event.dart @@ -1,12 +1,13 @@ +import 'package:intl/intl.dart'; import 'package:json_annotation/json_annotation.dart'; part '../../generated/model/entities/calendar_event.g.dart'; -import 'package:intl/intl.dart'; /// An event in the school calendar @JsonSerializable() class CalendarEvent { CalendarEvent(this.name, this.date); + factory CalendarEvent.fromJson(Map json) => _$CalendarEventFromJson(json); @@ -14,5 +15,26 @@ class CalendarEvent { /// String name; String date; + Map toJson() => _$CalendarEventToJson(this); + + DateTime? get parsedStartDate { + final splitDate = date.split(' '); + final month = splitDate.firstWhere( + (element) => + DateFormat + .MMMM('pt') + .dateSymbols + .MONTHS + .contains(element) || + element == 'TBD', + ); + + try { + return DateFormat('dd MMMM yyyy', 'pt') + .parse('${splitDate[0]} $month ${splitDate.last}'); + } catch (e) { + return null; + } + } } diff --git a/uni/lib/view/home/widgets/exam_card.dart b/uni/lib/view/home/widgets/exam_card.dart index 121fc1b6f..1b2984113 100644 --- a/uni/lib/view/home/widgets/exam_card.dart +++ b/uni/lib/view/home/widgets/exam_card.dart @@ -1,20 +1,15 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:uni/controller/local_storage/preferences_controller.dart'; import 'package:uni/generated/l10n.dart'; -import 'package:uni/model/entities/app_locale.dart'; import 'package:uni/model/entities/exam.dart'; import 'package:uni/model/providers/lazy/exam_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; -import 'package:uni/view/common_widgets/date_rectangle.dart'; import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; -import 'package:uni/view/common_widgets/row_container.dart'; -import 'package:uni/view/exams/widgets/exam_row.dart'; -import 'package:uni/view/exams/widgets/exam_title.dart'; import 'package:uni/view/home/widgets/exam_card_shimmer.dart'; +import 'package:uni/view/home/widgets/remaining_exams_card.dart'; import 'package:uni/view/lazy_consumer.dart'; -import 'package:uni/view/locale_notifier.dart'; + +import 'next_exams_card.dart'; /// Manages the exam card section inside the personal area. class ExamCard extends GenericCard { diff --git a/uni/pubspec.lock b/uni/pubspec.lock index 45adf371f..5242797e0 100644 --- a/uni/pubspec.lock +++ b/uni/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 url: "https://pub.dev" source: hosted - version: "61.0.0" + version: "64.0.0" add_2_calendar: dependency: "direct main" description: @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: analyzer - sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" url: "https://pub.dev" source: hosted - version: "5.13.0" + version: "6.2.0" animated_stack_widget: dependency: transitive description: @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: archive - sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b" + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" url: "https://pub.dev" source: hosted - version: "3.4.9" + version: "3.4.10" args: dependency: transitive description: @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: asn1lib - sha256: "21afe4333076c02877d14f4a89df111e658a6d466cbfc802eb705eb91bd5adfd" + sha256: c9c85fedbe2188b95133cbe960e16f5f448860f7133330e272edbbca5893ddc6 url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "1.5.2" async: dependency: transitive description: @@ -69,10 +69,10 @@ packages: dependency: "direct main" description: name: battery_plus - sha256: "0568fbba70697b8d0c34c1176faa2bc6d61c7fb211a2d2d64e493b91ff72d3f8" + sha256: ba605aeafd6609cb5f8020c609a51941803a5fb2b6a7576f7c7eeeb52d29e750 url: "https://pub.dev" source: hosted - version: "5.0.2" + version: "5.0.3" battery_plus_platform_interface: dependency: transitive description: @@ -133,10 +133,10 @@ packages: dependency: transitive description: name: build_runner_core - sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185 + sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" url: "https://pub.dev" source: hosted - version: "7.2.11" + version: "7.3.0" built_collection: dependency: transitive description: @@ -149,10 +149,10 @@ packages: dependency: transitive description: name: built_value - sha256: c9aabae0718ec394e5bc3c7272e6bb0dc0b32201a08fe185ec1d8401d3e39309 + sha256: fedde275e0a6b798c3296963c5cd224e3e1b55d0e478d5b7e65e6b540f363a0e url: "https://pub.dev" source: hosted - version: "8.8.1" + version: "8.9.1" cached_network_image: dependency: "direct main" description: @@ -213,18 +213,18 @@ packages: dependency: transitive description: name: code_builder - sha256: feee43a5c05e7b3199bb375a86430b8ada1b04104f2923d0e03cc01ca87b6d84 + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "4.10.0" collection: dependency: "direct main" description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" connectivity_plus: dependency: "direct main" description: @@ -253,10 +253,10 @@ packages: dependency: transitive description: name: coverage - sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" + sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" url: "https://pub.dev" source: hosted - version: "1.6.4" + version: "1.7.2" crypto: dependency: "direct main" description: @@ -285,18 +285,18 @@ packages: dependency: "direct main" description: name: currency_text_input_formatter - sha256: "5d8db755ccde76817f6f5fb33e65304d7b1db442e1ccff079fe235584c6b7d5a" + sha256: b60c298fec9f0e96dfad88d25d026a6bf43f4e2bb9c59218afd8de1e09f54a60 url: "https://pub.dev" source: hosted - version: "2.1.10" + version: "2.1.11" dart_style: dependency: transitive description: name: dart_style - sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" + sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.4" dbus: dependency: transitive description: @@ -304,7 +304,7 @@ packages: sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" url: "https://pub.dev" source: hosted - version: "0.7.8" + version: "0.7.10" diacritic: dependency: "direct main" description: @@ -402,10 +402,10 @@ packages: dependency: "direct main" description: name: flutter_local_notifications - sha256: "501ed9d54f1c8c0535b7991bade36f9e7e3b45a2346401f03775c1ec7a3c06ae" + sha256: "401643a6ea9d8451365f2ec11145335bf130560cfde367bdf8f0be6d60f89479" url: "https://pub.dev" source: hosted - version: "15.1.2" + version: "15.1.3" flutter_local_notifications_linux: dependency: transitive description: @@ -447,18 +447,18 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: "35108526a233cc0755664d445f8a6b4b61e6f8fe993b3658b80b4a26827fc196" + sha256: "5b24061317f850af858ef7151dadbb6eb77c1c449c954c7bb064e8a5e0e7d81f" url: "https://pub.dev" source: hosted - version: "0.6.18+2" + version: "0.6.20" flutter_svg: dependency: "direct main" description: name: flutter_svg - sha256: d39e7f95621fc84376bc0f7d504f05c3a41488c562f4a8ad410569127507402c + sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" url: "https://pub.dev" source: hosted - version: "2.0.9" + version: "2.0.10+1" flutter_test: dependency: "direct dev" description: flutter @@ -513,10 +513,10 @@ packages: dependency: "direct main" description: name: http - sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" http_multi_server: dependency: transitive description: @@ -537,10 +537,10 @@ packages: dependency: "direct main" description: name: image - sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d" + sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e" url: "https://pub.dev" source: hosted - version: "4.1.4" + version: "4.1.7" intl: dependency: "direct main" description: @@ -573,6 +573,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.8.1" + json_serializable: + dependency: "direct main" + description: + name: json_serializable + sha256: aa1f5a8912615733e0fdc7a02af03308933c93235bdc8d50d0b0c8a8ccb0b969 + url: "https://pub.dev" + source: hosted + version: "6.7.1" latlong2: dependency: "direct main" description: @@ -609,10 +617,10 @@ packages: dependency: transitive description: name: markdown - sha256: acf35edccc0463a9d7384e437c015a3535772e09714cf60e07eeef3a15870dcd + sha256: "1b134d9f8ff2da15cb298efe6cd8b7d2a78958c1b00384ebcbdf13fe340a6c90" url: "https://pub.dev" source: hosted - version: "7.1.1" + version: "7.2.1" matcher: dependency: transitive description: @@ -641,10 +649,10 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" mgrs_dart: dependency: transitive description: @@ -657,10 +665,10 @@ packages: dependency: transitive description: name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.5" mockito: dependency: "direct dev" description: @@ -722,10 +730,10 @@ packages: dependency: transitive description: name: package_info_plus - sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017" + sha256: "88bc797f44a94814f2213db1c9bd5badebafdfb8290ca9f78d4b9ee2a3db4d79" url: "https://pub.dev" source: hosted - version: "4.2.0" + version: "5.0.1" package_info_plus_platform_interface: dependency: transitive description: @@ -762,18 +770,18 @@ packages: dependency: transitive description: name: path_provider_android - sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.2" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" path_provider_linux: dependency: transitive description: @@ -786,10 +794,10 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_windows: dependency: transitive description: @@ -810,18 +818,18 @@ packages: dependency: transitive description: name: petitparser - sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "6.0.2" platform: dependency: transitive description: name: platform - sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "3.1.4" plausible_analytics: dependency: "direct main" description: @@ -834,18 +842,18 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.1.8" pointycastle: dependency: transitive description: name: pointycastle - sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" + sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" url: "https://pub.dev" source: hosted - version: "3.7.3" + version: "3.7.4" polylabel: dependency: transitive description: @@ -906,18 +914,18 @@ packages: dependency: transitive description: name: sentry - sha256: "89e426587b0879e53c46a0aae0eb312696d9d2d803ba14b252a65cc24b1416a2" + sha256: d2ee9c850d876d285f22e2e662f400ec2438df9939fe4acd5d780df9841794ce url: "https://pub.dev" source: hosted - version: "7.14.0" + version: "7.16.1" sentry_flutter: dependency: "direct main" description: name: sentry_flutter - sha256: fd089ee4e75a927be037c56815a0a54af5a519f52b803a5ffecb589bb36e2401 + sha256: "5b428c189c825f16fb14e9166529043f06b965d5b59bfc3a1415e39c082398c0" url: "https://pub.dev" source: hosted - version: "7.14.0" + version: "7.16.1" shared_preferences: dependency: "direct main" description: @@ -938,10 +946,10 @@ packages: dependency: transitive description: name: shared_preferences_foundation - sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7" + sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" url: "https://pub.dev" source: hosted - version: "2.3.4" + version: "2.3.5" shared_preferences_linux: dependency: transitive description: @@ -954,18 +962,18 @@ packages: dependency: transitive description: name: shared_preferences_platform_interface - sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a + sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf + sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.2" shared_preferences_windows: dependency: transitive description: @@ -1027,6 +1035,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" + url: "https://pub.dev" + source: hosted + version: "1.3.4" source_map_stack_trace: dependency: transitive description: @@ -1063,50 +1079,50 @@ packages: dependency: "direct main" description: name: sqflite - sha256: "591f1602816e9c31377d5f008c2d9ef7b8aca8941c3f89cc5fd9d84da0c38a9a" + sha256: a9016f495c927cb90557c909ff26a6d92d9bd54fc42ba92e19d4e79d61e798c6 url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.3.2" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: bb4738f15b23352822f4c42a531677e5c6f522e079461fd240ead29d8d8a54a6 + sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5" url: "https://pub.dev" source: hosted - version: "2.5.0+2" + version: "2.5.3" sqflite_common_ffi: dependency: "direct dev" description: name: sqflite_common_ffi - sha256: "35d2fce1e971707c227cc4775cc017d5eafe06c2654c3435ebd5c3ad6c170f5f" + sha256: "754927d82de369a6b9e760fb60640aa81da650f35ffd468d5a992814d6022908" url: "https://pub.dev" source: hosted - version: "2.3.0+4" + version: "2.3.2+1" sqlite3: dependency: transitive description: name: sqlite3 - sha256: db65233e6b99e99b2548932f55a987961bc06d82a31a0665451fa0b4fff4c3fb + sha256: "072128763f1547e3e9b4735ce846bfd226d68019ccda54db4cd427b12dfdedc9" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.4.0" stack_trace: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -1143,26 +1159,26 @@ packages: dependency: "direct dev" description: name: test - sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46" + sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f url: "https://pub.dev" source: hosted - version: "1.24.3" + version: "1.24.9" test_api: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" test_core: dependency: transitive description: name: test_core - sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e" + sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a url: "https://pub.dev" source: hosted - version: "0.5.3" + version: "0.5.9" timelines: dependency: "direct main" description: @@ -1231,26 +1247,26 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: e9aa5ea75c84cf46b3db4eea212523591211c3cf2e13099ee4ec147f54201c86 + sha256: "0ecc004c62fd3ed36a2ffcbe0dd9700aee63bd7532d0b642a488b1ec310f492e" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.2.5" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def" + sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745 url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "6.3.0" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: bba3373219b7abb6b5e0d071b0fe66dfbe005d07517a68e38d4fc3638f35c6d3 + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" url: "https://pub.dev" source: hosted - version: "6.2.1" + version: "6.2.4" url_launcher_linux: dependency: transitive description: @@ -1271,18 +1287,18 @@ packages: dependency: transitive description: name: url_launcher_platform_interface - sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50" + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.2" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.2.3" url_launcher_windows: dependency: transitive description: @@ -1295,34 +1311,34 @@ packages: dependency: transitive description: name: uuid - sha256: "22c94e5ad1e75f9934b766b53c742572ee2677c56bc871d850a57dad0f82127f" + sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 url: "https://pub.dev" source: hosted - version: "4.2.2" + version: "4.3.3" vector_graphics: dependency: transitive description: name: vector_graphics - sha256: "0f0c746dd2d6254a0057218ff980fc7f5670fd0fcf5e4db38a490d31eed4ad43" + sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" url: "https://pub.dev" source: hosted - version: "1.1.9+1" + version: "1.1.11+1" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: "0edf6d630d1bfd5589114138ed8fada3234deacc37966bec033d3047c29248b7" + sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da url: "https://pub.dev" source: hosted - version: "1.1.9+1" + version: "1.1.11+1" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: d24333727332d9bd20990f1483af4e09abdb9b1fc7c3db940b56ab5c42790c26 + sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" url: "https://pub.dev" source: hosted - version: "1.1.9+1" + version: "1.1.11+1" vector_math: dependency: transitive description: @@ -1343,10 +1359,10 @@ packages: dependency: transitive description: name: vm_service - sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "11.10.0" + version: "13.0.0" watcher: dependency: transitive description: @@ -1359,10 +1375,10 @@ packages: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "0.3.0" web_socket_channel: dependency: transitive description: @@ -1383,10 +1399,10 @@ packages: dependency: transitive description: name: win32 - sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" url: "https://pub.dev" source: hosted - version: "5.1.1" + version: "5.2.0" wkt_parser: dependency: transitive description: @@ -1407,18 +1423,18 @@ packages: dependency: transitive description: name: xdg_directories - sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" xml: dependency: transitive description: name: xml - sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.5.0" yaml: dependency: transitive description: @@ -1428,5 +1444,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.1.3 <4.0.0" - flutter: ">=3.13.7" + dart: ">=3.2.0 <4.0.0" + flutter: ">=3.16.0" diff --git a/uni/pubspec.yaml b/uni/pubspec.yaml index ecaaf4889..4464709f1 100644 --- a/uni/pubspec.yaml +++ b/uni/pubspec.yaml @@ -44,6 +44,7 @@ dependencies: image: ^4.1.4 intl: ^0.18.0 json_annotation: ^4.8.1 + json_serializable: ^6.7.1 latlong2: ^0.9.0 logger: ^2.0.2+1 material_design_icons_flutter: ^7.0.7296 From 8420f388b46365acdfcb8260bc87f6eddb3375f6 Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Mon, 4 Mar 2024 14:26:24 +0000 Subject: [PATCH 08/10] Fix linter issues --- uni/lib/model/entities/calendar_event.dart | 8 ++------ uni/lib/view/home/widgets/exam_card.dart | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/uni/lib/model/entities/calendar_event.dart b/uni/lib/model/entities/calendar_event.dart index e5d031432..ebb616236 100644 --- a/uni/lib/model/entities/calendar_event.dart +++ b/uni/lib/model/entities/calendar_event.dart @@ -21,12 +21,8 @@ class CalendarEvent { DateTime? get parsedStartDate { final splitDate = date.split(' '); final month = splitDate.firstWhere( - (element) => - DateFormat - .MMMM('pt') - .dateSymbols - .MONTHS - .contains(element) || + (element) => + DateFormat.MMMM('pt').dateSymbols.MONTHS.contains(element) || element == 'TBD', ); diff --git a/uni/lib/view/home/widgets/exam_card.dart b/uni/lib/view/home/widgets/exam_card.dart index d72b53e38..3c0bb83b9 100644 --- a/uni/lib/view/home/widgets/exam_card.dart +++ b/uni/lib/view/home/widgets/exam_card.dart @@ -7,11 +7,10 @@ import 'package:uni/model/providers/lazy/exam_provider.dart'; import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; import 'package:uni/view/home/widgets/exam_card_shimmer.dart'; +import 'package:uni/view/home/widgets/next_exams_card.dart'; import 'package:uni/view/home/widgets/remaining_exams_card.dart'; import 'package:uni/view/lazy_consumer.dart'; -import 'next_exams_card.dart'; - /// Manages the exam card section inside the personal area. class ExamCard extends GenericCard { ExamCard({super.key}); @@ -36,6 +35,7 @@ class ExamCard extends GenericCard { void onRefresh(BuildContext context) { Provider.of(context, listen: false).forceRefresh(context); } + @override Widget buildCardContent(BuildContext context) { return StreamBuilder( From d0dcf2b2a4a81b4f7b7d083d979c2637f0768402 Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Wed, 5 Jun 2024 14:41:50 +0100 Subject: [PATCH 09/10] Separate converters into different files --- .../model/converters/date_time_converter.dart | 15 +++ uni/lib/model/converters/tuple_converter.dart | 22 +++++ uni/lib/model/entities/bug_report.dart | 21 +--- uni/lib/model/entities/exam.dart | 18 +--- uni/lib/model/entities/lecture.dart | 15 +-- uni/lib/model/entities/meal.dart | 18 +--- uni/pubspec.lock | 96 ++++--------------- uni/pubspec.yaml | 3 +- 8 files changed, 63 insertions(+), 145 deletions(-) create mode 100644 uni/lib/model/converters/date_time_converter.dart create mode 100644 uni/lib/model/converters/tuple_converter.dart diff --git a/uni/lib/model/converters/date_time_converter.dart b/uni/lib/model/converters/date_time_converter.dart new file mode 100644 index 000000000..70612ce65 --- /dev/null +++ b/uni/lib/model/converters/date_time_converter.dart @@ -0,0 +1,15 @@ +import 'package:json_annotation/json_annotation.dart'; + +class DateTimeConverter extends JsonConverter { + const DateTimeConverter(); + + @override + DateTime fromJson(String json) { + return DateTime.parse(json); + } + + @override + String toJson(DateTime object) { + return object.toIso8601String(); + } +} diff --git a/uni/lib/model/converters/tuple_converter.dart b/uni/lib/model/converters/tuple_converter.dart new file mode 100644 index 000000000..49cb64ded --- /dev/null +++ b/uni/lib/model/converters/tuple_converter.dart @@ -0,0 +1,22 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:tuple/tuple.dart'; + +class TupleConverter extends JsonConverter?, String?> { + const TupleConverter(); + + @override + Tuple2? fromJson(String? json) { + if (json == null) { + return null; + } + return Tuple2('', json); + } + + @override + String? toJson(Tuple2? object) { + if (object == null) { + return null; + } + return object.item2; + } +} diff --git a/uni/lib/model/entities/bug_report.dart b/uni/lib/model/entities/bug_report.dart index 73eb12434..8667e4945 100644 --- a/uni/lib/model/entities/bug_report.dart +++ b/uni/lib/model/entities/bug_report.dart @@ -1,29 +1,10 @@ // Stores information about Bug Report import 'package:json_annotation/json_annotation.dart'; import 'package:tuple/tuple.dart'; +import 'package:uni/model/converters/tuple_converter.dart'; part '../../generated/model/entities/bug_report.g.dart'; -class TupleConverter extends JsonConverter?, String?> { - const TupleConverter(); - - @override - Tuple2? fromJson(String? json) { - if (json == null) { - return null; - } - return Tuple2('', json); - } - - @override - String? toJson(Tuple2? object) { - if (object == null) { - return null; - } - return object.item2; - } -} - @TupleConverter() @JsonSerializable() class BugReport { diff --git a/uni/lib/model/entities/exam.dart b/uni/lib/model/entities/exam.dart index 85defb3e2..e8134c3bc 100644 --- a/uni/lib/model/entities/exam.dart +++ b/uni/lib/model/entities/exam.dart @@ -2,26 +2,10 @@ import 'package:intl/intl.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:logger/logger.dart'; import 'package:uni/model/entities/app_locale.dart'; +import 'package:uni/model/entities/reference.dart'; part '../../generated/model/entities/exam.g.dart'; -class DateTimeConverter extends JsonConverter { - const DateTimeConverter(); - - @override - DateTime fromJson(String json) { - final format = DateFormat('yyyy-M-dd'); - return format.parse(json); - } - - @override - String toJson(DateTime object) { - final format = DateFormat('yyyy-MM-dd'); - - return format.format(object); - } -} - /// Manages a generic Exam. /// /// The information stored is: diff --git a/uni/lib/model/entities/lecture.dart b/uni/lib/model/entities/lecture.dart index 2cc749414..c129c2a83 100644 --- a/uni/lib/model/entities/lecture.dart +++ b/uni/lib/model/entities/lecture.dart @@ -1,22 +1,9 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:logger/logger.dart'; +import 'package:uni/model/entities/reference.dart'; part '../../generated/model/entities/lecture.g.dart'; -class DateTimeConverter extends JsonConverter { - const DateTimeConverter(); - - @override - DateTime fromJson(String json) { - return DateTime.parse(json); - } - - @override - String toJson(DateTime object) { - return object.toIso8601String(); - } -} - /// Stores information about a lecture. @DateTimeConverter() @JsonSerializable() diff --git a/uni/lib/model/entities/meal.dart b/uni/lib/model/entities/meal.dart index 847320882..828df6837 100644 --- a/uni/lib/model/entities/meal.dart +++ b/uni/lib/model/entities/meal.dart @@ -1,25 +1,9 @@ -import 'package:intl/intl.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:uni/model/entities/reference.dart'; import 'package:uni/model/utils/day_of_week.dart'; part '../../generated/model/entities/meal.g.dart'; -class DateTimeConverter extends JsonConverter { - const DateTimeConverter(); - - @override - DateTime fromJson(String json) { - final format = DateFormat('d-M-y'); - return format.parse(json); - } - - @override - String toJson(DateTime object) { - final format = DateFormat('d-M-y'); - return format.format(object); - } -} - @DateTimeConverter() @JsonSerializable() class Meal { diff --git a/uni/pubspec.lock b/uni/pubspec.lock index 52fe3beef..da9a9fdc6 100644 --- a/uni/pubspec.lock +++ b/uni/pubspec.lock @@ -25,14 +25,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.4.1" - analyzer_plugin: - dependency: transitive - description: - name: analyzer_plugin - sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161" - url: "https://pub.dev" - source: hosted - version: "0.11.3" animated_stack_widget: dependency: transitive description: @@ -201,14 +193,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" - ci: - dependency: transitive - description: - name: ci - sha256: "145d095ce05cddac4d797a158bc4cf3b6016d1fe63d8c3d2fbd7212590adca13" - url: "https://pub.dev" - source: hosted - version: "0.1.0" cli_util: dependency: transitive description: @@ -305,30 +289,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.1" - custom_lint: - dependency: transitive - description: - name: custom_lint - sha256: "7c0aec12df22f9082146c354692056677f1e70bc43471644d1fdb36c6fdda799" - url: "https://pub.dev" - source: hosted - version: "0.6.4" - custom_lint_builder: - dependency: transitive - description: - name: custom_lint_builder - sha256: d7dc41e709dde223806660268678be7993559e523eb3164e2a1425fd6f7615a9 - url: "https://pub.dev" - source: hosted - version: "0.6.4" - custom_lint_core: - dependency: transitive - description: - name: custom_lint_core - sha256: a85e8f78f4c52f6c63cdaf8c872eb573db0231dcdf3c3a5906d493c1f8bc20e6 - url: "https://pub.dev" - source: hosted - version: "0.6.3" dart_style: dependency: transitive description: @@ -495,50 +455,50 @@ packages: dependency: "direct main" description: name: flutter_secure_storage - sha256: ffdbb60130e4665d2af814a0267c481bcf522c41ae2e43caf69fa0146876d685 + sha256: "165164745e6afb5c0e3e3fcc72a012fb9e58496fb26ffb92cf22e16a821e85d0" url: "https://pub.dev" source: hosted - version: "9.0.0" + version: "9.2.2" flutter_secure_storage_linux: dependency: transitive description: name: flutter_secure_storage_linux - sha256: "3d5032e314774ee0e1a7d0a9f5e2793486f0dff2dd9ef5a23f4e3fb2a0ae6a9e" + sha256: "4d91bfc23047422cbcd73ac684bc169859ee766482517c22172c86596bf1464b" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" flutter_secure_storage_macos: dependency: transitive description: name: flutter_secure_storage_macos - sha256: bd33935b4b628abd0b86c8ca20655c5b36275c3a3f5194769a7b3f37c905369c + sha256: "1693ab11121a5f925bbea0be725abfcfbbcf36c1e29e571f84a0c0f436147a81" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.1.2" flutter_secure_storage_platform_interface: dependency: transitive description: name: flutter_secure_storage_platform_interface - sha256: "0d4d3a5dd4db28c96ae414d7ba3b8422fd735a8255642774803b2532c9a61d7e" + sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8 url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.2" flutter_secure_storage_web: dependency: transitive description: name: flutter_secure_storage_web - sha256: "30f84f102df9dcdaa2241866a958c2ec976902ebdaa8883fbfe525f1f2f3cf20" + sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9 url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.1" flutter_secure_storage_windows: dependency: transitive description: name: flutter_secure_storage_windows - sha256: "5809c66f9dd3b4b93b0a6e2e8561539405322ee767ac2f64d084e2ab5429d108" + sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709 url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.1.2" flutter_svg: dependency: "direct main" description: @@ -565,14 +525,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.14.11" - freezed_annotation: - dependency: transitive - description: - name: freezed_annotation - sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d - url: "https://pub.dev" - source: hosted - version: "2.4.1" frontend_server_client: dependency: transitive description: @@ -597,14 +549,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" - hotreloader: - dependency: transitive - description: - name: hotreloader - sha256: ed56fdc1f3a8ac924e717257621d09e9ec20e308ab6352a73a50a1d7a4d9158e - url: "https://pub.dev" - source: hosted - version: "4.2.0" html: dependency: "direct main" description: @@ -717,14 +661,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.1" - leancode_lint: - dependency: "direct dev" - description: - name: leancode_lint - sha256: a0130e0dbe5d5ea2f03f7ba7fa097f0fd44be9dc43d3d7badd6d09cc50015384 - url: "https://pub.dev" - source: hosted - version: "11.0.0" lists: dependency: transitive description: @@ -1483,6 +1419,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + very_good_analysis: + dependency: "direct dev" + description: + name: very_good_analysis + sha256: "9ae7f3a3bd5764fb021b335ca28a34f040cd0ab6eec00a1b213b445dae58a4b8" + url: "https://pub.dev" + source: hosted + version: "5.1.0" vm_service: dependency: transitive description: diff --git a/uni/pubspec.yaml b/uni/pubspec.yaml index 87b95e463..9bcfb870c 100644 --- a/uni/pubspec.yaml +++ b/uni/pubspec.yaml @@ -37,12 +37,13 @@ dependencies: flutter_map: ^5.0.0 flutter_map_marker_popup: ^5.0.0 flutter_markdown: ^0.6.0 + flutter_secure_storage: ^9.2.2 flutter_svg: ^2.0.9 flutter_widget_from_html_core: ^0.14.11 html: ^0.15.0 http: ^1.1.0 image: ^4.1.4 - intl: ^0.18.0 + intl: ^0.19.0 json_annotation: ^4.8.1 json_serializable: ^6.7.1 latlong2: ^0.9.0 From 91ac998a14d3830c7049a0e608e993ae5e452eb9 Mon Sep 17 00:00:00 2001 From: Diogo Goiana <81827192+DGoiana@users.noreply.github.com> Date: Sat, 6 Jul 2024 00:01:29 +0100 Subject: [PATCH 10/10] linter fix --- uni/pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uni/pubspec.yaml b/uni/pubspec.yaml index f9ec024dd..a8f4ab4ce 100644 --- a/uni/pubspec.yaml +++ b/uni/pubspec.yaml @@ -41,9 +41,9 @@ dependencies: html: ^0.15.0 http: ^1.1.0 image: ^4.1.4 + intl: ^0.19.0 json_annotation: ^4.8.1 json_serializable: ^6.7.1 - intl: ^0.19.0 latlong2: ^0.9.0 logger: ^2.0.2+1 material_design_icons_flutter: ^7.0.7296 @@ -122,4 +122,4 @@ flutter_icons: adaptive_icon_foreground: "assets/icon/android_icon_foreground.png" flutter_intl: - enabled: true \ No newline at end of file + enabled: true