From 8bdaddb3892e2402d12faa844a3fb0c5ffad0d73 Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Sat, 23 Jun 2018 22:41:01 +0200 Subject: [PATCH] Allow backwards compatibility to previous solution to add quotes --- .../NSClientInternal/NsClientReceiverDelegate.java | 3 ++- .../NSClientInternal/NsClientReceiverDelegateTest.java | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NsClientReceiverDelegate.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NsClientReceiverDelegate.java index aa085d2a2d..ba6ec2c80b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NsClientReceiverDelegate.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NsClientReceiverDelegate.java @@ -122,7 +122,8 @@ class NsClientReceiverDelegate { boolean newAllowedState = true; if (ev.wifiConnected) { - if (!allowedSSIDs.trim().isEmpty() && !allowedSSIDs.contains(ev.getSsid())) { + if (!allowedSSIDs.trim().isEmpty() && + (!allowedSSIDs.contains(ev.getSsid()) && !allowedSSIDs.contains(ev.ssid))) { newAllowedState = false; } } else { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/NSClientInternal/NsClientReceiverDelegateTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/NSClientInternal/NsClientReceiverDelegateTest.java index 70e8d2c9b7..5bb1ca9a44 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/NSClientInternal/NsClientReceiverDelegateTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/NSClientInternal/NsClientReceiverDelegateTest.java @@ -70,6 +70,14 @@ public class NsClientReceiverDelegateTest { ev.mobileConnected = true; ev.wifiConnected = true; assertTrue(sut.calculateStatus(ev)); + + ev.ssid = "test"; + when(SP.getString(anyInt(), anyString())).thenReturn("\"test\""); + assertTrue(sut.calculateStatus(ev)); + + ev.ssid = "\"test\""; + assertTrue(sut.calculateStatus(ev)); + ev.wifiConnected = false; assertTrue(sut.calculateStatus(ev));