Browse Source

Skip update check for pre-release builds

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
86b04e69ee
  1. 3
      app/build.gradle
  2. 7
      app/src/main/java/awais/instagrabber/activities/MainActivity.java
  3. 1
      app/src/main/java/awais/instagrabber/fragments/settings/MorePreferencesFragment.java

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

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

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

Loading…
Cancel
Save