migrated timetable integration from WebUntis to the MarianumConnect API, implementing a Dio-based client with bearer token authentication, background session validation, and auto-refresh logic.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../../../../api/marianumconnect/queries/timetable_get_holidays/timetable_get_holidays_response.dart';
|
||||
import '../../../../../api/marianumconnect/queries/timetable_get_rooms/timetable_get_rooms_response.dart';
|
||||
import '../../../../../api/marianumconnect/queries/timetable_get_schoolyear/timetable_get_schoolyear_response.dart';
|
||||
import '../../../../../api/marianumconnect/queries/timetable_get_subjects/timetable_get_subjects_response.dart';
|
||||
import '../../../../../api/marianumconnect/queries/timetable_get_timegrid/timetable_get_timegrid_response.dart';
|
||||
import '../../../../../api/marianumconnect/queries/timetable_get_week/timetable_get_week_response.dart';
|
||||
import '../../../../../api/mhsl/custom_timetable_event/get/get_custom_timetable_event_response.dart';
|
||||
import '../../../../../api/webuntis/queries/get_current_schoolyear/get_current_schoolyear_response.dart';
|
||||
import '../../../../../api/webuntis/queries/get_holidays/get_holidays_response.dart';
|
||||
import '../../../../../api/webuntis/queries/get_rooms/get_rooms_response.dart';
|
||||
import '../../../../../api/webuntis/queries/get_subjects/get_subjects_response.dart';
|
||||
import '../../../../../api/webuntis/queries/get_timegrid_units/get_timegrid_units_response.dart';
|
||||
import '../../../../../api/webuntis/queries/get_timetable/get_timetable_response.dart';
|
||||
|
||||
part 'timetable_state.freezed.dart';
|
||||
part 'timetable_state.g.dart';
|
||||
@@ -16,18 +16,18 @@ abstract class TimetableState with _$TimetableState {
|
||||
const TimetableState._();
|
||||
|
||||
const factory TimetableState({
|
||||
@Default(<String, GetTimetableResponse>{})
|
||||
Map<String, GetTimetableResponse> weekCache,
|
||||
GetRoomsResponse? rooms,
|
||||
GetSubjectsResponse? subjects,
|
||||
GetHolidaysResponse? schoolHolidays,
|
||||
GetCurrentSchoolyearResponse? schoolyear,
|
||||
GetTimegridUnitsResponse? timegrid,
|
||||
@Default(<String, TimetableGetWeekResponse>{})
|
||||
Map<String, TimetableGetWeekResponse> weekCache,
|
||||
TimetableGetRoomsResponse? rooms,
|
||||
TimetableGetSubjectsResponse? subjects,
|
||||
TimetableGetHolidaysResponse? schoolHolidays,
|
||||
TimetableGetSchoolyearResponse? schoolyear,
|
||||
TimetableGetTimegridResponse? timegrid,
|
||||
GetCustomTimetableEventResponse? customEvents,
|
||||
required DateTime startDate,
|
||||
required DateTime endDate,
|
||||
@Default(0) int dataVersion,
|
||||
// Boundaries learned from `-7004 no allowed date` errors during scroll.
|
||||
// Boundaries learned from past server denials of inaccessible weeks.
|
||||
// Inclusive: weeks whose start is on/before `accessibleEndDate` and
|
||||
// whose end is on/after `accessibleStartDate` are within the user's
|
||||
// permitted range. Null = no upper / lower bound discovered yet.
|
||||
@@ -38,8 +38,8 @@ abstract class TimetableState with _$TimetableState {
|
||||
factory TimetableState.fromJson(Map<String, Object?> json) =>
|
||||
_$TimetableStateFromJson(json);
|
||||
|
||||
Iterable<GetTimetableResponseObject> getAllKnownLessons() =>
|
||||
weekCache.values.expand((response) => response.result);
|
||||
Iterable<McTimetableEntry> getAllKnownLessons() =>
|
||||
weekCache.values.expand((response) => response.entries);
|
||||
|
||||
bool get hasReferenceData =>
|
||||
rooms != null &&
|
||||
|
||||
Reference in New Issue
Block a user