Merge branch 'dev' into dagger3

This commit is contained in:
Milos Kozak 2020-03-21 18:32:23 +01:00
commit 235d241736
4 changed files with 27 additions and 5 deletions

View file

@ -92,6 +92,7 @@ import info.nightscout.androidaps.plugins.source.RandomBgPlugin;
import info.nightscout.androidaps.plugins.source.TomatoPlugin;
import info.nightscout.androidaps.plugins.source.XdripPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.receivers.ChargingStateReceiver;
import info.nightscout.androidaps.receivers.DataReceiver;
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
import info.nightscout.androidaps.receivers.NetworkChangeReceiver;
@ -346,6 +347,7 @@ public class MainApp extends DaggerApplication {
intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
registerReceiver(new NetworkChangeReceiver(), intentFilter);
registerReceiver(new ChargingStateReceiver(), new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
}
@Deprecated

View file

@ -63,7 +63,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_calibration), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
aapsLogger.debug("USER ENTRY: CALIBRATION $bg")
XdripCalibrations.confirmAndSendCalibration(bg, context)
XdripCalibrations.sendIntent(bg)
})
}
} else
@ -72,4 +72,4 @@ class CalibrationDialog : DialogFragmentWithDate() {
}
return true
}
}
}

View file

@ -31,6 +31,7 @@ import javax.inject.Inject;
import dagger.android.DaggerService;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
@ -70,6 +71,7 @@ import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.JsonHelper;
import info.nightscout.androidaps.utils.T;
import info.nightscout.androidaps.utils.buildHelper.BuildHelper;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
import io.reactivex.disposables.CompositeDisposable;
@ -88,6 +90,7 @@ public class NSClientService extends DaggerService {
@Inject ResourceHelper resourceHelper;
@Inject SP sp;
@Inject NSClientPlugin nsClientPlugin;
@Inject BuildHelper buildHelper;
private static Logger log = StacktraceLoggerWrapper.getLogger(L.NSCLIENT);
private CompositeDisposable disposable = new CompositeDisposable();
@ -290,7 +293,7 @@ public class NSClientService extends DaggerService {
} else if (!nsEnabled) {
rxBus.send(new EventNSClientNewLog("NSCLIENT", "disabled"));
rxBus.send(new EventNSClientStatus("Disabled"));
} else if (!nsURL.equals("")) {
} else if (!nsURL.equals("") && (buildHelper.isEngineeringMode() || nsURL.toLowerCase().startsWith("https://"))) {
try {
rxBus.send(new EventNSClientStatus("Connecting ..."));
IO.Options opt = new IO.Options();
@ -299,6 +302,9 @@ public class NSClientService extends DaggerService {
mSocket = IO.socket(nsURL, opt);
mSocket.on(Socket.EVENT_CONNECT, onConnect);
mSocket.on(Socket.EVENT_DISCONNECT, onDisconnect);
mSocket.on(Socket.EVENT_ERROR, onError);
mSocket.on(Socket.EVENT_CONNECT_ERROR, onError);
mSocket.on(Socket.EVENT_CONNECT_TIMEOUT, onError);
mSocket.on(Socket.EVENT_PING, onPing);
rxBus.send(new EventNSClientNewLog("NSCLIENT", "do connect"));
mSocket.connect();
@ -311,6 +317,9 @@ public class NSClientService extends DaggerService {
rxBus.send(new EventNSClientNewLog("NSCLIENT", "Wrong URL syntax"));
rxBus.send(new EventNSClientStatus("Wrong URL syntax"));
}
} else if (nsURL.toLowerCase().startsWith("http://")) {
rxBus.send(new EventNSClientNewLog("NSCLIENT", "NS URL not encrypted"));
rxBus.send(new EventNSClientStatus("Not encrypted"));
} else {
rxBus.send(new EventNSClientNewLog("NSCLIENT", "No NS URL specified"));
rxBus.send(new EventNSClientStatus("Not configured"));
@ -408,6 +417,17 @@ public class NSClientService extends DaggerService {
nsDevice = sp.getString("careportal_enteredby", "");
}
private Emitter.Listener onError = new Emitter.Listener() {
@Override
public void call(final Object... args) {
String msg = "Unknown Error";
if (args.length > 0 && args[0] != null) {
msg = args[0].toString();
}
rxBus.send(new EventNSClientNewLog("ERROR", msg));
}
};
private Emitter.Listener onPing = new Emitter.Listener() {
@Override
public void call(final Object... args) {

View file

@ -827,7 +827,7 @@
<string name="overview_show_activity">Actividade</string>
<string name="overview_show_sensitivity">Sensibilidade</string>
<string name="overview_show_deviations">Desvios</string>
<string name="overview_show_cob">Carboidratos a bordo</string>
<string name="overview_show_cob">Hidratos a Bordo (COB)</string>
<string name="overview_show_iob">Insulina a bordo</string>
<string name="overview_show_basals">Basais</string>
<string name="no_action_selected">Nenhuma acção seleccionada, nada irá acontecer</string>
@ -883,7 +883,7 @@
<string name="reset">repor</string>
<string name="waitingfortimesynchronization">À espera da sincronização da hora (%1$d sec)</string>
<string name="loopdisconnectedfor">Desligado (%1$d m)</string>
<string name="openapssmb_maxiob_title">Máximo total IOS OpenAPS não pode superar [U]</string>
<string name="openapssmb_maxiob_title">Máximo total IOB OpenAPS não pode superar [U]</string>
<string name="openapssmb_maxiob_summary">Este valor é chamado de Max IOB em contexto de OpenAPS\nOpenAPS não adicionará mais insulina se o IOB atual for maior que este valor</string>
<string name="pump_stopped">Bomba parada</string>
<string name="pump_started">Bomba iniciada</string>