Skip to content

Commit 4b07adb

Browse files
committed
Restore ns_noupload function. Thanks to @twain47
1 parent b8ce236 commit 4b07adb

File tree

1 file changed

+16
-13
lines changed
  • app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient

1 file changed

+16
-13
lines changed

app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/UploadQueue.java

+16-13
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
import java.sql.SQLException;
1515

1616
import info.nightscout.androidaps.MainApp;
17+
import info.nightscout.androidaps.R;
1718
import info.nightscout.androidaps.db.DatabaseHelper;
1819
import info.nightscout.androidaps.db.DbRequest;
1920
import info.nightscout.androidaps.logging.L;
2021
import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientService;
22+
import info.nightscout.androidaps.utils.SP;
2123

2224
/**
2325
* Created by mike on 21.02.2016.
@@ -42,21 +44,22 @@ private static void startService() {
4244
}
4345

4446
public static void add(final DbRequest dbr) {
47+
if (SP.getBoolean(R.string.key_ns_noupload, false)) return;
4548
startService();
46-
if (L.isEnabled(L.NSCLIENT))
47-
log.debug("Adding to queue: " + dbr.log());
48-
try {
49-
MainApp.getDbHelper().create(dbr);
50-
} catch (Exception e) {
51-
log.error("Unhandled exception", e);
52-
}
53-
NSClientPlugin plugin = NSClientPlugin.getPlugin();
54-
if (plugin != null) {
55-
plugin.resend("newdata");
56-
}
49+
if (L.isEnabled(L.NSCLIENT))
50+
log.debug("Adding to queue: " + dbr.log());
51+
try {
52+
MainApp.getDbHelper().create(dbr);
53+
} catch (Exception e) {
54+
log.error("Unhandled exception", e);
55+
}
56+
NSClientPlugin plugin = NSClientPlugin.getPlugin();
57+
if (plugin != null) {
58+
plugin.resend("newdata");
59+
}
5760
}
5861

59-
public static void clearQueue() {
62+
static void clearQueue() {
6063
startService();
6164
if (NSClientService.handler != null) {
6265
NSClientService.handler.post(() -> {
@@ -104,7 +107,7 @@ public static void removeID(final String action, final String _id) {
104107
}
105108
}
106109

107-
public String textList() {
110+
String textList() {
108111
String result = "";
109112
CloseableIterator<DbRequest> iterator;
110113
try {

0 commit comments

Comments
 (0)