diff --git a/app/build.gradle b/app/build.gradle index f58186c..cb71ef2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,6 +28,25 @@ android { debuggable true } } + + flavorDimensions "type" + productFlavors { + "default" { + dimension "type" + buildConfigField "boolean", "ENABLE_AUTO_UPDATER", "true" + } + + fdroid { + dimension "type" + applicationIdSuffix ".fdroid" + + // Need to disable auto-updater for F-Droid flavor because their inclusion policy + // forbids downloading blobs from third-party websites (and F-Droid APK isn't signed + // with our keys, so the APK wouldn't install anyways). + buildConfigField "boolean", "ENABLE_AUTO_UPDATER", "false" + } + } + compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 diff --git a/app/src/main/java/com/fox2code/mmm/AppUpdateManager.java b/app/src/main/java/com/fox2code/mmm/AppUpdateManager.java index 4a043d7..62acff2 100644 --- a/app/src/main/java/com/fox2code/mmm/AppUpdateManager.java +++ b/app/src/main/java/com/fox2code/mmm/AppUpdateManager.java @@ -63,6 +63,8 @@ public class AppUpdateManager { // Return true if should show a notification public boolean checkUpdate(boolean force) { + if (!BuildConfig.ENABLE_AUTO_UPDATER) + return false; if (!force && this.peekShouldUpdate()) return true; long lastChecked = this.lastChecked;