Disable self-updater for F-Droid builds via IS_FDROID_BUILD flag

Add IS_FDROID_BUILD BuildConfig field (default false). The F-Droid
workflow (create-release.yml) flips it to true via sed before building,
alongside the existing permission removal step. Amber.kt gates the
ZapstoreUpdater instantiation on this flag so F-Droid APKs never
attempt to check for or download updates.

https://claude.ai/code/session_01NmFcCFmEbY7NMradkEU5bv
This commit is contained in:
Claude
2026-04-06 13:59:24 -03:00
committed by greenart7c3
parent 039d50987f
commit 682b557c07
3 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -29,9 +29,10 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Remove self-update permission for F-Droid build
- name: Prepare F-Droid build (no self-update)
run: |
sed -i '/android.permission.REQUEST_INSTALL_PACKAGES/d' app/src/main/AndroidManifest.xml
sed -i 's/buildConfigField "boolean", "IS_FDROID_BUILD", "false"/buildConfigField "boolean", "IS_FDROID_BUILD", "true"/' app/build.gradle
- name: Build APK
run: ./gradlew assembleRelease --stacktrace
+2
View File
@@ -15,6 +15,8 @@ android {
versionCode 184
versionName "6.0.0-pre1"
buildConfigField "boolean", "IS_FDROID_BUILD", "false"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
@@ -132,7 +132,7 @@ class Amber :
// This runs on the foreground only
val profileSubscription = ProfileSubscription(client, this, applicationIOScope)
val zapstoreUpdater: ZapstoreUpdater? = if (!BuildFlavorChecker.isOfflineFlavor()) {
val zapstoreUpdater: ZapstoreUpdater? = if (!BuildFlavorChecker.isOfflineFlavor() && !BuildConfig.IS_FDROID_BUILD) {
ZapstoreUpdater(client, applicationIOScope)
} else {
null