Fix Boolean thingy
This commit is contained in:
parent
02e9ce105c
commit
306d45bb3e
|
@ -121,10 +121,16 @@ class NsClientReceiverDelegate {
|
|||
|
||||
boolean newAllowedState = true;
|
||||
|
||||
if (!ev.wifiConnected && wifiOnly) newAllowedState = false;
|
||||
if (ev.wifiConnected && !allowedSSIDs.trim().isEmpty() && !allowedSSIDs.contains(ev.ssid))
|
||||
if (ev.wifiConnected) {
|
||||
if (!allowedSSIDs.trim().isEmpty() && !allowedSSIDs.contains(ev.ssid)) {
|
||||
newAllowedState = false;
|
||||
if (!ev.wifiConnected && !allowRoaming && ev.roaming) newAllowedState = false;
|
||||
}
|
||||
} else {
|
||||
if ((!allowRoaming && ev.roaming) || wifiOnly) {
|
||||
newAllowedState = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return newAllowedState;
|
||||
}
|
||||
|
|
|
@ -111,5 +111,13 @@ public class NsClientReceiverDelegateTest {
|
|||
ev.wifiConnected = true;
|
||||
ev.roaming = true;
|
||||
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