Files
Cyrene-For-Android/app/proguard-rules.pro
T
AskaEth ce73f68bc8 fix: add ProGuard keep rules for UI screens and components
Navigation compose lambdas in NavGraph may not be traced by R8's call
graph, causing screen composables to be stripped in release builds.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 12:45:48 +08:00

105 lines
3.8 KiB
Prolog

# Cyrene ProGuard Rules
# --- Keep Android components declared in manifest ---
# These are instantiated by the Android system via reflection
-keep class top.yeij.cyrene.CyreneApplication { *; }
-keep class top.yeij.cyrene.MainActivity { *; }
-keep class top.yeij.cyrene.service.** { *; }
# --- Kotlin ---
-keepattributes *Annotation*
-keepattributes Signature
-keepattributes InnerClasses
-keepattributes EnclosingMethod
-keepattributes RuntimeVisibleAnnotations
-keepattributes RuntimeVisibleParameterAnnotations
-keepattributes AnnotationDefault
-keepattributes KotlinMetadata
-dontwarn kotlin.**
-keep class kotlin.Metadata { *; }
-keep class kotlin.coroutines.Continuation
-keep class kotlinx.coroutines.** { *; }
# --- Retrofit ---
-keep class retrofit2.** { *; }
-dontwarn retrofit2.**
# --- Gson ---
-keep class com.google.gson.** { *; }
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# Keep all DTO classes and their members for Gson serialization
-keep class top.yeij.cyrene.data.remote.dto.** { *; }
-keepclassmembers class top.yeij.cyrene.data.remote.dto.** { *; }
# --- OkHttp ---
-dontwarn okhttp3.**
-dontwarn okio.**
# --- Room ---
-keep class * extends androidx.room.RoomDatabase { *; }
-keep class top.yeij.cyrene.data.local.entity.** { *; }
-keepclassmembers class top.yeij.cyrene.data.local.entity.** { *; }
-dontwarn androidx.room.paging.**
# --- Koin ---
-keep class org.koin.** { *; }
-keep class top.yeij.cyrene.di.** { *; }
-keepclassmembers class top.yeij.cyrene.di.** { *; }
# --- Compose ---
-dontwarn androidx.compose.**
-keep class androidx.compose.** { *; }
# --- Coroutines ---
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
# --- Keep domain models (used in StateFlow, SharedFlow, etc.) ---
-keep class top.yeij.cyrene.domain.model.** { *; }
# --- Keep ViewModels (Koin instantiates via reflection) ---
-keep class top.yeij.cyrene.viewmodel.** { *; }
-keepclassmembers class top.yeij.cyrene.viewmodel.** { *; }
# --- Keep repository implementations (Koin binds by interface) ---
-keep class top.yeij.cyrene.data.repository.** { *; }
-keep class top.yeij.cyrene.domain.repository.** { *; }
# --- Keep PreferencesDataStore (Koin injects) ---
-keep class top.yeij.cyrene.data.local.PreferencesDataStore { *; }
# --- Keep utility classes (VoiceRecorder, RuntimeLog, etc. injected by Koin) ---
-keep class top.yeij.cyrene.util.** { *; }
-keepclassmembers class top.yeij.cyrene.util.** { *; }
# --- Keep voice/TTS/STT classes (injected by Koin into OverlayViewModel) ---
-keep class top.yeij.cyrene.voice.** { *; }
-keepclassmembers class top.yeij.cyrene.voice.** { *; }
# --- Keep domain use cases (injected by Koin into ViewModels) ---
-keep class top.yeij.cyrene.domain.usecase.** { *; }
-keepclassmembers class top.yeij.cyrene.domain.usecase.** { *; }
# --- Keep network interceptors and ApiService (Koin singletons) ---
-keep class top.yeij.cyrene.data.remote.RetrofitClient { *; }
-keep class top.yeij.cyrene.data.remote.ApiService { *; }
-keep class top.yeij.cyrene.data.remote.AuthInterceptor { *; }
-keep class top.yeij.cyrene.data.remote.DynamicUrlInterceptor { *; }
-keep class top.yeij.cyrene.data.remote.TokenAuthenticator { *; }
# --- Keep WebSocketService (injected into ChatRepositoryImpl) ---
-keep class top.yeij.cyrene.service.WebSocketService { *; }
# --- UI screens & components (called via Navigation compose lambda R8 may not trace) ---
-keep class top.yeij.cyrene.ui.screens.** { *; }
-keep class top.yeij.cyrene.ui.components.** { *; }
-keep class top.yeij.cyrene.ui.overlay.** { *; }
-keep class top.yeij.cyrene.ui.navigation.** { *; }
-keep class top.yeij.cyrene.ui.theme.** { *; }
# --- General AndroidX ---
-keep class androidx.lifecycle.** { *; }
-dontwarn androidx.lifecycle.**