diff --git a/app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt b/app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt index e9380c7b2a9..b9d1fe8f9c0 100644 --- a/app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt +++ b/app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt @@ -20,6 +20,7 @@ import org.schabi.newpipe.extractor.downloader.Response import org.schabi.newpipe.extractor.exceptions.ReCaptchaException import org.schabi.newpipe.util.ReleaseVersionUtil.coerceUpdateCheckExpiry import org.schabi.newpipe.util.ReleaseVersionUtil.isLastUpdateCheckExpired +import org.schabi.newpipe.util.ReleaseVersionUtil.isReleaseApk import org.schabi.newpipe.util.Version import java.io.IOException @@ -69,6 +70,11 @@ class NewVersionWorker( @Throws(IOException::class, ReCaptchaException::class) private fun checkNewVersion() { + // Check if the current apk is a github one or not. + if (!isReleaseApk()) { + return + } + val prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext) // Check if the last request has happened a certain time ago // to reduce the number of API requests. diff --git a/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java index a3b131d75f6..3776d78f679 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java @@ -9,6 +9,7 @@ import org.schabi.newpipe.MainActivity; import org.schabi.newpipe.R; +import org.schabi.newpipe.util.ReleaseVersionUtil; public class MainSettingsFragment extends BasePreferenceFragment { public static final boolean DEBUG = MainActivity.DEBUG; @@ -21,6 +22,14 @@ public void onCreatePreferences(final Bundle savedInstanceState, final String ro setHasOptionsMenu(true); // Otherwise onCreateOptionsMenu is not called + // Check if the app is updatable + if (!ReleaseVersionUtil.isReleaseApk()) { + getPreferenceScreen().removePreference( + findPreference(getString(R.string.update_pref_screen_key))); + + defaultPreferences.edit().putBoolean(getString(R.string.update_app_key), false).apply(); + } + // Hide debug preferences in RELEASE build variant if (!DEBUG) { getPreferenceScreen().removePreference(