From 8eddc8f7718048612165e723062aa54feb59ee05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= Date: Sun, 27 Sep 2026 14:51:14 +0200 Subject: [PATCH] fixed widget background refresh loading custom events from the legacy backend --- lib/background/widget_background_task.dart | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/background/widget_background_task.dart b/lib/background/widget_background_task.dart index 2a465bf..4e75191 100644 --- a/lib/background/widget_background_task.dart +++ b/lib/background/widget_background_task.dart @@ -6,6 +6,7 @@ import 'package:flutter/widgets.dart'; import 'package:workmanager/workmanager.dart'; import '../api/marianumconnect/marianumconnect_endpoint.dart'; +import '../api/marianumconnect/queries/timetable_custom_events/timetable_custom_events_get.dart'; import '../api/marianumconnect/queries/timetable_get_holidays/timetable_get_holidays.dart'; import '../api/marianumconnect/queries/timetable_get_holidays/timetable_get_holidays_response.dart'; import '../api/marianumconnect/queries/timetable_get_rooms/timetable_get_rooms.dart'; @@ -15,8 +16,6 @@ import '../api/marianumconnect/queries/timetable_get_subjects/timetable_get_subj import '../api/marianumconnect/queries/timetable_get_timegrid/timetable_get_timegrid.dart'; import '../api/marianumconnect/queries/timetable_get_timegrid/timetable_get_timegrid_response.dart'; import '../api/marianumconnect/queries/timetable_get_week/timetable_get_week.dart'; -import '../api/mhsl/custom_timetable_event/get/get_custom_timetable_event.dart'; -import '../api/mhsl/custom_timetable_event/get/get_custom_timetable_event_params.dart'; import '../api/mhsl/custom_timetable_event/get/get_custom_timetable_event_response.dart'; import '../session/session.dart'; import '../session/session_manager.dart'; @@ -106,7 +105,7 @@ class WidgetBackgroundTask { log('[widget-refresh] snapshot is fresh, skipping refresh'); return; } - await _refresh(session); + await _refresh(); } static Future cancelAll() async { @@ -143,7 +142,7 @@ void _callbackDispatcher() { }); } -Future _refresh(Session session) async { +Future _refresh() async { await WidgetSync.ensureInitialized(); // The background isolate doesn't go through main.dart's BlocBuilder, so we // re-apply the endpoint the foreground last persisted. Without this the @@ -182,14 +181,9 @@ Future _refresh(Session session) async { final timegridFuture = _runOrNull( () => TimetableGetTimegrid().run(), ); - final customEventsFuture = switch (session) { - CredentialSession(:final legacyUserSecret) => - _runOrNull( - () => GetCustomTimetableEvent( - GetCustomTimetableEventParams(legacyUserSecret), - ).run(), - ), - }; + final customEventsFuture = _runOrNull( + () => TimetableCustomEventsGet().run(), + ); final timetable = await timetableFuture; final subjects = await subjectsFuture; final rooms = await roomsFuture;