mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-25 18:35:06 +01:00
Fixed account/VPN only state changes
This commit is contained in:
@@ -38,6 +38,7 @@ public class TupleAccountNetworkState {
|
||||
public TupleAccountState accountState;
|
||||
|
||||
private JSONObject jconditions;
|
||||
private Boolean network_vpn_only;
|
||||
|
||||
public TupleAccountNetworkState(
|
||||
boolean enabled,
|
||||
@@ -65,8 +66,10 @@ public class TupleAccountNetworkState {
|
||||
public boolean canConnect(Context context) {
|
||||
boolean unmetered = jconditions.optBoolean("unmetered");
|
||||
boolean vpn_only = jconditions.optBoolean("vpn_only");
|
||||
if (vpn_only && this.network_vpn_only == null)
|
||||
this.network_vpn_only = ConnectionHelper.vpnActive(context);
|
||||
return (!unmetered || this.networkState.isUnmetered()) &&
|
||||
(!vpn_only || ConnectionHelper.vpnActive(context));
|
||||
(!vpn_only || this.network_vpn_only);
|
||||
}
|
||||
|
||||
public boolean canRun(Context context) {
|
||||
|
||||
Reference in New Issue
Block a user