diff --git a/android/app/build.gradle b/android/app/build.gradle index 7fca7976..b18d3067 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -20,12 +20,6 @@ android { ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' } } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } // AGP 8+ requires explicit opt-in for BuildConfig generation. We rely on // BuildConfig.DEBUG to gate Log.d calls that dump privacy-sensitive // identifiers (roomId, eventId) so release builds don't leak them through @@ -33,6 +27,26 @@ android { buildFeatures { buildConfig = true } + + signingConfigs { + release { + if (project.hasProperty('VOJO_RELEASE_STORE_FILE')) { + storeFile file(VOJO_RELEASE_STORE_FILE) + storePassword VOJO_RELEASE_STORE_PASSWORD + keyAlias VOJO_RELEASE_KEY_ALIAS + keyPassword VOJO_RELEASE_KEY_PASSWORD + } + } + } + + buildTypes { + release { + minifyEnabled true + shrinkResources true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.release + } + } } repositories { diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index f1b42451..2f8647a9 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -19,3 +19,27 @@ # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile + +# Keep custom app classes — entry points invoked by Android system (Intents, +# FCM, AndroidManifest references) or by JS bridge via reflection. +-keep class chat.vojo.app.MainActivity { *; } +-keep class chat.vojo.app.VojoFirebaseMessagingService { *; } +-keep class chat.vojo.app.CallForegroundPlugin { *; } +-keep class chat.vojo.app.CallForegroundService { *; } +-keep class chat.vojo.app.CallDeclineReceiver { *; } +-keep class chat.vojo.app.CallCancelReceiver { *; } +-keep class chat.vojo.app.FullScreenIntentPlugin { *; } +-keep class chat.vojo.app.LaunchSplashPlugin { *; } + +# Firebase Messaging — receivers/services resolved by Android via manifest. +-keep public class * extends com.google.firebase.messaging.FirebaseMessagingService +-keep class com.google.firebase.iid.** { *; } +-keep class com.google.firebase.messaging.** { *; } + +# Capacitor — plugins discovered by annotation/reflection. +-keep @com.getcapacitor.annotation.CapacitorPlugin class * { *; } +-keep class com.getcapacitor.** { *; } +-keep class com.getcapacitor.plugin.** { *; } + +# AndroidX splashscreen — reflection paths. +-keep class androidx.core.splashscreen.** { *; } diff --git a/package.json b/package.json index 45ebf51b..f7873a56 100644 --- a/package.json +++ b/package.json @@ -19,12 +19,13 @@ "gen:push-strings": "node scripts/gen-push-strings.mjs", "android:sync": "npx cap sync android", "android:open": "npx cap open android", + "android:strip-sourcemaps": "find dist -name '*.map' -delete", "android:apk:debug": "cd android && ./gradlew assembleDebug", "android:apk:release": "cd android && ./gradlew assembleRelease", "android:aab:release": "cd android && ./gradlew bundleRelease", - "build:android:debug": "npm run build && npm run android:sync && npm run android:apk:debug", - "build:android:release": "npm run build && npm run android:sync && npm run android:apk:release", - "build:android:aab": "npm run build && npm run android:sync && npm run android:aab:release", + "build:android:debug": "npm run build && npm run android:strip-sourcemaps && npm run android:sync && npm run android:apk:debug", + "build:android:release": "npm run build && npm run android:strip-sourcemaps && npm run android:sync && npm run android:apk:release", + "build:android:aab": "npm run build && npm run android:strip-sourcemaps && npm run android:sync && npm run android:aab:release", "prepare": "husky install", "commit": "git-cz" },