fix(mobile): URL changement mdp corrigée + v3.0 — multi-org, AppAuth, sécurité prod
Auth: - profile_repository.dart: /api/auth/change-password → /api/membres/auth/change-password Multi-org (Phase 3): - OrgSelectorPage, OrgSwitcherBloc, OrgSwitcherEntry - org_context_service.dart: headers X-Active-Organisation-Id + X-Active-Role Navigation: - MorePage: navigation conditionnelle par typeOrganisation - Suppression adaptive_navigation (remplacé par main_navigation_layout) Auth AppAuth: - keycloak_webview_auth_service: fixes AppAuth Android - AuthBloc: gestion REAUTH_REQUIS + premierLoginComplet Onboarding: - Nouveaux états: payment_method_page, onboarding_shared_widgets - SouscriptionStatusModel mis à jour StatutValidationSouscription Android: - build.gradle: ProGuard/R8, network_security_config - Gradle wrapper mis à jour
This commit is contained in:
@@ -2,9 +2,11 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../data/models/souscription_status_model.dart';
|
||||
import '../../../../features/authentication/presentation/bloc/auth_bloc.dart';
|
||||
import '../../../../shared/design_system/tokens/unionflow_colors.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
/// Étape 5 — En attente de validation SuperAdmin
|
||||
/// Page de secours — affichée si l'auto-activation échoue après paiement.
|
||||
/// Normalement jamais vue : confirmerPaiement() active le compte côté backend.
|
||||
class AwaitingValidationPage extends StatefulWidget {
|
||||
final SouscriptionStatusModel? souscription;
|
||||
|
||||
@@ -19,6 +21,7 @@ class _AwaitingValidationPageState extends State<AwaitingValidationPage>
|
||||
late AnimationController _pulseController;
|
||||
late Animation<double> _pulseAnimation;
|
||||
Timer? _refreshTimer;
|
||||
int _checkCount = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -27,13 +30,14 @@ class _AwaitingValidationPageState extends State<AwaitingValidationPage>
|
||||
vsync: this,
|
||||
duration: const Duration(seconds: 2),
|
||||
)..repeat(reverse: true);
|
||||
_pulseAnimation = Tween(begin: 0.85, end: 1.0).animate(
|
||||
_pulseAnimation = Tween(begin: 0.88, end: 1.0).animate(
|
||||
CurvedAnimation(parent: _pulseController, curve: Curves.easeInOut),
|
||||
);
|
||||
|
||||
// Vérification périodique toutes les 30 secondes (re-check le statut)
|
||||
_refreshTimer = Timer.periodic(const Duration(seconds: 30), (_) {
|
||||
// Vérification périodique toutes les 15 secondes
|
||||
_refreshTimer = Timer.periodic(const Duration(seconds: 15), (_) {
|
||||
if (mounted) {
|
||||
setState(() => _checkCount++);
|
||||
context.read<AuthBloc>().add(const AuthStatusChecked());
|
||||
}
|
||||
});
|
||||
@@ -49,71 +53,169 @@ class _AwaitingValidationPageState extends State<AwaitingValidationPage>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final sosc = widget.souscription;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: UnionFlowColors.background,
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(28),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Animation d'attente
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// Animation pulsante
|
||||
ScaleTransition(
|
||||
scale: _pulseAnimation,
|
||||
child: Container(
|
||||
width: 120,
|
||||
height: 120,
|
||||
width: 130,
|
||||
height: 130,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFFF3E0),
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: const Color(0xFFF57C00), width: 3),
|
||||
color: UnionFlowColors.goldPale,
|
||||
border: Border.all(
|
||||
color: UnionFlowColors.gold.withOpacity(0.5), width: 3),
|
||||
boxShadow: UnionFlowColors.goldGlowShadow,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.hourglass_top_rounded,
|
||||
size: 60,
|
||||
color: Color(0xFFF57C00),
|
||||
size: 64,
|
||||
color: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
const Text(
|
||||
'Demande soumise !',
|
||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
'Paiement reçu !',
|
||||
style: TextStyle(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'Votre souscription est en cours de vérification par notre équipe. '
|
||||
'Vous recevrez une notification dès que votre compte sera activé.',
|
||||
style: TextStyle(fontSize: 15, color: Colors.grey, height: 1.5),
|
||||
'Votre paiement a bien été reçu. Votre compte\nest en cours d\'activation.',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
height: 1.5,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
||||
if (sosc != null) ...[
|
||||
const SizedBox(height: 32),
|
||||
_SummaryCard(souscription: sosc),
|
||||
],
|
||||
|
||||
const SizedBox(height: 32),
|
||||
const Text(
|
||||
'Cette vérification prend généralement 24 à 48 heures ouvrables.',
|
||||
style: TextStyle(fontSize: 13, color: Colors.grey),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
||||
// Souscription recap card
|
||||
if (sosc != null) _RecapCard(souscription: sosc),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
OutlinedButton.icon(
|
||||
onPressed: () =>
|
||||
context.read<AuthBloc>().add(const AuthStatusChecked()),
|
||||
icon: const Icon(Icons.refresh),
|
||||
label: const Text('Vérifier l\'état de mon compte'),
|
||||
// État de vérification
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2.5,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
value: _checkCount > 0 ? null : null,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Vérification automatique en cours',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Vérifié $_checkCount fois · prochaine dans 15s',
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Note d'information
|
||||
Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.infoPale,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border:
|
||||
Border.all(color: UnionFlowColors.info.withOpacity(0.2)),
|
||||
),
|
||||
child: const Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Icons.info_outline_rounded,
|
||||
color: UnionFlowColors.info, size: 18),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'L\'activation est généralement immédiate. Si votre compte n\'est pas activé dans les 5 minutes, contactez notre support.',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: UnionFlowColors.info,
|
||||
height: 1.45),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 28),
|
||||
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: () =>
|
||||
context.read<AuthBloc>().add(const AuthStatusChecked()),
|
||||
icon: const Icon(Icons.refresh_rounded),
|
||||
label: const Text(
|
||||
'Vérifier maintenant',
|
||||
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w700),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: UnionFlowColors.unionGreen,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14)),
|
||||
shadowColor: UnionFlowColors.unionGreen.withOpacity(0.3),
|
||||
elevation: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
context.read<AuthBloc>().add(const AuthLogoutRequested()),
|
||||
child: const Text('Se déconnecter'),
|
||||
child: const Text(
|
||||
'Se déconnecter',
|
||||
style: TextStyle(color: UnionFlowColors.textSecondary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -123,26 +225,49 @@ class _AwaitingValidationPageState extends State<AwaitingValidationPage>
|
||||
}
|
||||
}
|
||||
|
||||
class _SummaryCard extends StatelessWidget {
|
||||
class _RecapCard extends StatelessWidget {
|
||||
final SouscriptionStatusModel souscription;
|
||||
const _SummaryCard({required this.souscription});
|
||||
const _RecapCard({required this.souscription});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[50],
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: Colors.grey[200]!),
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
border: Border.all(color: UnionFlowColors.border),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
_Row('Organisation', souscription.organisationNom ?? '—'),
|
||||
_Row('Formule', souscription.typeFormule),
|
||||
_Row('Période', souscription.typePeriode),
|
||||
if (souscription.montantTotal != null)
|
||||
_Row('Montant payé', '${souscription.montantTotal!.toStringAsFixed(0)} FCFA'),
|
||||
_Row(
|
||||
icon: Icons.business_rounded,
|
||||
label: 'Organisation',
|
||||
value: souscription.organisationNom ?? '—',
|
||||
),
|
||||
const Divider(height: 16, color: UnionFlowColors.border),
|
||||
_Row(
|
||||
icon: Icons.workspace_premium_rounded,
|
||||
label: 'Formule',
|
||||
value: souscription.typeFormule,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_Row(
|
||||
icon: Icons.calendar_today_rounded,
|
||||
label: 'Période',
|
||||
value: souscription.typePeriode,
|
||||
),
|
||||
if (souscription.montantTotal != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
_Row(
|
||||
icon: Icons.payments_rounded,
|
||||
label: 'Montant payé',
|
||||
value: '${souscription.montantTotal!.toStringAsFixed(0)} FCFA',
|
||||
valueColor: UnionFlowColors.unionGreen,
|
||||
valueBold: true,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -150,22 +275,41 @@ class _SummaryCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _Row extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final String value;
|
||||
const _Row(this.label, this.value);
|
||||
final Color valueColor;
|
||||
final bool valueBold;
|
||||
|
||||
const _Row({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.value,
|
||||
this.valueColor = UnionFlowColors.textPrimary,
|
||||
this.valueBold = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(label, style: const TextStyle(color: Colors.grey, fontSize: 13)),
|
||||
Text(value,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 13)),
|
||||
],
|
||||
),
|
||||
return Row(
|
||||
children: [
|
||||
Icon(icon, size: 16, color: UnionFlowColors.textTertiary),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
color: UnionFlowColors.textSecondary, fontSize: 13),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
color: valueColor,
|
||||
fontSize: 13,
|
||||
fontWeight: valueBold ? FontWeight.w700 : FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user