Fix Boolean thingy
This commit is contained in:
parent
02e9ce105c
commit
306d45bb3e
|
@ -121,10 +121,16 @@ class NsClientReceiverDelegate {
|
||||||
|
|
||||||
boolean newAllowedState = true;
|
boolean newAllowedState = true;
|
||||||
|
|
||||||
if (!ev.wifiConnected && wifiOnly) newAllowedState = false;
|
if (ev.wifiConnected) {
|
||||||
if (ev.wifiConnected && !allowedSSIDs.trim().isEmpty() && !allowedSSIDs.contains(ev.ssid))
|
if (!allowedSSIDs.trim().isEmpty() && !allowedSSIDs.contains(ev.ssid)) {
|
||||||
newAllowedState = false;
|
newAllowedState = false;
|
||||||
if (!ev.wifiConnected && !allowRoaming && ev.roaming) newAllowedState = false;
|
}
|
||||||
|
} else {
|
||||||
|
if ((!allowRoaming && ev.roaming) || wifiOnly) {
|
||||||
|
newAllowedState = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return newAllowedState;
|
return newAllowedState;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,5 +111,13 @@ public class NsClientReceiverDelegateTest {
|
||||||
ev.wifiConnected = true;
|
ev.wifiConnected = true;
|
||||||
ev.roaming = true;
|
ev.roaming = true;
|
||||||
assertTrue(sut.calculateStatus(ev));
|
assertTrue(sut.calculateStatus(ev));
|
||||||
|
|
||||||
|
// wifiOnly = false
|
||||||
|
// allowRoaming = false
|
||||||
|
when(SP.getBoolean(R.string.key_ns_wifionly, false)).thenReturn(false);
|
||||||
|
when(SP.getBoolean(R.string.key_ns_allowroaming, true)).thenReturn(false);
|
||||||
|
ev.wifiConnected = true;
|
||||||
|
ev.roaming = true;
|
||||||
|
assertTrue(sut.calculateStatus(ev));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue