Files
unionflow-mobile-apps/android/app/build.gradle
dahoud 37db88672b feat: BLoC tests complets + sécurité production + freerasp 7.5.1 migration
## 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>
2026-04-21 12:42:35 +00:00

130 lines
4.7 KiB
Groovy

plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}
// ── Dev Host — source unique : android/local.properties → dev.host ───────────
def localProps = new Properties()
def localPropsFile = rootProject.file('local.properties')
if (localPropsFile.exists()) localPropsFile.withInputStream { localProps.load(it) }
def devHost = localProps.getProperty('dev.host', '10.0.2.2')
task generateDevConfig {
description = 'Generates network_security_config.xml and local_config.dart from local.properties'
group = 'UnionFlow'
inputs.property('devHost', devHost)
outputs.files(
file("src/main/res/xml/network_security_config.xml"),
rootProject.file("../lib/core/config/local_config.dart")
)
doLast {
def xmlContent = """\
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- Production: cleartext disabled by default -->
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system"/>
</trust-anchors>
</base-config>
<!-- Dev local - single source: android/local.properties -> dev.host -->
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">${devHost}</domain>
<domain includeSubdomains="true">localhost</domain>
<domain includeSubdomains="true">10.0.2.2</domain>
<domain includeSubdomains="true">127.0.0.1</domain>
</domain-config>
</network-security-config>"""
def dartContent = """\
// AUTO-GENERATED by build.gradle - DO NOT EDIT
// Edit android/local.properties (dev.host) instead.
// ignore_for_file: prefer_single_quotes
const String kDevHost = '${devHost}';
"""
// Write with explicit UTF-8 encoding (avoids Windows-1252 on French systems)
file("src/main/res/xml/network_security_config.xml")
.newWriter('UTF-8').withWriter { w -> w << xmlContent }
rootProject.file("../lib/core/config/local_config.dart")
.newWriter('UTF-8').withWriter { w -> w << dartContent }
}
}
preBuild.dependsOn generateDevConfig
// local_config.dart is consumed by Flutter compile tasks — declare explicit dependency
tasks.configureEach { task ->
if (task.name.startsWith('compileFlutterBuild')) {
task.dependsOn generateDevConfig
}
}
// ─────────────────────────────────────────────────────────────────────────────
android {
namespace = "dev.lions.unionflow_mobile_apps"
compileSdk = 36
ndkVersion = flutter.ndkVersion
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "dev.lions.unionflow_mobile_apps"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
// Configuration pour flutter_appauth
manifestPlaceholders = [
'appAuthRedirectScheme': 'dev.lions.unionflow-mobile',
'applicationName': 'android.app.Application'
]
}
signingConfigs {
release {
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
}
buildTypes {
release {
signingConfig = signingConfigs.release
// Activer la minification et l'obfuscation pour la release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source = "../.."
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
}