- Umgebungen (Name, API-URL, Keycloak-Issuer) kommen aus assets/hl_server_config.json statt hartcodiertem BackendConfig.prod; Testumgebung 192.168.1.9:3001 ist dort hinterlegt - AppBloc laedt die Config, aktiviert die gespeicherte Wahl (Fallback Default) und registriert das Networking; Wechsel persistiert per SharedPreferences und registriert neu - Bloc-Baum ist pro Umgebung gekeyt: beim Wechsel entstehen alle Blocs mit dem neuen API-Client neu - Login-Screen: Zahnrad oben rechts oeffnet Einstellungen mit Umgebungs- Cards (Name + IP:Port); Hinweis auf aktive Umgebung unter dem Button - Fahrzeugauswahl pro Umgebung getrennt (eigene DB = eigene Car-IDs) - Tests fuer Config-Parsing, Auswahl-Fallback, Card-Wechsel, Re-Registrierung Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
875 B
Dart
33 lines
875 B
Dart
import 'package:hl_lieferservice/data/network/backend_environment.dart';
|
|
|
|
/// Lifecycle-States des App-Bootstraps.
|
|
///
|
|
/// `AppConfigLoaded` heißt: Server-Config ist gelesen, die aktive Umgebung
|
|
/// steht fest und das Networking dafür ist im Locator registriert.
|
|
abstract class AppState {
|
|
const AppState();
|
|
}
|
|
|
|
class AppInitial extends AppState {
|
|
const AppInitial();
|
|
}
|
|
|
|
class AppConfigLoading extends AppState {
|
|
const AppConfigLoading();
|
|
}
|
|
|
|
class AppConfigLoaded extends AppState {
|
|
const AppConfigLoaded({required this.catalog, required this.active});
|
|
|
|
/// Alle auswählbaren Umgebungen aus der Config-Datei.
|
|
final ServerCatalog catalog;
|
|
|
|
/// Die Umgebung, gegen die die App gerade spricht.
|
|
final BackendEnvironment active;
|
|
}
|
|
|
|
class AppConfigLoadingFailed extends AppState {
|
|
const AppConfigLoadingFailed({required this.message});
|
|
final String message;
|
|
}
|