Skip update check for pre-release builds

This commit is contained in:
Ammar Githam 2021-03-28 23:32:27 +09:00
parent 1089a39375
commit 86b04e69ee
3 changed files with 9 additions and 2 deletions

View File

@ -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
}

View File

@ -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();

View File

@ -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);