From 2d4bd0c41727f0c68ef68d4e3178fad53de1f61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:48:18 +0200 Subject: [PATCH 01/12] Bump Dependencies, Fix Build Errors --- lib/base/networking/cache/cache_entry.g.dart | 133 ++++++++++-------- .../model/calendar_event.g.dart | 3 +- pubspec.lock | 80 +++++------ pubspec.yaml | 4 +- 4 files changed, 121 insertions(+), 99 deletions(-) diff --git a/lib/base/networking/cache/cache_entry.g.dart b/lib/base/networking/cache/cache_entry.g.dart index 1d352c3d..9d64d21e 100644 --- a/lib/base/networking/cache/cache_entry.g.dart +++ b/lib/base/networking/cache/cache_entry.g.dart @@ -340,61 +340,78 @@ typedef $$CacheEntryTableUpdateCompanionBuilder = CacheEntryCompanion Function({ }); class $$CacheEntryTableFilterComposer - extends FilterComposer<_$CacheDatabase, $CacheEntryTable> { - $$CacheEntryTableFilterComposer(super.$state); - ColumnFilters get id => $state.composableBuilder( - column: $state.table.id, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get url => $state.composableBuilder( - column: $state.table.url, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get validUntil => $state.composableBuilder( - column: $state.table.validUntil, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get saved => $state.composableBuilder( - column: $state.table.saved, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get body => $state.composableBuilder( - column: $state.table.body, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); + extends Composer<_$CacheDatabase, $CacheEntryTable> { + $$CacheEntryTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get url => $composableBuilder( + column: $table.url, builder: (column) => ColumnFilters(column)); + + ColumnFilters get validUntil => $composableBuilder( + column: $table.validUntil, builder: (column) => ColumnFilters(column)); + + ColumnFilters get saved => $composableBuilder( + column: $table.saved, builder: (column) => ColumnFilters(column)); + + ColumnFilters get body => $composableBuilder( + column: $table.body, builder: (column) => ColumnFilters(column)); } class $$CacheEntryTableOrderingComposer - extends OrderingComposer<_$CacheDatabase, $CacheEntryTable> { - $$CacheEntryTableOrderingComposer(super.$state); - ColumnOrderings get id => $state.composableBuilder( - column: $state.table.id, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get url => $state.composableBuilder( - column: $state.table.url, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get validUntil => $state.composableBuilder( - column: $state.table.validUntil, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get saved => $state.composableBuilder( - column: $state.table.saved, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get body => $state.composableBuilder( - column: $state.table.body, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); + extends Composer<_$CacheDatabase, $CacheEntryTable> { + $$CacheEntryTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get url => $composableBuilder( + column: $table.url, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get validUntil => $composableBuilder( + column: $table.validUntil, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get saved => $composableBuilder( + column: $table.saved, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get body => $composableBuilder( + column: $table.body, builder: (column) => ColumnOrderings(column)); +} + +class $$CacheEntryTableAnnotationComposer + extends Composer<_$CacheDatabase, $CacheEntryTable> { + $$CacheEntryTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get url => + $composableBuilder(column: $table.url, builder: (column) => column); + + GeneratedColumn get validUntil => $composableBuilder( + column: $table.validUntil, builder: (column) => column); + + GeneratedColumn get saved => + $composableBuilder(column: $table.saved, builder: (column) => column); + + GeneratedColumn get body => + $composableBuilder(column: $table.body, builder: (column) => column); } class $$CacheEntryTableTableManager extends RootTableManager< @@ -403,6 +420,7 @@ class $$CacheEntryTableTableManager extends RootTableManager< CacheEntryData, $$CacheEntryTableFilterComposer, $$CacheEntryTableOrderingComposer, + $$CacheEntryTableAnnotationComposer, $$CacheEntryTableCreateCompanionBuilder, $$CacheEntryTableUpdateCompanionBuilder, ( @@ -415,10 +433,12 @@ class $$CacheEntryTableTableManager extends RootTableManager< : super(TableManagerState( db: db, table: table, - filteringComposer: - $$CacheEntryTableFilterComposer(ComposerState(db, table)), - orderingComposer: - $$CacheEntryTableOrderingComposer(ComposerState(db, table)), + createFilteringComposer: () => + $$CacheEntryTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$CacheEntryTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$CacheEntryTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value id = const Value.absent(), Value url = const Value.absent(), @@ -464,6 +484,7 @@ typedef $$CacheEntryTableProcessedTableManager = ProcessedTableManager< CacheEntryData, $$CacheEntryTableFilterComposer, $$CacheEntryTableOrderingComposer, + $$CacheEntryTableAnnotationComposer, $$CacheEntryTableCreateCompanionBuilder, $$CacheEntryTableUpdateCompanionBuilder, ( diff --git a/lib/calendarComponent/model/calendar_event.g.dart b/lib/calendarComponent/model/calendar_event.g.dart index 37f61b1e..bfcaa047 100644 --- a/lib/calendarComponent/model/calendar_event.g.dart +++ b/lib/calendarComponent/model/calendar_event.g.dart @@ -17,7 +17,7 @@ CalendarEvent _$CalendarEventFromJson(Map json) => endDate: DateTime.parse(json['dtend'] as String), location: json['location'] as String?, color: (json['color'] as num?)?.toInt(), - ); + )..isVisible = json['isVisible'] as bool?; Map _$CalendarEventToJson(CalendarEvent instance) => { @@ -30,6 +30,7 @@ Map _$CalendarEventToJson(CalendarEvent instance) => 'dtend': instance.endDate.toIso8601String(), 'location': instance.location, 'color': instance.color, + 'isVisible': instance.isVisible, }; CalendarEvents _$CalendarEventsFromJson(Map json) => diff --git a/pubspec.lock b/pubspec.lock index a069e49e..04c50706 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -58,10 +58,10 @@ packages: dependency: transitive description: name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.6.0" async: dependency: transitive description: @@ -290,10 +290,10 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074 + sha256: db03b2d2a3fa466a4627709e1db58692c3f7f658e36a5942d342d86efedc4091 url: "https://pub.dev" source: hosted - version: "10.1.2" + version: "11.0.0" device_info_plus_platform_interface: dependency: transitive description: @@ -322,18 +322,18 @@ packages: dependency: "direct main" description: name: drift - sha256: d6ff1ec6a0f3fa097dda6b776cf601f1f3d88b53b287288e09c1306f394fb1b3 + sha256: df027d168a2985a2e9da900adeba2ab0136f0d84436592cf3cd5135f82c8579c url: "https://pub.dev" source: hosted - version: "2.20.3" + version: "2.21.0" drift_dev: dependency: "direct dev" description: name: drift_dev - sha256: "3ee987578ca2281b5ff91eadd757cd6dd36001458d6e33784f990d67ff38f756" + sha256: "27bab15e7869b69259663590381180117873b9b273a1ea9ebb21bb73133d1233" url: "https://pub.dev" source: hosted - version: "2.20.3" + version: "2.21.0" easy_localization: dependency: "direct main" description: @@ -370,10 +370,10 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" firebase_core: dependency: "direct main" description: @@ -510,10 +510,10 @@ packages: dependency: "direct main" description: name: flutter_riverpod - sha256: "0f1974eff5bbe774bf1d870e406fc6f29e3d6f1c46bd9c58e7172ff68a785d7d" + sha256: "711d916456563f715bde1e139d7cfdca009f8264befab3ac9f8ded8b6ec26405" url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.5.3" flutter_secure_storage: dependency: "direct main" description: @@ -696,18 +696,18 @@ packages: dependency: transitive description: name: google_maps_flutter_android - sha256: a591ff8d0816436e6a4d9f32bbdf10ebb30bb26f72f6db2a51ddb2426ff7d9ec + sha256: "6caec25edb8014ec7d503babc597794de2d4c1baf3e3d20b57c41bd3e439b916" url: "https://pub.dev" source: hosted - version: "2.14.8" + version: "2.14.10" google_maps_flutter_ios: dependency: transitive description: name: google_maps_flutter_ios - sha256: "3a484846fc56f15e47e3de1f5ea80a7ff2b31721d2faa88f390f3b3cf580c953" + sha256: "753ebf6a2bc24c5eba8e714c901345d858abd9694b1f878c43614fd3f06b8060" url: "https://pub.dev" source: hosted - version: "2.13.0" + version: "2.13.1" google_maps_flutter_platform_interface: dependency: transitive description: @@ -897,10 +897,10 @@ packages: dependency: "direct main" description: name: lottie - sha256: "6a24ade5d3d918c306bb1c21a6b9a04aab0489d51a2582522eea820b4093b62b" + sha256: "7afc60865a2429d994144f7d66ced2ae4305fe35d82890b8766e3359872d872c" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.3" macros: dependency: transitive description: @@ -977,10 +977,10 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: a75164ade98cb7d24cfd0a13c6408927c6b217fa60dee5a7ff5c116a58f28918 + sha256: "894f37107424311bdae3e476552229476777b8752c5a2a2369c0cb9a2d5442ef" url: "https://pub.dev" source: hosted - version: "8.0.2" + version: "8.0.3" package_info_plus_platform_interface: dependency: transitive description: @@ -1209,10 +1209,10 @@ packages: dependency: transitive description: name: riverpod - sha256: f21b32ffd26a36555e501b04f4a5dca43ed59e16343f1a30c13632b2351dfa4d + sha256: c86fedfb45dd1da98ee6493dd9374325cdf494e7d523ebfb0c387eecc5f7b5c9 url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.5.3" rxdart: dependency: "direct main" description: @@ -1414,10 +1414,10 @@ packages: dependency: transitive description: name: sqflite_platform_interface - sha256: b62ab81e1284341783222aefbbb44f984ebf4663d672ae10408c9a8ddab4bfb6 + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" url: "https://pub.dev" source: hosted - version: "2.4.0-0" + version: "2.4.0" sqlite3: dependency: "direct main" description: @@ -1438,10 +1438,10 @@ packages: dependency: transitive description: name: sqlparser - sha256: "852cf80f9e974ac8e1b613758a8aa640215f7701352b66a7f468e95711eb570b" + sha256: c5f63dff8677407ddcddfa4744c176ea6dc44286c47ba9e69e76d8071398034d url: "https://pub.dev" source: hosted - version: "0.38.1" + version: "0.39.1" stack_trace: dependency: transitive description: @@ -1486,34 +1486,34 @@ packages: dependency: "direct main" description: name: syncfusion_flutter_calendar - sha256: c2105449ffb46a9a79e5b622ceb8a78e2937c88e69747469244051803fba6b52 + sha256: d5efcd867d8e9a678a95446e3bb1eed29a90cb92d61b32d3099ed3dd4bfce34d url: "https://pub.dev" source: hosted - version: "27.1.52" + version: "27.1.53" syncfusion_flutter_charts: dependency: "direct main" description: name: syncfusion_flutter_charts - sha256: "4e89e0893297780d8e06be0c482b9b0a23ecf54c3d64e6e40ff06cf30952bce6" + sha256: df13f25d2095bf747c0c67460a06b655a6cce6d74380d9e4ef24d9a523a2e1b6 url: "https://pub.dev" source: hosted - version: "27.1.52" + version: "27.1.53" syncfusion_flutter_core: dependency: "direct main" description: name: syncfusion_flutter_core - sha256: "7130fc3259247946b59fe9b76ee89500c775c3f7e5c1d0826f3105e1dd0bebf6" + sha256: becd190595cba56feac5ec17b805b35df9f006171c131c209f79b5c58fc780eb url: "https://pub.dev" source: hosted - version: "27.1.52" + version: "27.1.53" syncfusion_flutter_datepicker: dependency: "direct main" description: name: syncfusion_flutter_datepicker - sha256: "61efc09e962d7b7cc3c7d33a2e44ec027112403af49590d5cc1025a255cc34fa" + sha256: "5638805bea1c70a6d46dea9d39ef67f0085176e1c15cf57f7036cf67c1568816" url: "https://pub.dev" source: hosted - version: "27.1.52" + version: "27.1.53" synchronized: dependency: transitive description: @@ -1598,10 +1598,10 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.3.1" url_launcher_android: dependency: transitive description: @@ -1710,10 +1710,10 @@ packages: dependency: transitive description: name: video_player_android - sha256: ae5287ca367e206eb74d7b3dc1ce0b8912ab9a3fc0597b6a101a0a5239f229d3 + sha256: "340b29bc38b2c341ed3afa08148f3d9f351220403cdd2b3a9eb38b71a4be1a9d" url: "https://pub.dev" source: hosted - version: "2.7.9" + version: "2.7.12" video_player_avfoundation: dependency: transitive description: @@ -1790,10 +1790,10 @@ packages: dependency: transitive description: name: win32 - sha256: "4d45dc9069dba4619dc0ebd93c7cec5e66d8482cb625a370ac806dcc8165f2ec" + sha256: e5c39a90447e7c81cfec14b041cdbd0d0916bd9ebbc7fe02ab69568be703b9bd url: "https://pub.dev" source: hosted - version: "5.5.5" + version: "5.6.0" win32_registry: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2c3f9086..76eaa513 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: campus_flutter description: "A new Flutter project." publish_to: 'none' -version: 5.1.0+1 +version: 5.1.1+1 environment: sdk: '>=3.2.3 <4.0.0' @@ -53,7 +53,7 @@ dependencies: ref: master # helpers - device_info_plus: ^10.0.1 + device_info_plus: ^11.0.0 flutter_secure_storage: ^9.0.0 geolocator: ^13.0.1 package_info_plus: ^8.0.0 From 73d00759840e78206b0923ae99afab55269b2234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:43:35 +0200 Subject: [PATCH 02/12] Migrate to new IRIS Api, Add Utilization Percentages to Study Rooms --- assets/translations/de.json | 3 +- assets/translations/en.json | 3 +- .../networking/apis/irisApi/iris_api.dart | 23 +++++++++++++ .../apis/irisApi/iris_api_endpoint.dart | 5 +++ .../apis/tumDevAppApi/tum_dev_app_api.dart | 23 ------------- .../tumDevAppApi/tum_dev_app_api_service.dart | 18 ---------- .../model/studyRooms/study_room.dart | 33 ++++++++++++++++++- .../model/studyRooms/study_room.g.dart | 6 ++++ .../services/study_rooms_service.dart | 8 ++--- .../viewModels/study_rooms_viewmodel.dart | 11 ++++--- .../studyGroups/study_room_group_view.dart | 3 +- .../studyGroups/study_room_row_view.dart | 10 +----- 12 files changed, 83 insertions(+), 63 deletions(-) create mode 100644 lib/base/networking/apis/irisApi/iris_api.dart create mode 100644 lib/base/networking/apis/irisApi/iris_api_endpoint.dart delete mode 100644 lib/base/networking/apis/tumDevAppApi/tum_dev_app_api.dart delete mode 100644 lib/base/networking/apis/tumDevAppApi/tum_dev_app_api_service.dart diff --git a/assets/translations/de.json b/assets/translations/de.json index d38c095d..daa90f8c 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -227,5 +227,6 @@ "studies": "Studium", "suggested": "Interessante {}", "all": "Alle", - "visibility": "Sichtbarkeit" + "visibility": "Sichtbarkeit", + "utilizationAt": "Auslastung bei {}%" } diff --git a/assets/translations/en.json b/assets/translations/en.json index 5abfcc87..f7bdf380 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -227,5 +227,6 @@ "studies": "Studies", "suggested": "Suggested {}", "all": "All", - "visibility": "Visibility" + "visibility": "Visibility", + "utilizationAt": "Utilization at {}%" } diff --git a/lib/base/networking/apis/irisApi/iris_api.dart b/lib/base/networking/apis/irisApi/iris_api.dart new file mode 100644 index 00000000..eaf13410 --- /dev/null +++ b/lib/base/networking/apis/irisApi/iris_api.dart @@ -0,0 +1,23 @@ +import 'package:campus_flutter/base/networking/apis/irisApi/iris_api_endpoint.dart'; +import 'package:campus_flutter/base/networking/protocols/api.dart'; + +class IrisApi extends Api { + final IrisApiEndpoint irisApiEndpoint; + + IrisApi({required this.irisApiEndpoint}); + + @override + String get baseURL => "iris.asta.tum.de"; + + @override + bool get needsAuth => false; + + @override + Map get parameters => irisApiEndpoint.getParameters(); + + @override + String get path => ""; + + @override + String get paths => "api"; +} diff --git a/lib/base/networking/apis/irisApi/iris_api_endpoint.dart b/lib/base/networking/apis/irisApi/iris_api_endpoint.dart new file mode 100644 index 00000000..7b8c7e0c --- /dev/null +++ b/lib/base/networking/apis/irisApi/iris_api_endpoint.dart @@ -0,0 +1,5 @@ +sealed class IrisApiEndpoint { + Map getParameters() => {}; +} + +class IrisApiEndpointRooms extends IrisApiEndpoint {} diff --git a/lib/base/networking/apis/tumDevAppApi/tum_dev_app_api.dart b/lib/base/networking/apis/tumDevAppApi/tum_dev_app_api.dart deleted file mode 100644 index 4eebd4da..00000000 --- a/lib/base/networking/apis/tumDevAppApi/tum_dev_app_api.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:campus_flutter/base/networking/apis/tumDevAppApi/tum_dev_app_api_service.dart'; -import 'package:campus_flutter/base/networking/protocols/api.dart'; - -class TumDevAppApi extends Api { - final TumDevAppService tumDevAppService; - - TumDevAppApi({required this.tumDevAppService}); - - @override - String get baseURL => "www.devapp.it.tum.de"; - - @override - bool get needsAuth => false; - - @override - Map get parameters => tumDevAppService.getParameters(); - - @override - String get path => ""; - - @override - String get paths => "iris/ris_api.php"; -} diff --git a/lib/base/networking/apis/tumDevAppApi/tum_dev_app_api_service.dart b/lib/base/networking/apis/tumDevAppApi/tum_dev_app_api_service.dart deleted file mode 100644 index 71c00fbb..00000000 --- a/lib/base/networking/apis/tumDevAppApi/tum_dev_app_api_service.dart +++ /dev/null @@ -1,18 +0,0 @@ -sealed class TumDevAppService { - Map getParameters() => {}; -} - -class TumDevAppServiceRoom extends TumDevAppService { - final int roomNr; - - TumDevAppServiceRoom({required this.roomNr}); - - @override - Map getParameters() => - {"format": "json", "raum": roomNr.toString()}; -} - -class TumDevAppServiceRooms extends TumDevAppService { - @override - Map getParameters() => {"format": "json"}; -} diff --git a/lib/placesComponent/model/studyRooms/study_room.dart b/lib/placesComponent/model/studyRooms/study_room.dart index 3adb7c1c..04b8e3a5 100644 --- a/lib/placesComponent/model/studyRooms/study_room.dart +++ b/lib/placesComponent/model/studyRooms/study_room.dart @@ -40,6 +40,23 @@ class StudyRoom extends Searchable { final String? status; @JsonKey(name: "attribute") final List? attributes; + @JsonKey(name: "color") + final String? suggestedColor; + final double? percent; + final String? subtitle; + + Color get color { + if (suggestedColor != null) { + final hexColor = int.tryParse("0xff${suggestedColor!.substring(1)}"); + return hexColor != null ? Color(hexColor) : Colors.green; + } else { + if (status == "frei") { + return Colors.green; + } else { + return Colors.red; + } + } + } String localizedStatus(BuildContext context) { switch (status) { @@ -54,13 +71,24 @@ class StudyRoom extends Searchable { } else { return context.tr("unknown"); } + case "WAAS": + if (percent != null) { + return context.tr( + "utilizationAt", + args: [ + percent!.isNegative ? "0" : (percent! * 100).round().toString(), + ], + ); + } else { + return context.tr("unknown"); + } default: return context.tr("unknown"); } } bool get isAvailable { - return status == "frei"; + return status == "frei" || (percent != null && percent! < 100); } @override @@ -98,6 +126,9 @@ class StudyRoom extends Searchable { required this.resNo, this.status, this.attributes, + this.suggestedColor, + this.percent, + this.subtitle, }); factory StudyRoom.fromJson(Map json) => diff --git a/lib/placesComponent/model/studyRooms/study_room.g.dart b/lib/placesComponent/model/studyRooms/study_room.g.dart index 713c5e2d..c9a3d879 100644 --- a/lib/placesComponent/model/studyRooms/study_room.g.dart +++ b/lib/placesComponent/model/studyRooms/study_room.g.dart @@ -25,6 +25,9 @@ StudyRoom _$StudyRoomFromJson(Map json) => StudyRoom( attributes: (json['attribute'] as List?) ?.map((e) => StudyRoomAttribute.fromJson(e as Map)) .toList(), + suggestedColor: json['color'] as String?, + percent: (json['percent'] as num?)?.toDouble(), + subtitle: json['subtitle'] as String?, ); Map _$StudyRoomToJson(StudyRoom instance) => { @@ -44,4 +47,7 @@ Map _$StudyRoomToJson(StudyRoom instance) => { 'res_nr': instance.resNo, 'status': instance.status, 'attribute': instance.attributes, + 'color': instance.suggestedColor, + 'percent': instance.percent, + 'subtitle': instance.subtitle, }; diff --git a/lib/placesComponent/services/study_rooms_service.dart b/lib/placesComponent/services/study_rooms_service.dart index 71770c5b..792963b9 100644 --- a/lib/placesComponent/services/study_rooms_service.dart +++ b/lib/placesComponent/services/study_rooms_service.dart @@ -1,5 +1,5 @@ -import 'package:campus_flutter/base/networking/apis/tumDevAppApi/tum_dev_app_api.dart'; -import 'package:campus_flutter/base/networking/apis/tumDevAppApi/tum_dev_app_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/irisApi/iris_api.dart'; +import 'package:campus_flutter/base/networking/apis/irisApi/iris_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/placesComponent/model/studyRooms/study_room_data.dart'; import 'package:campus_flutter/main.dart'; @@ -9,8 +9,8 @@ class StudyRoomsService { bool forcedRefresh, ) async { RestClient restClient = getIt(); - final response = await restClient.get( - TumDevAppApi(tumDevAppService: TumDevAppServiceRooms()), + final response = await restClient.get( + IrisApi(irisApiEndpoint: IrisApiEndpointRooms()), StudyRoomData.fromJson, forcedRefresh, ); diff --git a/lib/placesComponent/viewModels/study_rooms_viewmodel.dart b/lib/placesComponent/viewModels/study_rooms_viewmodel.dart index 5c0a29eb..77c1ae30 100644 --- a/lib/placesComponent/viewModels/study_rooms_viewmodel.dart +++ b/lib/placesComponent/viewModels/study_rooms_viewmodel.dart @@ -153,11 +153,12 @@ class StudyRoomsViewModel { rooms.sort((room1, room2) { Map statusOrder = { "frei": 0, - "belegt": 1, - "unbekannt": 2, + "WAAS": 1, + "belegt": 2, + "unbekannt": 3, }; - int statusValue1 = statusOrder[room1.status] ?? 3; - int statusValue2 = statusOrder[room2.status] ?? 3; + int statusValue1 = statusOrder[room1.status] ?? 4; + int statusValue2 = statusOrder[room2.status] ?? 4; return statusValue1.compareTo(statusValue2); }); studyRooms[group] = rooms; @@ -192,7 +193,7 @@ class StudyRoomsViewModel { int freeRooms(StudyRoomGroup studyRoomGroup) { List data = studyRooms.value?[studyRoomGroup] ?? []; - return data.where((element) => element.status == "frei").length; + return data.where((element) => element.isAvailable).length; } List getStudyRoomEntries(BuildContext context) { diff --git a/lib/placesComponent/views/studyGroups/study_room_group_view.dart b/lib/placesComponent/views/studyGroups/study_room_group_view.dart index bce6dabd..82079e8b 100644 --- a/lib/placesComponent/views/studyGroups/study_room_group_view.dart +++ b/lib/placesComponent/views/studyGroups/study_room_group_view.dart @@ -1,4 +1,5 @@ import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; +import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/util/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/util/last_updated_text.dart'; import 'package:campus_flutter/base/errorHandling/error_handling_router.dart'; @@ -105,7 +106,7 @@ class StudyRoomGroupView extends ConsumerWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), + padding: EdgeInsets.symmetric(horizontal: context.padding), child: Text( studyRoomGroup?.name ?? context.tr("unknown"), style: Theme.of(context).textTheme.titleLarge, diff --git a/lib/placesComponent/views/studyGroups/study_room_row_view.dart b/lib/placesComponent/views/studyGroups/study_room_row_view.dart index 58748a48..ce5815da 100644 --- a/lib/placesComponent/views/studyGroups/study_room_row_view.dart +++ b/lib/placesComponent/views/studyGroups/study_room_row_view.dart @@ -19,7 +19,7 @@ class StudyRoomRowView extends ConsumerWidget { subtitle: Text( studyRoom.localizedStatus(context), style: TextStyle( - color: _statusColor(studyRoom.localizedStatus(context), context), + color: studyRoom.color, ), ), trailing: const Icon( @@ -30,12 +30,4 @@ class StudyRoomRowView extends ConsumerWidget { context.push(navigaTum, extra: studyRoom.roomNoArchitect ?? "null"), ); } - - Color _statusColor(String status, BuildContext context) { - if (status == context.tr("free")) { - return Colors.green; - } else { - return Colors.red; - } - } } From f83fe5939c10f070786a1c0a5b000434d603b24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:44:09 +0200 Subject: [PATCH 03/12] Improve Naming of Api Endpoints --- lib/base/networking/apis/eatApi/eat_api.dart | 20 +-- .../apis/eatApi/eat_api_endpoint.dart | 23 ++++ .../apis/eatApi/eat_api_service.dart | 23 ---- .../apis/navigaTumApi/navigatum_api.dart | 18 +-- .../navigaTumApi/navigatum_api_endpoint.dart | 34 +++++ .../navigaTumApi/navigatum_api_service.dart | 34 ----- .../apis/tumOnlineApi/tum_online_api.dart | 74 +++++------ .../tumOnlineApi/tum_online_api_endpoint.dart | 116 ++++++++++++++++++ .../tumOnlineApi/tum_online_api_service.dart | 116 ------------------ .../services/calendar_service.dart | 8 +- .../services/navigatum_search_service.dart | 4 +- .../services/navigatum_service.dart | 6 +- .../views/navigatum_room_maps_view.dart | 10 +- .../services/onboarding_service.dart | 6 +- .../services/person_details_service.dart | 4 +- .../services/person_search_service.dart | 4 +- .../services/profile_service.dart | 6 +- .../services/cafeterias_service.dart | 4 +- .../services/mealplan_service.dart | 8 +- .../services/student_card_service.dart | 4 +- .../service/grade_service.dart | 6 +- .../service/lecture_details_service.dart | 4 +- .../service/lecture_search_service.dart | 4 +- .../service/lecture_service.dart | 4 +- 24 files changed, 270 insertions(+), 270 deletions(-) create mode 100644 lib/base/networking/apis/eatApi/eat_api_endpoint.dart delete mode 100644 lib/base/networking/apis/eatApi/eat_api_service.dart create mode 100644 lib/base/networking/apis/navigaTumApi/navigatum_api_endpoint.dart delete mode 100644 lib/base/networking/apis/navigaTumApi/navigatum_api_service.dart create mode 100644 lib/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart delete mode 100644 lib/base/networking/apis/tumOnlineApi/tum_online_api_service.dart diff --git a/lib/base/networking/apis/eatApi/eat_api.dart b/lib/base/networking/apis/eatApi/eat_api.dart index f790d7ac..77d39201 100644 --- a/lib/base/networking/apis/eatApi/eat_api.dart +++ b/lib/base/networking/apis/eatApi/eat_api.dart @@ -1,10 +1,10 @@ -import 'package:campus_flutter/base/networking/apis/eatApi/eat_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/eatApi/eat_api_endpoint.dart'; import 'package:campus_flutter/base/networking/protocols/api.dart'; class EatApi extends Api { - final EatApiService eatApiService; + final EatApiEndpoint eatApiEndpoint; - EatApi(this.eatApiService); + EatApi(this.eatApiEndpoint); @override String get baseURL => "tum-dev.github.io"; @@ -14,18 +14,18 @@ class EatApi extends Api { @override String get paths { - switch (eatApiService) { - case EatApiServiceCanteens _: + switch (eatApiEndpoint) { + case EatApiEndpointCanteens _: return "${path}enums/canteens.json"; - case EatApiServiceLanguages _: + case EatApiEndpointLanguages _: return "${path}enums/languages.json"; - case EatApiServiceLabels _: + case EatApiEndpointLabels _: return "${path}enums/labels.json"; - case EatApiServiceAll _: + case EatApiEndpointAll _: return "${path}all.json"; - case EatApiServiceAllRef _: + case EatApiEndpointAllRef _: return "${path}all_ref.json"; - case EatApiServiceMenu menu: + case EatApiEndpointMenu menu: return "$path${menu.location}/${menu.year}/${menu.week.toString().padLeft(1, "0")}.json"; } } diff --git a/lib/base/networking/apis/eatApi/eat_api_endpoint.dart b/lib/base/networking/apis/eatApi/eat_api_endpoint.dart new file mode 100644 index 00000000..630ffa5e --- /dev/null +++ b/lib/base/networking/apis/eatApi/eat_api_endpoint.dart @@ -0,0 +1,23 @@ +import 'package:campus_flutter/base/extensions/date_time.dart'; + +sealed class EatApiEndpoint {} + +class EatApiEndpointCanteens extends EatApiEndpoint {} + +class EatApiEndpointLanguages extends EatApiEndpoint {} + +class EatApiEndpointLabels extends EatApiEndpoint {} + +class EatApiEndpointAll extends EatApiEndpoint {} + +class EatApiEndpointAllRef extends EatApiEndpoint {} + +class EatApiEndpointMenu extends EatApiEndpoint { + final String location; + final int year; + final String week; + + EatApiEndpointMenu({required this.location, int? year, String? week}) + : year = year ?? DateTime.now().year, + week = week ?? DateTime.now().weekNumber(); +} diff --git a/lib/base/networking/apis/eatApi/eat_api_service.dart b/lib/base/networking/apis/eatApi/eat_api_service.dart deleted file mode 100644 index e81c0684..00000000 --- a/lib/base/networking/apis/eatApi/eat_api_service.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:campus_flutter/base/extensions/date_time.dart'; - -sealed class EatApiService {} - -class EatApiServiceCanteens extends EatApiService {} - -class EatApiServiceLanguages extends EatApiService {} - -class EatApiServiceLabels extends EatApiService {} - -class EatApiServiceAll extends EatApiService {} - -class EatApiServiceAllRef extends EatApiService {} - -class EatApiServiceMenu extends EatApiService { - final String location; - final int year; - final String week; - - EatApiServiceMenu({required this.location, int? year, String? week}) - : year = year ?? DateTime.now().year, - week = week ?? DateTime.now().weekNumber(); -} diff --git a/lib/base/networking/apis/navigaTumApi/navigatum_api.dart b/lib/base/networking/apis/navigaTumApi/navigatum_api.dart index 20ef4cad..49648e02 100644 --- a/lib/base/networking/apis/navigaTumApi/navigatum_api.dart +++ b/lib/base/networking/apis/navigaTumApi/navigatum_api.dart @@ -1,10 +1,10 @@ -import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api_endpoint.dart'; import 'package:campus_flutter/base/networking/protocols/api.dart'; class NavigaTumApi extends Api { - final NavigaTumApiService navigaTumApiService; + final NavigaTumApiEndpoint navigaTumApiEndpoint; - NavigaTumApi({required this.navigaTumApiService}); + NavigaTumApi({required this.navigaTumApiEndpoint}); @override String get baseURL => "nav.tum.de"; @@ -13,21 +13,21 @@ class NavigaTumApi extends Api { bool get needsAuth => false; @override - Map get parameters => navigaTumApiService.getParameters(); + Map get parameters => navigaTumApiEndpoint.getParameters(); @override String get path => ""; @override String get paths { - switch (navigaTumApiService) { - case NavigaTumApiServiceSearch _: + switch (navigaTumApiEndpoint) { + case NavigaTumApiEndpointSearch _: return "api/search"; - case NavigaTumApiServiceDetails details: + case NavigaTumApiEndpointDetails details: return "api/locations/${details.id}"; - case NavigaTumApiServiceImages images: + case NavigaTumApiEndpointImages images: return "cdn/maps/roomfinder/${images.id}"; - case NavigaTumApiServiceOverlayImages overlayImages: + case NavigaTumApiEndpointOverlayImages overlayImages: return "cdn/maps/roomfinder/${overlayImages.id}"; } } diff --git a/lib/base/networking/apis/navigaTumApi/navigatum_api_endpoint.dart b/lib/base/networking/apis/navigaTumApi/navigatum_api_endpoint.dart new file mode 100644 index 00000000..05c8a63c --- /dev/null +++ b/lib/base/networking/apis/navigaTumApi/navigatum_api_endpoint.dart @@ -0,0 +1,34 @@ +sealed class NavigaTumApiEndpoint { + Map getParameters() => {}; +} + +class NavigaTumApiEndpointSearch extends NavigaTumApiEndpoint { + final String query; + + NavigaTumApiEndpointSearch({required this.query}); + + @override + Map getParameters() => {"q": query}; +} + +class NavigaTumApiEndpointDetails extends NavigaTumApiEndpoint { + final String id; + final String language; + + NavigaTumApiEndpointDetails({required this.id, required this.language}); + + @override + Map getParameters() => {"lang": language}; +} + +class NavigaTumApiEndpointImages extends NavigaTumApiEndpoint { + final String id; + + NavigaTumApiEndpointImages({required this.id}); +} + +class NavigaTumApiEndpointOverlayImages extends NavigaTumApiEndpoint { + final String id; + + NavigaTumApiEndpointOverlayImages({required this.id}); +} diff --git a/lib/base/networking/apis/navigaTumApi/navigatum_api_service.dart b/lib/base/networking/apis/navigaTumApi/navigatum_api_service.dart deleted file mode 100644 index d87c5c38..00000000 --- a/lib/base/networking/apis/navigaTumApi/navigatum_api_service.dart +++ /dev/null @@ -1,34 +0,0 @@ -sealed class NavigaTumApiService { - Map getParameters() => {}; -} - -class NavigaTumApiServiceSearch extends NavigaTumApiService { - final String query; - - NavigaTumApiServiceSearch({required this.query}); - - @override - Map getParameters() => {"q": query}; -} - -class NavigaTumApiServiceDetails extends NavigaTumApiService { - final String id; - final String language; - - NavigaTumApiServiceDetails({required this.id, required this.language}); - - @override - Map getParameters() => {"lang": language}; -} - -class NavigaTumApiServiceImages extends NavigaTumApiService { - final String id; - - NavigaTumApiServiceImages({required this.id}); -} - -class NavigaTumApiServiceOverlayImages extends NavigaTumApiService { - final String id; - - NavigaTumApiServiceOverlayImages({required this.id}); -} diff --git a/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart b/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart index 559d3efe..1ebaa504 100644 --- a/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart +++ b/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart @@ -1,11 +1,11 @@ -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/protocols/api.dart'; import 'package:intl/intl.dart'; class TumOnlineApi extends Api { - final TumOnlineService tumOnlineService; + final TumOnlineEndpoint tumOnlineEndpoint; - TumOnlineApi(this.tumOnlineService); + TumOnlineApi(this.tumOnlineEndpoint); @override final path = "/tumonline/"; @@ -15,64 +15,64 @@ class TumOnlineApi extends Api { @override String get paths { - switch (tumOnlineService) { - case TumOnlineServicePersonSearch _: + switch (tumOnlineEndpoint) { + case TumOnlineEndpointPersonSearch _: return "${path}wbservicesbasic.personenSuche"; - case TumOnlineServiceTokenRequest _: + case TumOnlineEndpointTokenRequest _: return "${path}wbservicesbasic.requestToken"; - case TumOnlineServiceTokenConfirmation _: + case TumOnlineEndpointTokenConfirmation _: return "${path}wbservicesbasic.isTokenConfirmed"; - case TumOnlineServiceTuitionStatus _: + case TumOnlineEndpointTuitionStatus _: return "${path}wbservicesbasic.studienbeitragsstatus"; - case TumOnlineServiceCalendar _: + case TumOnlineEndpointCalendar _: return "${path}wbservicesbasic.kalender"; - case TumOnlineServicePersonDetails _: + case TumOnlineEndpointPersonDetails _: return "${path}wbservicesbasic.personenDetails"; - case TumOnlineServicePersonalLectures _: + case TumOnlineEndpointPersonalLectures _: return "${path}wbservicesbasic.veranstaltungenEigene"; - case TumOnlineServicePersonalGrades _: + case TumOnlineEndpointPersonalGrades _: return "${path}wbservicesbasic.noten"; - case TumOnlineServiceLectureSearch _: + case TumOnlineEndpointLectureSearch _: return "${path}wbservicesbasic.veranstaltungenSuche"; - case TumOnlineServiceLectureDetails _: + case TumOnlineEndpointLectureDetails _: return "${path}wbservicesbasic.veranstaltungenDetails"; - case TumOnlineServiceIdentify _: + case TumOnlineEndpointIdentify _: return "${path}wbservicesbasic.id"; - case TumOnlineServiceSecretUpload _: + case TumOnlineEndpointSecretUpload _: return "${path}wbservicesbasic.secretUpload"; - case TumOnlineServiceProfileImage _: + case TumOnlineEndpointProfileImage _: return "${path}visitenkarte.showImage"; - case TumOnlineServiceAverageGrades _: + case TumOnlineEndpointAverageGrades _: return "${path}wbservicesbasic.absNoten"; - case TumOnlineServiceTumCard _: + case TumOnlineEndpointTumCard _: return "${path}wbservicesbasic.tumCard"; - case TumOnlineServiceEventCreate _: + case TumOnlineEndpointEventCreate _: return "${path}wbservicesbasic.terminCreate"; - case TumOnlineServiceEventDelete _: + case TumOnlineEndpointEventDelete _: return "${path}wbservicesbasic.terminDelete"; } } @override - Map get parameters => tumOnlineService.getParameters(); + Map get parameters => tumOnlineEndpoint.getParameters(); @override bool get needsAuth { - switch (tumOnlineService) { - case TumOnlineServicePersonSearch _: - case TumOnlineServiceTokenConfirmation _: - case TumOnlineServiceTuitionStatus _: - case TumOnlineServiceCalendar _: - case TumOnlineServicePersonDetails _: - case TumOnlineServicePersonalLectures _: - case TumOnlineServicePersonalGrades _: - case TumOnlineServiceLectureSearch _: - case TumOnlineServiceLectureDetails _: - case TumOnlineServiceIdentify _: - case TumOnlineServiceTumCard _: - case TumOnlineServiceAverageGrades _: - case TumOnlineServiceEventCreate _: - case TumOnlineServiceEventDelete _: + switch (tumOnlineEndpoint) { + case TumOnlineEndpointPersonSearch _: + case TumOnlineEndpointTokenConfirmation _: + case TumOnlineEndpointTuitionStatus _: + case TumOnlineEndpointCalendar _: + case TumOnlineEndpointPersonDetails _: + case TumOnlineEndpointPersonalLectures _: + case TumOnlineEndpointPersonalGrades _: + case TumOnlineEndpointLectureSearch _: + case TumOnlineEndpointLectureDetails _: + case TumOnlineEndpointIdentify _: + case TumOnlineEndpointTumCard _: + case TumOnlineEndpointAverageGrades _: + case TumOnlineEndpointEventCreate _: + case TumOnlineEndpointEventDelete _: return true; default: return false; diff --git a/lib/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart b/lib/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart new file mode 100644 index 00000000..0237a46b --- /dev/null +++ b/lib/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart @@ -0,0 +1,116 @@ +sealed class TumOnlineEndpoint { + Map getParameters() => {}; +} + +class TumOnlineEndpointTokenRequest extends TumOnlineEndpoint { + final String tumId; + final String deviceName; + + TumOnlineEndpointTokenRequest({required this.tumId, required this.deviceName}); + + @override + Map getParameters() => { + "pUsername": tumId, + "pTokenName": deviceName, + }; +} + +class TumOnlineEndpointTokenConfirmation extends TumOnlineEndpoint {} + +class TumOnlineEndpointTuitionStatus extends TumOnlineEndpoint {} + +class TumOnlineEndpointCalendar extends TumOnlineEndpoint {} + +class TumOnlineEndpointPersonSearch extends TumOnlineEndpoint { + final String search; + + TumOnlineEndpointPersonSearch({required this.search}); + + @override + Map getParameters() => {"pSuche": search}; +} + +class TumOnlineEndpointPersonDetails extends TumOnlineEndpoint { + final String identNumber; + + TumOnlineEndpointPersonDetails({required this.identNumber}); + + @override + Map getParameters() => {"pIdentNr": identNumber}; +} + +class TumOnlineEndpointPersonalLectures extends TumOnlineEndpoint {} + +class TumOnlineEndpointPersonalGrades extends TumOnlineEndpoint {} + +class TumOnlineEndpointAverageGrades extends TumOnlineEndpoint {} + +class TumOnlineEndpointLectureSearch extends TumOnlineEndpoint { + final String search; + + TumOnlineEndpointLectureSearch({required this.search}); + + @override + Map getParameters() => {"pSuche": search}; +} + +class TumOnlineEndpointLectureDetails extends TumOnlineEndpoint { + final String lvNr; + + TumOnlineEndpointLectureDetails({required this.lvNr}); + + @override + Map getParameters() => {"pLVNr": lvNr}; +} + +class TumOnlineEndpointIdentify extends TumOnlineEndpoint {} + +class TumOnlineEndpointSecretUpload extends TumOnlineEndpoint {} + +class TumOnlineEndpointTumCard extends TumOnlineEndpoint {} + +class TumOnlineEndpointProfileImage extends TumOnlineEndpoint { + final String personGroup; + final String id; + + TumOnlineEndpointProfileImage({required this.personGroup, required this.id}); + + @override + Map getParameters() => + {"pPersonenGruppe": personGroup, "pPersonenId": id}; +} + +class TumOnlineEndpointEventCreate extends TumOnlineEndpoint { + final String title; + final String? annotation; + final String from; + final String to; + + TumOnlineEndpointEventCreate({ + required this.title, + required this.annotation, + required this.from, + required this.to, + }); + + @override + Map getParameters() => { + "pTitel": title, + if (annotation != null) "pAnmerkung": annotation!, + "pVon": from, + "pBis": to, + }; +} + +class TumOnlineEndpointEventDelete extends TumOnlineEndpoint { + final String eventId; + + TumOnlineEndpointEventDelete({ + required this.eventId, + }); + + @override + Map getParameters() => { + "pTerminNr": eventId, + }; +} diff --git a/lib/base/networking/apis/tumOnlineApi/tum_online_api_service.dart b/lib/base/networking/apis/tumOnlineApi/tum_online_api_service.dart deleted file mode 100644 index 79a2276c..00000000 --- a/lib/base/networking/apis/tumOnlineApi/tum_online_api_service.dart +++ /dev/null @@ -1,116 +0,0 @@ -sealed class TumOnlineService { - Map getParameters() => {}; -} - -class TumOnlineServiceTokenRequest extends TumOnlineService { - final String tumId; - final String deviceName; - - TumOnlineServiceTokenRequest({required this.tumId, required this.deviceName}); - - @override - Map getParameters() => { - "pUsername": tumId, - "pTokenName": deviceName, - }; -} - -class TumOnlineServiceTokenConfirmation extends TumOnlineService {} - -class TumOnlineServiceTuitionStatus extends TumOnlineService {} - -class TumOnlineServiceCalendar extends TumOnlineService {} - -class TumOnlineServicePersonSearch extends TumOnlineService { - final String search; - - TumOnlineServicePersonSearch({required this.search}); - - @override - Map getParameters() => {"pSuche": search}; -} - -class TumOnlineServicePersonDetails extends TumOnlineService { - final String identNumber; - - TumOnlineServicePersonDetails({required this.identNumber}); - - @override - Map getParameters() => {"pIdentNr": identNumber}; -} - -class TumOnlineServicePersonalLectures extends TumOnlineService {} - -class TumOnlineServicePersonalGrades extends TumOnlineService {} - -class TumOnlineServiceAverageGrades extends TumOnlineService {} - -class TumOnlineServiceLectureSearch extends TumOnlineService { - final String search; - - TumOnlineServiceLectureSearch({required this.search}); - - @override - Map getParameters() => {"pSuche": search}; -} - -class TumOnlineServiceLectureDetails extends TumOnlineService { - final String lvNr; - - TumOnlineServiceLectureDetails({required this.lvNr}); - - @override - Map getParameters() => {"pLVNr": lvNr}; -} - -class TumOnlineServiceIdentify extends TumOnlineService {} - -class TumOnlineServiceSecretUpload extends TumOnlineService {} - -class TumOnlineServiceTumCard extends TumOnlineService {} - -class TumOnlineServiceProfileImage extends TumOnlineService { - final String personGroup; - final String id; - - TumOnlineServiceProfileImage({required this.personGroup, required this.id}); - - @override - Map getParameters() => - {"pPersonenGruppe": personGroup, "pPersonenId": id}; -} - -class TumOnlineServiceEventCreate extends TumOnlineService { - final String title; - final String? annotation; - final String from; - final String to; - - TumOnlineServiceEventCreate({ - required this.title, - required this.annotation, - required this.from, - required this.to, - }); - - @override - Map getParameters() => { - "pTitel": title, - if (annotation != null) "pAnmerkung": annotation!, - "pVon": from, - "pBis": to, - }; -} - -class TumOnlineServiceEventDelete extends TumOnlineService { - final String eventId; - - TumOnlineServiceEventDelete({ - required this.eventId, - }); - - @override - Map getParameters() => { - "pTerminNr": eventId, - }; -} diff --git a/lib/calendarComponent/services/calendar_service.dart b/lib/calendarComponent/services/calendar_service.dart index 4ac97499..5e5dbf66 100644 --- a/lib/calendarComponent/services/calendar_service.dart +++ b/lib/calendarComponent/services/calendar_service.dart @@ -1,6 +1,6 @@ import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/calendarComponent/model/calendar_editing.dart'; import 'package:campus_flutter/calendarComponent/model/calendar_event.dart'; @@ -13,7 +13,7 @@ class CalendarService { RestClient restClient = getIt(); final response = await restClient .getWithException( - TumOnlineApi(TumOnlineServiceCalendar()), + TumOnlineApi(TumOnlineEndpointCalendar()), CalendarEvents.fromJson, TumOnlineApiException.fromJson, forcedRefresh, @@ -28,7 +28,7 @@ class CalendarService { final response = await restClient.getWithException< CalendarCreationConfirmationData, TumOnlineApi, TumOnlineApiException>( TumOnlineApi( - TumOnlineServiceEventCreate( + TumOnlineEndpointEventCreate( title: addedCalendarEvent.title, annotation: addedCalendarEvent.annotation, from: TumOnlineApi.dateFormat.format(addedCalendarEvent.from), @@ -48,7 +48,7 @@ class CalendarService { RestClient restClient = getIt(); restClient.getWithException( TumOnlineApi( - TumOnlineServiceEventDelete( + TumOnlineEndpointEventDelete( eventId: id, ), ), diff --git a/lib/navigaTumComponent/services/navigatum_search_service.dart b/lib/navigaTumComponent/services/navigatum_search_service.dart index 89e0207e..d5c95a4e 100644 --- a/lib/navigaTumComponent/services/navigatum_search_service.dart +++ b/lib/navigaTumComponent/services/navigatum_search_service.dart @@ -1,5 +1,5 @@ import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api.dart'; -import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/navigaTumComponent/model/search/navigatum_search_response.dart'; import 'package:campus_flutter/main.dart'; @@ -13,7 +13,7 @@ class NavigaTumSearchService { final response = await restClient.get( NavigaTumApi( - navigaTumApiService: NavigaTumApiServiceSearch(query: query), + navigaTumApiEndpoint: NavigaTumApiEndpointSearch(query: query), ), NavigaTumSearchResponse.fromJson, forcedRefresh, diff --git a/lib/navigaTumComponent/services/navigatum_service.dart b/lib/navigaTumComponent/services/navigatum_service.dart index 110decb7..23cc795b 100644 --- a/lib/navigaTumComponent/services/navigatum_service.dart +++ b/lib/navigaTumComponent/services/navigatum_service.dart @@ -1,5 +1,5 @@ import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api.dart'; -import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/navigaTumComponent/model/navigatum_navigation_details.dart'; import 'package:campus_flutter/navigaTumComponent/model/search/navigatum_search_response.dart'; @@ -15,7 +15,7 @@ class NavigaTumService { final response = await restClient.get( NavigaTumApi( - navigaTumApiService: NavigaTumApiServiceSearch(query: query), + navigaTumApiEndpoint: NavigaTumApiEndpointSearch(query: query), ), NavigaTumSearchResponse.fromJson, forcedRefresh, @@ -32,7 +32,7 @@ class NavigaTumService { final response = await getIt().get( NavigaTumApi( - navigaTumApiService: NavigaTumApiServiceDetails( + navigaTumApiEndpoint: NavigaTumApiEndpointDetails( id: id, language: Localizations.localeOf(context).languageCode, ), diff --git a/lib/navigaTumComponent/views/navigatum_room_maps_view.dart b/lib/navigaTumComponent/views/navigatum_room_maps_view.dart index 75f3bdf9..45116fa4 100644 --- a/lib/navigaTumComponent/views/navigatum_room_maps_view.dart +++ b/lib/navigaTumComponent/views/navigatum_room_maps_view.dart @@ -2,7 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:campus_flutter/base/util/card_with_padding.dart'; import 'package:campus_flutter/base/util/horizontal_slider.dart'; import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api.dart'; -import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/navigaTumApi/navigatum_api_endpoint.dart'; import 'package:campus_flutter/base/routing/routes.dart'; import 'package:campus_flutter/homeComponent/view/widget/widget_frame_view.dart'; import 'package:campus_flutter/navigaTumComponent/model/navigatum_roomfinder_map.dart'; @@ -28,16 +28,16 @@ class NavigaTumRoomMapsView extends StatelessWidget { return InkWell( child: CachedNetworkImage( imageUrl: NavigaTumApi( - navigaTumApiService: - NavigaTumApiServiceImages(id: map.imageUrl), + navigaTumApiEndpoint: + NavigaTumApiEndpointImages(id: map.imageUrl), ).asURL().toString(), ), onTap: () => context.push( networkImage, extra: ( NavigaTumApi( - navigaTumApiService: - NavigaTumApiServiceImages(id: map.imageUrl), + navigaTumApiEndpoint: + NavigaTumApiEndpointImages(id: map.imageUrl), ).asURL().toString(), map ), diff --git a/lib/onboardingComponent/services/onboarding_service.dart b/lib/onboardingComponent/services/onboarding_service.dart index 5cb99d27..417c3750 100644 --- a/lib/onboardingComponent/services/onboarding_service.dart +++ b/lib/onboardingComponent/services/onboarding_service.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/onboardingComponent/model/confirm.dart'; import 'package:campus_flutter/onboardingComponent/model/token.dart'; @@ -33,7 +33,7 @@ class OnboardingService { final response = await restClient .getWithException( TumOnlineApi( - TumOnlineServiceTokenRequest( + TumOnlineEndpointTokenRequest( tumId: name, deviceName: "TCA - ${Platform.isIOS ? "iOS" : "Android"}", ), @@ -49,7 +49,7 @@ class OnboardingService { RestClient restClient = getIt(); final response = await restClient .getWithException( - TumOnlineApi(TumOnlineServiceTokenConfirmation()), + TumOnlineApi(TumOnlineEndpointTokenConfirmation()), Confirm.fromJson, TumOnlineApiException.fromJson, forcedRefresh, diff --git a/lib/personComponent/services/person_details_service.dart b/lib/personComponent/services/person_details_service.dart index fd9df9e3..0d1e41b6 100644 --- a/lib/personComponent/services/person_details_service.dart +++ b/lib/personComponent/services/person_details_service.dart @@ -1,6 +1,6 @@ import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/main.dart'; import 'package:campus_flutter/personComponent/model/personDetails/person_details.dart'; @@ -13,7 +13,7 @@ class PersonDetailsService { RestClient restClient = getIt(); final response = await restClient.getWithException( - TumOnlineApi(TumOnlineServicePersonDetails(identNumber: identNumber)), + TumOnlineApi(TumOnlineEndpointPersonDetails(identNumber: identNumber)), PersonDetailsData.fromJson, TumOnlineApiException.fromJson, forcedRefresh, diff --git a/lib/personComponent/services/person_search_service.dart b/lib/personComponent/services/person_search_service.dart index 5aae4bf4..f58dcbb5 100644 --- a/lib/personComponent/services/person_search_service.dart +++ b/lib/personComponent/services/person_search_service.dart @@ -1,6 +1,6 @@ import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/personComponent/model/personSearch/person.dart'; import 'package:campus_flutter/main.dart'; @@ -13,7 +13,7 @@ class PersonSearchService { RestClient restClient = getIt(); final response = await restClient .getWithException( - TumOnlineApi(TumOnlineServicePersonSearch(search: query)), + TumOnlineApi(TumOnlineEndpointPersonSearch(search: query)), Persons.fromJson, TumOnlineApiException.fromJson, forcedRefresh, diff --git a/lib/personComponent/services/profile_service.dart b/lib/personComponent/services/profile_service.dart index 3b05f384..1e4f3a69 100644 --- a/lib/personComponent/services/profile_service.dart +++ b/lib/personComponent/services/profile_service.dart @@ -1,5 +1,5 @@ import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/main.dart'; @@ -11,7 +11,7 @@ class ProfileService { RestClient restClient = getIt(); final response = await restClient .getWithException( - TumOnlineApi(TumOnlineServiceIdentify()), + TumOnlineApi(TumOnlineEndpointIdentify()), Profiles.fromJson, TumOnlineApiException.fromJson, forcedRefresh, @@ -28,7 +28,7 @@ class ProfileService { RestClient restClient = getIt(); final response = await restClient .getWithException( - TumOnlineApi(TumOnlineServiceTuitionStatus()), + TumOnlineApi(TumOnlineEndpointTuitionStatus()), Tuitions.fromJson, TumOnlineApiException.fromJson, forcedRefresh, diff --git a/lib/placesComponent/services/cafeterias_service.dart b/lib/placesComponent/services/cafeterias_service.dart index cfffcc66..915691e2 100644 --- a/lib/placesComponent/services/cafeterias_service.dart +++ b/lib/placesComponent/services/cafeterias_service.dart @@ -1,5 +1,5 @@ import 'package:campus_flutter/base/networking/apis/eatApi/eat_api.dart'; -import 'package:campus_flutter/base/networking/apis/eatApi/eat_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/eatApi/eat_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/placesComponent/model/cafeterias/cafeteria.dart'; import 'package:campus_flutter/main.dart'; @@ -10,7 +10,7 @@ class CafeteriasService { ) async { RestClient restClient = getIt(); final response = await restClient.get( - EatApi(EatApiServiceCanteens()), + EatApi(EatApiEndpointCanteens()), Cafeterias.fromJson, forcedRefresh, ); diff --git a/lib/placesComponent/services/mealplan_service.dart b/lib/placesComponent/services/mealplan_service.dart index 2dfdc6a6..0826a283 100644 --- a/lib/placesComponent/services/mealplan_service.dart +++ b/lib/placesComponent/services/mealplan_service.dart @@ -1,6 +1,6 @@ import 'package:campus_flutter/base/extensions/date_time.dart'; import 'package:campus_flutter/base/networking/apis/eatApi/eat_api.dart'; -import 'package:campus_flutter/base/networking/apis/eatApi/eat_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/eatApi/eat_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/placesComponent/model/cafeterias/cafeteria.dart'; import 'package:campus_flutter/placesComponent/model/cafeterias/cafeteria_menu.dart'; @@ -21,7 +21,7 @@ class MealPlanService { /// attempt to fetch current weeks meal plan final response = await restClient.get( EatApi( - EatApiServiceMenu( + EatApiEndpointMenu( location: cafeteria.id, year: today.year, week: today.weekNumber(), @@ -39,7 +39,7 @@ class MealPlanService { try { final nextWeekResponse = await restClient.get( EatApi( - EatApiServiceMenu( + EatApiEndpointMenu( location: cafeteria.id, year: nextWeek.year, week: nextWeek.weekNumber(), @@ -67,7 +67,7 @@ class MealPlanService { final nextWeek = today.add(const Duration(days: 7)); final response = await restClient.get( EatApi( - EatApiServiceMenu( + EatApiEndpointMenu( location: cafeteria.id, year: nextWeek.year, week: nextWeek.weekNumber(), diff --git a/lib/studentCardComponent/services/student_card_service.dart b/lib/studentCardComponent/services/student_card_service.dart index c3b3a7df..bd5c4778 100644 --- a/lib/studentCardComponent/services/student_card_service.dart +++ b/lib/studentCardComponent/services/student_card_service.dart @@ -2,7 +2,7 @@ import 'dart:developer'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/main.dart'; import 'package:campus_flutter/studentCardComponent/model/student_card.dart'; @@ -15,7 +15,7 @@ class StudentCardService { RestClient restClient = getIt(); final response = await restClient .getWithException( - TumOnlineApi(TumOnlineServiceTumCard()), + TumOnlineApi(TumOnlineEndpointTumCard()), StudentCards.fromJson, TumOnlineApiException.fromJson, forcedRefresh, diff --git a/lib/studiesComponent/service/grade_service.dart b/lib/studiesComponent/service/grade_service.dart index e218437b..10a72ecf 100644 --- a/lib/studiesComponent/service/grade_service.dart +++ b/lib/studiesComponent/service/grade_service.dart @@ -1,6 +1,6 @@ import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/studiesComponent/model/average_grade.dart'; import 'package:campus_flutter/studiesComponent/model/grade.dart'; @@ -13,7 +13,7 @@ class GradeService { RestClient restClient = getIt(); final response = await restClient .getWithException( - TumOnlineApi(TumOnlineServicePersonalGrades()), + TumOnlineApi(TumOnlineEndpointPersonalGrades()), Grades.fromJson, TumOnlineApiException.fromJson, forcedRefresh, @@ -26,7 +26,7 @@ class GradeService { RestClient restClient = getIt(); final response = await restClient .getWithException( - TumOnlineApi(TumOnlineServiceAverageGrades()), + TumOnlineApi(TumOnlineEndpointAverageGrades()), AverageGrades.fromJson, TumOnlineApiException.fromJson, forcedRefresh, diff --git a/lib/studiesComponent/service/lecture_details_service.dart b/lib/studiesComponent/service/lecture_details_service.dart index 6d23b2d8..45f0a02a 100644 --- a/lib/studiesComponent/service/lecture_details_service.dart +++ b/lib/studiesComponent/service/lecture_details_service.dart @@ -1,6 +1,6 @@ import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/main.dart'; import 'package:campus_flutter/studiesComponent/model/lecture_details.dart'; @@ -13,7 +13,7 @@ class LectureDetailsService { RestClient restClient = getIt(); final response = await restClient.getWithException( - TumOnlineApi(TumOnlineServiceLectureDetails(lvNr: lvNumber)), + TumOnlineApi(TumOnlineEndpointLectureDetails(lvNr: lvNumber)), LectureDetailsElement.fromJson, TumOnlineApiException.fromJson, forcedRefresh, diff --git a/lib/studiesComponent/service/lecture_search_service.dart b/lib/studiesComponent/service/lecture_search_service.dart index 6e56759b..8fe042f0 100644 --- a/lib/studiesComponent/service/lecture_search_service.dart +++ b/lib/studiesComponent/service/lecture_search_service.dart @@ -1,6 +1,6 @@ import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/studiesComponent/model/lecture.dart'; import 'package:campus_flutter/main.dart'; @@ -12,7 +12,7 @@ class LectureSearchService { ) async { final response = await getIt() .getWithException( - TumOnlineApi(TumOnlineServiceLectureSearch(search: query)), + TumOnlineApi(TumOnlineEndpointLectureSearch(search: query)), Lectures.fromJson, TumOnlineApiException.fromJson, forcedRefresh, diff --git a/lib/studiesComponent/service/lecture_service.dart b/lib/studiesComponent/service/lecture_service.dart index fc78a50d..579ecbb8 100644 --- a/lib/studiesComponent/service/lecture_service.dart +++ b/lib/studiesComponent/service/lecture_service.dart @@ -1,6 +1,6 @@ import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; -import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_service.dart'; +import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart'; import 'package:campus_flutter/base/networking/base/rest_client.dart'; import 'package:campus_flutter/studiesComponent/model/lecture.dart'; import 'package:campus_flutter/main.dart'; @@ -12,7 +12,7 @@ class LectureService { RestClient restClient = getIt(); final response = await restClient .getWithException( - TumOnlineApi(TumOnlineServicePersonalLectures()), + TumOnlineApi(TumOnlineEndpointPersonalLectures()), Lectures.fromJson, TumOnlineApiException.fromJson, forcedRefresh, From fd31b8cd6a5032d9cdaabc086b25bfb8eb97130f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:45:37 +0200 Subject: [PATCH 04/12] Fix Formatting, Update Protos --- .../tumOnlineApi/tum_online_api_endpoint.dart | 5 +- .../apis/tumdev/campus_backend.pb.dart | 306 ------------------ .../apis/tumdev/campus_backend.pbgrpc.dart | 80 ----- .../apis/tumdev/campus_backend.pbjson.dart | 69 ---- protos/tumdev/campus_backend.proto | 38 --- 5 files changed, 4 insertions(+), 494 deletions(-) diff --git a/lib/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart b/lib/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart index 0237a46b..da1cb426 100644 --- a/lib/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart +++ b/lib/base/networking/apis/tumOnlineApi/tum_online_api_endpoint.dart @@ -6,7 +6,10 @@ class TumOnlineEndpointTokenRequest extends TumOnlineEndpoint { final String tumId; final String deviceName; - TumOnlineEndpointTokenRequest({required this.tumId, required this.deviceName}); + TumOnlineEndpointTokenRequest({ + required this.tumId, + required this.deviceName, + }); @override Map getParameters() => { diff --git a/lib/base/networking/apis/tumdev/campus_backend.pb.dart b/lib/base/networking/apis/tumdev/campus_backend.pb.dart index e7f0b15f..e189f087 100644 --- a/lib/base/networking/apis/tumdev/campus_backend.pb.dart +++ b/lib/base/networking/apis/tumdev/campus_backend.pb.dart @@ -3788,56 +3788,6 @@ class GetMemberReply extends $pb.GeneratedMessage { void clearMemberId() => clearField(3); } -class GetUploadStatusRequest extends $pb.GeneratedMessage { - factory GetUploadStatusRequest({ - $core.String? lrzId, - }) { - final $result = create(); - if (lrzId != null) { - $result.lrzId = lrzId; - } - return $result; - } - GetUploadStatusRequest._() : super(); - factory GetUploadStatusRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetUploadStatusRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetUploadStatusRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'api'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'lrzId') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetUploadStatusRequest clone() => GetUploadStatusRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetUploadStatusRequest copyWith(void Function(GetUploadStatusRequest) updates) => super.copyWith((message) => updates(message as GetUploadStatusRequest)) as GetUploadStatusRequest; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GetUploadStatusRequest create() => GetUploadStatusRequest._(); - GetUploadStatusRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetUploadStatusRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetUploadStatusRequest? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get lrzId => $_getSZ(0); - @$pb.TagNumber(1) - set lrzId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasLrzId() => $_has(0); - @$pb.TagNumber(1) - void clearLrzId() => clearField(1); -} - class GetUploadStatusReply extends $pb.GeneratedMessage { factory GetUploadStatusReply({ $core.String? fcmToken, @@ -3944,262 +3894,6 @@ class GetUploadStatusReply extends $pb.GeneratedMessage { void clearExternalId() => clearField(5); } -class GetNotificationRequest extends $pb.GeneratedMessage { - factory GetNotificationRequest({ - $core.int? notificationId, - }) { - final $result = create(); - if (notificationId != null) { - $result.notificationId = notificationId; - } - return $result; - } - GetNotificationRequest._() : super(); - factory GetNotificationRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetNotificationRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetNotificationRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'api'), createEmptyInstance: create) - ..a<$core.int>(1, _omitFieldNames ? '' : 'notificationId', $pb.PbFieldType.O3) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetNotificationRequest clone() => GetNotificationRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetNotificationRequest copyWith(void Function(GetNotificationRequest) updates) => super.copyWith((message) => updates(message as GetNotificationRequest)) as GetNotificationRequest; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GetNotificationRequest create() => GetNotificationRequest._(); - GetNotificationRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetNotificationRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetNotificationRequest? _defaultInstance; - - @$pb.TagNumber(1) - $core.int get notificationId => $_getIZ(0); - @$pb.TagNumber(1) - set notificationId($core.int v) { $_setSignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasNotificationId() => $_has(0); - @$pb.TagNumber(1) - void clearNotificationId() => clearField(1); -} - -class GetNotificationReply extends $pb.GeneratedMessage { - factory GetNotificationReply({ - $core.int? notificationId, - $core.int? type, - $core.String? title, - $core.String? description, - $core.String? signature, - }) { - final $result = create(); - if (notificationId != null) { - $result.notificationId = notificationId; - } - if (type != null) { - $result.type = type; - } - if (title != null) { - $result.title = title; - } - if (description != null) { - $result.description = description; - } - if (signature != null) { - $result.signature = signature; - } - return $result; - } - GetNotificationReply._() : super(); - factory GetNotificationReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetNotificationReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetNotificationReply', package: const $pb.PackageName(_omitMessageNames ? '' : 'api'), createEmptyInstance: create) - ..a<$core.int>(1, _omitFieldNames ? '' : 'notificationId', $pb.PbFieldType.O3) - ..a<$core.int>(2, _omitFieldNames ? '' : 'type', $pb.PbFieldType.O3) - ..aOS(3, _omitFieldNames ? '' : 'title') - ..aOS(4, _omitFieldNames ? '' : 'description') - ..aOS(5, _omitFieldNames ? '' : 'signature') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetNotificationReply clone() => GetNotificationReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetNotificationReply copyWith(void Function(GetNotificationReply) updates) => super.copyWith((message) => updates(message as GetNotificationReply)) as GetNotificationReply; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GetNotificationReply create() => GetNotificationReply._(); - GetNotificationReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetNotificationReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetNotificationReply? _defaultInstance; - - @$pb.TagNumber(1) - $core.int get notificationId => $_getIZ(0); - @$pb.TagNumber(1) - set notificationId($core.int v) { $_setSignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasNotificationId() => $_has(0); - @$pb.TagNumber(1) - void clearNotificationId() => clearField(1); - - @$pb.TagNumber(2) - $core.int get type => $_getIZ(1); - @$pb.TagNumber(2) - set type($core.int v) { $_setSignedInt32(1, v); } - @$pb.TagNumber(2) - $core.bool hasType() => $_has(1); - @$pb.TagNumber(2) - void clearType() => clearField(2); - - @$pb.TagNumber(3) - $core.String get title => $_getSZ(2); - @$pb.TagNumber(3) - set title($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasTitle() => $_has(2); - @$pb.TagNumber(3) - void clearTitle() => clearField(3); - - @$pb.TagNumber(4) - $core.String get description => $_getSZ(3); - @$pb.TagNumber(4) - set description($core.String v) { $_setString(3, v); } - @$pb.TagNumber(4) - $core.bool hasDescription() => $_has(3); - @$pb.TagNumber(4) - void clearDescription() => clearField(4); - - @$pb.TagNumber(5) - $core.String get signature => $_getSZ(4); - @$pb.TagNumber(5) - set signature($core.String v) { $_setString(4, v); } - @$pb.TagNumber(5) - $core.bool hasSignature() => $_has(4); - @$pb.TagNumber(5) - void clearSignature() => clearField(5); -} - -class GetNotificationConfirmRequest extends $pb.GeneratedMessage { - factory GetNotificationConfirmRequest({ - $core.int? notificationId, - }) { - final $result = create(); - if (notificationId != null) { - $result.notificationId = notificationId; - } - return $result; - } - GetNotificationConfirmRequest._() : super(); - factory GetNotificationConfirmRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetNotificationConfirmRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetNotificationConfirmRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'api'), createEmptyInstance: create) - ..a<$core.int>(1, _omitFieldNames ? '' : 'notificationId', $pb.PbFieldType.O3) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetNotificationConfirmRequest clone() => GetNotificationConfirmRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetNotificationConfirmRequest copyWith(void Function(GetNotificationConfirmRequest) updates) => super.copyWith((message) => updates(message as GetNotificationConfirmRequest)) as GetNotificationConfirmRequest; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GetNotificationConfirmRequest create() => GetNotificationConfirmRequest._(); - GetNotificationConfirmRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetNotificationConfirmRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetNotificationConfirmRequest? _defaultInstance; - - @$pb.TagNumber(1) - $core.int get notificationId => $_getIZ(0); - @$pb.TagNumber(1) - set notificationId($core.int v) { $_setSignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasNotificationId() => $_has(0); - @$pb.TagNumber(1) - void clearNotificationId() => clearField(1); -} - -class GetNotificationConfirmReply extends $pb.GeneratedMessage { - factory GetNotificationConfirmReply({ - $core.String? status, - }) { - final $result = create(); - if (status != null) { - $result.status = status; - } - return $result; - } - GetNotificationConfirmReply._() : super(); - factory GetNotificationConfirmReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetNotificationConfirmReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetNotificationConfirmReply', package: const $pb.PackageName(_omitMessageNames ? '' : 'api'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'status') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetNotificationConfirmReply clone() => GetNotificationConfirmReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetNotificationConfirmReply copyWith(void Function(GetNotificationConfirmReply) updates) => super.copyWith((message) => updates(message as GetNotificationConfirmReply)) as GetNotificationConfirmReply; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GetNotificationConfirmReply create() => GetNotificationConfirmReply._(); - GetNotificationConfirmReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetNotificationConfirmReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetNotificationConfirmReply? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get status => $_getSZ(0); - @$pb.TagNumber(1) - set status($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasStatus() => $_has(0); - @$pb.TagNumber(1) - void clearStatus() => clearField(1); -} - class GetCanteenHeadCountRequest extends $pb.GeneratedMessage { factory GetCanteenHeadCountRequest({ $core.String? canteenId, diff --git a/lib/base/networking/apis/tumdev/campus_backend.pbgrpc.dart b/lib/base/networking/apis/tumdev/campus_backend.pbgrpc.dart index a806781e..212f77b8 100644 --- a/lib/base/networking/apis/tumdev/campus_backend.pbgrpc.dart +++ b/lib/base/networking/apis/tumdev/campus_backend.pbgrpc.dart @@ -81,22 +81,6 @@ class CampusClient extends $grpc.Client { '/api.Campus/CreateFeedback', ($0.CreateFeedbackRequest value) => value.writeToBuffer(), ($core.List<$core.int> value) => $0.CreateFeedbackReply.fromBuffer(value)); - static final _$getUploadStatus = $grpc.ClientMethod<$0.GetUploadStatusRequest, $0.GetUploadStatusReply>( - '/api.Campus/GetUploadStatus', - ($0.GetUploadStatusRequest value) => value.writeToBuffer(), - ($core.List<$core.int> value) => $0.GetUploadStatusReply.fromBuffer(value)); - static final _$getNotification = $grpc.ClientMethod<$0.GetNotificationRequest, $0.GetNotificationReply>( - '/api.Campus/GetNotification', - ($0.GetNotificationRequest value) => value.writeToBuffer(), - ($core.List<$core.int> value) => $0.GetNotificationReply.fromBuffer(value)); - static final _$getNotificationConfirm = $grpc.ClientMethod<$0.GetNotificationConfirmRequest, $0.GetNotificationConfirmReply>( - '/api.Campus/GetNotificationConfirm', - ($0.GetNotificationConfirmRequest value) => value.writeToBuffer(), - ($core.List<$core.int> value) => $0.GetNotificationConfirmReply.fromBuffer(value)); - static final _$getMember = $grpc.ClientMethod<$0.GetMemberRequest, $0.GetMemberReply>( - '/api.Campus/GetMember', - ($0.GetMemberRequest value) => value.writeToBuffer(), - ($core.List<$core.int> value) => $0.GetMemberReply.fromBuffer(value)); static final _$getCanteenHeadCount = $grpc.ClientMethod<$0.GetCanteenHeadCountRequest, $0.GetCanteenHeadCountReply>( '/api.Campus/GetCanteenHeadCount', ($0.GetCanteenHeadCountRequest value) => value.writeToBuffer(), @@ -180,22 +164,6 @@ class CampusClient extends $grpc.Client { return $createStreamingCall(_$createFeedback, request, options: options).single; } - $grpc.ResponseFuture<$0.GetUploadStatusReply> getUploadStatus($0.GetUploadStatusRequest request, {$grpc.CallOptions? options}) { - return $createUnaryCall(_$getUploadStatus, request, options: options); - } - - $grpc.ResponseFuture<$0.GetNotificationReply> getNotification($0.GetNotificationRequest request, {$grpc.CallOptions? options}) { - return $createUnaryCall(_$getNotification, request, options: options); - } - - $grpc.ResponseFuture<$0.GetNotificationConfirmReply> getNotificationConfirm($0.GetNotificationConfirmRequest request, {$grpc.CallOptions? options}) { - return $createUnaryCall(_$getNotificationConfirm, request, options: options); - } - - $grpc.ResponseFuture<$0.GetMemberReply> getMember($0.GetMemberRequest request, {$grpc.CallOptions? options}) { - return $createUnaryCall(_$getMember, request, options: options); - } - $grpc.ResponseFuture<$0.GetCanteenHeadCountReply> getCanteenHeadCount($0.GetCanteenHeadCountRequest request, {$grpc.CallOptions? options}) { return $createUnaryCall(_$getCanteenHeadCount, request, options: options); } @@ -323,34 +291,6 @@ abstract class CampusServiceBase extends $grpc.Service { false, ($core.List<$core.int> value) => $0.CreateFeedbackRequest.fromBuffer(value), ($0.CreateFeedbackReply value) => value.writeToBuffer())); - $addMethod($grpc.ServiceMethod<$0.GetUploadStatusRequest, $0.GetUploadStatusReply>( - 'GetUploadStatus', - getUploadStatus_Pre, - false, - false, - ($core.List<$core.int> value) => $0.GetUploadStatusRequest.fromBuffer(value), - ($0.GetUploadStatusReply value) => value.writeToBuffer())); - $addMethod($grpc.ServiceMethod<$0.GetNotificationRequest, $0.GetNotificationReply>( - 'GetNotification', - getNotification_Pre, - false, - false, - ($core.List<$core.int> value) => $0.GetNotificationRequest.fromBuffer(value), - ($0.GetNotificationReply value) => value.writeToBuffer())); - $addMethod($grpc.ServiceMethod<$0.GetNotificationConfirmRequest, $0.GetNotificationConfirmReply>( - 'GetNotificationConfirm', - getNotificationConfirm_Pre, - false, - false, - ($core.List<$core.int> value) => $0.GetNotificationConfirmRequest.fromBuffer(value), - ($0.GetNotificationConfirmReply value) => value.writeToBuffer())); - $addMethod($grpc.ServiceMethod<$0.GetMemberRequest, $0.GetMemberReply>( - 'GetMember', - getMember_Pre, - false, - false, - ($core.List<$core.int> value) => $0.GetMemberRequest.fromBuffer(value), - ($0.GetMemberReply value) => value.writeToBuffer())); $addMethod($grpc.ServiceMethod<$0.GetCanteenHeadCountRequest, $0.GetCanteenHeadCountReply>( 'GetCanteenHeadCount', getCanteenHeadCount_Pre, @@ -437,22 +377,6 @@ abstract class CampusServiceBase extends $grpc.Service { return listMovies(call, await request); } - $async.Future<$0.GetUploadStatusReply> getUploadStatus_Pre($grpc.ServiceCall call, $async.Future<$0.GetUploadStatusRequest> request) async { - return getUploadStatus(call, await request); - } - - $async.Future<$0.GetNotificationReply> getNotification_Pre($grpc.ServiceCall call, $async.Future<$0.GetNotificationRequest> request) async { - return getNotification(call, await request); - } - - $async.Future<$0.GetNotificationConfirmReply> getNotificationConfirm_Pre($grpc.ServiceCall call, $async.Future<$0.GetNotificationConfirmRequest> request) async { - return getNotificationConfirm(call, await request); - } - - $async.Future<$0.GetMemberReply> getMember_Pre($grpc.ServiceCall call, $async.Future<$0.GetMemberRequest> request) async { - return getMember(call, await request); - } - $async.Future<$0.GetCanteenHeadCountReply> getCanteenHeadCount_Pre($grpc.ServiceCall call, $async.Future<$0.GetCanteenHeadCountRequest> request) async { return getCanteenHeadCount(call, await request); } @@ -484,10 +408,6 @@ abstract class CampusServiceBase extends $grpc.Service { $async.Future<$0.GetUpdateNoteReply> getUpdateNote($grpc.ServiceCall call, $0.GetUpdateNoteRequest request); $async.Future<$0.ListMoviesReply> listMovies($grpc.ServiceCall call, $0.ListMoviesRequest request); $async.Future<$0.CreateFeedbackReply> createFeedback($grpc.ServiceCall call, $async.Stream<$0.CreateFeedbackRequest> request); - $async.Future<$0.GetUploadStatusReply> getUploadStatus($grpc.ServiceCall call, $0.GetUploadStatusRequest request); - $async.Future<$0.GetNotificationReply> getNotification($grpc.ServiceCall call, $0.GetNotificationRequest request); - $async.Future<$0.GetNotificationConfirmReply> getNotificationConfirm($grpc.ServiceCall call, $0.GetNotificationConfirmRequest request); - $async.Future<$0.GetMemberReply> getMember($grpc.ServiceCall call, $0.GetMemberRequest request); $async.Future<$0.GetCanteenHeadCountReply> getCanteenHeadCount($grpc.ServiceCall call, $0.GetCanteenHeadCountRequest request); $async.Future<$0.CreateDeviceReply> createDevice($grpc.ServiceCall call, $0.CreateDeviceRequest request); $async.Future<$0.DeleteDeviceReply> deleteDevice($grpc.ServiceCall call, $0.DeleteDeviceRequest request); diff --git a/lib/base/networking/apis/tumdev/campus_backend.pbjson.dart b/lib/base/networking/apis/tumdev/campus_backend.pbjson.dart index cb725b89..efd4245d 100644 --- a/lib/base/networking/apis/tumdev/campus_backend.pbjson.dart +++ b/lib/base/networking/apis/tumdev/campus_backend.pbjson.dart @@ -805,18 +805,6 @@ final $typed_data.Uint8List getMemberReplyDescriptor = $convert.base64Decode( 'Cg5HZXRNZW1iZXJSZXBseRIVCgZscnpfaWQYASABKAlSBWxyeklkEhIKBG5hbWUYAiABKAlSBG' '5hbWUSGwoJbWVtYmVyX2lkGAMgASgFUghtZW1iZXJJZA=='); -@$core.Deprecated('Use getUploadStatusRequestDescriptor instead') -const GetUploadStatusRequest$json = { - '1': 'GetUploadStatusRequest', - '2': [ - {'1': 'lrz_id', '3': 1, '4': 1, '5': 9, '10': 'lrzId'}, - ], -}; - -/// Descriptor for `GetUploadStatusRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getUploadStatusRequestDescriptor = $convert.base64Decode( - 'ChZHZXRVcGxvYWRTdGF0dXNSZXF1ZXN0EhUKBmxyel9pZBgBIAEoCVIFbHJ6SWQ='); - @$core.Deprecated('Use getUploadStatusReplyDescriptor instead') const GetUploadStatusReply$json = { '1': 'GetUploadStatusReply', @@ -836,63 +824,6 @@ final $typed_data.Uint8List getUploadStatusReplyDescriptor = $convert.base64Deco 'SWQSHwoLZW1wbG95ZWVfaWQYBCABKAhSCmVtcGxveWVlSWQSHwoLZXh0ZXJuYWxfaWQYBSABKA' 'hSCmV4dGVybmFsSWQ='); -@$core.Deprecated('Use getNotificationRequestDescriptor instead') -const GetNotificationRequest$json = { - '1': 'GetNotificationRequest', - '2': [ - {'1': 'notification_id', '3': 1, '4': 1, '5': 5, '10': 'notificationId'}, - ], -}; - -/// Descriptor for `GetNotificationRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getNotificationRequestDescriptor = $convert.base64Decode( - 'ChZHZXROb3RpZmljYXRpb25SZXF1ZXN0EicKD25vdGlmaWNhdGlvbl9pZBgBIAEoBVIObm90aW' - 'ZpY2F0aW9uSWQ='); - -@$core.Deprecated('Use getNotificationReplyDescriptor instead') -const GetNotificationReply$json = { - '1': 'GetNotificationReply', - '2': [ - {'1': 'notification_id', '3': 1, '4': 1, '5': 5, '10': 'notificationId'}, - {'1': 'type', '3': 2, '4': 1, '5': 5, '10': 'type'}, - {'1': 'title', '3': 3, '4': 1, '5': 9, '10': 'title'}, - {'1': 'description', '3': 4, '4': 1, '5': 9, '10': 'description'}, - {'1': 'signature', '3': 5, '4': 1, '5': 9, '10': 'signature'}, - ], -}; - -/// Descriptor for `GetNotificationReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getNotificationReplyDescriptor = $convert.base64Decode( - 'ChRHZXROb3RpZmljYXRpb25SZXBseRInCg9ub3RpZmljYXRpb25faWQYASABKAVSDm5vdGlmaW' - 'NhdGlvbklkEhIKBHR5cGUYAiABKAVSBHR5cGUSFAoFdGl0bGUYAyABKAlSBXRpdGxlEiAKC2Rl' - 'c2NyaXB0aW9uGAQgASgJUgtkZXNjcmlwdGlvbhIcCglzaWduYXR1cmUYBSABKAlSCXNpZ25hdH' - 'VyZQ=='); - -@$core.Deprecated('Use getNotificationConfirmRequestDescriptor instead') -const GetNotificationConfirmRequest$json = { - '1': 'GetNotificationConfirmRequest', - '2': [ - {'1': 'notification_id', '3': 1, '4': 1, '5': 5, '10': 'notificationId'}, - ], -}; - -/// Descriptor for `GetNotificationConfirmRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getNotificationConfirmRequestDescriptor = $convert.base64Decode( - 'Ch1HZXROb3RpZmljYXRpb25Db25maXJtUmVxdWVzdBInCg9ub3RpZmljYXRpb25faWQYASABKA' - 'VSDm5vdGlmaWNhdGlvbklk'); - -@$core.Deprecated('Use getNotificationConfirmReplyDescriptor instead') -const GetNotificationConfirmReply$json = { - '1': 'GetNotificationConfirmReply', - '2': [ - {'1': 'status', '3': 1, '4': 1, '5': 9, '10': 'status'}, - ], -}; - -/// Descriptor for `GetNotificationConfirmReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getNotificationConfirmReplyDescriptor = $convert.base64Decode( - 'ChtHZXROb3RpZmljYXRpb25Db25maXJtUmVwbHkSFgoGc3RhdHVzGAEgASgJUgZzdGF0dXM='); - @$core.Deprecated('Use getCanteenHeadCountRequestDescriptor instead') const GetCanteenHeadCountRequest$json = { '1': 'GetCanteenHeadCountRequest', diff --git a/protos/tumdev/campus_backend.proto b/protos/tumdev/campus_backend.proto index 4ecb265c..bd66d0dc 100644 --- a/protos/tumdev/campus_backend.proto +++ b/protos/tumdev/campus_backend.proto @@ -114,22 +114,6 @@ service Campus { }; } - rpc GetUploadStatus(GetUploadStatusRequest) returns (GetUploadStatusReply) { - option (google.api.http) = {get: "/device/uploaded/{lrz_id}"}; - } - - rpc GetNotification(GetNotificationRequest) returns (GetNotificationReply) { - option (google.api.http) = {get: "/notifications/{notification_id}"}; - } - - rpc GetNotificationConfirm(GetNotificationConfirmRequest) returns (GetNotificationConfirmReply) { - option (google.api.http) = {get: "/notifications/confirm/{notification_id}"}; - } - - rpc GetMember(GetMemberRequest) returns (GetMemberReply) { - option (google.api.http) = {get: "/members/{lrz_id}"}; - } - rpc GetCanteenHeadCount(GetCanteenHeadCountRequest) returns (GetCanteenHeadCountReply) { option (google.api.http) = {get: "/canteen/headCount/{canteen_id}"}; } @@ -519,10 +503,6 @@ message GetMemberReply { int32 member_id = 3; } -message GetUploadStatusRequest { - string lrz_id = 1; -} - message GetUploadStatusReply { string fcm_token = 1; string public_key = 2; @@ -531,24 +511,6 @@ message GetUploadStatusReply { bool external_id = 5; } -message GetNotificationRequest { - int32 notification_id = 1; -} -message GetNotificationReply { - int32 notification_id = 1; - int32 type = 2; - string title = 3; - string description = 4; - string signature = 5; -} - -message GetNotificationConfirmRequest { - int32 notification_id = 1; -} -message GetNotificationConfirmReply { - string status = 1; -} - message GetCanteenHeadCountRequest { // The requested canteen ID string canteen_id = 1; From b0900bf6d1a57135c99dfd2019016e54892f97ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:49:31 +0200 Subject: [PATCH 05/12] Improve Naming of API Components --- lib/base/networking/apis/eatApi/eat_api.dart | 18 ++++----- .../networking/apis/irisApi/iris_api.dart | 6 +-- .../mvvDeparturesApi/mvv_departures_api.dart | 6 +-- .../apis/navigaTumApi/navigatum_api.dart | 6 +-- .../apis/tumOnlineApi/tum_online_api.dart | 40 +++++++++---------- lib/base/networking/protocols/api.dart | 12 +++--- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/lib/base/networking/apis/eatApi/eat_api.dart b/lib/base/networking/apis/eatApi/eat_api.dart index 77d39201..886952ab 100644 --- a/lib/base/networking/apis/eatApi/eat_api.dart +++ b/lib/base/networking/apis/eatApi/eat_api.dart @@ -7,26 +7,26 @@ class EatApi extends Api { EatApi(this.eatApiEndpoint); @override - String get baseURL => "tum-dev.github.io"; + String get domain => "tum-dev.github.io"; @override - String get path => "/eat-api/"; + String get slug => "/eat-api/"; @override - String get paths { + String get path { switch (eatApiEndpoint) { case EatApiEndpointCanteens _: - return "${path}enums/canteens.json"; + return "${slug}enums/canteens.json"; case EatApiEndpointLanguages _: - return "${path}enums/languages.json"; + return "${slug}enums/languages.json"; case EatApiEndpointLabels _: - return "${path}enums/labels.json"; + return "${slug}enums/labels.json"; case EatApiEndpointAll _: - return "${path}all.json"; + return "${slug}all.json"; case EatApiEndpointAllRef _: - return "${path}all_ref.json"; + return "${slug}all_ref.json"; case EatApiEndpointMenu menu: - return "$path${menu.location}/${menu.year}/${menu.week.toString().padLeft(1, "0")}.json"; + return "$slug${menu.location}/${menu.year}/${menu.week.toString().padLeft(1, "0")}.json"; } } diff --git a/lib/base/networking/apis/irisApi/iris_api.dart b/lib/base/networking/apis/irisApi/iris_api.dart index eaf13410..d921c2ff 100644 --- a/lib/base/networking/apis/irisApi/iris_api.dart +++ b/lib/base/networking/apis/irisApi/iris_api.dart @@ -7,7 +7,7 @@ class IrisApi extends Api { IrisApi({required this.irisApiEndpoint}); @override - String get baseURL => "iris.asta.tum.de"; + String get domain => "iris.asta.tum.de"; @override bool get needsAuth => false; @@ -16,8 +16,8 @@ class IrisApi extends Api { Map get parameters => irisApiEndpoint.getParameters(); @override - String get path => ""; + String get slug => ""; @override - String get paths => "api"; + String get path => "api"; } diff --git a/lib/base/networking/apis/mvvDeparturesApi/mvv_departures_api.dart b/lib/base/networking/apis/mvvDeparturesApi/mvv_departures_api.dart index d4be1f45..190ef1e7 100644 --- a/lib/base/networking/apis/mvvDeparturesApi/mvv_departures_api.dart +++ b/lib/base/networking/apis/mvvDeparturesApi/mvv_departures_api.dart @@ -7,7 +7,7 @@ class MvvDeparturesApi extends Api { MvvDeparturesApi({required this.station, required this.walkingTime}); @override - String get baseURL => "efa.mvv-muenchen.de"; + String get domain => "efa.mvv-muenchen.de"; @override bool get needsAuth => false; @@ -31,8 +31,8 @@ class MvvDeparturesApi extends Api { }; @override - String get path => "/ng/"; + String get slug => "/ng/"; @override - String get paths => "${path}XML_DM_REQUEST"; + String get path => "${slug}XML_DM_REQUEST"; } diff --git a/lib/base/networking/apis/navigaTumApi/navigatum_api.dart b/lib/base/networking/apis/navigaTumApi/navigatum_api.dart index 49648e02..d468c686 100644 --- a/lib/base/networking/apis/navigaTumApi/navigatum_api.dart +++ b/lib/base/networking/apis/navigaTumApi/navigatum_api.dart @@ -7,7 +7,7 @@ class NavigaTumApi extends Api { NavigaTumApi({required this.navigaTumApiEndpoint}); @override - String get baseURL => "nav.tum.de"; + String get domain => "nav.tum.de"; @override bool get needsAuth => false; @@ -16,10 +16,10 @@ class NavigaTumApi extends Api { Map get parameters => navigaTumApiEndpoint.getParameters(); @override - String get path => ""; + String get slug => ""; @override - String get paths { + String get path { switch (navigaTumApiEndpoint) { case NavigaTumApiEndpointSearch _: return "api/search"; diff --git a/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart b/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart index 1ebaa504..9e6982b3 100644 --- a/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart +++ b/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart @@ -8,48 +8,48 @@ class TumOnlineApi extends Api { TumOnlineApi(this.tumOnlineEndpoint); @override - final path = "/tumonline/"; + final slug = "/tumonline/"; @override - String get baseURL => "campus.tum.de"; + String get domain => "campus.tum.de"; @override - String get paths { + String get path { switch (tumOnlineEndpoint) { case TumOnlineEndpointPersonSearch _: - return "${path}wbservicesbasic.personenSuche"; + return "${slug}wbservicesbasic.personenSuche"; case TumOnlineEndpointTokenRequest _: - return "${path}wbservicesbasic.requestToken"; + return "${slug}wbservicesbasic.requestToken"; case TumOnlineEndpointTokenConfirmation _: - return "${path}wbservicesbasic.isTokenConfirmed"; + return "${slug}wbservicesbasic.isTokenConfirmed"; case TumOnlineEndpointTuitionStatus _: - return "${path}wbservicesbasic.studienbeitragsstatus"; + return "${slug}wbservicesbasic.studienbeitragsstatus"; case TumOnlineEndpointCalendar _: - return "${path}wbservicesbasic.kalender"; + return "${slug}wbservicesbasic.kalender"; case TumOnlineEndpointPersonDetails _: - return "${path}wbservicesbasic.personenDetails"; + return "${slug}wbservicesbasic.personenDetails"; case TumOnlineEndpointPersonalLectures _: - return "${path}wbservicesbasic.veranstaltungenEigene"; + return "${slug}wbservicesbasic.veranstaltungenEigene"; case TumOnlineEndpointPersonalGrades _: - return "${path}wbservicesbasic.noten"; + return "${slug}wbservicesbasic.noten"; case TumOnlineEndpointLectureSearch _: - return "${path}wbservicesbasic.veranstaltungenSuche"; + return "${slug}wbservicesbasic.veranstaltungenSuche"; case TumOnlineEndpointLectureDetails _: - return "${path}wbservicesbasic.veranstaltungenDetails"; + return "${slug}wbservicesbasic.veranstaltungenDetails"; case TumOnlineEndpointIdentify _: - return "${path}wbservicesbasic.id"; + return "${slug}wbservicesbasic.id"; case TumOnlineEndpointSecretUpload _: - return "${path}wbservicesbasic.secretUpload"; + return "${slug}wbservicesbasic.secretUpload"; case TumOnlineEndpointProfileImage _: - return "${path}visitenkarte.showImage"; + return "${slug}visitenkarte.showImage"; case TumOnlineEndpointAverageGrades _: - return "${path}wbservicesbasic.absNoten"; + return "${slug}wbservicesbasic.absNoten"; case TumOnlineEndpointTumCard _: - return "${path}wbservicesbasic.tumCard"; + return "${slug}wbservicesbasic.tumCard"; case TumOnlineEndpointEventCreate _: - return "${path}wbservicesbasic.terminCreate"; + return "${slug}wbservicesbasic.terminCreate"; case TumOnlineEndpointEventDelete _: - return "${path}wbservicesbasic.terminDelete"; + return "${slug}wbservicesbasic.terminDelete"; } } diff --git a/lib/base/networking/protocols/api.dart b/lib/base/networking/protocols/api.dart index 8469e238..1243ee09 100644 --- a/lib/base/networking/protocols/api.dart +++ b/lib/base/networking/protocols/api.dart @@ -3,15 +3,15 @@ import 'package:dio/dio.dart' as dio; abstract class Api { static String tumToken = ""; - String get baseURL; + String get domain; - String get path; + String get slug; Map get baseHeaders { return {}; } - String get paths; + String get path; Map get parameters; @@ -37,9 +37,9 @@ abstract class Api { if (needsAuth) { var finalParameters = parameters; finalParameters.addAll({"pToken": tumToken}); - return Uri.https(baseURL, paths, finalParameters); + return Uri.https(domain, path, finalParameters); } else { - return Uri.https(baseURL, paths, parameters); + return Uri.https(domain, path, parameters); } } @@ -49,6 +49,6 @@ abstract class Api { @override String toString() { - return baseURL + path + paths; + return domain + slug + path; } } From 2fb91c67aac80acd5ad2c6ae7e17d285105ea90b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:55:51 +0200 Subject: [PATCH 06/12] Further Improve Naming of API Components --- lib/base/networking/apis/eatApi/eat_api.dart | 16 ++++---- .../networking/apis/irisApi/iris_api.dart | 4 +- .../mvvDeparturesApi/mvv_departures_api.dart | 4 +- .../apis/navigaTumApi/navigatum_api.dart | 4 +- .../apis/tumOnlineApi/tum_online_api.dart | 38 +++++++++---------- lib/base/networking/protocols/api.dart | 10 ++--- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/lib/base/networking/apis/eatApi/eat_api.dart b/lib/base/networking/apis/eatApi/eat_api.dart index 886952ab..348baaf8 100644 --- a/lib/base/networking/apis/eatApi/eat_api.dart +++ b/lib/base/networking/apis/eatApi/eat_api.dart @@ -10,23 +10,23 @@ class EatApi extends Api { String get domain => "tum-dev.github.io"; @override - String get slug => "/eat-api/"; + String get path => "eat-api/"; @override - String get path { + String get slug { switch (eatApiEndpoint) { case EatApiEndpointCanteens _: - return "${slug}enums/canteens.json"; + return "enums/canteens.json"; case EatApiEndpointLanguages _: - return "${slug}enums/languages.json"; + return "enums/languages.json"; case EatApiEndpointLabels _: - return "${slug}enums/labels.json"; + return "enums/labels.json"; case EatApiEndpointAll _: - return "${slug}all.json"; + return "all.json"; case EatApiEndpointAllRef _: - return "${slug}all_ref.json"; + return "all_ref.json"; case EatApiEndpointMenu menu: - return "$slug${menu.location}/${menu.year}/${menu.week.toString().padLeft(1, "0")}.json"; + return "${menu.location}/${menu.year}/${menu.week.toString().padLeft(1, "0")}.json"; } } diff --git a/lib/base/networking/apis/irisApi/iris_api.dart b/lib/base/networking/apis/irisApi/iris_api.dart index d921c2ff..f2981c02 100644 --- a/lib/base/networking/apis/irisApi/iris_api.dart +++ b/lib/base/networking/apis/irisApi/iris_api.dart @@ -16,8 +16,8 @@ class IrisApi extends Api { Map get parameters => irisApiEndpoint.getParameters(); @override - String get slug => ""; + String get path => ""; @override - String get path => "api"; + String get slug => "api"; } diff --git a/lib/base/networking/apis/mvvDeparturesApi/mvv_departures_api.dart b/lib/base/networking/apis/mvvDeparturesApi/mvv_departures_api.dart index 190ef1e7..031594c8 100644 --- a/lib/base/networking/apis/mvvDeparturesApi/mvv_departures_api.dart +++ b/lib/base/networking/apis/mvvDeparturesApi/mvv_departures_api.dart @@ -31,8 +31,8 @@ class MvvDeparturesApi extends Api { }; @override - String get slug => "/ng/"; + String get path => "ng/"; @override - String get path => "${slug}XML_DM_REQUEST"; + String get slug => "XML_DM_REQUEST"; } diff --git a/lib/base/networking/apis/navigaTumApi/navigatum_api.dart b/lib/base/networking/apis/navigaTumApi/navigatum_api.dart index d468c686..eeac6bad 100644 --- a/lib/base/networking/apis/navigaTumApi/navigatum_api.dart +++ b/lib/base/networking/apis/navigaTumApi/navigatum_api.dart @@ -16,10 +16,10 @@ class NavigaTumApi extends Api { Map get parameters => navigaTumApiEndpoint.getParameters(); @override - String get slug => ""; + String get path => ""; @override - String get path { + String get slug { switch (navigaTumApiEndpoint) { case NavigaTumApiEndpointSearch _: return "api/search"; diff --git a/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart b/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart index 9e6982b3..8cb551e8 100644 --- a/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart +++ b/lib/base/networking/apis/tumOnlineApi/tum_online_api.dart @@ -8,48 +8,48 @@ class TumOnlineApi extends Api { TumOnlineApi(this.tumOnlineEndpoint); @override - final slug = "/tumonline/"; + final path = "tumonline/"; @override String get domain => "campus.tum.de"; @override - String get path { + String get slug { switch (tumOnlineEndpoint) { case TumOnlineEndpointPersonSearch _: - return "${slug}wbservicesbasic.personenSuche"; + return "wbservicesbasic.personenSuche"; case TumOnlineEndpointTokenRequest _: - return "${slug}wbservicesbasic.requestToken"; + return "wbservicesbasic.requestToken"; case TumOnlineEndpointTokenConfirmation _: - return "${slug}wbservicesbasic.isTokenConfirmed"; + return "wbservicesbasic.isTokenConfirmed"; case TumOnlineEndpointTuitionStatus _: - return "${slug}wbservicesbasic.studienbeitragsstatus"; + return "wbservicesbasic.studienbeitragsstatus"; case TumOnlineEndpointCalendar _: - return "${slug}wbservicesbasic.kalender"; + return "wbservicesbasic.kalender"; case TumOnlineEndpointPersonDetails _: - return "${slug}wbservicesbasic.personenDetails"; + return "wbservicesbasic.personenDetails"; case TumOnlineEndpointPersonalLectures _: - return "${slug}wbservicesbasic.veranstaltungenEigene"; + return "wbservicesbasic.veranstaltungenEigene"; case TumOnlineEndpointPersonalGrades _: - return "${slug}wbservicesbasic.noten"; + return "wbservicesbasic.noten"; case TumOnlineEndpointLectureSearch _: - return "${slug}wbservicesbasic.veranstaltungenSuche"; + return "wbservicesbasic.veranstaltungenSuche"; case TumOnlineEndpointLectureDetails _: - return "${slug}wbservicesbasic.veranstaltungenDetails"; + return "wbservicesbasic.veranstaltungenDetails"; case TumOnlineEndpointIdentify _: - return "${slug}wbservicesbasic.id"; + return "wbservicesbasic.id"; case TumOnlineEndpointSecretUpload _: - return "${slug}wbservicesbasic.secretUpload"; + return "wbservicesbasic.secretUpload"; case TumOnlineEndpointProfileImage _: - return "${slug}visitenkarte.showImage"; + return "visitenkarte.showImage"; case TumOnlineEndpointAverageGrades _: - return "${slug}wbservicesbasic.absNoten"; + return "wbservicesbasic.absNoten"; case TumOnlineEndpointTumCard _: - return "${slug}wbservicesbasic.tumCard"; + return "wbservicesbasic.tumCard"; case TumOnlineEndpointEventCreate _: - return "${slug}wbservicesbasic.terminCreate"; + return "wbservicesbasic.terminCreate"; case TumOnlineEndpointEventDelete _: - return "${slug}wbservicesbasic.terminDelete"; + return "wbservicesbasic.terminDelete"; } } diff --git a/lib/base/networking/protocols/api.dart b/lib/base/networking/protocols/api.dart index 1243ee09..0174b083 100644 --- a/lib/base/networking/protocols/api.dart +++ b/lib/base/networking/protocols/api.dart @@ -5,13 +5,13 @@ abstract class Api { String get domain; - String get slug; + String get path; Map get baseHeaders { return {}; } - String get path; + String get slug; Map get parameters; @@ -37,9 +37,9 @@ abstract class Api { if (needsAuth) { var finalParameters = parameters; finalParameters.addAll({"pToken": tumToken}); - return Uri.https(domain, path, finalParameters); + return Uri.https(domain, path + slug, finalParameters); } else { - return Uri.https(domain, path, parameters); + return Uri.https(domain, path + slug, parameters); } } @@ -49,6 +49,6 @@ abstract class Api { @override String toString() { - return domain + slug + path; + return domain + path + slug; } } From cb6ea5b557c9064225db5942af62fff47ef244bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:14:59 +0200 Subject: [PATCH 07/12] Further improve Study Rooms UI --- assets/translations/de.json | 5 +- assets/translations/en.json | 5 +- ios/Podfile.lock | 28 +++--- .../model/studyRooms/study_room.dart | 6 +- .../studyGroups/study_room_group_view.dart | 13 ++- .../studyGroups/study_room_row_view.dart | 16 +++- pubspec.lock | 96 +++++++++---------- 7 files changed, 95 insertions(+), 74 deletions(-) diff --git a/assets/translations/de.json b/assets/translations/de.json index daa90f8c..4836078d 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -33,6 +33,7 @@ "done": "Fertig", "studyRoom": "Lernraum", "studyRooms": "Lernräume", + "unknownStudyRoom": "Unbekannter Lernraum", "nearestStudyRooms": "Nächste Lernräume", "noNearFreeStudyRoomsFound": "Keine Lernräume in deiner Nähe gefunden", "mostSearchedRooms": "Meist gesuchte Räume", @@ -195,8 +196,8 @@ "selectAction": "Wähle eine Aktion", "openIn": "In {} öffnen", "unknownDirection": "Unbekannte Richtung", - "showWeekends": "Wochenenden anzeigen", - "showHiddenCalendarEntries": "Versteckte Kalendareintrage anzeigen", + "showWeekends": "Wochenenden", + "showHiddenCalendarEntries": "Versteckte Kalendareintrage", "color": "Farbe", "resetLogin": "Zurücksetzen & Anmelden", "resetPreferences": "Einstellungen zurücksetzen", diff --git a/assets/translations/en.json b/assets/translations/en.json index f7bdf380..b3564243 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -33,6 +33,7 @@ "done": "Done", "studyRoom": "Study Room", "studyRooms": "Study Rooms", + "unknownStudyRoom": "Unknown Study Room", "nearestStudyRooms": "Nearest Study Rooms", "noNearFreeStudyRoomsFound": "No Study Rooms Near You Found!", "mostSearchedRooms": "Most Searched Rooms", @@ -195,8 +196,8 @@ "selectAction": "Select an action", "openIn": "Open in {}", "unknownDirection": "Unknown Direction", - "showWeekends": "Show Weekends", - "showHiddenCalendarEntries": "Show Hidden Calendar Entries", + "showWeekends": "Weekends", + "showHiddenCalendarEntries": "Hidden Calendar Entries", "color": "Color", "resetLogin": "Reset & Login", "resetPreferences": "Reset Preferences", diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 22263ef5..fc0ffc13 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -20,15 +20,15 @@ PODS: - Firebase/RemoteConfig (= 11.2.0) - firebase_core - Flutter - - FirebaseABTesting (11.3.0): + - FirebaseABTesting (11.4.0): - FirebaseCore (~> 11.0) - FirebaseCore (11.2.0): - FirebaseCoreInternal (~> 11.0) - GoogleUtilities/Environment (~> 8.0) - GoogleUtilities/Logger (~> 8.0) - - FirebaseCoreExtension (11.3.0): + - FirebaseCoreExtension (11.4.1): - FirebaseCore (~> 11.0) - - FirebaseCoreInternal (11.3.0): + - FirebaseCoreInternal (11.4.0): - "GoogleUtilities/NSData+zlib (~> 8.0)" - FirebaseCrashlytics (11.2.0): - FirebaseCore (~> 11.0) @@ -39,7 +39,7 @@ PODS: - GoogleUtilities/Environment (~> 8.0) - nanopb (~> 3.30910.0) - PromisesObjC (~> 2.4) - - FirebaseInstallations (11.3.0): + - FirebaseInstallations (11.4.0): - FirebaseCore (~> 11.0) - GoogleUtilities/Environment (~> 8.0) - GoogleUtilities/UserDefaults (~> 8.0) @@ -52,7 +52,7 @@ PODS: - FirebaseSharedSwift (~> 11.0) - GoogleUtilities/Environment (~> 8.0) - "GoogleUtilities/NSData+zlib (~> 8.0)" - - FirebaseRemoteConfigInterop (11.3.0) + - FirebaseRemoteConfigInterop (11.4.0) - FirebaseSessions (11.3.0): - FirebaseCore (~> 11.0) - FirebaseCoreExtension (~> 11.0) @@ -62,7 +62,7 @@ PODS: - GoogleUtilities/UserDefaults (~> 8.0) - nanopb (~> 3.30910.0) - PromisesSwift (~> 2.1) - - FirebaseSharedSwift (11.3.0) + - FirebaseSharedSwift (11.4.0) - Flutter (1.0.0) - flutter_native_splash (0.0.1): - Flutter @@ -233,21 +233,21 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/video_player_avfoundation/darwin" SPEC CHECKSUMS: - device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d + device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342 Firebase: 98e6bf5278170668a7983e12971a66b2cd57fc8c firebase_core: 2bedc3136ec7c7b8561c6123ed0239387b53f2af firebase_crashlytics: 37d104d457b51760b48504a93a12b3bf70995d77 firebase_remote_config: d522653d828836503715498f1662901a6efcd809 - FirebaseABTesting: c4559fcd2eba9f6bdaf0599e2c37ded01c343e4c + FirebaseABTesting: aef1719704fade00b200827e7973f352efc4caee FirebaseCore: a282032ae9295c795714ded2ec9c522fc237f8da - FirebaseCoreExtension: 30bb063476ef66cd46925243d64ad8b2c8ac3264 - FirebaseCoreInternal: ac26d09a70c730e497936430af4e60fb0c68ec4e + FirebaseCoreExtension: f1bc67a4702931a7caa097d8e4ac0a1b0d16720e + FirebaseCoreInternal: 5c2b016f06a96fbf20d9b443459f80427a827d7b FirebaseCrashlytics: cfc69af5b53565dc6a5e563788809b5778ac4eac - FirebaseInstallations: 58cf94dabf1e2bb2fa87725a9be5c2249171cda0 + FirebaseInstallations: 6ef4a1c7eb2a61ee1f74727d7f6ce2e72acf1414 FirebaseRemoteConfig: fca0b2d017fc1de52b28a4e5bcf2007c1a840457 - FirebaseRemoteConfigInterop: c3a5c31b3c22079f41ba1dc645df889d9ce38cb9 + FirebaseRemoteConfigInterop: e76f46ffa4d6a65e273d4dfebb6a79e588cec136 FirebaseSessions: 655ff17f3cc1a635cbdc2d69b953878001f9e25b - FirebaseSharedSwift: d39c2ad64a11a8d936ce25a42b00df47078bb59c + FirebaseSharedSwift: 505dae2d05969dbf6d43749a642bb1bf230f0252 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778 flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12 @@ -260,7 +260,7 @@ SPEC CHECKSUMS: home_widget: 0434835a4c9a75704264feff6be17ea40e0f0d57 map_launcher: 5fde49ac9a52672bf99da746599f507b4490d7b5 nanopb: fad817b59e0457d11a5dfbde799381cd727c1275 - package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c + package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4 path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 diff --git a/lib/placesComponent/model/studyRooms/study_room.dart b/lib/placesComponent/model/studyRooms/study_room.dart index 04b8e3a5..031406d2 100644 --- a/lib/placesComponent/model/studyRooms/study_room.dart +++ b/lib/placesComponent/model/studyRooms/study_room.dart @@ -76,7 +76,11 @@ class StudyRoom extends Searchable { return context.tr( "utilizationAt", args: [ - percent!.isNegative ? "0" : (percent! * 100).round().toString(), + percent!.isNegative + ? "0" + : percent! > 1 + ? "100" + : (percent! * 100).round().toString(), ], ); } else { diff --git a/lib/placesComponent/views/studyGroups/study_room_group_view.dart b/lib/placesComponent/views/studyGroups/study_room_group_view.dart index 82079e8b..267329af 100644 --- a/lib/placesComponent/views/studyGroups/study_room_group_view.dart +++ b/lib/placesComponent/views/studyGroups/study_room_group_view.dart @@ -3,7 +3,7 @@ import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/util/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/util/last_updated_text.dart'; import 'package:campus_flutter/base/errorHandling/error_handling_router.dart'; -import 'package:campus_flutter/base/util/seperated_list.dart'; +import 'package:campus_flutter/base/util/padded_divider.dart'; import 'package:campus_flutter/homeComponent/view/widget/widget_frame_view.dart'; import 'package:campus_flutter/placesComponent/model/studyRooms/study_room.dart'; import 'package:campus_flutter/placesComponent/model/studyRooms/study_room_group.dart'; @@ -102,6 +102,7 @@ class StudyRoomGroupView extends ConsumerWidget { return RefreshIndicator( onRefresh: () => ref.read(studyRoomsViewModel).fetch(true), child: SingleChildScrollView( + physics: AlwaysScrollableScrollPhysics(), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -121,9 +122,13 @@ class StudyRoomGroupView extends ConsumerWidget { subtitle: lastFetched != null ? LastUpdatedText(lastFetched) : null, child: Card( - child: SeparatedList.list( - data: studyRooms ?? [], - tile: (studyRoom) => StudyRoomRowView(studyRoom: studyRoom), + child: ListView.separated( + shrinkWrap: true, + padding: EdgeInsets.zero, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => StudyRoomRowView(studyRoom: studyRooms![index]), + separatorBuilder: (context, index) => PaddedDivider(height: 0,), + itemCount: (studyRooms ?? []).length, ), ), ), diff --git a/lib/placesComponent/views/studyGroups/study_room_row_view.dart b/lib/placesComponent/views/studyGroups/study_room_row_view.dart index ce5815da..5fcd34be 100644 --- a/lib/placesComponent/views/studyGroups/study_room_row_view.dart +++ b/lib/placesComponent/views/studyGroups/study_room_row_view.dart @@ -13,9 +13,7 @@ class StudyRoomRowView extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return ListTile( - title: Text( - "${studyRoom.name ?? context.tr("unknown")} (${studyRoom.code ?? context.tr("unknown")})", - ), + title: Text(title(studyRoom, context)), subtitle: Text( studyRoom.localizedStatus(context), style: TextStyle( @@ -30,4 +28,16 @@ class StudyRoomRowView extends ConsumerWidget { context.push(navigaTum, extra: studyRoom.roomNoArchitect ?? "null"), ); } + + String title(StudyRoom studyRoom, BuildContext context) { + if (studyRoom.name == null && studyRoom.roomNoArchitect == null) { + return context.tr("unknownStudyRoom"); + } else if (studyRoom.name != null && studyRoom.roomNoArchitect == null) { + return studyRoom.roomNoArchitect!; + } else if (studyRoom.name == null && studyRoom.roomNoArchitect != null) { + return studyRoom.name!; + } else { + return "${studyRoom.name} (${studyRoom.roomNoArchitect})"; + } + } } diff --git a/pubspec.lock b/pubspec.lock index 04c50706..c5eafa6a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -250,26 +250,26 @@ packages: dependency: transitive description: name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" coverage: dependency: transitive description: name: coverage - sha256: c1fb2dce3c0085f39dc72668e85f8e0210ec7de05345821ff58530567df345a5 + sha256: "88b0fddbe4c92910fefc09cc0248f5e7f0cd23e450ded4c28f16ab8ee8f83268" url: "https://pub.dev" source: hosted - version: "1.9.2" + version: "1.10.0" crypto: dependency: transitive description: name: crypto - sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.6" csslib: dependency: transitive description: @@ -290,10 +290,10 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: db03b2d2a3fa466a4627709e1db58692c3f7f658e36a5942d342d86efedc4091 + sha256: c4af09051b4f0508f6c1dc0a5c085bf014d5c9a4a0678ce1799c2b4d716387a0 url: "https://pub.dev" source: hosted - version: "11.0.0" + version: "11.1.0" device_info_plus_platform_interface: dependency: transitive description: @@ -442,10 +442,10 @@ packages: dependency: transitive description: name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" flutter: dependency: "direct main" description: flutter @@ -494,10 +494,10 @@ packages: dependency: "direct main" description: name: flutter_native_splash - sha256: aa06fec78de2190f3db4319dd60fdc8d12b2626e93ef9828633928c2dcaea840 + sha256: ee5c9bd2b74ea8676442fd4ab876b5d41681df49276488854d6c81a5377c0ef1 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -510,10 +510,10 @@ packages: dependency: "direct main" description: name: flutter_riverpod - sha256: "711d916456563f715bde1e139d7cfdca009f8264befab3ac9f8ded8b6ec26405" + sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1" url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.6.1" flutter_secure_storage: dependency: "direct main" description: @@ -648,10 +648,10 @@ packages: dependency: "direct main" description: name: get_it - sha256: ff97e5e7b2e82e63c82f5658c6ba2605ea831f0f7489b0d2fb255d817ec4eb5e + sha256: "35c253f83f9e03cbac65ffa159510e41ae15f49b37291ab8c522d7a0b6f330cd" url: "https://pub.dev" source: hosted - version: "8.0.0" + version: "8.0.1" glob: dependency: transitive description: @@ -801,10 +801,10 @@ packages: dependency: transitive description: name: image - sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8" + sha256: f31d52537dc417fdcde36088fdf11d191026fd5e4fae742491ebd40e5a8bea7d url: "https://pub.dev" source: hosted - version: "4.2.0" + version: "4.3.0" intl: dependency: "direct main" description: @@ -889,10 +889,10 @@ packages: dependency: transitive description: name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" lottie: dependency: "direct main" description: @@ -977,10 +977,10 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: "894f37107424311bdae3e476552229476777b8752c5a2a2369c0cb9a2d5442ef" + sha256: df3eb3e0aed5c1107bb0fdb80a8e82e778114958b1c5ac5644fb1ac9cae8a998 url: "https://pub.dev" source: hosted - version: "8.0.3" + version: "8.1.0" package_info_plus_platform_interface: dependency: transitive description: @@ -1065,10 +1065,10 @@ packages: dependency: transitive description: name: permission_handler_android - sha256: "76e4ab092c1b240d31177bb64d2b0bea43f43d0e23541ec866151b9f7b2490fa" + sha256: "71bbecfee799e65aff7c744761a57e817e73b738fedf62ab7afd5593da21f9f1" url: "https://pub.dev" source: hosted - version: "12.0.12" + version: "12.0.13" permission_handler_apple: dependency: transitive description: @@ -1113,10 +1113,10 @@ packages: dependency: transitive description: name: platform - sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" url: "https://pub.dev" source: hosted - version: "3.1.5" + version: "3.1.6" plugin_platform_interface: dependency: transitive description: @@ -1209,10 +1209,10 @@ packages: dependency: transitive description: name: riverpod - sha256: c86fedfb45dd1da98ee6493dd9374325cdf494e7d523ebfb0c387eecc5f7b5c9 + sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959" url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.6.1" rxdart: dependency: "direct main" description: @@ -1422,18 +1422,18 @@ packages: dependency: "direct main" description: name: sqlite3 - sha256: "45f168ae2213201b54e09429ed0c593dc2c88c924a1488d6f9c523a255d567cb" + sha256: bb174b3ec2527f9c5f680f73a89af8149dd99782fbb56ea88ad0807c5638f2ed url: "https://pub.dev" source: hosted - version: "2.4.6" + version: "2.4.7" sqlite3_flutter_libs: dependency: "direct main" description: name: sqlite3_flutter_libs - sha256: "62bbb4073edbcdf53f40c80775f33eea01d301b7b81417e5b3fb7395416258c1" + sha256: ccd29dd6cf6fb9351fa07cd6f92895809adbf0779c1d986acf5e3d53b3250e33 url: "https://pub.dev" source: hosted - version: "0.5.24" + version: "0.5.25" sqlparser: dependency: transitive description: @@ -1486,34 +1486,34 @@ packages: dependency: "direct main" description: name: syncfusion_flutter_calendar - sha256: d5efcd867d8e9a678a95446e3bb1eed29a90cb92d61b32d3099ed3dd4bfce34d + sha256: "1fdbcb8435abc4a1fb36914b83d9690eb0dea617df3ac2772519fba7a3011828" url: "https://pub.dev" source: hosted - version: "27.1.53" + version: "27.1.55" syncfusion_flutter_charts: dependency: "direct main" description: name: syncfusion_flutter_charts - sha256: df13f25d2095bf747c0c67460a06b655a6cce6d74380d9e4ef24d9a523a2e1b6 + sha256: ec08668a7b3c95075aee32f6d73b7a053c6f1361de1e85f88a433d63f835beed url: "https://pub.dev" source: hosted - version: "27.1.53" + version: "27.1.55" syncfusion_flutter_core: dependency: "direct main" description: name: syncfusion_flutter_core - sha256: becd190595cba56feac5ec17b805b35df9f006171c131c209f79b5c58fc780eb + sha256: bc86234c9a0a87b6c3288b9065175e74e9a73e22b2237989a8bbdeff0c8befd7 url: "https://pub.dev" source: hosted - version: "27.1.53" + version: "27.1.55" syncfusion_flutter_datepicker: dependency: "direct main" description: name: syncfusion_flutter_datepicker - sha256: "5638805bea1c70a6d46dea9d39ef67f0085176e1c15cf57f7036cf67c1568816" + sha256: "54fe7e7a660ecdf072cceec890425d7531b42f647245f9244565c61e96fbca4a" url: "https://pub.dev" source: hosted - version: "27.1.53" + version: "27.1.55" synchronized: dependency: transitive description: @@ -1582,10 +1582,10 @@ packages: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" universal_io: dependency: transitive description: @@ -1654,10 +1654,10 @@ packages: dependency: transitive description: name: url_launcher_windows - sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" + sha256: "44cf3aabcedde30f2dba119a9dea3b0f2672fbe6fa96e85536251d678216b3c4" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.3" uuid: dependency: "direct main" description: @@ -1710,10 +1710,10 @@ packages: dependency: transitive description: name: video_player_android - sha256: "340b29bc38b2c341ed3afa08148f3d9f351220403cdd2b3a9eb38b71a4be1a9d" + sha256: "2800d68d6d5b4c22da62453568ed68e63c35bea524d4fa42062e53d6bb591433" url: "https://pub.dev" source: hosted - version: "2.7.12" + version: "2.7.13" video_player_avfoundation: dependency: transitive description: @@ -1790,10 +1790,10 @@ packages: dependency: transitive description: name: win32 - sha256: e5c39a90447e7c81cfec14b041cdbd0d0916bd9ebbc7fe02ab69568be703b9bd + sha256: e1d0cc62e65dc2561f5071fcbccecf58ff20c344f8f3dc7d4922df372a11df1f url: "https://pub.dev" source: hosted - version: "5.6.0" + version: "5.7.1" win32_registry: dependency: transitive description: From 1368b83ad54efca1c109e8be09742c4b882b1e53 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Wed, 30 Oct 2024 21:13:14 +0100 Subject: [PATCH 08/12] Chore: Update Protos to v0.9.2 (#294) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jakob Körber <56073945+jakobkoerber@users.noreply.github.com> --- README.md | 2 +- android/app/build.gradle | 2 +- .../de/tum/in/tumcampus/util/DateTimeUtils.kt | 20 +++++++++---------- .../widgets/calendar/WidgetCalendarItem.kt | 1 + .../main/res/color/widget_header_color.xml | 5 ----- .../drawable-v21/app_widget_background.xml | 10 ---------- .../app_widget_inner_view_background.xml | 10 ---------- .../src/main/res/drawable/ic_filter_list.xml | 9 --------- ...get_content_rounded_corners_background.xml | 8 -------- ...dget_header_rounded_corners_background.xml | 8 -------- .../src/main/res/layout/calendar_widget.xml | 13 ++++++------ .../main/res/layout/calendar_widget_item.xml | 3 +++ .../app/src/main/res/values-de/strings.xml | 10 +++++----- .../src/main/res/values-night-v31/themes.xml | 10 ---------- .../app/src/main/res/values-v21/styles.xml | 14 ------------- .../app/src/main/res/values-v31/styles.xml | 16 --------------- .../app/src/main/res/values-v31/themes.xml | 19 ++++++++++-------- android/app/src/main/res/values/strings.xml | 10 +++++----- android/app/src/main/res/values/styles.xml | 6 +++--- android/app/src/main/res/values/themes.xml | 14 ++++++------- .../main/res/xml-v31/calendar_widget_info.xml | 13 ++++++++++++ .../src/main/res/xml/calendar_widget_info.xml | 6 ++---- lib/base/enums/user_preference.dart | 3 ++- lib/base/routing/router_service.dart | 4 ++-- .../services}/user_preferences_service.dart | 0 .../viewModels/calendar_viewmodel.dart | 16 +++++++++++++++ .../views/calendars_view.dart | 13 ++++++++---- .../viewmodel/departures_viewmodel.dart | 2 +- .../viewmodel/home_viewmodel.dart | 2 +- lib/main.dart | 2 +- .../viewModels/onboarding_viewmodel.dart | 6 +++--- .../viewModels/cafeterias_viewmodel.dart | 2 +- .../viewModels/study_rooms_viewmodel.dart | 2 +- ...viewmodel.dart => settings_viewmodel.dart} | 10 +++++----- .../views/appearance_settings_view.dart | 10 +++++----- .../views/calendar_settings_view.dart | 6 +++--- protos/tumdev/campus_backend.proto | 4 ++-- 37 files changed, 121 insertions(+), 170 deletions(-) delete mode 100644 android/app/src/main/res/color/widget_header_color.xml delete mode 100644 android/app/src/main/res/drawable-v21/app_widget_background.xml delete mode 100644 android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml delete mode 100644 android/app/src/main/res/drawable/ic_filter_list.xml delete mode 100644 android/app/src/main/res/drawable/widget_content_rounded_corners_background.xml delete mode 100644 android/app/src/main/res/drawable/widget_header_rounded_corners_background.xml delete mode 100644 android/app/src/main/res/values-night-v31/themes.xml delete mode 100644 android/app/src/main/res/values-v21/styles.xml delete mode 100644 android/app/src/main/res/values-v31/styles.xml create mode 100644 android/app/src/main/res/xml-v31/calendar_widget_info.xml rename lib/{settingsComponent/service => base/services}/user_preferences_service.dart (100%) rename lib/settingsComponent/viewModels/{user_preferences_viewmodel.dart => settings_viewmodel.dart} (92%) diff --git a/README.md b/README.md index 833a88aa..9481e82f 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ To update the generated stubs for the Campus, you need protoc installed, then ac dart pub global activate protoc_plugin export PATH="$PATH:$HOME/.pub-cache/bin" curl -o protos/tumdev/campus_backend.proto https://raw.githubusercontent.com/TUM-Dev/Campus-Backend/main/server/api/tumdev/campus_backend.proto -protoc --dart_out=grpc:lib/base/networking/apis -I./protos google/protobuf/timestamp.proto google/protobuf/empty.proto protos/tumdev/campus_backend.proto +protoc --dart_out=grpc:lib/base/networking/apis -I./protos google/protobuf/timestamp.proto google/protobuf/empty.proto tumdev/campus_backend.proto ``` ### Current needed Forks diff --git a/android/app/build.gradle b/android/app/build.gradle index 0004d8cd..e7b7a46b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -44,7 +44,7 @@ android { defaultConfig { applicationId "de.tum.in.tumcampus" - minSdkVersion 26 + minSdkVersion 29 targetSdkVersion flutter.targetSdkVersion ndkVersion "26.1.10909125" versionCode flutterVersionCode.toInteger() diff --git a/android/app/src/main/kotlin/de/tum/in/tumcampus/util/DateTimeUtils.kt b/android/app/src/main/kotlin/de/tum/in/tumcampus/util/DateTimeUtils.kt index 254edd8a..32e37191 100644 --- a/android/app/src/main/kotlin/de/tum/in/tumcampus/util/DateTimeUtils.kt +++ b/android/app/src/main/kotlin/de/tum/in/tumcampus/util/DateTimeUtils.kt @@ -20,18 +20,18 @@ fun LocalDateTime.timeAgo(context: Context): String { val now = LocalDateTime.now() val duration = Duration.between(this, now) - val years = duration.toDays() / 365 - val months = duration.toDays() / 30 - val days = duration.toDays() - val hours = duration.toHours() - val minutes = duration.toMinutes() + val years = (duration.toDays() / 365).toInt() + val months = (duration.toDays() / 30).toInt() + val days = duration.toDays().toInt() + val hours = duration.toHours().toInt() + val minutes = duration.toMinutes().toInt() return when { - years > 0 -> context.resources.getQuantityString(R.plurals.yearsAgo, years.toInt()) - months > 0 -> context.resources.getQuantityString(R.plurals.monthsAgo, months.toInt()) - days > 0 -> context.resources.getQuantityString(R.plurals.daysAgo, days.toInt()) - hours > 0 -> context.resources.getQuantityString(R.plurals.hoursAgo, hours.toInt()) - minutes > 0 -> context.resources.getQuantityString(R.plurals.minutesAgo, minutes.toInt()) + years > 0 -> context.resources.getQuantityString(R.plurals.yearsAgo, years, years) + months > 0 -> context.resources.getQuantityString(R.plurals.monthsAgo, months, months) + days > 0 -> context.resources.getQuantityString(R.plurals.daysAgo, days, days) + hours > 0 -> context.resources.getQuantityString(R.plurals.hoursAgo, hours, hours) + minutes > 0 -> context.resources.getQuantityString(R.plurals.minutesAgo, minutes, minutes) else -> context.resources.getString(R.string.just_now) } } diff --git a/android/app/src/main/kotlin/de/tum/in/tumcampus/widgets/calendar/WidgetCalendarItem.kt b/android/app/src/main/kotlin/de/tum/in/tumcampus/widgets/calendar/WidgetCalendarItem.kt index 33ff067f..853768fe 100644 --- a/android/app/src/main/kotlin/de/tum/in/tumcampus/widgets/calendar/WidgetCalendarItem.kt +++ b/android/app/src/main/kotlin/de/tum/in/tumcampus/widgets/calendar/WidgetCalendarItem.kt @@ -25,6 +25,7 @@ data class WidgetCalendarItem( val endDate: LocalDateTime, val location: String? = null, val color: Long? = null, + val isVisible: Boolean? = null, var isFirstOnDay: Boolean = false ) { fun getEventColor(context: Context): Int { diff --git a/android/app/src/main/res/color/widget_header_color.xml b/android/app/src/main/res/color/widget_header_color.xml deleted file mode 100644 index a79bc007..00000000 --- a/android/app/src/main/res/color/widget_header_color.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v21/app_widget_background.xml b/android/app/src/main/res/drawable-v21/app_widget_background.xml deleted file mode 100644 index 785445c6..00000000 --- a/android/app/src/main/res/drawable-v21/app_widget_background.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml b/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml deleted file mode 100644 index 007e2872..00000000 --- a/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_filter_list.xml b/android/app/src/main/res/drawable/ic_filter_list.xml deleted file mode 100644 index d19a788c..00000000 --- a/android/app/src/main/res/drawable/ic_filter_list.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/android/app/src/main/res/drawable/widget_content_rounded_corners_background.xml b/android/app/src/main/res/drawable/widget_content_rounded_corners_background.xml deleted file mode 100644 index abdb9700..00000000 --- a/android/app/src/main/res/drawable/widget_content_rounded_corners_background.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/drawable/widget_header_rounded_corners_background.xml b/android/app/src/main/res/drawable/widget_header_rounded_corners_background.xml deleted file mode 100644 index 412726a4..00000000 --- a/android/app/src/main/res/drawable/widget_header_rounded_corners_background.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/layout/calendar_widget.xml b/android/app/src/main/res/layout/calendar_widget.xml index b945b8db..70dc326a 100644 --- a/android/app/src/main/res/layout/calendar_widget.xml +++ b/android/app/src/main/res/layout/calendar_widget.xml @@ -2,11 +2,12 @@ + android:padding="@dimen/widget_margin" + android:theme="@style/Theme.AppWidget.AppWidgetContainer"> @@ -34,7 +35,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:textAlignment="viewEnd" - android:textColor="@color/text_primary" + android:textColor="?android:attr/textColorPrimary" android:textSize="14sp" tools:text="Date" /> @@ -58,7 +59,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/calendar_widget_no_lectures" - android:textColor="@color/text_dark_gray" + android:textColor="?android:attr/textColorPrimary" android:visibility="gone" tools:visibility="visible" /> @@ -69,7 +70,7 @@ android:layout_gravity="center" android:text="@string/calendar_widget_old_data" android:textAlignment="center" - android:textColor="@color/text_primary" + android:textColor="?android:attr/textColorPrimary" android:visibility="gone" tools:visibility="visible" /> diff --git a/android/app/src/main/res/layout/calendar_widget_item.xml b/android/app/src/main/res/layout/calendar_widget_item.xml index eff81f14..038f57c3 100644 --- a/android/app/src/main/res/layout/calendar_widget_item.xml +++ b/android/app/src/main/res/layout/calendar_widget_item.xml @@ -12,6 +12,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="38dp" + android:textColor="?android:attr/textColorPrimary" android:visibility="gone" tools:text="Month" tools:visibility="visible" /> @@ -28,6 +29,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:background="@android:color/transparent" + android:textColor="?android:attr/textColorPrimary" android:textSize="18sp" android:textStyle="bold" tools:text="8" /> @@ -39,6 +41,7 @@ android:layout_marginTop="-6dp" android:layout_weight="1" android:background="@android:color/transparent" + android:textColor="?android:attr/textColorPrimary" android:textSize="13sp" tools:text="Do." /> diff --git a/android/app/src/main/res/values-de/strings.xml b/android/app/src/main/res/values-de/strings.xml index 65e6ecc8..57d74f70 100644 --- a/android/app/src/main/res/values-de/strings.xml +++ b/android/app/src/main/res/values-de/strings.xml @@ -12,23 +12,23 @@ Gerade eben Gestern - Vor 1 Jahr + Vor %d Jahr Vor %d Jahren - Vor 1 Monaten + Vor %d Monaten Vor %d Monaten - Vor 1 Tag + Vor %d Tag Vor %d Tagen - Vor 1 Stunde + Vor %d Stunde Vor %d Stunden - Vor 1 Minute + Vor %d Minute Vor %d Minuten \ No newline at end of file diff --git a/android/app/src/main/res/values-night-v31/themes.xml b/android/app/src/main/res/values-night-v31/themes.xml deleted file mode 100644 index f253c9da..00000000 --- a/android/app/src/main/res/values-night-v31/themes.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/values-v21/styles.xml b/android/app/src/main/res/values-v21/styles.xml deleted file mode 100644 index 0b35f7d8..00000000 --- a/android/app/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/values-v31/styles.xml b/android/app/src/main/res/values-v31/styles.xml deleted file mode 100644 index 6b133976..00000000 --- a/android/app/src/main/res/values-v31/styles.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/values-v31/themes.xml b/android/app/src/main/res/values-v31/themes.xml index badd306a..f70dc6f3 100644 --- a/android/app/src/main/res/values-v31/themes.xml +++ b/android/app/src/main/res/values-v31/themes.xml @@ -1,11 +1,14 @@ - + - - + \ No newline at end of file diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 07ec7f99..ce4c3a9c 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -13,23 +13,23 @@ Yesterday %1$s–%2$s - 1 year ago + %d year ago %d years ago - 1 month ago + %d month ago %d months ago - 1 day ago + %d day ago %d days ago - 1 hour ago + %d hour ago %d hours ago - 1 minute ago + %d minute ago %d minutes ago \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index d1d13fc7..d9c6cb68 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -16,13 +16,13 @@ ?android:colorBackground - - diff --git a/android/app/src/main/res/values/themes.xml b/android/app/src/main/res/values/themes.xml index dcd8899e..fb94a839 100644 --- a/android/app/src/main/res/values/themes.xml +++ b/android/app/src/main/res/values/themes.xml @@ -1,16 +1,16 @@ + - - diff --git a/android/app/src/main/res/xml-v31/calendar_widget_info.xml b/android/app/src/main/res/xml-v31/calendar_widget_info.xml new file mode 100644 index 00000000..474289c5 --- /dev/null +++ b/android/app/src/main/res/xml-v31/calendar_widget_info.xml @@ -0,0 +1,13 @@ + + diff --git a/android/app/src/main/res/xml/calendar_widget_info.xml b/android/app/src/main/res/xml/calendar_widget_info.xml index 9beadf7a..474289c5 100644 --- a/android/app/src/main/res/xml/calendar_widget_info.xml +++ b/android/app/src/main/res/xml/calendar_widget_info.xml @@ -8,8 +8,6 @@ android:minResizeWidth="270dp" android:minResizeHeight="110dp" android:previewImage="@drawable/appwidget_preview" - android:previewLayout="@layout/calendar_widget" android:resizeMode="horizontal|vertical" - android:updatePeriodMillis="86400000" - android:widgetCategory="home_screen" /> + android:updatePeriodMillis="600000" + android:widgetCategory="home_screen" /> diff --git a/lib/base/enums/user_preference.dart b/lib/base/enums/user_preference.dart index c1e0faf9..9f68bd0d 100644 --- a/lib/base/enums/user_preference.dart +++ b/lib/base/enums/user_preference.dart @@ -8,7 +8,8 @@ enum UserPreference { browser(bool), failedGrades(bool), weekends(bool), - hiddenCalendarEntries(bool); + hiddenCalendarEntries(bool), + calendarTab(int); final Type type; diff --git a/lib/base/routing/router_service.dart b/lib/base/routing/router_service.dart index c18ea1a3..d9e6f3f4 100644 --- a/lib/base/routing/router_service.dart +++ b/lib/base/routing/router_service.dart @@ -1,6 +1,6 @@ import 'package:campus_flutter/base/routing/routes.dart'; import 'package:campus_flutter/onboardingComponent/viewModels/onboarding_viewmodel.dart'; -import 'package:campus_flutter/settingsComponent/viewModels/user_preferences_viewmodel.dart'; +import 'package:campus_flutter/settingsComponent/viewModels/settings_viewmodel.dart'; import 'package:campus_flutter/studentCardComponent/viewModel/student_card_viewmodel.dart'; import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -17,7 +17,7 @@ class RouterService { Future routingCallback(GoRouterState state) async { if (!_isInitialized) { if (await ref.read(onboardingViewModel).checkLogin() == true) { - await ref.read(userPreferencesViewModel).loadPreferences(); + await ref.read(settingsViewModel).loadPreferences(); await ref.read(studentCardViewModel).fetch(false); _isInitialized = true; FlutterNativeSplash.remove(); diff --git a/lib/settingsComponent/service/user_preferences_service.dart b/lib/base/services/user_preferences_service.dart similarity index 100% rename from lib/settingsComponent/service/user_preferences_service.dart rename to lib/base/services/user_preferences_service.dart diff --git a/lib/calendarComponent/viewModels/calendar_viewmodel.dart b/lib/calendarComponent/viewModels/calendar_viewmodel.dart index eb9925e1..9a246afe 100644 --- a/lib/calendarComponent/viewModels/calendar_viewmodel.dart +++ b/lib/calendarComponent/viewModels/calendar_viewmodel.dart @@ -1,9 +1,11 @@ import 'dart:convert'; +import 'package:campus_flutter/base/enums/user_preference.dart'; import 'package:campus_flutter/calendarComponent/model/calendar_event.dart'; import 'package:campus_flutter/calendarComponent/services/calendar_preference_service.dart'; import 'package:campus_flutter/calendarComponent/services/calendar_service.dart'; import 'package:campus_flutter/main.dart'; +import 'package:campus_flutter/base/services/user_preferences_service.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:home_widget/home_widget.dart'; @@ -153,6 +155,20 @@ class CalendarViewModel { updateHomeWidget(events.value ?? []); } + int getTabPreference() { + return (getIt().load( + UserPreference.calendarTab, + ) as int?) ?? + 0; + } + + void saveTabPreference(int currentTab) { + getIt().save( + UserPreference.calendarTab, + currentTab, + ); + } + void resetPreferences() { _resetEventColors(); _resetVisibility(); diff --git a/lib/calendarComponent/views/calendars_view.dart b/lib/calendarComponent/views/calendars_view.dart index cb064e45..d517ec3a 100644 --- a/lib/calendarComponent/views/calendars_view.dart +++ b/lib/calendarComponent/views/calendars_view.dart @@ -41,7 +41,7 @@ class _CalendarsViewState extends ConsumerState ref .read(selectedDate.notifier) .addListener((state) => _selectedDateListener(state)); - _selectedCalendarTab = 0; + _selectedCalendarTab = ref.read(calendarViewModel).getTabPreference(); super.initState(); } @@ -98,9 +98,14 @@ class _CalendarsViewState extends ConsumerState selected: { _selectedCalendarTab, }, - onSelectionChanged: (newSelection) => setState(() { - _selectedCalendarTab = newSelection.first; - }), + onSelectionChanged: (newSelection) { + setState(() { + _selectedCalendarTab = newSelection.first; + }); + ref.read(calendarViewModel).saveTabPreference( + _selectedCalendarTab, + ); + }, ), ), ], diff --git a/lib/homeComponent/viewmodel/departures_viewmodel.dart b/lib/homeComponent/viewmodel/departures_viewmodel.dart index 9195efa9..1c1ab344 100644 --- a/lib/homeComponent/viewmodel/departures_viewmodel.dart +++ b/lib/homeComponent/viewmodel/departures_viewmodel.dart @@ -11,7 +11,7 @@ import 'package:campus_flutter/homeComponent/model/mvv_response.dart'; import 'package:campus_flutter/homeComponent/model/station.dart'; import 'package:campus_flutter/homeComponent/service/departures_service.dart'; import 'package:campus_flutter/main.dart'; -import 'package:campus_flutter/settingsComponent/service/user_preferences_service.dart'; +import 'package:campus_flutter/base/services/user_preferences_service.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:geolocator/geolocator.dart'; diff --git a/lib/homeComponent/viewmodel/home_viewmodel.dart b/lib/homeComponent/viewmodel/home_viewmodel.dart index 95454fc1..6d01a3a5 100644 --- a/lib/homeComponent/viewmodel/home_viewmodel.dart +++ b/lib/homeComponent/viewmodel/home_viewmodel.dart @@ -6,7 +6,7 @@ import 'package:campus_flutter/homeComponent/view/departure/departures_widget_vi import 'package:campus_flutter/main.dart'; import 'package:campus_flutter/placesComponent/views/homeWidget/cafeteria_widget_view.dart'; import 'package:campus_flutter/placesComponent/views/homeWidget/study_room_widget_view.dart'; -import 'package:campus_flutter/settingsComponent/service/user_preferences_service.dart'; +import 'package:campus_flutter/base/services/user_preferences_service.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/main.dart b/lib/main.dart index 0e796b31..726ed0cd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,7 +16,7 @@ import 'package:campus_flutter/calendarComponent/services/calendar_view_service. import 'package:campus_flutter/onboardingComponent/services/onboarding_service.dart'; import 'package:campus_flutter/navigation_service.dart'; import 'package:campus_flutter/placesComponent/services/map_theme_service.dart'; -import 'package:campus_flutter/settingsComponent/service/user_preferences_service.dart'; +import 'package:campus_flutter/base/services/user_preferences_service.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:easy_logger/easy_logger.dart'; import 'package:firebase_remote_config/firebase_remote_config.dart'; diff --git a/lib/onboardingComponent/viewModels/onboarding_viewmodel.dart b/lib/onboardingComponent/viewModels/onboarding_viewmodel.dart index 1cbde077..8aa4047b 100644 --- a/lib/onboardingComponent/viewModels/onboarding_viewmodel.dart +++ b/lib/onboardingComponent/viewModels/onboarding_viewmodel.dart @@ -12,8 +12,8 @@ import 'package:campus_flutter/onboardingComponent/services/onboarding_service.d import 'package:campus_flutter/main.dart'; import 'package:campus_flutter/personComponent/viewModel/person_details_viewmodel.dart'; import 'package:campus_flutter/personComponent/viewModel/profile_viewmodel.dart'; -import 'package:campus_flutter/settingsComponent/service/user_preferences_service.dart'; -import 'package:campus_flutter/settingsComponent/viewModels/user_preferences_viewmodel.dart'; +import 'package:campus_flutter/base/services/user_preferences_service.dart'; +import 'package:campus_flutter/settingsComponent/viewModels/settings_viewmodel.dart'; import 'package:campus_flutter/studentCardComponent/viewModel/student_card_viewmodel.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -147,7 +147,7 @@ class OnboardingViewModel { Future resetPreferences(WidgetRef ref) async { getIt().resetAll(); getIt().resetPreferences(); - ref.read(userPreferencesViewModel).loadPreferences(); + ref.read(settingsViewModel).loadPreferences(); ref.read(calendarViewModel).resetPreferences(); } diff --git a/lib/placesComponent/viewModels/cafeterias_viewmodel.dart b/lib/placesComponent/viewModels/cafeterias_viewmodel.dart index f79760b6..e445d29a 100644 --- a/lib/placesComponent/viewModels/cafeterias_viewmodel.dart +++ b/lib/placesComponent/viewModels/cafeterias_viewmodel.dart @@ -9,7 +9,7 @@ import 'package:campus_flutter/placesComponent/model/cafeterias/dish.dart'; import 'package:campus_flutter/placesComponent/model/cafeterias/mensa_menu.dart'; import 'package:campus_flutter/placesComponent/services/cafeterias_service.dart'; import 'package:campus_flutter/placesComponent/services/mealplan_service.dart'; -import 'package:campus_flutter/settingsComponent/service/user_preferences_service.dart'; +import 'package:campus_flutter/base/services/user_preferences_service.dart'; import 'package:collection/collection.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; diff --git a/lib/placesComponent/viewModels/study_rooms_viewmodel.dart b/lib/placesComponent/viewModels/study_rooms_viewmodel.dart index 77c1ae30..81cb7cdc 100644 --- a/lib/placesComponent/viewModels/study_rooms_viewmodel.dart +++ b/lib/placesComponent/viewModels/study_rooms_viewmodel.dart @@ -7,7 +7,7 @@ import 'package:campus_flutter/placesComponent/model/studyRooms/study_room.dart' import 'package:campus_flutter/placesComponent/model/studyRooms/study_room_data.dart'; import 'package:campus_flutter/placesComponent/model/studyRooms/study_room_group.dart'; import 'package:campus_flutter/placesComponent/services/study_rooms_service.dart'; -import 'package:campus_flutter/settingsComponent/service/user_preferences_service.dart'; +import 'package:campus_flutter/base/services/user_preferences_service.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:collection/collection.dart'; diff --git a/lib/settingsComponent/viewModels/user_preferences_viewmodel.dart b/lib/settingsComponent/viewModels/settings_viewmodel.dart similarity index 92% rename from lib/settingsComponent/viewModels/user_preferences_viewmodel.dart rename to lib/settingsComponent/viewModels/settings_viewmodel.dart index 27f49d6e..761daf69 100644 --- a/lib/settingsComponent/viewModels/user_preferences_viewmodel.dart +++ b/lib/settingsComponent/viewModels/settings_viewmodel.dart @@ -3,19 +3,19 @@ import 'package:campus_flutter/base/enums/user_preference.dart'; import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/util/icon_text.dart'; import 'package:campus_flutter/main.dart'; -import 'package:campus_flutter/settingsComponent/service/user_preferences_service.dart'; +import 'package:campus_flutter/base/services/user_preferences_service.dart'; import 'package:campus_flutter/settingsComponent/views/settings_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -final userPreferencesViewModel = Provider( - (ref) => UserPreferencesViewModel(ref), +final settingsViewModel = Provider( + (ref) => SettingsViewModel(ref), ); -class UserPreferencesViewModel { +class SettingsViewModel { final Ref ref; - UserPreferencesViewModel(this.ref); + SettingsViewModel(this.ref); Future loadPreferences() async { return Future(() async { diff --git a/lib/settingsComponent/views/appearance_settings_view.dart b/lib/settingsComponent/views/appearance_settings_view.dart index db515795..e8248044 100644 --- a/lib/settingsComponent/views/appearance_settings_view.dart +++ b/lib/settingsComponent/views/appearance_settings_view.dart @@ -4,7 +4,7 @@ import 'package:campus_flutter/base/util/seperated_list.dart'; import 'package:campus_flutter/studiesComponent/viewModel/grade_viewmodel.dart'; import 'package:campus_flutter/homeComponent/view/widget/widget_frame_view.dart'; import 'package:campus_flutter/main.dart'; -import 'package:campus_flutter/settingsComponent/viewModels/user_preferences_viewmodel.dart'; +import 'package:campus_flutter/settingsComponent/viewModels/settings_viewmodel.dart'; import 'package:campus_flutter/settingsComponent/views/settings_view.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -39,14 +39,14 @@ class AppearanceSettingsView extends ConsumerWidget { trailing: DropdownButton( onChanged: (Appearance? newAppearance) { if (newAppearance != null) { - ref.read(userPreferencesViewModel).savePreference( + ref.read(settingsViewModel).savePreference( UserPreference.theme, newAppearance, ); } }, value: ref.watch(appearance), - items: UserPreferencesViewModel.getAppearanceEntries(context), + items: SettingsViewModel.getAppearanceEntries(context), ), ); } @@ -61,7 +61,7 @@ class AppearanceSettingsView extends ConsumerWidget { trailing: Switch( value: ref.watch(useWebView), onChanged: (showWebView) { - ref.read(userPreferencesViewModel).savePreference( + ref.read(settingsViewModel).savePreference( UserPreference.browser, showWebView, ); @@ -81,7 +81,7 @@ class AppearanceSettingsView extends ConsumerWidget { trailing: Switch( value: ref.watch(hideFailedGrades), onChanged: (value) { - ref.read(userPreferencesViewModel).savePreference( + ref.read(settingsViewModel).savePreference( UserPreference.failedGrades, value, ); diff --git a/lib/settingsComponent/views/calendar_settings_view.dart b/lib/settingsComponent/views/calendar_settings_view.dart index 20b60443..7cae9f08 100644 --- a/lib/settingsComponent/views/calendar_settings_view.dart +++ b/lib/settingsComponent/views/calendar_settings_view.dart @@ -3,7 +3,7 @@ import 'package:campus_flutter/base/util/seperated_list.dart'; import 'package:campus_flutter/calendarComponent/viewModels/calendar_viewmodel.dart'; import 'package:campus_flutter/calendarComponent/views/calendars_view.dart'; import 'package:campus_flutter/homeComponent/view/widget/widget_frame_view.dart'; -import 'package:campus_flutter/settingsComponent/viewModels/user_preferences_viewmodel.dart'; +import 'package:campus_flutter/settingsComponent/viewModels/settings_viewmodel.dart'; import 'package:campus_flutter/settingsComponent/views/settings_view.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -38,7 +38,7 @@ class CalendarSettingsView extends ConsumerWidget { trailing: Switch( value: ref.watch(showWeekends), onChanged: (value) { - ref.read(userPreferencesViewModel).savePreference( + ref.read(settingsViewModel).savePreference( UserPreference.weekends, value, ); @@ -59,7 +59,7 @@ class CalendarSettingsView extends ConsumerWidget { trailing: Switch( value: ref.watch(showHiddenCalendarEntries), onChanged: (value) { - ref.read(userPreferencesViewModel).savePreference( + ref.read(settingsViewModel).savePreference( UserPreference.hiddenCalendarEntries, value, ); diff --git a/protos/tumdev/campus_backend.proto b/protos/tumdev/campus_backend.proto index bd66d0dc..2304ff41 100644 --- a/protos/tumdev/campus_backend.proto +++ b/protos/tumdev/campus_backend.proto @@ -131,9 +131,9 @@ service Campus { option (google.api.http) = {delete: "/device/{device_id}"}; } - // Delete a device from push notifications + // List all avaliable student clubs rpc ListStudentClub(ListStudentClubRequest) returns (ListStudentClubReply) { - option (google.api.http) = {delete: "/student_clubs"}; + option (google.api.http) = {get: "/student_clubs"}; } } From 2cb0665a3830f021d5219f32673fb8e3643e915b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:16:16 +0100 Subject: [PATCH 09/12] Decoding of Study Room Group Opening Hours --- ios/Podfile.lock | 82 ++++----- .../apis/google/protobuf/empty.pb.dart | 2 + .../apis/google/protobuf/timestamp.pb.dart | 4 +- .../model/studyRooms/study_room_group.dart | 5 + .../model/studyRooms/study_room_group.g.dart | 4 + .../studyRooms/study_room_opening_hours.dart | 24 +++ .../study_room_opening_hours.g.dart | 25 +++ .../studyGroups/study_room_group_view.dart | 7 +- pubspec.lock | 158 +++++++++--------- 9 files changed, 188 insertions(+), 123 deletions(-) create mode 100644 lib/placesComponent/model/studyRooms/study_room_opening_hours.dart create mode 100644 lib/placesComponent/model/studyRooms/study_room_opening_hours.g.dart diff --git a/ios/Podfile.lock b/ios/Podfile.lock index fc0ffc13..6e2fa432 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,37 +1,37 @@ PODS: - device_info_plus (0.0.1): - Flutter - - Firebase/CoreOnly (11.2.0): - - FirebaseCore (= 11.2.0) - - Firebase/Crashlytics (11.2.0): + - Firebase/CoreOnly (11.4.0): + - FirebaseCore (= 11.4.0) + - Firebase/Crashlytics (11.4.0): - Firebase/CoreOnly - - FirebaseCrashlytics (~> 11.2.0) - - Firebase/RemoteConfig (11.2.0): + - FirebaseCrashlytics (~> 11.4.0) + - Firebase/RemoteConfig (11.4.0): - Firebase/CoreOnly - - FirebaseRemoteConfig (~> 11.2.0) - - firebase_core (3.6.0): - - Firebase/CoreOnly (= 11.2.0) + - FirebaseRemoteConfig (~> 11.4.0) + - firebase_core (3.7.0): + - Firebase/CoreOnly (= 11.4.0) - Flutter - - firebase_crashlytics (4.1.3): - - Firebase/Crashlytics (= 11.2.0) + - firebase_crashlytics (4.1.4): + - Firebase/Crashlytics (= 11.4.0) - firebase_core - Flutter - - firebase_remote_config (5.1.3): - - Firebase/RemoteConfig (= 11.2.0) + - firebase_remote_config (5.1.4): + - Firebase/RemoteConfig (= 11.4.0) - firebase_core - Flutter - FirebaseABTesting (11.4.0): - FirebaseCore (~> 11.0) - - FirebaseCore (11.2.0): + - FirebaseCore (11.4.0): - FirebaseCoreInternal (~> 11.0) - GoogleUtilities/Environment (~> 8.0) - GoogleUtilities/Logger (~> 8.0) - FirebaseCoreExtension (11.4.1): - FirebaseCore (~> 11.0) - - FirebaseCoreInternal (11.4.0): + - FirebaseCoreInternal (11.4.2): - "GoogleUtilities/NSData+zlib (~> 8.0)" - - FirebaseCrashlytics (11.2.0): - - FirebaseCore (~> 11.0) + - FirebaseCrashlytics (11.4.0): + - FirebaseCore (~> 11.4) - FirebaseInstallations (~> 11.0) - FirebaseRemoteConfigInterop (~> 11.0) - FirebaseSessions (~> 11.0) @@ -44,7 +44,7 @@ PODS: - GoogleUtilities/Environment (~> 8.0) - GoogleUtilities/UserDefaults (~> 8.0) - PromisesObjC (~> 2.4) - - FirebaseRemoteConfig (11.2.0): + - FirebaseRemoteConfig (11.4.0): - FirebaseABTesting (~> 11.0) - FirebaseCore (~> 11.0) - FirebaseInstallations (~> 11.0) @@ -53,9 +53,9 @@ PODS: - GoogleUtilities/Environment (~> 8.0) - "GoogleUtilities/NSData+zlib (~> 8.0)" - FirebaseRemoteConfigInterop (11.4.0) - - FirebaseSessions (11.3.0): - - FirebaseCore (~> 11.0) - - FirebaseCoreExtension (~> 11.0) + - FirebaseSessions (11.4.0): + - FirebaseCore (~> 11.4) + - FirebaseCoreExtension (~> 11.4) - FirebaseInstallations (~> 11.0) - GoogleDataTransport (~> 10.0) - GoogleUtilities/Environment (~> 8.0) @@ -122,20 +122,20 @@ PODS: - sqflite_darwin (0.0.4): - Flutter - FlutterMacOS - - "sqlite3 (3.46.1+1)": - - "sqlite3/common (= 3.46.1+1)" - - "sqlite3/common (3.46.1+1)" - - "sqlite3/dbstatvtab (3.46.1+1)": + - sqlite3 (3.47.0): + - sqlite3/common (= 3.47.0) + - sqlite3/common (3.47.0) + - sqlite3/dbstatvtab (3.47.0): - sqlite3/common - - "sqlite3/fts5 (3.46.1+1)": + - sqlite3/fts5 (3.47.0): - sqlite3/common - - "sqlite3/perf-threadsafe (3.46.1+1)": + - sqlite3/perf-threadsafe (3.47.0): - sqlite3/common - - "sqlite3/rtree (3.46.1+1)": + - sqlite3/rtree (3.47.0): - sqlite3/common - sqlite3_flutter_libs (0.0.1): - Flutter - - "sqlite3 (~> 3.46.0+1)" + - sqlite3 (~> 3.47.0) - sqlite3/dbstatvtab - sqlite3/fts5 - sqlite3/perf-threadsafe @@ -234,19 +234,19 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342 - Firebase: 98e6bf5278170668a7983e12971a66b2cd57fc8c - firebase_core: 2bedc3136ec7c7b8561c6123ed0239387b53f2af - firebase_crashlytics: 37d104d457b51760b48504a93a12b3bf70995d77 - firebase_remote_config: d522653d828836503715498f1662901a6efcd809 + Firebase: cf1b19f21410b029b6786a54e9764a0cacad3c99 + firebase_core: f8c5b220a8f9c436fdbd075ae321cef3d96ef181 + firebase_crashlytics: 4b31ac507cf01d25151cc34cbb0fec66d21c7138 + firebase_remote_config: 1b2da0c0a4f781a970ccf84597b8092e3ec69142 FirebaseABTesting: aef1719704fade00b200827e7973f352efc4caee - FirebaseCore: a282032ae9295c795714ded2ec9c522fc237f8da + FirebaseCore: e0510f1523bc0eb21653cac00792e1e2bd6f1771 FirebaseCoreExtension: f1bc67a4702931a7caa097d8e4ac0a1b0d16720e - FirebaseCoreInternal: 5c2b016f06a96fbf20d9b443459f80427a827d7b - FirebaseCrashlytics: cfc69af5b53565dc6a5e563788809b5778ac4eac + FirebaseCoreInternal: 35731192cab10797b88411be84940d2beb33a238 + FirebaseCrashlytics: 41bbdd2b514a8523cede0c217aee6ef7ecf38401 FirebaseInstallations: 6ef4a1c7eb2a61ee1f74727d7f6ce2e72acf1414 - FirebaseRemoteConfig: fca0b2d017fc1de52b28a4e5bcf2007c1a840457 + FirebaseRemoteConfig: 7655681d02417bc9b287338edb9d721ff79e1a4a FirebaseRemoteConfigInterop: e76f46ffa4d6a65e273d4dfebb6a79e588cec136 - FirebaseSessions: 655ff17f3cc1a635cbdc2d69b953878001f9e25b + FirebaseSessions: 3f56f177d9e53a85021d16b31f9a111849d1dd8b FirebaseSharedSwift: 505dae2d05969dbf6d43749a642bb1bf230f0252 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778 @@ -267,12 +267,12 @@ SPEC CHECKSUMS: PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 quick_actions_ios: 56f3cbaa71e94f212838d1f9fe354bd0734779bf shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 - sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13 - sqlite3: 0bb0e6389d824e40296f531b858a2a0b71c0d2fb - sqlite3_flutter_libs: c00457ebd31e59fa6bb830380ddba24d44fbcd3b + sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d + sqlite3: 0aa20658a9b238a3b1ff7175eb7bdd863b0ab4fd + sqlite3_flutter_libs: b55ef23cfafea5318ae5081e0bf3fbbce8417c94 url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 PODFILE CHECKSUM: f5f6fa56ec332013222699049ea868939deda084 -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/lib/base/networking/apis/google/protobuf/empty.pb.dart b/lib/base/networking/apis/google/protobuf/empty.pb.dart index 05ae77c7..fb65fac9 100644 --- a/lib/base/networking/apis/google/protobuf/empty.pb.dart +++ b/lib/base/networking/apis/google/protobuf/empty.pb.dart @@ -20,6 +20,8 @@ import 'package:protobuf/protobuf.dart' as $pb; /// service Foo { /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); /// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. class Empty extends $pb.GeneratedMessage { factory Empty() => create(); Empty._() : super(); diff --git a/lib/base/networking/apis/google/protobuf/timestamp.pb.dart b/lib/base/networking/apis/google/protobuf/timestamp.pb.dart index ea44b44e..85f80767 100644 --- a/lib/base/networking/apis/google/protobuf/timestamp.pb.dart +++ b/lib/base/networking/apis/google/protobuf/timestamp.pb.dart @@ -65,6 +65,7 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) /// .setNanos((int) ((millis % 1000) * 1000000)).build(); /// +/// /// Example 5: Compute Timestamp from Java `Instant.now()`. /// /// Instant now = Instant.now(); @@ -73,6 +74,7 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; /// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) /// .setNanos(now.getNano()).build(); /// +/// /// Example 6: Compute Timestamp from current time in Python. /// /// timestamp = Timestamp() @@ -102,7 +104,7 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; /// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with /// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use /// the Joda Time's [`ISODateTimeFormat.dateTime()`]( -/// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() +/// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D /// ) to obtain a formatter capable of generating timestamps in this format. class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin { factory Timestamp({ diff --git a/lib/placesComponent/model/studyRooms/study_room_group.dart b/lib/placesComponent/model/studyRooms/study_room_group.dart index ad227e7f..6c11b4b0 100644 --- a/lib/placesComponent/model/studyRooms/study_room_group.dart +++ b/lib/placesComponent/model/studyRooms/study_room_group.dart @@ -1,4 +1,6 @@ +import 'package:campus_flutter/base/util/read_list_value.dart'; import 'package:campus_flutter/placesComponent/model/studyRooms/study_room.dart'; +import 'package:campus_flutter/placesComponent/model/studyRooms/study_room_opening_hours.dart'; import 'package:campus_flutter/searchComponent/model/comparison_token.dart'; import 'package:campus_flutter/searchComponent/protocols/searchable.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; @@ -16,6 +18,8 @@ class StudyRoomGroup extends Searchable { final int sorting; @JsonKey(name: "raeume") final List? rooms; + @JsonKey(name: "opening_hours", readValue: readListValue) + final List openingHours; LatLng? get coordinate { switch (id) { @@ -70,6 +74,7 @@ class StudyRoomGroup extends Searchable { required this.name, required this.sorting, this.rooms, + required this.openingHours, }); factory StudyRoomGroup.fromJson(Map json) => diff --git a/lib/placesComponent/model/studyRooms/study_room_group.g.dart b/lib/placesComponent/model/studyRooms/study_room_group.g.dart index 40582196..b015005a 100644 --- a/lib/placesComponent/model/studyRooms/study_room_group.g.dart +++ b/lib/placesComponent/model/studyRooms/study_room_group.g.dart @@ -15,6 +15,9 @@ StudyRoomGroup _$StudyRoomGroupFromJson(Map json) => rooms: (json['raeume'] as List?) ?.map((e) => (e as num).toInt()) .toList(), + openingHours: (readListValue(json, 'opening_hours') as List) + .map((e) => StudyRoomOpeningHours.fromJson(e as Map)) + .toList(), ); Map _$StudyRoomGroupToJson(StudyRoomGroup instance) => @@ -24,4 +27,5 @@ Map _$StudyRoomGroupToJson(StudyRoomGroup instance) => 'name': instance.name, 'sortierung': instance.sorting, 'raeume': instance.rooms, + 'opening_hours': instance.openingHours, }; diff --git a/lib/placesComponent/model/studyRooms/study_room_opening_hours.dart b/lib/placesComponent/model/studyRooms/study_room_opening_hours.dart new file mode 100644 index 00000000..77f9fcaf --- /dev/null +++ b/lib/placesComponent/model/studyRooms/study_room_opening_hours.dart @@ -0,0 +1,24 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'study_room_opening_hours.g.dart'; + +@JsonSerializable() +class StudyRoomOpeningHours { + final String days; + @JsonKey(name: "daysbitmask") + final String daysBitMask; + final String start; + final String end; + + StudyRoomOpeningHours({ + required this.days, + required this.daysBitMask, + required this.start, + required this.end, + }); + + factory StudyRoomOpeningHours.fromJson(Map json) => + _$StudyRoomOpeningHoursFromJson(json); + + Map toJson() => _$StudyRoomOpeningHoursToJson(this); +} diff --git a/lib/placesComponent/model/studyRooms/study_room_opening_hours.g.dart b/lib/placesComponent/model/studyRooms/study_room_opening_hours.g.dart new file mode 100644 index 00000000..0e5b4e4b --- /dev/null +++ b/lib/placesComponent/model/studyRooms/study_room_opening_hours.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'study_room_opening_hours.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StudyRoomOpeningHours _$StudyRoomOpeningHoursFromJson( + Map json) => + StudyRoomOpeningHours( + days: json['days'] as String, + daysBitMask: json['daysbitmask'] as String, + start: json['start'] as String, + end: json['end'] as String, + ); + +Map _$StudyRoomOpeningHoursToJson( + StudyRoomOpeningHours instance) => + { + 'days': instance.days, + 'daysbitmask': instance.daysBitMask, + 'start': instance.start, + 'end': instance.end, + }; diff --git a/lib/placesComponent/views/studyGroups/study_room_group_view.dart b/lib/placesComponent/views/studyGroups/study_room_group_view.dart index 267329af..968513c3 100644 --- a/lib/placesComponent/views/studyGroups/study_room_group_view.dart +++ b/lib/placesComponent/views/studyGroups/study_room_group_view.dart @@ -126,8 +126,11 @@ class StudyRoomGroupView extends ConsumerWidget { shrinkWrap: true, padding: EdgeInsets.zero, physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) => StudyRoomRowView(studyRoom: studyRooms![index]), - separatorBuilder: (context, index) => PaddedDivider(height: 0,), + itemBuilder: (context, index) => + StudyRoomRowView(studyRoom: studyRooms![index]), + separatorBuilder: (context, index) => PaddedDivider( + height: 0, + ), itemCount: (studyRooms ?? []).length, ), ), diff --git a/pubspec.lock b/pubspec.lock index c5eafa6a..41435b12 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,10 +13,10 @@ packages: dependency: transitive description: name: _flutterfire_internals - sha256: "5534e701a2c505fed1f0799e652dd6ae23bd4d2c4cf797220e5ced5764a7c1c2" + sha256: "5a0296da7ae717ffb7444dee8439ca25ac80e162a345b933aa57f0a4a48dca2c" url: "https://pub.dev" source: hosted - version: "1.3.44" + version: "1.3.45" _macros: dependency: transitive description: dart @@ -218,10 +218,10 @@ packages: dependency: transitive description: name: cli_util - sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c url: "https://pub.dev" source: hosted - version: "0.4.1" + version: "0.4.2" clock: dependency: transitive description: @@ -234,10 +234,10 @@ packages: dependency: transitive description: name: code_builder - sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" url: "https://pub.dev" source: hosted - version: "4.10.0" + version: "4.10.1" collection: dependency: "direct main" description: @@ -258,10 +258,10 @@ packages: dependency: transitive description: name: coverage - sha256: "88b0fddbe4c92910fefc09cc0248f5e7f0cd23e450ded4c28f16ab8ee8f83268" + sha256: "4b03e11f6d5b8f6e5bb5e9f7889a56fe6c5cbe942da5378ea4d4d7f73ef9dfe5" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" crypto: dependency: transitive description: @@ -274,10 +274,10 @@ packages: dependency: transitive description: name: csslib - sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.2" dart_style: dependency: transitive description: @@ -290,10 +290,10 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: c4af09051b4f0508f6c1dc0a5c085bf014d5c9a4a0678ce1799c2b4d716387a0 + sha256: f545ffbadee826f26f2e1a0f0cbd667ae9a6011cc0f77c0f8f00a969655e6e95 url: "https://pub.dev" source: hosted - version: "11.1.0" + version: "11.1.1" device_info_plus_platform_interface: dependency: transitive description: @@ -330,10 +330,10 @@ packages: dependency: "direct dev" description: name: drift_dev - sha256: "27bab15e7869b69259663590381180117873b9b273a1ea9ebb21bb73133d1233" + sha256: "623649abe932fc17bd32e578e7e05f7ac5e7dd0b33e6c8669a0634105d1389bf" url: "https://pub.dev" source: hosted - version: "2.21.0" + version: "2.21.2" easy_localization: dependency: "direct main" description: @@ -378,10 +378,10 @@ packages: dependency: "direct main" description: name: firebase_core - sha256: "51dfe2fbf3a984787a2e7b8592f2f05c986bfedd6fdacea3f9e0a7beb334de96" + sha256: e59141ff83e70a9ba571a1f8733c5598cf57e6e68037ab185581d7fc0a436738 url: "https://pub.dev" source: hosted - version: "3.6.0" + version: "3.7.0" firebase_core_platform_interface: dependency: transitive description: @@ -402,42 +402,42 @@ packages: dependency: "direct main" description: name: firebase_crashlytics - sha256: "6899800fff1af819955aef740f18c4c8600f8b952a2a1ea97bc0872ebb257387" + sha256: "859c0f9c40f44b555fc44227c3506b4236b86e6680cafb837e1eef40e661956e" url: "https://pub.dev" source: hosted - version: "4.1.3" + version: "4.1.4" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface - sha256: "97c47b0a1779a3d4118416a3f0c6c564cc59ad89095e899893204d4b2ad08f4c" + sha256: "4ae5bc279fd0a352d684340f9250b25571386fee0f7f3a750aae11c1cbbeaa40" url: "https://pub.dev" source: hosted - version: "3.6.44" + version: "3.6.45" firebase_remote_config: dependency: "direct main" description: name: firebase_remote_config - sha256: "8985e55900060437136a11f794f430d810a95f93e4a422117c474326feedc2c6" + sha256: "10ecace220616349263c8b6b80760f302d4bc68e6a9db2800c615ab06853de46" url: "https://pub.dev" source: hosted - version: "5.1.3" + version: "5.1.4" firebase_remote_config_platform_interface: dependency: transitive description: name: firebase_remote_config_platform_interface - sha256: ecde097c286b5967b9338f0374725655e2af71e685a8567f9b4700bbeec04ab8 + sha256: "2595a3def5dfab965b8a2cfd272a5595dec464a7a593258cfa9e4144cbe9842c" url: "https://pub.dev" source: hosted - version: "1.4.44" + version: "1.4.45" firebase_remote_config_web: dependency: transitive description: name: firebase_remote_config_web - sha256: e4dc0f7a63150181c800b8bd4fa9f50ce252479f1935f47e7a2845100239eb0a + sha256: fc8ec1bfab20eec37026c4ca0272f3647eae28bc186168e4a2d2859ed7d0f863 url: "https://pub.dev" source: hosted - version: "1.7.2" + version: "1.7.3" fixnum: dependency: transitive description: @@ -574,10 +574,10 @@ packages: dependency: "direct main" description: name: flutter_svg - sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" + sha256: "578bd8c508144fdaffd4f77b8ef2d8c523602275cd697cc3db284dbd762ef4ce" url: "https://pub.dev" source: hosted - version: "2.0.10+1" + version: "2.0.14" flutter_test: dependency: "direct dev" description: flutter @@ -648,10 +648,10 @@ packages: dependency: "direct main" description: name: get_it - sha256: "35c253f83f9e03cbac65ffa159510e41ae15f49b37291ab8c522d7a0b6f330cd" + sha256: c49895c1ecb0ee2a0ec568d39de882e2c299ba26355aa6744ab1001f98cebd15 url: "https://pub.dev" source: hosted - version: "8.0.1" + version: "8.0.2" glob: dependency: transitive description: @@ -664,18 +664,18 @@ packages: dependency: "direct main" description: name: go_router - sha256: "6f1b756f6e863259a99135ff3c95026c3cdca17d10ebef2bba2261a25ddc8bbc" + sha256: ce89c5a993ca5eea74535f798478502c30a625ecb10a1de4d7fef5cd1bcac2a4 url: "https://pub.dev" source: hosted - version: "14.3.0" + version: "14.4.1" google_identity_services_web: dependency: transitive description: name: google_identity_services_web - sha256: "5be191523702ba8d7a01ca97c17fca096822ccf246b0a9f11923a6ded06199b6" + sha256: "304e2a4c25d84c287df6d7ebf5b93d8bbd4ceb817d96c2686d44f6a346f227b6" url: "https://pub.dev" source: hosted - version: "0.3.1+4" + version: "0.3.1+5" google_maps: dependency: transitive description: @@ -696,10 +696,10 @@ packages: dependency: transitive description: name: google_maps_flutter_android - sha256: "6caec25edb8014ec7d503babc597794de2d4c1baf3e3d20b57c41bd3e439b916" + sha256: bccf64ccbb2ea672dc62a61177b315a340af86b0228564484b023657544a3fd5 url: "https://pub.dev" source: hosted - version: "2.14.10" + version: "2.14.11" google_maps_flutter_ios: dependency: transitive description: @@ -745,7 +745,7 @@ packages: description: path: "." ref: master - resolved-ref: b41fd2557ea2098bba0b515cdfc651e1a92a464f + resolved-ref: eec18f632982da4c3d83f8fa39a428d05e011fef url: "https://github.com/jakobkoerber/grpc-dart.git" source: git version: "4.0.2-wip" @@ -761,10 +761,10 @@ packages: dependency: "direct main" description: name: html - sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" url: "https://pub.dev" source: hosted - version: "0.15.4" + version: "0.15.5" http: dependency: transitive description: @@ -977,10 +977,10 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: df3eb3e0aed5c1107bb0fdb80a8e82e778114958b1c5ac5644fb1ac9cae8a998 + sha256: da8d9ac8c4b1df253d1a328b7bf01ae77ef132833479ab40763334db13b91cce url: "https://pub.dev" source: hosted - version: "8.1.0" + version: "8.1.1" package_info_plus_platform_interface: dependency: transitive description: @@ -1001,18 +1001,18 @@ packages: dependency: transitive description: name: path_parsing - sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" path_provider: dependency: "direct main" description: name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.5" path_provider_android: dependency: transitive description: @@ -1233,10 +1233,10 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" + sha256: "95f9997ca1fb9799d494d0cb2a780fd7be075818d59f00c43832ed112b158a82" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3" shared_preferences_android: dependency: transitive description: @@ -1382,10 +1382,10 @@ packages: dependency: transitive description: name: sqflite - sha256: "79a297dc3cc137e758c6a4baf83342b039e5a6d2436fcdf3f96a00adaaf2ad62" + sha256: "2d7299468485dca85efeeadf5d38986909c5eb0cd71fd3db2c2f000e6c9454bb" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.1" sqflite_android: dependency: transitive description: @@ -1406,10 +1406,10 @@ packages: dependency: transitive description: name: sqflite_darwin - sha256: "769733dddf94622d5541c73e4ddc6aa7b252d865285914b6fcd54a63c4b4f027" + sha256: "96a698e2bc82bd770a4d6aab00b42396a7c63d9e33513a56945cbccb594c2474" url: "https://pub.dev" source: hosted - version: "2.4.1-1" + version: "2.4.1" sqflite_platform_interface: dependency: transitive description: @@ -1430,18 +1430,18 @@ packages: dependency: "direct main" description: name: sqlite3_flutter_libs - sha256: ccd29dd6cf6fb9351fa07cd6f92895809adbf0779c1d986acf5e3d53b3250e33 + sha256: "7ae52b23366e5295005022e62fa093f64bfe190810223ea0ebf733a4cd140bce" url: "https://pub.dev" source: hosted - version: "0.5.25" + version: "0.5.26" sqlparser: dependency: transitive description: name: sqlparser - sha256: c5f63dff8677407ddcddfa4744c176ea6dc44286c47ba9e69e76d8071398034d + sha256: d77749237609784e337ec36c979d41f6f38a7b279df98622ae23929c8eb954a4 url: "https://pub.dev" source: hosted - version: "0.39.1" + version: "0.39.2" stack_trace: dependency: transitive description: @@ -1486,34 +1486,34 @@ packages: dependency: "direct main" description: name: syncfusion_flutter_calendar - sha256: "1fdbcb8435abc4a1fb36914b83d9690eb0dea617df3ac2772519fba7a3011828" + sha256: "769d3bbf8743922d74b242a968366661bd7b2973b3d34af9b9bc865874a520d9" url: "https://pub.dev" source: hosted - version: "27.1.55" + version: "27.1.58" syncfusion_flutter_charts: dependency: "direct main" description: name: syncfusion_flutter_charts - sha256: ec08668a7b3c95075aee32f6d73b7a053c6f1361de1e85f88a433d63f835beed + sha256: e97025be6a68d358463dcf0a83b3c600c52e14574c754b331aac5d1cbb86c759 url: "https://pub.dev" source: hosted - version: "27.1.55" + version: "27.1.58" syncfusion_flutter_core: dependency: "direct main" description: name: syncfusion_flutter_core - sha256: bc86234c9a0a87b6c3288b9065175e74e9a73e22b2237989a8bbdeff0c8befd7 + sha256: "31d2ddf410ee41abb3ecf85b7b6e8e1563307ad52ee784ddd91337e30280f715" url: "https://pub.dev" source: hosted - version: "27.1.55" + version: "27.1.58" syncfusion_flutter_datepicker: dependency: "direct main" description: name: syncfusion_flutter_datepicker - sha256: "54fe7e7a660ecdf072cceec890425d7531b42f647245f9244565c61e96fbca4a" + sha256: e25797401bec43cd64c475150f87150e8bc3e67212d4d1273ff35483ea793a8b url: "https://pub.dev" source: hosted - version: "27.1.55" + version: "27.1.58" synchronized: dependency: transitive description: @@ -1606,10 +1606,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "8fc3bae0b68c02c47c5c86fa8bfa74471d42687b0eded01b78de87872db745e2" + sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193" url: "https://pub.dev" source: hosted - version: "6.3.12" + version: "6.3.14" url_launcher_ios: dependency: transitive description: @@ -1670,26 +1670,26 @@ packages: dependency: transitive description: name: vector_graphics - sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" + sha256: "773c9522d66d523e1c7b25dfb95cc91c26a1e17b107039cfe147285e92de7878" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.14" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da + sha256: "2430b973a4ca3c4dbc9999b62b8c719a160100dcbae5c819bae0cacce32c9cdb" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.12" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" + sha256: ab9ff38fc771e9ee1139320adbe3d18a60327370c218c60752068ebee4b49ab1 url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.15" vector_math: dependency: transitive description: @@ -1710,10 +1710,10 @@ packages: dependency: transitive description: name: video_player_android - sha256: "2800d68d6d5b4c22da62453568ed68e63c35bea524d4fa42062e53d6bb591433" + sha256: "391e092ba4abe2f93b3e625bd6b6a6ec7d7414279462c1c0ee42b5ab8d0a0898" url: "https://pub.dev" source: hosted - version: "2.7.13" + version: "2.7.16" video_player_avfoundation: dependency: transitive description: @@ -1734,10 +1734,10 @@ packages: dependency: transitive description: name: video_player_web - sha256: "6dcdd298136523eaf7dfc31abaf0dfba9aa8a8dbc96670e87e9d42b6f2caf774" + sha256: "881b375a934d8ebf868c7fb1423b2bfaa393a0a265fa3f733079a86536064a10" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3" vm_service: dependency: transitive description: @@ -1790,10 +1790,10 @@ packages: dependency: transitive description: name: win32 - sha256: e1d0cc62e65dc2561f5071fcbccecf58ff20c344f8f3dc7d4922df372a11df1f + sha256: "84ba388638ed7a8cb3445a320c8273136ab2631cd5f2c57888335504ddab1bc2" url: "https://pub.dev" source: hosted - version: "5.7.1" + version: "5.8.0" win32_registry: dependency: transitive description: @@ -1823,10 +1823,10 @@ packages: description: path: "." ref: master - resolved-ref: "519915971f5cfcce2fc5ac274c4b711a6bb743e8" + resolved-ref: "6120a04a6e7cc7edecae69fcb9cc966fde4d6f23" url: "https://github.com/jakobkoerber/xml2json.git" source: git - version: "6.2.4" + version: "6.2.5" yaml: dependency: transitive description: From 59f4d2164ac25726603442a5db8b01621544bf92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Wed, 13 Nov 2024 01:18:18 +0100 Subject: [PATCH 10/12] Fix Movie Fetching --- lib/campusComponent/service/movie_service.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/campusComponent/service/movie_service.dart b/lib/campusComponent/service/movie_service.dart index 987e0ca3..77e82efd 100644 --- a/lib/campusComponent/service/movie_service.dart +++ b/lib/campusComponent/service/movie_service.dart @@ -7,15 +7,15 @@ class MovieService { static Future<(DateTime?, List)> fetchMovies( bool forcedRefresh, ) async { - final start = DateTime.now(); + final currentDate = DateTime.now(); GrpcClient grpcClient = getIt(); final response = await grpcClient.listMovies( ListMoviesRequest( oldestDateAt: Timestamp.fromDateTime( - DateTime(start.year, start.month, start.day), + currentDate, ), ), ); - return (start, response.movies); + return (currentDate, response.movies); } } From 8b32124d08a008cd0aa6a90147eea2d684419fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:30:56 +0100 Subject: [PATCH 11/12] Display Opening Hours of Study Rooms --- assets/translations/de.json | 3 + assets/translations/en.json | 3 + lib/base/util/days_parser.dart | 31 ++++++++++ lib/base/util/info_row.dart | 1 + .../model/studyRooms/study_room_group.dart | 10 +++ .../studyRooms/study_room_opening_hours.dart | 24 +++++++- .../study_room_opening_hours.g.dart | 4 +- .../study_room_group_scaffold.dart | 61 +++++++++++++++++++ .../studyGroups/study_room_group_view.dart | 31 +++++++--- 9 files changed, 157 insertions(+), 11 deletions(-) create mode 100644 lib/base/util/days_parser.dart diff --git a/assets/translations/de.json b/assets/translations/de.json index 4836078d..3e9d9a04 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -132,6 +132,9 @@ "wednesday": "Mittwoch", "thursday": "Donnerstag", "friday": "Freitag", + "saturday": "Samstag", + "sunday": "Sonntag", + "fromTo": "{} - {}", "weekend": "Wochenende", "openingHours": "Öffnungszeiten", "open": "{} offen von {} - {}", diff --git a/assets/translations/en.json b/assets/translations/en.json index b3564243..c1462375 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -132,6 +132,9 @@ "wednesday": "Wednesday", "thursday": "Thursday", "friday": "Friday", + "saturday": "Saturday", + "sunday": "Sunday", + "fromTo": "{} - {}", "weekend": "Weekend", "openingHours": "Opening Hours", "open": "Open {} from {} - {}", diff --git a/lib/base/util/days_parser.dart b/lib/base/util/days_parser.dart new file mode 100644 index 00000000..cd88cdc5 --- /dev/null +++ b/lib/base/util/days_parser.dart @@ -0,0 +1,31 @@ +import 'dart:core'; + +List decodeDaysBitmask(String bitmaskString) { + final bitmask = int.tryParse(bitmaskString); + if (bitmask == null) { + return []; + } + + final decodedDays = []; + + for (int i = 0; i < 7; i++) { + if (bitmask & (1 << i) != 0) { + decodedDays.add(i + 1); + } + } + + return decodedDays; +} + +String getDayOfWeek(int dayNumber) { + final daysOfWeek = [ + 'monday', + 'tuesday', + 'wednesday', + 'thursday', + 'friday', + 'saturday', + 'sunday', + ]; + return daysOfWeek[dayNumber - 1]; +} diff --git a/lib/base/util/info_row.dart b/lib/base/util/info_row.dart index 5ff658a9..df622101 100644 --- a/lib/base/util/info_row.dart +++ b/lib/base/util/info_row.dart @@ -10,6 +10,7 @@ class InfoRow extends StatelessWidget { @override Widget build(BuildContext context) { return Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: diff --git a/lib/placesComponent/model/studyRooms/study_room_group.dart b/lib/placesComponent/model/studyRooms/study_room_group.dart index 6c11b4b0..aec5fc8b 100644 --- a/lib/placesComponent/model/studyRooms/study_room_group.dart +++ b/lib/placesComponent/model/studyRooms/study_room_group.dart @@ -21,6 +21,16 @@ class StudyRoomGroup extends Searchable { @JsonKey(name: "opening_hours", readValue: readListValue) final List openingHours; + List? get openToday { + final currentDay = DateTime.now().weekday; + for (var openingHour in openingHours) { + if (openingHour.days.contains(currentDay)) { + return [openingHour.startString, openingHour.endString]; + } + } + return null; + } + LatLng? get coordinate { switch (id) { case 44: diff --git a/lib/placesComponent/model/studyRooms/study_room_opening_hours.dart b/lib/placesComponent/model/studyRooms/study_room_opening_hours.dart index 77f9fcaf..0356971d 100644 --- a/lib/placesComponent/model/studyRooms/study_room_opening_hours.dart +++ b/lib/placesComponent/model/studyRooms/study_room_opening_hours.dart @@ -1,17 +1,37 @@ +import 'package:campus_flutter/base/util/days_parser.dart'; import 'package:json_annotation/json_annotation.dart'; part 'study_room_opening_hours.g.dart'; @JsonSerializable() class StudyRoomOpeningHours { - final String days; + @JsonKey(name: "days") + final String daysString; @JsonKey(name: "daysbitmask") final String daysBitMask; final String start; final String end; + List get days => decodeDaysBitmask(daysBitMask); + + String get firstDay { + return getDayOfWeek(days.first); + } + + String? get lastDay { + if (days.length == 1) { + return null; + } else { + return getDayOfWeek(days.last); + } + } + + String get startString => start.substring(0, start.length - 3); + + String get endString => end.substring(0, end.length - 3); + StudyRoomOpeningHours({ - required this.days, + required this.daysString, required this.daysBitMask, required this.start, required this.end, diff --git a/lib/placesComponent/model/studyRooms/study_room_opening_hours.g.dart b/lib/placesComponent/model/studyRooms/study_room_opening_hours.g.dart index 0e5b4e4b..3072edd8 100644 --- a/lib/placesComponent/model/studyRooms/study_room_opening_hours.g.dart +++ b/lib/placesComponent/model/studyRooms/study_room_opening_hours.g.dart @@ -9,7 +9,7 @@ part of 'study_room_opening_hours.dart'; StudyRoomOpeningHours _$StudyRoomOpeningHoursFromJson( Map json) => StudyRoomOpeningHours( - days: json['days'] as String, + daysString: json['days'] as String, daysBitMask: json['daysbitmask'] as String, start: json['start'] as String, end: json['end'] as String, @@ -18,7 +18,7 @@ StudyRoomOpeningHours _$StudyRoomOpeningHoursFromJson( Map _$StudyRoomOpeningHoursToJson( StudyRoomOpeningHours instance) => { - 'days': instance.days, + 'days': instance.daysString, 'daysbitmask': instance.daysBitMask, 'start': instance.start, 'end': instance.end, diff --git a/lib/placesComponent/views/studyGroups/study_room_group_scaffold.dart b/lib/placesComponent/views/studyGroups/study_room_group_scaffold.dart index 739db139..7a2432dd 100644 --- a/lib/placesComponent/views/studyGroups/study_room_group_scaffold.dart +++ b/lib/placesComponent/views/studyGroups/study_room_group_scaffold.dart @@ -1,10 +1,14 @@ import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/util/custom_back_button.dart'; +import 'package:campus_flutter/base/util/info_row.dart'; import 'package:campus_flutter/base/util/map_launcher.dart'; import 'package:campus_flutter/placesComponent/model/studyRooms/study_room_group.dart'; +import 'package:campus_flutter/placesComponent/model/studyRooms/study_room_opening_hours.dart'; import 'package:campus_flutter/placesComponent/views/studyGroups/study_room_group_view.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; class StudyRoomGroupScaffold extends ConsumerWidget { @@ -39,6 +43,15 @@ class StudyRoomGroupScaffold extends ConsumerWidget { appBar: AppBar( leading: const CustomBackButton(), actions: [ + if (studyRoomGroup != null && studyRoomGroup!.openingHours.isNotEmpty) + IconButton( + onPressed: () => + _openAlert(studyRoomGroup!.openingHours, context), + icon: Icon( + Icons.access_time_filled, + color: context.theme.primaryColor, + ), + ), if (studyRoomGroup != null && studyRoomGroup?.coordinate != null) IconButton( onPressed: () => showDirectionsDialog( @@ -61,4 +74,52 @@ class StudyRoomGroupScaffold extends ConsumerWidget { : StudyRoomGroupView(null, isSplitView), ); } + + void _openAlert( + List openingHours, + BuildContext context, + ) { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: Text( + context.tr("openingHours"), + style: Theme.of(context).textTheme.titleMedium, + textAlign: TextAlign.center, + ), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + for (var openingHour in openingHours) + InfoRow( + title: context.tr( + "fromTo", + args: [ + context.tr(openingHour.firstDay), + if (openingHour.lastDay != null) + context.tr(openingHour.lastDay!), + ], + ), + info: context.tr( + "fromTo", + args: [ + openingHour.startString, + openingHour.endString, + ], + ), + ), + ], + ), + actions: [ + ElevatedButton( + onPressed: () => context.pop(), + child: const Text("Okay"), + ), + ], + actionsAlignment: MainAxisAlignment.center, + ); + }, + ); + } } diff --git a/lib/placesComponent/views/studyGroups/study_room_group_view.dart b/lib/placesComponent/views/studyGroups/study_room_group_view.dart index 968513c3..41d8cb62 100644 --- a/lib/placesComponent/views/studyGroups/study_room_group_view.dart +++ b/lib/placesComponent/views/studyGroups/study_room_group_view.dart @@ -106,13 +106,7 @@ class StudyRoomGroupView extends ConsumerWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: context.padding), - child: Text( - studyRoomGroup?.name ?? context.tr("unknown"), - style: Theme.of(context).textTheme.titleLarge, - ), - ), + _header(context), if (orientation == Orientation.portrait) ...[ if (studyRoomGroup?.coordinate != null) _portraitMap(studyRoomGroup, context), @@ -141,6 +135,29 @@ class StudyRoomGroupView extends ConsumerWidget { ); } + Widget _header(BuildContext context) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: context.padding), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + studyRoomGroup?.name ?? context.tr("unknown"), + style: Theme.of(context).textTheme.titleLarge, + ), + Text( + studyRoomGroup?.openToday != null + ? context.tr( + "open", + args: [context.tr("today"), ...studyRoomGroup!.openToday!], + ) + : context.tr("closedToday"), + ), + ], + ), + ); + } + Widget _landscape( StudyRoomGroup? studyRoomGroup, List? studyRooms, From efbb13c37d09cede9e3a12eec752667ff270e3a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:39:51 +0100 Subject: [PATCH 12/12] Bump Dependencies --- ios/Podfile.lock | 24 ++++++++++++------------ pubspec.lock | 36 ++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6e2fa432..d85df077 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -9,14 +9,14 @@ PODS: - Firebase/RemoteConfig (11.4.0): - Firebase/CoreOnly - FirebaseRemoteConfig (~> 11.4.0) - - firebase_core (3.7.0): + - firebase_core (3.8.0): - Firebase/CoreOnly (= 11.4.0) - Flutter - - firebase_crashlytics (4.1.4): + - firebase_crashlytics (4.1.5): - Firebase/Crashlytics (= 11.4.0) - firebase_core - Flutter - - firebase_remote_config (5.1.4): + - firebase_remote_config (5.1.5): - Firebase/RemoteConfig (= 11.4.0) - firebase_core - Flutter @@ -28,7 +28,7 @@ PODS: - GoogleUtilities/Logger (~> 8.0) - FirebaseCoreExtension (11.4.1): - FirebaseCore (~> 11.0) - - FirebaseCoreInternal (11.4.2): + - FirebaseCoreInternal (11.5.0): - "GoogleUtilities/NSData+zlib (~> 8.0)" - FirebaseCrashlytics (11.4.0): - FirebaseCore (~> 11.4) @@ -52,7 +52,7 @@ PODS: - FirebaseSharedSwift (~> 11.0) - GoogleUtilities/Environment (~> 8.0) - "GoogleUtilities/NSData+zlib (~> 8.0)" - - FirebaseRemoteConfigInterop (11.4.0) + - FirebaseRemoteConfigInterop (11.5.0) - FirebaseSessions (11.4.0): - FirebaseCore (~> 11.4) - FirebaseCoreExtension (~> 11.4) @@ -62,7 +62,7 @@ PODS: - GoogleUtilities/UserDefaults (~> 8.0) - nanopb (~> 3.30910.0) - PromisesSwift (~> 2.1) - - FirebaseSharedSwift (11.4.0) + - FirebaseSharedSwift (11.5.0) - Flutter (1.0.0) - flutter_native_splash (0.0.1): - Flutter @@ -235,19 +235,19 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342 Firebase: cf1b19f21410b029b6786a54e9764a0cacad3c99 - firebase_core: f8c5b220a8f9c436fdbd075ae321cef3d96ef181 - firebase_crashlytics: 4b31ac507cf01d25151cc34cbb0fec66d21c7138 - firebase_remote_config: 1b2da0c0a4f781a970ccf84597b8092e3ec69142 + firebase_core: 9efc3ecf689cdbc90f13f4dc58108c83ea46b266 + firebase_crashlytics: 72a8b504422ba8bb435a7a0c0a9341320cbcbe29 + firebase_remote_config: 96a9b7e79624c5d9d16befdef60791966bb83919 FirebaseABTesting: aef1719704fade00b200827e7973f352efc4caee FirebaseCore: e0510f1523bc0eb21653cac00792e1e2bd6f1771 FirebaseCoreExtension: f1bc67a4702931a7caa097d8e4ac0a1b0d16720e - FirebaseCoreInternal: 35731192cab10797b88411be84940d2beb33a238 + FirebaseCoreInternal: f47dd28ae7782e6a4738aad3106071a8fe0af604 FirebaseCrashlytics: 41bbdd2b514a8523cede0c217aee6ef7ecf38401 FirebaseInstallations: 6ef4a1c7eb2a61ee1f74727d7f6ce2e72acf1414 FirebaseRemoteConfig: 7655681d02417bc9b287338edb9d721ff79e1a4a - FirebaseRemoteConfigInterop: e76f46ffa4d6a65e273d4dfebb6a79e588cec136 + FirebaseRemoteConfigInterop: 7a7aebb9342d53913a5c890efa88e289d9e5c1bc FirebaseSessions: 3f56f177d9e53a85021d16b31f9a111849d1dd8b - FirebaseSharedSwift: 505dae2d05969dbf6d43749a642bb1bf230f0252 + FirebaseSharedSwift: 302ac5967857ad7e7388b15382d705b8c8d892aa Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778 flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12 diff --git a/pubspec.lock b/pubspec.lock index 41435b12..9dcca061 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,10 +13,10 @@ packages: dependency: transitive description: name: _flutterfire_internals - sha256: "5a0296da7ae717ffb7444dee8439ca25ac80e162a345b933aa57f0a4a48dca2c" + sha256: "71c01c1998c40b3af1944ad0a5f374b4e6fef7f3d2df487f3970dbeadaeb25a1" url: "https://pub.dev" source: hosted - version: "1.3.45" + version: "1.3.46" _macros: dependency: transitive description: dart @@ -378,10 +378,10 @@ packages: dependency: "direct main" description: name: firebase_core - sha256: e59141ff83e70a9ba571a1f8733c5598cf57e6e68037ab185581d7fc0a436738 + sha256: "2438a75ad803e818ad3bd5df49137ee619c46b6fc7101f4dbc23da07305ce553" url: "https://pub.dev" source: hosted - version: "3.7.0" + version: "3.8.0" firebase_core_platform_interface: dependency: transitive description: @@ -402,42 +402,42 @@ packages: dependency: "direct main" description: name: firebase_crashlytics - sha256: "859c0f9c40f44b555fc44227c3506b4236b86e6680cafb837e1eef40e661956e" + sha256: "4e80ef22428dfecf609df8049419c7446c6e1d797d7f307cad3c7ab70e72ddc5" url: "https://pub.dev" source: hosted - version: "4.1.4" + version: "4.1.5" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface - sha256: "4ae5bc279fd0a352d684340f9250b25571386fee0f7f3a750aae11c1cbbeaa40" + sha256: "1104f428ec5249fff62016985719bb232ca91c4bde0d1a033af9b7d8b7451d70" url: "https://pub.dev" source: hosted - version: "3.6.45" + version: "3.6.46" firebase_remote_config: dependency: "direct main" description: name: firebase_remote_config - sha256: "10ecace220616349263c8b6b80760f302d4bc68e6a9db2800c615ab06853de46" + sha256: "29619302396823622dd9d0ccb8ac2b48804c518c0c82aa85ef3d86b91fdf55ca" url: "https://pub.dev" source: hosted - version: "5.1.4" + version: "5.1.5" firebase_remote_config_platform_interface: dependency: transitive description: name: firebase_remote_config_platform_interface - sha256: "2595a3def5dfab965b8a2cfd272a5595dec464a7a593258cfa9e4144cbe9842c" + sha256: ae899364a77fdf706c2ec37f1336df1dd3cc6777f8cd6ce7cf0cae65830bf1cf url: "https://pub.dev" source: hosted - version: "1.4.45" + version: "1.4.46" firebase_remote_config_web: dependency: transitive description: name: firebase_remote_config_web - sha256: fc8ec1bfab20eec37026c4ca0272f3647eae28bc186168e4a2d2859ed7d0f863 + sha256: "6f018a0d7ce4b67784d29ec7193806e494adc243a4c880a4fab49e59afca212f" url: "https://pub.dev" source: hosted - version: "1.7.3" + version: "1.7.4" fixnum: dependency: transitive description: @@ -664,10 +664,10 @@ packages: dependency: "direct main" description: name: go_router - sha256: ce89c5a993ca5eea74535f798478502c30a625ecb10a1de4d7fef5cd1bcac2a4 + sha256: "8ae664a70174163b9f65ea68dd8673e29db8f9095de7b5cd00e167c621f4fef5" url: "https://pub.dev" source: hosted - version: "14.4.1" + version: "14.6.0" google_identity_services_web: dependency: transitive description: @@ -1622,10 +1622,10 @@ packages: dependency: transitive description: name: url_launcher_linux - sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.2.1" url_launcher_macos: dependency: transitive description: