refactor(adr): remplacer Firebase par implémentation directe APNS/FCM

Remplace toutes les références au SDK Firebase par une implémentation
directe des APIs APNS (iOS) et FCM (Android) pour éliminer le vendor
lock-in et assurer la cohérence avec la stratégie self-hosted.

Modifications :
- ADR-017 : Architecture notifications avec APNS/FCM direct
- ADR-018 : Remplacement firebase.google.com/go par sideshow/apns2 + oauth2
- ADR-020 : Remplacement firebase_messaging par flutter_apns + flutter_fcm
- Règles métier 09 & 14 : Mise à jour références coûts notifications

Avantages :
- Aucun vendor lock-in (code 100% maîtrisé)
- Cohérence avec ADR-008 (self-hosted) et ADR-015 (souveraineté)
- Gratuit sans limite (APNS/FCM natifs)
- APIs standard HTTP/2 et OAuth2
This commit is contained in:
jpgiannetti
2026-02-02 21:36:59 +01:00
parent b132fb957d
commit 6ba0688f87
5 changed files with 142 additions and 96 deletions

View File

@@ -31,7 +31,7 @@ Utilisation de **9 librairies open-source** Flutter avec licences permissives, d
| Catégorie | Librairie | Licence | Justification |
|-----------|-----------|---------|---------------|
| **GPS temps réel** | `geolocator` | MIT | Mode voiture, WebSocket position updates, high accuracy |
| **Push notifications** | `firebase_messaging` | BSD-3 | FCM tokens, notifications serveur (ADR-017) |
| **Push APNS/FCM** | `flutter_apns` + `flutter_fcm` | MIT | Intégration native APNS et FCM directe (ADR-017) |
| **Notifications locales** | `flutter_local_notifications` | BSD-3 | Compteur dynamique, icônes custom, iOS/Android |
| **Permissions** | `permission_handler` | MIT | Gestion unifiée permissions iOS/Android |
@@ -69,9 +69,10 @@ Utilisation de **9 librairies open-source** Flutter avec licences permissives, d
- **background_location** : Spécifique background uniquement
### Notifications Push
- **firebase_messaging** (choisi) : Gratuit, 99.95% uptime, intégration native iOS/Android
- **OneSignal** : Plus cher (500€/mois @ 100K users)
- **Custom WebSocket** : Complex, toujours besoin APNS/FCM au final (voir ADR-017)
- **flutter_apns + flutter_fcm** (choisi) : Implémentation directe APNS/FCM, pas de vendor lock-in
- **firebase_messaging** : SDK Firebase, vendor lock-in Google
- **OneSignal** : Plus cher (500€/mois @ 100K users), vendor lock-in
- **Custom WebSocket** : Complexe, toujours besoin APNS/FCM au final (voir ADR-017)
### Geofencing (Phase 2)
- **geofence_service** (choisi) : Natif iOS/Android, économie batterie optimale
@@ -95,7 +96,7 @@ Utilisation de **9 librairies open-source** Flutter avec licences permissives, d
- **Compilation native** : Dart → ARM64 (pas de bridge JS comme React Native)
- **just_audio** : Utilise AVPlayer (iOS) et ExoPlayer (Android) natifs
- **geolocator** : Accès direct CoreLocation (iOS) et FusedLocation (Android)
- **firebase_messaging** : Utilise services systèmes (Google Play Services, APNS)
- **flutter_apns + flutter_fcm** : Utilise services systèmes natifs (APNS, Google Play Services)
- **geofence_service** (Phase 2) : Geofencing natif, minimise consommation batterie
### Conformité Stores
@@ -122,7 +123,7 @@ graph TB
subgraph Services["Services Layer - Phase 1 MVP"]
Audio["just_audio<br/>(HLS Streaming)"]
GPS["geolocator<br/>(GPS + WebSocket)"]
FCM["firebase_messaging<br/>(Push Serveur)"]
Push["flutter_apns + flutter_fcm<br/>(Push Natifs APNS/FCM)"]
Notif["flutter_local_notifications<br/>(Notifications Locales)"]
Perms["permission_handler<br/>(Permissions iOS/Android)"]
end
@@ -140,14 +141,14 @@ graph TB
Bloc --> API
Bloc --> Audio
Bloc --> GPS
Bloc --> FCM
Bloc --> Push
API --> Storage
Widgets --> Cache
GPS --> Perms
FCM --> Perms
FCM --> Notif
Push --> Perms
Push --> Notif
Geofence -.->|Phase 2| Perms
Geofence -.->|Phase 2| Notif
@@ -179,7 +180,7 @@ graph TB
### Négatives
- ⚠️ **CarPlay/Android Auto** : Packages communautaires (pas officiels Flutter)
- ⚠️ **Firebase dépendance** : Vendor lock-in Google (mitigé par abstraction layer, voir ADR-017)
- ⚠️ **Configuration APNS/FCM** : Gestion certificats et OAuth2, configuration manuelle
- ⚠️ **Permission "Always" Phase 2** : Taux acceptation ~30% (geofencing local)
-**Courbe d'apprentissage** : Dart + pattern BLoC à maîtriser
-**Tests stores** : Validation TestFlight (iOS) et Internal Testing (Android) obligatoires
@@ -197,7 +198,8 @@ graph TB
**Géolocalisation & Notifications (Phase 1 MVP)** :
- `geolocator` - GPS haute précision, WebSocket position updates
- `firebase_messaging` - Push notifications serveur (ADR-017)
- `flutter_apns` - Push notifications APNS natif iOS (ADR-017)
- `flutter_fcm` - Push notifications FCM natif Android (ADR-017)
- `flutter_local_notifications` - Notifications locales
- `permission_handler` - Gestion permissions
@@ -237,7 +239,8 @@ La section "Packages clés" de l'ADR-010 est désormais obsolète et doit réfé
- [flutter_bloc documentation](https://bloclibrary.dev/)
- [just_audio repository](https://pub.dev/packages/just_audio)
- [geolocator documentation](https://pub.dev/packages/geolocator)
- [firebase_messaging documentation](https://pub.dev/packages/firebase_messaging)
- [flutter_apns documentation](https://pub.dev/packages/flutter_apns)
- [flutter_fcm documentation](https://pub.dev/packages/flutter_fcm)
- [geofence_service documentation](https://pub.dev/packages/geofence_service)
- [Apple CarPlay Developer Guide](https://developer.apple.com/carplay/)
- [Android Auto Developer Guide](https://developer.android.com/training/cars)