implemented RMV public transit module including trip search, station departures, and nearby stop lookup, added "Marianum Connect" API integration with bearer token authentication and auto-refresh logic, integrated geolocator for location-based station search, added persistent storage for favorite stations and recent trip queries, and implemented comprehensive UI for journey details, trip results, and disruption alerts
This commit is contained in:
@@ -38,4 +38,5 @@ const _$ModulesEnumMap = {
|
||||
Modules.gradeAveragesCalculator: 'gradeAveragesCalculator',
|
||||
Modules.holidays: 'holidays',
|
||||
Modules.marianumDates: 'marianumDates',
|
||||
Modules.rmv: 'rmv',
|
||||
};
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../api/connect/rmv/rmv_models.dart';
|
||||
|
||||
part 'rmv_settings.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class RmvSettings {
|
||||
List<StopLocation> favoriteStations;
|
||||
List<StopLocation> recentStations;
|
||||
List<RecentTripQuery> recentTripQueries;
|
||||
|
||||
static const int maxRecents = 10;
|
||||
|
||||
RmvSettings({
|
||||
this.favoriteStations = const [],
|
||||
this.recentStations = const [],
|
||||
this.recentTripQueries = const [],
|
||||
});
|
||||
|
||||
factory RmvSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$RmvSettingsFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$RmvSettingsToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class RecentTripQuery {
|
||||
final StopLocation from;
|
||||
final StopLocation to;
|
||||
final int timestampMs;
|
||||
|
||||
RecentTripQuery({
|
||||
required this.from,
|
||||
required this.to,
|
||||
required this.timestampMs,
|
||||
});
|
||||
|
||||
factory RecentTripQuery.fromJson(Map<String, dynamic> json) =>
|
||||
_$RecentTripQueryFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$RecentTripQueryToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'rmv_settings.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
RmvSettings _$RmvSettingsFromJson(Map<String, dynamic> json) => RmvSettings(
|
||||
favoriteStations:
|
||||
(json['favoriteStations'] as List<dynamic>?)
|
||||
?.map((e) => StopLocation.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const [],
|
||||
recentStations:
|
||||
(json['recentStations'] as List<dynamic>?)
|
||||
?.map((e) => StopLocation.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const [],
|
||||
recentTripQueries:
|
||||
(json['recentTripQueries'] as List<dynamic>?)
|
||||
?.map((e) => RecentTripQuery.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const [],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$RmvSettingsToJson(
|
||||
RmvSettings instance,
|
||||
) => <String, dynamic>{
|
||||
'favoriteStations': instance.favoriteStations.map((e) => e.toJson()).toList(),
|
||||
'recentStations': instance.recentStations.map((e) => e.toJson()).toList(),
|
||||
'recentTripQueries': instance.recentTripQueries
|
||||
.map((e) => e.toJson())
|
||||
.toList(),
|
||||
};
|
||||
|
||||
RecentTripQuery _$RecentTripQueryFromJson(Map<String, dynamic> json) =>
|
||||
RecentTripQuery(
|
||||
from: StopLocation.fromJson(json['from'] as Map<String, dynamic>),
|
||||
to: StopLocation.fromJson(json['to'] as Map<String, dynamic>),
|
||||
timestampMs: (json['timestampMs'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$RecentTripQueryToJson(RecentTripQuery instance) =>
|
||||
<String, dynamic>{
|
||||
'from': instance.from.toJson(),
|
||||
'to': instance.to.toJson(),
|
||||
'timestampMs': instance.timestampMs,
|
||||
};
|
||||
@@ -7,6 +7,7 @@ import 'file_view_settings.dart';
|
||||
import 'holidays_settings.dart';
|
||||
import 'modules_settings.dart';
|
||||
import 'notification_settings.dart';
|
||||
import 'rmv_settings.dart';
|
||||
import 'talk_settings.dart';
|
||||
import 'timetable_settings.dart';
|
||||
|
||||
@@ -23,6 +24,7 @@ class Settings {
|
||||
TalkSettings talkSettings;
|
||||
FileSettings fileSettings;
|
||||
HolidaysSettings holidaysSettings;
|
||||
RmvSettings rmvSettings;
|
||||
FileViewSettings fileViewSettings;
|
||||
NotificationSettings notificationSettings;
|
||||
DevToolsSettings devToolsSettings;
|
||||
@@ -35,6 +37,7 @@ class Settings {
|
||||
required this.talkSettings,
|
||||
required this.fileSettings,
|
||||
required this.holidaysSettings,
|
||||
required this.rmvSettings,
|
||||
required this.fileViewSettings,
|
||||
required this.notificationSettings,
|
||||
required this.devToolsSettings,
|
||||
|
||||
@@ -24,6 +24,9 @@ Settings _$SettingsFromJson(Map<String, dynamic> json) => Settings(
|
||||
holidaysSettings: HolidaysSettings.fromJson(
|
||||
json['holidaysSettings'] as Map<String, dynamic>,
|
||||
),
|
||||
rmvSettings: RmvSettings.fromJson(
|
||||
json['rmvSettings'] as Map<String, dynamic>,
|
||||
),
|
||||
fileViewSettings: FileViewSettings.fromJson(
|
||||
json['fileViewSettings'] as Map<String, dynamic>,
|
||||
),
|
||||
@@ -43,6 +46,7 @@ Map<String, dynamic> _$SettingsToJson(Settings instance) => <String, dynamic>{
|
||||
'talkSettings': instance.talkSettings.toJson(),
|
||||
'fileSettings': instance.fileSettings.toJson(),
|
||||
'holidaysSettings': instance.holidaysSettings.toJson(),
|
||||
'rmvSettings': instance.rmvSettings.toJson(),
|
||||
'fileViewSettings': instance.fileViewSettings.toJson(),
|
||||
'notificationSettings': instance.notificationSettings.toJson(),
|
||||
'devToolsSettings': instance.devToolsSettings.toJson(),
|
||||
|
||||
Reference in New Issue
Block a user