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"}; } }