From 5ba9022374636b5ce09c5eaa48b0f064b865d23d Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 24 Jul 2016 10:40:12 +0200 Subject: [PATCH] Remove development options from release versions --- .../faircode/netguard/ActivitySettings.java | 29 +++++++++---------- .../java/eu/faircode/netguard/Receiver.java | 4 ++- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/ActivitySettings.java b/app/src/main/java/eu/faircode/netguard/ActivitySettings.java index 2421fe37..56d9c455 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivitySettings.java +++ b/app/src/main/java/eu/faircode/netguard/ActivitySettings.java @@ -132,7 +132,6 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere PreferenceGroup cat_advanced = (PreferenceGroup) ((PreferenceGroup) screen.findPreference("screen_advanced_options")).findPreference("category_advanced_options"); PreferenceGroup cat_stats = (PreferenceGroup) ((PreferenceGroup) screen.findPreference("screen_stats")).findPreference("category_stats"); PreferenceGroup cat_backup = (PreferenceGroup) ((PreferenceGroup) screen.findPreference("screen_backup")).findPreference("category_backup"); - PreferenceGroup cat_development = (PreferenceGroup) ((PreferenceGroup) screen.findPreference("screen_development")).findPreference("category_development"); // Handle auto enable Preference pref_auto_enable = screen.findPreference("auto_enable"); @@ -346,21 +345,19 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere } // Development - Preference pref_show_resolved = screen.findPreference("show_resolved"); - if (!(Util.isDebuggable(this) || Util.getSelfVersionName(this).contains("beta"))) { - screen.removePreference(cat_development); - prefs.edit().remove("loglevel").apply(); - } else if (!Util.isDebuggable(this)) - cat_development.removePreference(pref_show_resolved); - - // Show resolved - pref_show_resolved.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - startActivity(new Intent(ActivitySettings.this, ActivityDns.class)); - return true; - } - }); + if (!Util.isDebuggable(this)) + screen.removePreference(screen.findPreference("screen_development")); + else { + // Show resolved + Preference pref_show_resolved = screen.findPreference("show_resolved"); + pref_show_resolved.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + startActivity(new Intent(ActivitySettings.this, ActivityDns.class)); + return true; + } + }); + } // Handle technical info Preference.OnPreferenceClickListener listener = new Preference.OnPreferenceClickListener() { diff --git a/app/src/main/java/eu/faircode/netguard/Receiver.java b/app/src/main/java/eu/faircode/netguard/Receiver.java index f2b7b079..84765738 100644 --- a/app/src/main/java/eu/faircode/netguard/Receiver.java +++ b/app/src/main/java/eu/faircode/netguard/Receiver.java @@ -249,9 +249,11 @@ public class Receiver extends BroadcastReceiver { editor.remove("update_check"); editor.remove("use_hosts"); editor.remove("hosts_url"); - editor.remove("loglevel"); } + if (!Util.isDebuggable(context)) + editor.remove("loglevel"); + editor.putInt("version", newVersion); editor.apply(); }