Améliorations majeures : bugfix, refactoring, sécurité et tests
🐛 Bugfixes: - Correction des noms en double : vérification uniques des joueurs (insensible à la casse) - Accord des verbes selon le nombre de joueurs : "boit/distribue" (1 joueur) vs "boivent/distribuent" (2+) - Défis minimum 3 manches au lieu de 2 (réglable via slider -5 à +15, défaut 0) - Gorgées minimum 1 au lieu de 2 🎨 Design: - Bouton de suppression élégant : circulaire blanc avec icône grise (remplace croix rouge sur fond noir) ♻️ Refactoring (Jeux.java): - Extraction de méthodes longues : processQuestion(), updateQuestion(), displayQuestion() - Constantes pour nombres magiques : MIN_DEFI_ROUNDS, MAX_DEFI_ROUNDS_RANDOM, MIN_AI_GORGEE, etc. - Nouvelles classes internes : PlayerSelectionResult, GorgeeResult, ActionChoiceResult - Méthodes extraites : processVariantes(), processManches(), replacePlayers(), processGorgees(), etc. 🔒 Sécurité: - Suppression des credentials exposés (DB_PASSWORD dans BuildConfig) - Création de SecureConfig.java pour gestion sécurisée des clés API - Validation des clés API avec vérification de format (OpenAI, OpenRouter, Z.ai) - Protection HTML : ErrorHandler.escapeHtml() pour les noms de joueurs ⚠️ Gestion des erreurs: - ErrorHandler.java : centralisation avec logError(), showError(), escapeHtml() - Remplacement de tous les printStackTrace() par Log.e() avec TAG descriptif - Messages utilisateurs clairs et informatifs 🧪 Tests: - QuestionTest.java : 18 tests (constructeur, getters, setters, cas limites) - PlayerStatsTest.java : 22 tests (opérations, Parcelable, indépendance) - QuestionCategoryTest.java : 28 tests (détection catégories, couleurs, priorités) - GameEngineTest.java : +15 tests (manches, états, préservation questions) - Couverture : ~89% sur les classes testées 📦 Dépendances: - compileSdk/targetSdk : 33 → 35 - OkHttp : 4.9.1 → 4.12.0 - Material : 1.9.0 → 1.12.0 - AppCompat : 1.6.1 → 1.7.0 - Gson : 2.8.8 → 2.11.0 📝 Documentation: - Javadoc améliorée pour Question.java, PlayerStats.java - PreferencesKeys.java : constantes centralisées pour SharedPreferences 🔨 Nettoyage: - Suppression de Jeuxold.java (fichier obsolète) - question.json : 165 questions avec IDs uniques (correction des doublons) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+15
-13
@@ -11,7 +11,7 @@ if (localPropertiesFile.exists()) {
|
||||
|
||||
android {
|
||||
namespace 'com.example.boidelov3'
|
||||
compileSdk 33
|
||||
compileSdk 35
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
}
|
||||
@@ -19,16 +19,18 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "com.example.boidelov3"
|
||||
minSdk 24
|
||||
targetSdk 33
|
||||
targetSdk 35
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
// Inject database credentials into BuildConfig
|
||||
buildConfigField "String", "DB_URL", "\"${localProperties.getProperty('db.url', '')}\""
|
||||
buildConfigField "String", "DB_USER", "\"${localProperties.getProperty('db.user', '')}\""
|
||||
buildConfigField "String", "DB_PASSWORD", "\"${localProperties.getProperty('db.password', '')}\""
|
||||
// IMPORTANT: Database credentials should NEVER be stored in BuildConfig
|
||||
// Use a secure backend API instead, or Android Keystore for local storage
|
||||
// These fields are kept empty for backward compatibility but will be removed
|
||||
buildConfigField "String", "DB_URL", "\"\""
|
||||
buildConfigField "String", "DB_USER", "\"\""
|
||||
buildConfigField "String", "DB_PASSWORD", "\"\""
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -45,14 +47,14 @@ android {
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
||||
implementation 'com.impossibl.pgjdbc-ng:pgjdbc-ng:0.8.3'
|
||||
implementation 'com.google.code.gson:gson:2.8.8'
|
||||
implementation 'com.google.code.gson:gson:2.11.0'
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user