331 lines
7.6 KiB
Markdown
331 lines
7.6 KiB
Markdown
# 🚀 Déploiement Frontend AfterWork
|
|
|
|
**Date** : 2026-01-10
|
|
**Statut** : ✅ Prêt pour le build production
|
|
|
|
---
|
|
|
|
## 📋 Configuration de Production
|
|
|
|
### URL de l'API Backend
|
|
```
|
|
https://api.lions.dev/afterwork
|
|
```
|
|
|
|
### WebSocket
|
|
```
|
|
wss://api.lions.dev/afterwork/ws/notifications/{userId}
|
|
wss://api.lions.dev/afterwork/ws/chat/{userId}
|
|
```
|
|
|
|
---
|
|
|
|
## 🔧 Build de l'Application
|
|
|
|
### Build APK (Android)
|
|
|
|
```powershell
|
|
cd C:\Users\dadyo\PersonalProjects\lions-workspace\afterwork
|
|
|
|
# Build APK production
|
|
.\build-prod.ps1 -Target apk
|
|
|
|
# Ou directement avec Flutter
|
|
flutter build apk --release \
|
|
--dart-define=API_BASE_URL=https://api.lions.dev/afterwork \
|
|
--dart-define=ENVIRONMENT=production \
|
|
--dart-define=DEBUG_MODE=false \
|
|
--split-per-abi
|
|
```
|
|
|
|
**Artefacts générés:**
|
|
```
|
|
build/app/outputs/flutter-apk/
|
|
├── app-armeabi-v7a-release.apk
|
|
├── app-arm64-v8a-release.apk (Recommandé pour la plupart des appareils)
|
|
└── app-x86_64-release.apk
|
|
```
|
|
|
|
### Build AAB (Google Play Store)
|
|
|
|
```powershell
|
|
# Build AAB pour Play Store
|
|
.\build-prod.ps1 -Target appbundle
|
|
|
|
# Ou directement
|
|
flutter build appbundle --release \
|
|
--dart-define=API_BASE_URL=https://api.lions.dev/afterwork \
|
|
--dart-define=ENVIRONMENT=production \
|
|
--dart-define=DEBUG_MODE=false
|
|
```
|
|
|
|
**Artefact généré:**
|
|
```
|
|
build/app/outputs/bundle/release/app-release.aab
|
|
```
|
|
|
|
---
|
|
|
|
## 📱 Installation et Test
|
|
|
|
### Installer l'APK sur un Appareil
|
|
|
|
```bash
|
|
# Via ADB
|
|
adb install build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
|
|
|
|
# Ou copier l'APK sur l'appareil et l'installer manuellement
|
|
```
|
|
|
|
### Tester l'Application
|
|
|
|
1. **Connexion au Backend**
|
|
- L'app doit pointer vers `https://api.lions.dev/afterwork`
|
|
- Vérifier que le login fonctionne
|
|
|
|
2. **WebSocket (Temps Réel)**
|
|
- Tester les notifications en temps réel
|
|
- Tester le chat instantané
|
|
- Vérifier les typing indicators
|
|
|
|
3. **Fonctionnalités Principales**
|
|
- ✅ Login/Signup
|
|
- ✅ Gestion de profil
|
|
- ✅ Événements
|
|
- ✅ Amis (ajout, suggestions, demandes)
|
|
- ✅ Chat (messages, statuts ✓✓✓)
|
|
- ✅ Social (posts, likes, commentaires)
|
|
- ✅ Stories
|
|
- ✅ Notifications
|
|
|
|
---
|
|
|
|
## 🔄 Changements pour Production
|
|
|
|
### Configuration API
|
|
|
|
Le fichier `lib/core/constants/env_config.dart` est configuré pour supporter les variables d'environnement:
|
|
|
|
```dart
|
|
static const String apiBaseUrl = String.fromEnvironment(
|
|
'API_BASE_URL',
|
|
defaultValue: 'http://192.168.1.145:8080', // Développement
|
|
);
|
|
```
|
|
|
|
**En production:**
|
|
- Via `--dart-define=API_BASE_URL=https://api.lions.dev/afterwork`
|
|
- Le script `build-prod.ps1` configure automatiquement cette variable
|
|
|
|
### Validation
|
|
|
|
Au démarrage, l'app valide la configuration:
|
|
- En production, HTTPS est obligatoire
|
|
- Les URLs malformées sont rejetées
|
|
- Les clés API manquantes génèrent des warnings
|
|
|
|
---
|
|
|
|
## 🐛 Corrections Appliquées
|
|
|
|
### Race Condition Chat (CRITIQUE)
|
|
**Problème:** Les icônes de statut (✓, ✓✓, ✓✓ bleu) ne s'affichaient pas
|
|
|
|
**Solution:** Pattern Optimistic UI
|
|
- Message créé localement immédiatement
|
|
- Ajouté à la liste AVANT la requête HTTP
|
|
- Remplacé par le message serveur à la réponse
|
|
|
|
**Fichier:** `lib/presentation/state_management/chat_bloc.dart`
|
|
|
|
### TODOs Implémentés (13)
|
|
- Partage de posts (copier lien, partage natif)
|
|
- Signalement de posts
|
|
- Recherche de conversations
|
|
- Gestion de médias (upload, suppression, miniatures)
|
|
- Sélection d'amis pour partage
|
|
|
|
---
|
|
|
|
## 📦 Fichiers Importants
|
|
|
|
### Configuration
|
|
```
|
|
lib/core/constants/
|
|
├── env_config.dart # Configuration environnements
|
|
├── colors.dart # Thème de couleurs
|
|
└── urls.dart # URLs et endpoints
|
|
|
|
lib/config/
|
|
├── injection/injection.dart # Injection de dépendances
|
|
└── router.dart # Navigation
|
|
```
|
|
|
|
### Services
|
|
```
|
|
lib/data/services/
|
|
├── chat_websocket_service.dart # WebSocket chat
|
|
├── realtime_notification_service.dart # WebSocket notifications
|
|
├── media_upload_service.dart # Upload médias
|
|
└── image_compression_service.dart # Compression images
|
|
```
|
|
|
|
### État Management
|
|
```
|
|
lib/presentation/state_management/
|
|
├── chat_bloc.dart # Gestion chat
|
|
├── event_bloc.dart # Gestion événements
|
|
└── user_bloc.dart # Gestion utilisateurs
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 URLs et Endpoints
|
|
|
|
### Authentification
|
|
- **POST** `/api/users/login`
|
|
- **POST** `/api/users/register`
|
|
|
|
### Utilisateurs
|
|
- **GET** `/api/users/{id}`
|
|
- **PUT** `/api/users/{id}`
|
|
- **GET** `/api/users/friends`
|
|
|
|
### Chat
|
|
- **GET** `/api/messages/conversations`
|
|
- **GET** `/api/messages/conversation/{id}`
|
|
- **POST** `/api/messages/send`
|
|
- **WebSocket** `/ws/chat/{userId}`
|
|
|
|
### Social
|
|
- **GET** `/api/social/posts`
|
|
- **POST** `/api/social/posts`
|
|
- **POST** `/api/social/posts/{id}/like`
|
|
- **POST** `/api/social/posts/{id}/comment`
|
|
|
|
### Notifications
|
|
- **GET** `/api/notifications`
|
|
- **PUT** `/api/notifications/{id}/read`
|
|
- **WebSocket** `/ws/notifications/{userId}`
|
|
|
|
---
|
|
|
|
## 📊 Statistiques du Projet
|
|
|
|
| Métrique | Valeur |
|
|
|----------|--------|
|
|
| **Fichiers Dart** | ~200+ |
|
|
| **Lignes de code** | ~40,000+ |
|
|
| **Widgets custom** | 80+ |
|
|
| **Blocs/Providers** | 15+ |
|
|
| **Services** | 20+ |
|
|
| **Entities** | 15+ |
|
|
| **Tests** | 25+ |
|
|
|
|
---
|
|
|
|
## ✅ Checklist de Déploiement
|
|
|
|
### Avant le Build
|
|
- [x] Backend déployé et accessible sur `https://api.lions.dev/afterwork`
|
|
- [x] Configuration `env_config.dart` prête
|
|
- [x] Script `build-prod.ps1` configuré
|
|
- [x] Tests manuels effectués en local
|
|
- [x] Race condition chat corrigée
|
|
|
|
### Build
|
|
- [ ] Exécuter `.\build-prod.ps1 -Target apk`
|
|
- [ ] Vérifier la taille des APKs générés
|
|
- [ ] Tester l'installation sur un appareil réel
|
|
|
|
### Tests Post-Build
|
|
- [ ] Login fonctionne avec l'API production
|
|
- [ ] WebSocket se connecte correctement
|
|
- [ ] Chat temps réel fonctionne
|
|
- [ ] Notifications temps réel fonctionnent
|
|
- [ ] Upload de médias fonctionne
|
|
- [ ] Pas d'erreurs dans les logs
|
|
|
|
### Distribution
|
|
- [ ] Signer l'APK/AAB si nécessaire
|
|
- [ ] Upload sur Play Store (ou distribution interne)
|
|
- [ ] Documentation utilisateur mise à jour
|
|
|
|
---
|
|
|
|
## 🔐 Sécurité
|
|
|
|
### HTTPS Obligatoire en Production
|
|
L'application force HTTPS en production via `env_config.dart`:
|
|
|
|
```dart
|
|
if (isProduction && !apiBaseUrl.startsWith('https://')) {
|
|
errors.add('API_BASE_URL doit utiliser HTTPS en production');
|
|
}
|
|
```
|
|
|
|
### Tokens et Authentification
|
|
- Les tokens JWT sont stockés de manière sécurisée
|
|
- Refresh automatique des tokens expirés
|
|
- Déconnexion automatique si le token est invalide
|
|
|
|
---
|
|
|
|
## 📞 Support
|
|
|
|
En cas de problème:
|
|
|
|
1. **Vérifier les logs de l'app:**
|
|
```bash
|
|
flutter logs
|
|
# ou
|
|
adb logcat | grep flutter
|
|
```
|
|
|
|
2. **Vérifier la connexion API:**
|
|
```bash
|
|
curl https://api.lions.dev/afterwork/q/health/ready
|
|
```
|
|
|
|
3. **Vérifier les WebSockets:**
|
|
- Ouvrir l'app
|
|
- Vérifier les logs pour "WebSocket connected"
|
|
|
|
---
|
|
|
|
## 🎉 Résumé
|
|
|
|
### ✅ Application Complète et Fonctionnelle
|
|
|
|
- **Frontend**: Flutter avec architecture Clean + BLoC
|
|
- **Backend**: Quarkus avec WebSocket temps réel
|
|
- **Infrastructure**: Kubernetes sur VPS
|
|
- **URL Production**: https://api.lions.dev/afterwork
|
|
|
|
### ✅ Prêt pour Production
|
|
|
|
Toutes les fonctionnalités sont implémentées et testées:
|
|
- Authentification sécurisée
|
|
- Chat temps réel avec statuts de messages
|
|
- Publications sociales avec médias
|
|
- Stories temporaires
|
|
- Notifications push temps réel
|
|
- Gestion d'événements
|
|
- Système d'amitié complet
|
|
|
|
---
|
|
|
|
**Pour builder l'application:**
|
|
```powershell
|
|
.\build-prod.ps1 -Target apk
|
|
```
|
|
|
|
**Artefacts:**
|
|
```
|
|
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
|
|
```
|
|
|
|
---
|
|
|
|
**Dernière mise à jour:** 2026-01-10
|