mirror of
https://github.com/M66B/NetGuard.git
synced 2025-01-04 06:23:04 +00:00
Added settings to reload on every connectivity change
This commit is contained in:
parent
16a34aafdf
commit
7b96f5a950
5 changed files with 19 additions and 1 deletions
|
@ -199,6 +199,13 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
TwoStatePreference pref_reload_onconnectivity =
|
||||||
|
(TwoStatePreference) screen.findPreference("reload_onconnectivity");
|
||||||
|
pref_reload_onconnectivity.setChecked(true);
|
||||||
|
pref_reload_onconnectivity.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle port forwarding
|
// Handle port forwarding
|
||||||
Preference pref_forwarding = screen.findPreference("forwarding");
|
Preference pref_forwarding = screen.findPreference("forwarding");
|
||||||
pref_forwarding.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
pref_forwarding.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
|
|
|
@ -2257,7 +2257,9 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
@Override
|
@Override
|
||||||
public void onLinkPropertiesChanged(Network network, LinkProperties linkProperties) {
|
public void onLinkPropertiesChanged(Network network, LinkProperties linkProperties) {
|
||||||
// Make sure the right DNS servers are being used
|
// Make sure the right DNS servers are being used
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSinkhole.this);
|
||||||
|
if (prefs.getBoolean("reload_onconnectivity", false) ||
|
||||||
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||||
reload("link properties changed", ServiceSinkhole.this, false);
|
reload("link properties changed", ServiceSinkhole.this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,7 @@ however it is impossible to guarantee NetGuard will work correctly on every devi
|
||||||
<string name="setting_call">Disable on call</string>
|
<string name="setting_call">Disable on call</string>
|
||||||
<string name="setting_lockdown_wifi">Lockdown Wi-Fi</string>
|
<string name="setting_lockdown_wifi">Lockdown Wi-Fi</string>
|
||||||
<string name="setting_lockdown_other">Lockdown mobile</string>
|
<string name="setting_lockdown_other">Lockdown mobile</string>
|
||||||
|
<string name="setting_reload_onconnectivity">Reload on every connectivity change</string>
|
||||||
|
|
||||||
<string name="setting_advanced_options">Advanced options</string>
|
<string name="setting_advanced_options">Advanced options</string>
|
||||||
<string name="setting_system">Manage system apps</string>
|
<string name="setting_system">Manage system apps</string>
|
||||||
|
|
|
@ -143,6 +143,10 @@
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="lockdown_other"
|
android:key="lockdown_other"
|
||||||
android:title="@string/setting_lockdown_other" />
|
android:title="@string/setting_lockdown_other" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="reload_onconnectivity"
|
||||||
|
android:title="@string/setting_reload_onconnectivity" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,10 @@
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="lockdown_other"
|
android:key="lockdown_other"
|
||||||
android:title="@string/setting_lockdown_other" />
|
android:title="@string/setting_lockdown_other" />
|
||||||
|
<eu.faircode.netguard.SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="reload_onconnectivity"
|
||||||
|
android:title="@string/setting_reload_onconnectivity" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue