mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-21 23:33:21 +00:00
skip automatic update check notification for beta releases
This commit is contained in:
parent
f07ec3b6ed
commit
cf63219eaf
6 changed files with 26 additions and 4 deletions
|
@ -319,8 +319,10 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
|||
|
||||
pref_rcode.setTitle(getString(R.string.setting_rcode, prefs.getString("rcode", "3")));
|
||||
|
||||
if (Util.isPlayStoreInstall(this) || !Util.hasValidFingerprint(this))
|
||||
if (Util.isPlayStoreInstall(this) || !Util.hasValidFingerprint(this)) {
|
||||
cat_options.removePreference(screen.findPreference("update_check"));
|
||||
cat_options.removePreference(screen.findPreference("beta_release"));
|
||||
}
|
||||
|
||||
if (Util.isPlayStoreInstall(this)) {
|
||||
Log.i(TAG, "Play store install");
|
||||
|
|
|
@ -118,6 +118,7 @@ public class ReceiverAutostart extends BroadcastReceiver {
|
|||
|
||||
if (Util.isPlayStoreInstall(context)) {
|
||||
editor.remove("update_check");
|
||||
editor.remove("beta_release");
|
||||
editor.remove("use_hosts");
|
||||
editor.remove("hosts_url");
|
||||
}
|
||||
|
|
|
@ -671,7 +671,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
if (!Util.isPlayStoreInstall(ServiceSinkhole.this) &&
|
||||
Util.hasValidFingerprint(ServiceSinkhole.this) &&
|
||||
prefs.getBoolean("update_check", true))
|
||||
checkUpdate();
|
||||
checkUpdate(prefs.getBoolean("beta_release", false));
|
||||
}
|
||||
|
||||
private void watchdog(Intent intent) {
|
||||
|
@ -684,7 +684,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
}
|
||||
}
|
||||
|
||||
private void checkUpdate() {
|
||||
private void checkUpdate(boolean notifyForBetaReleases) {
|
||||
StringBuilder json = new StringBuilder();
|
||||
HttpsURLConnection urlConnection = null;
|
||||
try {
|
||||
|
@ -705,7 +705,12 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
|
||||
try {
|
||||
JSONObject jroot = new JSONObject(json.toString());
|
||||
if (jroot.has("tag_name") && jroot.has("html_url") && jroot.has("assets")) {
|
||||
if (jroot.has("tag_name") && jroot.has("html_url") && jroot.has("assets") && jroot.has("name")) {
|
||||
String releaseName = jroot.getString("name");
|
||||
if (!notifyForBetaReleases && releaseName.contains("beta")) {
|
||||
Log.i(TAG, "Skipping beta release '" + releaseName + "' due to update preferences");
|
||||
return;
|
||||
}
|
||||
String url = jroot.getString("html_url");
|
||||
JSONArray jassets = jroot.getJSONArray("assets");
|
||||
if (jassets.length() > 0) {
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
<string name="setting_auto">Auto enable after %1$s minutes</string>
|
||||
<string name="setting_delay">Delay screen off %1$s minutes</string>
|
||||
<string name="setting_update">Check for updates</string>
|
||||
<string name="setting_beta_release">Beta releases</string>
|
||||
|
||||
<string name="setting_network_options">Network options</string>
|
||||
<string name="setting_subnet">Subnet routing</string>
|
||||
|
@ -155,6 +156,7 @@
|
|||
<string name="summary_auto">After disabling using the widget, automatically enable NetGuard again after the selected number of minutes (enter zero to disable this option)</string>
|
||||
<string name="summary_delay">After turning the screen off, keep screen on rules active for the selected number of minutes (enter zero to disable this option)</string>
|
||||
<string name="summary_update">Check for new releases on GitHub twice daily</string>
|
||||
<string name="summary_beta_release">Notify for beta releases</string>
|
||||
|
||||
<string name="summary_tethering">Depending on the Android version, tethering may work or may not work. Tethered traffic cannot be filtered.</string>
|
||||
<string name="summary_subnet">Enable subnet routing; might enable Wi-Fi calling, but might also trigger bugs in Android and increase battery usage</string>
|
||||
|
|
|
@ -70,6 +70,12 @@
|
|||
android:key="update_check"
|
||||
android:summary="@string/summary_update"
|
||||
android:title="@string/setting_update" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:dependency="update_check"
|
||||
android:key="beta_release"
|
||||
android:summary="@string/summary_beta_release"
|
||||
android:title="@string/setting_beta_release" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
|
|
|
@ -70,6 +70,12 @@
|
|||
android:key="update_check"
|
||||
android:summary="@string/summary_update"
|
||||
android:title="@string/setting_update" />
|
||||
<eu.faircode.netguard.SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:dependency="update_check"
|
||||
android:key="beta_release"
|
||||
android:summary="@string/summary_beta_release"
|
||||
android:title="@string/setting_beta_release" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
|
|
Loading…
Reference in a new issue