1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-22 07:43:15 +00:00

Reload on network changed

This commit is contained in:
M66B 2024-06-04 12:33:45 +02:00
parent f050f90e2c
commit 8fa72e48ee

View file

@ -2619,6 +2619,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
builder.addCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
ConnectivityManager.NetworkCallback nc = new ConnectivityManager.NetworkCallback() {
private Network last_network = null;
private Boolean last_connected = null;
private Boolean last_metered = null;
private String last_generation = null;
@ -2663,6 +2664,9 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
String reason = null;
if (reason == null && !Objects.equals(network, last_network))
reason = "Network changed";
if (reason == null && last_connected != null && !last_connected.equals(connected))
reason = "Connected state changed";
@ -2680,6 +2684,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
if (reason != null)
reload(reason, ServiceSinkhole.this, false);
last_network = network;
last_connected = connected;
last_metered = metered;
last_generation = generation;