From 86b04e69eee1b3d5c6c265e6ddb327a7879603c5 Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Sun, 28 Mar 2021 23:32:27 +0900 Subject: [PATCH] Skip update check for pre-release builds --- app/build.gradle | 3 +++ .../java/awais/instagrabber/activities/MainActivity.java | 7 +++++-- .../fragments/settings/MorePreferencesFragment.java | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9b39a1a2..f48a0439 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -66,11 +66,13 @@ android { dimension "repo" // versionNameSuffix "-github" // appended in assemble task buildConfigField("String", "dsn", SENTRY_DSN) + buildConfigField("boolean", "isPre", "false") } fdroid { dimension "repo" versionNameSuffix "-fdroid" + buildConfigField("boolean", "isPre", "false") } } @@ -84,6 +86,7 @@ android { def suffix = "${versionName}-${flavor}_${builtType}" // eg. 19.1.0-github_debug or release if (builtType.toString() == 'release' && project.hasProperty("pre")) { + buildConfigField("boolean", "isPre", "true") // append latest commit short hash for pre-release suffix = "${versionName}.${getGitHash()}-${flavor}" // eg. 19.1.0.b123456-github } diff --git a/app/src/main/java/awais/instagrabber/activities/MainActivity.java b/app/src/main/java/awais/instagrabber/activities/MainActivity.java index 408a841a..5ea65279 100644 --- a/app/src/main/java/awais/instagrabber/activities/MainActivity.java +++ b/app/src/main/java/awais/instagrabber/activities/MainActivity.java @@ -58,6 +58,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import awais.instagrabber.BuildConfig; import awais.instagrabber.R; import awais.instagrabber.adapters.SuggestionsAdapter; import awais.instagrabber.asyncs.PostFetcher; @@ -163,8 +164,10 @@ public class MainActivity extends BaseLanguageActivity implements FragmentManage setupBottomNavigationBar(true); } setupSuggestions(); - final boolean checkUpdates = settingsHelper.getBoolean(Constants.CHECK_UPDATES); - if (checkUpdates) FlavorTown.updateCheck(this); + if (!BuildConfig.isPre) { + final boolean checkUpdates = settingsHelper.getBoolean(Constants.CHECK_UPDATES); + if (checkUpdates) FlavorTown.updateCheck(this); + } FlavorTown.changelogCheck(this); new ViewModelProvider(this).get(AppStateViewModel.class); // Just initiate the App state here final Intent intent = getIntent(); diff --git a/app/src/main/java/awais/instagrabber/fragments/settings/MorePreferencesFragment.java b/app/src/main/java/awais/instagrabber/fragments/settings/MorePreferencesFragment.java index 1343bb60..684888c5 100644 --- a/app/src/main/java/awais/instagrabber/fragments/settings/MorePreferencesFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/settings/MorePreferencesFragment.java @@ -193,6 +193,7 @@ public class MorePreferencesFragment extends BasePreferencesFragment { BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")", -1, preference -> { + if (BuildConfig.isPre) return true; final AppCompatActivity activity = (AppCompatActivity) getActivity(); if (activity == null) return true; FlavorTown.updateCheck(activity, true);