## Tests BLoC (Task P2.4 Mobile) - 25 nouveaux fichiers *_bloc_test.dart + mocks générés (build_runner) - Features couvertes : authentication, admin_users, adhesions, backup, communication/messaging, contributions, dashboard, finance (approval/budget), events, explore/network, feed, logs_monitoring, notifications, onboarding, organizations (switcher/types/CRUD), profile, reports, settings, solidarity - ~380 tests, > 80% coverage BLoCs ## Sécurité Production (Task P2.2) - lib/core/security/app_integrity_service.dart (freerasp 7.5.1) - Migration API breaking changes freerasp 7.5.1 : - onRootDetected → onPrivilegedAccess - onDebuggerDetected → onDebug - onSignatureDetected → onAppIntegrity - onHookDetected → onHooks - onEmulatorDetected → onSimulator - onUntrustedInstallationSourceDetected → onUnofficialStore - onDeviceBindingDetected → onDeviceBinding - onObfuscationIssuesDetected → onObfuscationIssues - Talsec.start() split → start() + attachListener() - const AndroidConfig/IOSConfig → final (constructors call ConfigVerifier) - supportedAlternativeStores → supportedStores ## Pubspec - bloc_test: ^9.1.7 → ^10.0.0 (compat flutter_bloc ^9.0.0) - freerasp 7.5.1 ## Config - android/app/build.gradle : ajustements release - lib/core/config/environment.dart : URLs API actualisées - lib/main.dart + app_router : intégrations sécurité/BLoC ## Cleanup - Suppression docs intermédiaires (TACHES_*.md, TASK_*_COMPLETION_REPORT.md, TESTS_UNITAIRES_PROGRESS.md) - .g.dart régénérés (json_serializable) - .mocks.dart régénérés (mockito) ## Résultat - 142 fichiers, +27 596 insertions - Toutes les tâches P2 mobile complétées Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
105 lines
3.6 KiB
Dart
105 lines
3.6 KiB
Dart
import 'local_config.dart';
|
|
|
|
/// Environnements de déploiement de l'application
|
|
enum Environment { dev, staging, prod }
|
|
|
|
/// Configuration centralisée par environnement.
|
|
/// Les URLs sont injectées via --dart-define=ENV=dev|staging|prod
|
|
/// L'IP dev est définie dans android/local.properties → dev.host
|
|
/// (propagée automatiquement vers ce fichier via build.gradle).
|
|
class AppConfig {
|
|
static late final Environment _environment;
|
|
static late final String apiBaseUrl;
|
|
static late final String keycloakBaseUrl;
|
|
static late final String wsBaseUrl;
|
|
static late final bool enableDebugMode;
|
|
static late final bool enableLogging;
|
|
static late final bool enableCrashReporting;
|
|
static late final bool enableAnalytics;
|
|
static late final String sentryDsn;
|
|
|
|
/// Initialise la configuration à partir de l'environnement.
|
|
/// Appeler dans main() avant runApp().
|
|
static void initialize() {
|
|
const envString = String.fromEnvironment('ENV', defaultValue: 'dev');
|
|
_environment = Environment.values.firstWhere(
|
|
(e) => e.name == envString,
|
|
orElse: () => Environment.dev,
|
|
);
|
|
|
|
switch (_environment) {
|
|
case Environment.dev:
|
|
apiBaseUrl = const String.fromEnvironment(
|
|
'API_URL',
|
|
defaultValue: 'http://$kDevHost:8085',
|
|
);
|
|
keycloakBaseUrl = const String.fromEnvironment(
|
|
'KEYCLOAK_URL',
|
|
defaultValue: 'http://$kDevHost:8180',
|
|
);
|
|
wsBaseUrl = const String.fromEnvironment(
|
|
'WS_URL',
|
|
defaultValue: 'ws://$kDevHost:8085',
|
|
);
|
|
enableDebugMode = true;
|
|
enableLogging = true;
|
|
enableCrashReporting = false;
|
|
enableAnalytics = false;
|
|
sentryDsn = '';
|
|
|
|
case Environment.staging:
|
|
apiBaseUrl = const String.fromEnvironment(
|
|
'API_URL',
|
|
defaultValue: 'https://api-staging.lions.dev',
|
|
);
|
|
keycloakBaseUrl = const String.fromEnvironment(
|
|
'KEYCLOAK_URL',
|
|
defaultValue: 'https://security-staging.lions.dev',
|
|
);
|
|
wsBaseUrl = const String.fromEnvironment(
|
|
'WS_URL',
|
|
defaultValue: 'wss://api-staging.lions.dev',
|
|
);
|
|
enableDebugMode = false;
|
|
enableLogging = true;
|
|
enableCrashReporting = true;
|
|
enableAnalytics = false;
|
|
sentryDsn = const String.fromEnvironment('SENTRY_DSN', defaultValue: '');
|
|
|
|
case Environment.prod:
|
|
apiBaseUrl = const String.fromEnvironment(
|
|
'API_URL',
|
|
defaultValue: 'https://api.lions.dev/unionflow',
|
|
);
|
|
keycloakBaseUrl = const String.fromEnvironment(
|
|
'KEYCLOAK_URL',
|
|
defaultValue: 'https://security.lions.dev',
|
|
);
|
|
wsBaseUrl = const String.fromEnvironment(
|
|
'WS_URL',
|
|
defaultValue: 'wss://api.lions.dev/unionflow',
|
|
);
|
|
enableDebugMode = false;
|
|
enableLogging = false;
|
|
enableCrashReporting = true;
|
|
enableAnalytics = true;
|
|
sentryDsn = const String.fromEnvironment('SENTRY_DSN', defaultValue: '');
|
|
}
|
|
}
|
|
|
|
static Environment get environment => _environment;
|
|
static bool get isDev => _environment == Environment.dev;
|
|
static bool get isStaging => _environment == Environment.staging;
|
|
static bool get isProd => _environment == Environment.prod;
|
|
|
|
/// URL complète du realm Keycloak
|
|
static String get keycloakRealmUrl => '$keycloakBaseUrl/realms/unionflow';
|
|
|
|
/// URL du endpoint token Keycloak
|
|
static String get keycloakTokenUrl =>
|
|
'$keycloakRealmUrl/protocol/openid-connect/token';
|
|
|
|
/// URL du endpoint WebSocket dashboard
|
|
static String get wsDashboardUrl => '$wsBaseUrl/ws/dashboard';
|
|
}
|