75 lines
2.8 KiB
Markdown
75 lines
2.8 KiB
Markdown
# ADR-014 : Frontend Mobile
|
|
|
|
**Statut** : Accepté
|
|
**Date** : 2025-01-20
|
|
|
|
## Contexte
|
|
|
|
RoadWave nécessite applications iOS et Android avec support CarPlay/Android Auto, lecture audio HLS avancée, géolocalisation temps réel. Le choix du framework impacte vélocité développement et performances.
|
|
|
|
## Décision
|
|
|
|
**Flutter** pour iOS et Android avec codebase unique.
|
|
|
|
## Alternatives considérées
|
|
|
|
| Framework | Codebase | Performance | Audio/CarPlay | Communauté |
|
|
|-----------|----------|-------------|---------------|------------|
|
|
| **Flutter** | Unique | Native | Excellente | Large |
|
|
| React Native | Unique | Bonne | Modules natifs requis | Très large |
|
|
| Native (Swift+Kotlin) | Double | Excellente | Native | Large |
|
|
| Ionic/Capacitor | Unique | Moyenne | Limitée | Moyenne |
|
|
|
|
## Justification
|
|
|
|
- **Codebase unique** : iOS + Android maintenus ensemble, vélocité développement x2
|
|
- **Performance** : Dart compilé en code natif (pas de bridge JS)
|
|
- **Audio HLS** : Package `just_audio` mature avec support HLS, buffering adaptatif
|
|
- **CarPlay/Android Auto** : Support via packages communautaires (`flutter_carplay`, `android_auto_flutter`)
|
|
- **Géolocalisation** : `geolocator` robuste avec gestion permissions
|
|
- **Écosystème** : Widgets riches (Material/Cupertino), state management mature (Bloc, Riverpod)
|
|
|
|
## Packages clés
|
|
|
|
```yaml
|
|
dependencies:
|
|
flutter_bloc: ^8.1.3 # State management
|
|
just_audio: ^0.9.36 # Lecture audio HLS
|
|
geolocator: ^11.0.0 # GPS temps réel (mode voiture)
|
|
geofence_service: ^5.2.0 # Geofencing arrière-plan (mode piéton)
|
|
flutter_local_notifications: ^17.0.0 # Notifications géolocalisées
|
|
dio: ^5.4.0 # HTTP client
|
|
flutter_secure_storage: ^9.0.0 # Tokens JWT
|
|
cached_network_image: ^3.3.1 # Cache images
|
|
```
|
|
|
|
**Nouveaux packages (contenus géolocalisés)** :
|
|
|
|
- **`geofence_service`** : Détection entrée/sortie rayon 200m en arrière-plan (mode piéton)
|
|
- Geofencing natif iOS/Android
|
|
- Minimise consommation batterie
|
|
- Supporte notifications push même app fermée
|
|
|
|
- **`flutter_local_notifications`** : Notifications locales avec compteur dynamique
|
|
- Notification avec compteur décroissant (7→1) en mode voiture
|
|
- Icônes personnalisées selon type contenu
|
|
- Désactivation overlay en mode CarPlay/Android Auto (conformité)
|
|
|
|
## Structure application
|
|
|
|
```
|
|
lib/
|
|
├── core/ # Config, DI, routes
|
|
├── data/ # Repositories, API clients
|
|
├── domain/ # Models, business logic
|
|
├── presentation/ # UI (screens, widgets, blocs)
|
|
└── main.dart
|
|
```
|
|
|
|
## Conséquences
|
|
|
|
- Équipe doit apprendre Dart (syntaxe proche Java/TypeScript)
|
|
- Taille binaire : 8-15 MB (acceptable)
|
|
- Tests : `flutter_test` pour widgets, `integration_test` pour E2E
|
|
- CI/CD : Fastlane pour déploiement stores
|