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:
@@ -0,0 +1,25 @@
|
||||
import '../../errors/app_exception.dart';
|
||||
|
||||
class ConnectException extends AppException {
|
||||
const ConnectException({
|
||||
super.userMessage =
|
||||
'Verbindung zum Marianum-Connect-Server fehlgeschlagen.',
|
||||
super.technicalDetails,
|
||||
super.allowRetry,
|
||||
});
|
||||
|
||||
factory ConnectException.authFailed({String? technicalDetails}) =>
|
||||
ConnectException(
|
||||
userMessage:
|
||||
'Anmeldung am Connect-Server fehlgeschlagen. Bitte prüfe deine Anmeldedaten.',
|
||||
technicalDetails: technicalDetails,
|
||||
allowRetry: false,
|
||||
);
|
||||
|
||||
factory ConnectException.notAuthenticated() => const ConnectException(
|
||||
userMessage:
|
||||
'Für diese Funktion ist eine Anmeldung am Connect-Server nötig.',
|
||||
technicalDetails: 'AccountData missing while trying to log in to connect',
|
||||
allowRetry: false,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import '../../errors/app_exception.dart';
|
||||
|
||||
class RmvRateLimitedException extends AppException {
|
||||
final Duration retryAfter;
|
||||
|
||||
RmvRateLimitedException({required this.retryAfter, super.technicalDetails})
|
||||
: super(
|
||||
userMessage:
|
||||
'Die Fahrplanauskunft ist gerade überlastet. Bitte in ${retryAfter.inSeconds} Sekunden erneut versuchen.',
|
||||
allowRetry: true,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import '../../errors/app_exception.dart';
|
||||
|
||||
class RmvUpstreamException extends AppException {
|
||||
final String? errorCode;
|
||||
|
||||
RmvUpstreamException({required this.errorCode, super.technicalDetails})
|
||||
: super(userMessage: _mapMessage(errorCode), allowRetry: true);
|
||||
|
||||
static String _mapMessage(String? code) {
|
||||
switch (code) {
|
||||
case 'H390':
|
||||
return 'Keine Verbindung gefunden.';
|
||||
case 'H891':
|
||||
return 'Eine der angegebenen Stationen ist ungültig.';
|
||||
case 'H895':
|
||||
return 'Start- und Zielhaltestelle sind identisch.';
|
||||
case 'H900':
|
||||
case 'H892':
|
||||
return 'Die Fahrplanauskunft ist gerade nicht verfügbar.';
|
||||
case 'H910':
|
||||
return 'Die angegebene Zeit liegt außerhalb des Fahrplans.';
|
||||
case null:
|
||||
return 'Die Fahrplanauskunft konnte keine Antwort liefern.';
|
||||
default:
|
||||
return 'Die Fahrplanauskunft hat einen Fehler gemeldet ($code).';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user