Merge branch 'dev' of https://github.com/nightscout/AndroidAPS into dev
This commit is contained in:
commit
a0c9ab7de0
|
@ -2,6 +2,22 @@
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
<option name="AUTODETECT_INDENTS" value="false" />
|
<option name="AUTODETECT_INDENTS" value="false" />
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
|
<value>
|
||||||
|
<package name="java.util" alias="false" withSubpackages="false" />
|
||||||
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
|
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||||
|
<value>
|
||||||
|
<package name="" alias="false" withSubpackages="true" />
|
||||||
|
<package name="java" alias="false" withSubpackages="true" />
|
||||||
|
<package name="javax" alias="false" withSubpackages="true" />
|
||||||
|
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||||
|
<package name="" alias="true" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
|
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="6" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="6" />
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="6" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="6" />
|
||||||
|
|
|
@ -10,7 +10,9 @@ import info.nightscout.androidaps.Config
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.db.DatabaseHelperProvider
|
import info.nightscout.androidaps.db.DatabaseHelperProvider
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.*
|
||||||
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
|
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefs
|
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefs
|
||||||
|
@ -23,10 +25,10 @@ import info.nightscout.androidaps.utils.androidNotification.NotificationHolder
|
||||||
import info.nightscout.androidaps.utils.resources.IconsProvider
|
import info.nightscout.androidaps.utils.resources.IconsProvider
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.androidaps.utils.rx.DefaultAapsSchedulers
|
import info.nightscout.androidaps.utils.rx.DefaultAapsSchedulers
|
||||||
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
import info.nightscout.androidaps.utils.storage.FileStorage
|
import info.nightscout.androidaps.utils.storage.FileStorage
|
||||||
import info.nightscout.androidaps.utils.storage.Storage
|
import info.nightscout.androidaps.utils.storage.Storage
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Module(includes = [
|
@Module(includes = [
|
||||||
AppModule.AppBindings::class
|
AppModule.AppBindings::class
|
||||||
])
|
])
|
||||||
|
@ -56,9 +58,18 @@ open class AppModule {
|
||||||
@Singleton
|
@Singleton
|
||||||
internal fun provideSchedulers(): AapsSchedulers = DefaultAapsSchedulers()
|
internal fun provideSchedulers(): AapsSchedulers = DefaultAapsSchedulers()
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun providesUploadQueue(
|
||||||
|
aapsLogger: AAPSLogger,
|
||||||
|
databaseHelper: DatabaseHelperInterface,
|
||||||
|
context: Context,
|
||||||
|
sp: SP,
|
||||||
|
rxBus: RxBusWrapper
|
||||||
|
): UploadQueueAdminInterface = UploadQueue(aapsLogger, databaseHelper, context, sp, rxBus)
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
interface AppBindings {
|
interface AppBindings {
|
||||||
|
|
||||||
@Binds fun bindContext(mainApp: MainApp): Context
|
@Binds fun bindContext(mainApp: MainApp): Context
|
||||||
@Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector
|
@Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector
|
||||||
@Binds fun bindActivePluginProvider(pluginStore: PluginStore): ActivePluginProvider
|
@Binds fun bindActivePluginProvider(pluginStore: PluginStore): ActivePluginProvider
|
||||||
|
@ -67,12 +78,13 @@ open class AppModule {
|
||||||
@Binds fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilderInterface
|
@Binds fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilderInterface
|
||||||
@Binds fun bindTreatmentInterface(treatmentsPlugin: TreatmentsPlugin): TreatmentsInterface
|
@Binds fun bindTreatmentInterface(treatmentsPlugin: TreatmentsPlugin): TreatmentsInterface
|
||||||
@Binds fun bindDatabaseHelperInterface(databaseHelperProvider: DatabaseHelperProvider): DatabaseHelperInterface
|
@Binds fun bindDatabaseHelperInterface(databaseHelperProvider: DatabaseHelperProvider): DatabaseHelperInterface
|
||||||
@Binds fun bindUploadQueueInterface(uploadQueue: UploadQueue): UploadQueueInterface
|
|
||||||
@Binds fun bindNotificationHolderInterface(notificationHolder: NotificationHolder): NotificationHolderInterface
|
@Binds fun bindNotificationHolderInterface(notificationHolder: NotificationHolder): NotificationHolderInterface
|
||||||
@Binds fun bindImportExportPrefsInterface(importExportPrefs: ImportExportPrefs): ImportExportPrefsInterface
|
@Binds fun bindImportExportPrefsInterface(importExportPrefs: ImportExportPrefs): ImportExportPrefsInterface
|
||||||
@Binds fun bindIconsProviderInterface(iconsProvider: IconsProvider): IconsProviderInterface
|
@Binds fun bindIconsProviderInterface(iconsProvider: IconsProvider): IconsProviderInterface
|
||||||
@Binds fun bindLoopInterface(loopPlugin: LoopPlugin): LoopInterface
|
@Binds fun bindLoopInterface(loopPlugin: LoopPlugin): LoopInterface
|
||||||
@Binds fun bindIobCobCalculatorInterface(iobCobCalculatorPlugin: IobCobCalculatorPlugin): IobCobCalculatorInterface
|
@Binds fun bindIobCobCalculatorInterface(iobCobCalculatorPlugin: IobCobCalculatorPlugin): IobCobCalculatorInterface
|
||||||
@Binds fun bindSmsCommunicatorInterface(smsCommunicatorPlugin: SmsCommunicatorPlugin): SmsCommunicatorInterface
|
@Binds fun bindSmsCommunicatorInterface(smsCommunicatorPlugin: SmsCommunicatorPlugin): SmsCommunicatorInterface
|
||||||
|
@Binds fun bindUploadQueueAdminInterfaceToUploadQueue(uploadQueueAdminInterface: UploadQueueAdminInterface) : UploadQueueInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@ import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentService
|
import info.nightscout.androidaps.plugins.treatments.TreatmentService
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
@ -34,7 +34,7 @@ class TreatmentsPluginHistory @Inject constructor(
|
||||||
nsUpload: NSUpload,
|
nsUpload: NSUpload,
|
||||||
fabricPrivacy: FabricPrivacy,
|
fabricPrivacy: FabricPrivacy,
|
||||||
dateUtil: DateUtil,
|
dateUtil: DateUtil,
|
||||||
uploadQueue: UploadQueue,
|
uploadQueue: UploadQueueInterface,
|
||||||
databaseHelper: DatabaseHelperInterface,
|
databaseHelper: DatabaseHelperInterface,
|
||||||
repository: AppRepository
|
repository: AppRepository
|
||||||
) : TreatmentsPlugin(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, context, sp, profileFunction, activePlugin, nsUpload, fabricPrivacy, dateUtil, uploadQueue, databaseHelper, repository) {
|
) : TreatmentsPlugin(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, context, sp, profileFunction, activePlugin, nsUpload, fabricPrivacy, dateUtil, uploadQueue, databaseHelper, repository) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.android.support.DaggerFragment;
|
import dagger.android.support.DaggerFragment;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueAdminInterface;
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry;
|
import info.nightscout.androidaps.database.entities.UserEntry;
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.*;
|
import info.nightscout.androidaps.database.entities.UserEntry.*;
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger;
|
import info.nightscout.androidaps.logging.UserEntryLogger;
|
||||||
|
@ -36,7 +37,7 @@ public class NSClientFragment extends DaggerFragment implements View.OnClickList
|
||||||
@Inject SP sp;
|
@Inject SP sp;
|
||||||
@Inject ResourceHelper resourceHelper;
|
@Inject ResourceHelper resourceHelper;
|
||||||
@Inject RxBusWrapper rxBus;
|
@Inject RxBusWrapper rxBus;
|
||||||
@Inject UploadQueue uploadQueue;
|
@Inject UploadQueueAdminInterface uploadQueue;
|
||||||
@Inject FabricPrivacy fabricPrivacy;
|
@Inject FabricPrivacy fabricPrivacy;
|
||||||
@Inject AapsSchedulers aapsSchedulers;
|
@Inject AapsSchedulers aapsSchedulers;
|
||||||
@Inject UserEntryLogger uel;
|
@Inject UserEntryLogger uel;
|
||||||
|
|
|
@ -11,12 +11,11 @@ import org.json.JSONObject;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||||
import info.nightscout.androidaps.db.DbRequest;
|
import info.nightscout.androidaps.db.DbRequest;
|
||||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueAdminInterface;
|
||||||
import info.nightscout.androidaps.interfaces.UploadQueueInterface;
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
|
@ -28,14 +27,13 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
/**
|
/**
|
||||||
* Created by mike on 21.02.2016.
|
* Created by mike on 21.02.2016.
|
||||||
*/
|
*/
|
||||||
public class UploadQueue implements UploadQueueInterface {
|
public class UploadQueue implements UploadQueueAdminInterface {
|
||||||
private final AAPSLogger aapsLogger;
|
private final AAPSLogger aapsLogger;
|
||||||
private final DatabaseHelperInterface databaseHelper;
|
private final DatabaseHelperInterface databaseHelper;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final SP sp;
|
private final SP sp;
|
||||||
private final RxBusWrapper rxBus;
|
private final RxBusWrapper rxBus;
|
||||||
|
|
||||||
@Inject
|
|
||||||
public UploadQueue(
|
public UploadQueue(
|
||||||
AAPSLogger aapsLogger,
|
AAPSLogger aapsLogger,
|
||||||
DatabaseHelperInterface databaseHelper,
|
DatabaseHelperInterface databaseHelper,
|
||||||
|
@ -54,6 +52,7 @@ public class UploadQueue implements UploadQueueInterface {
|
||||||
return "QUEUE: " + databaseHelper.size(DatabaseHelper.DATABASE_DBREQUESTS);
|
return "QUEUE: " + databaseHelper.size(DatabaseHelper.DATABASE_DBREQUESTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long size() {
|
public long size() {
|
||||||
return databaseHelper.size(DatabaseHelper.DATABASE_DBREQUESTS);
|
return databaseHelper.size(DatabaseHelper.DATABASE_DBREQUESTS);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +75,7 @@ public class UploadQueue implements UploadQueueInterface {
|
||||||
rxBus.send(new EventNSClientResend("newdata"));
|
rxBus.send(new EventNSClientResend("newdata"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearQueue() {
|
@Override public void clearQueue() {
|
||||||
startService();
|
startService();
|
||||||
if (NSClientService.handler != null) {
|
if (NSClientService.handler != null) {
|
||||||
NSClientService.handler.post(() -> {
|
NSClientService.handler.post(() -> {
|
||||||
|
@ -87,7 +86,8 @@ public class UploadQueue implements UploadQueueInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeID(final JSONObject record) {
|
@Override
|
||||||
|
public void removeByNsClientIdIfExists(final JSONObject record) {
|
||||||
startService();
|
startService();
|
||||||
if (NSClientService.handler != null) {
|
if (NSClientService.handler != null) {
|
||||||
NSClientService.handler.post(() -> {
|
NSClientService.handler.post(() -> {
|
||||||
|
@ -108,7 +108,8 @@ public class UploadQueue implements UploadQueueInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeID(final String action, final String _id) {
|
@Override
|
||||||
|
public void removeByMongoId(final String action, final String _id) {
|
||||||
if (_id == null || _id.equals(""))
|
if (_id == null || _id.equals(""))
|
||||||
return;
|
return;
|
||||||
startService();
|
startService();
|
||||||
|
@ -120,7 +121,7 @@ public class UploadQueue implements UploadQueueInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String textList() {
|
@Override public String textList() {
|
||||||
String result = "";
|
String result = "";
|
||||||
CloseableIterator<DbRequest> iterator;
|
CloseableIterator<DbRequest> iterator;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -39,11 +39,11 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileStore;
|
import info.nightscout.androidaps.interfaces.ProfileStore;
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.acks.NSAddAck;
|
import info.nightscout.androidaps.plugins.general.nsclient.acks.NSAddAck;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.acks.NSAuthAck;
|
import info.nightscout.androidaps.plugins.general.nsclient.acks.NSAuthAck;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.acks.NSUpdateAck;
|
import info.nightscout.androidaps.plugins.general.nsclient.acks.NSUpdateAck;
|
||||||
|
@ -90,7 +90,7 @@ public class NSClientService extends DaggerService {
|
||||||
@Inject BuildHelper buildHelper;
|
@Inject BuildHelper buildHelper;
|
||||||
@Inject Config config;
|
@Inject Config config;
|
||||||
@Inject DateUtil dateUtil;
|
@Inject DateUtil dateUtil;
|
||||||
@Inject UploadQueue uploadQueue;
|
@Inject UploadQueueInterface uploadQueue;
|
||||||
|
|
||||||
private final CompositeDisposable disposable = new CompositeDisposable();
|
private final CompositeDisposable disposable = new CompositeDisposable();
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ public class NSClientService extends DaggerService {
|
||||||
|
|
||||||
public void processAddAck(NSAddAck ack) {
|
public void processAddAck(NSAddAck ack) {
|
||||||
if (ack.nsClientID != null) {
|
if (ack.nsClientID != null) {
|
||||||
uploadQueue.removeID(ack.json);
|
uploadQueue.removeByNsClientIdIfExists(ack.json);
|
||||||
rxBus.send(new EventNSClientNewLog("DBADD", "Acked " + ack.nsClientID));
|
rxBus.send(new EventNSClientNewLog("DBADD", "Acked " + ack.nsClientID));
|
||||||
} else {
|
} else {
|
||||||
rxBus.send(new EventNSClientNewLog("ERROR", "DBADD Unknown response"));
|
rxBus.send(new EventNSClientNewLog("ERROR", "DBADD Unknown response"));
|
||||||
|
@ -223,7 +223,7 @@ public class NSClientService extends DaggerService {
|
||||||
|
|
||||||
public void processUpdateAck(NSUpdateAck ack) {
|
public void processUpdateAck(NSUpdateAck ack) {
|
||||||
if (ack.result) {
|
if (ack.result) {
|
||||||
uploadQueue.removeID(ack.action, ack._id);
|
uploadQueue.removeByMongoId(ack.action, ack._id);
|
||||||
rxBus.send(new EventNSClientNewLog("DBUPDATE/DBREMOVE", "Acked " + ack._id));
|
rxBus.send(new EventNSClientNewLog("DBUPDATE/DBREMOVE", "Acked " + ack._id));
|
||||||
} else {
|
} else {
|
||||||
rxBus.send(new EventNSClientNewLog("ERROR", "DBUPDATE/DBREMOVE Unknown response"));
|
rxBus.send(new EventNSClientNewLog("ERROR", "DBUPDATE/DBREMOVE Unknown response"));
|
||||||
|
@ -597,7 +597,7 @@ public class NSClientService extends DaggerService {
|
||||||
NSTreatment treatment = new NSTreatment(jsonTreatment);
|
NSTreatment treatment = new NSTreatment(jsonTreatment);
|
||||||
|
|
||||||
// remove from upload queue if Ack is failing
|
// remove from upload queue if Ack is failing
|
||||||
uploadQueue.removeID(jsonTreatment);
|
uploadQueue.removeByNsClientIdIfExists(jsonTreatment);
|
||||||
//Find latest date in treatment
|
//Find latest date in treatment
|
||||||
if (treatment.getMills() != null && treatment.getMills() < System.currentTimeMillis())
|
if (treatment.getMills() != null && treatment.getMills() < System.currentTimeMillis())
|
||||||
if (treatment.getMills() > latestDateInReceivedData)
|
if (treatment.getMills() > latestDateInReceivedData)
|
||||||
|
@ -629,7 +629,7 @@ public class NSClientService extends DaggerService {
|
||||||
for (Integer index = 0; index < devicestatuses.length(); index++) {
|
for (Integer index = 0; index < devicestatuses.length(); index++) {
|
||||||
JSONObject jsonStatus = devicestatuses.getJSONObject(index);
|
JSONObject jsonStatus = devicestatuses.getJSONObject(index);
|
||||||
// remove from upload queue if Ack is failing
|
// remove from upload queue if Ack is failing
|
||||||
uploadQueue.removeID(jsonStatus);
|
uploadQueue.removeByNsClientIdIfExists(jsonStatus);
|
||||||
}
|
}
|
||||||
nsDeviceStatus.handleNewData(devicestatuses);
|
nsDeviceStatus.handleNewData(devicestatuses);
|
||||||
}
|
}
|
||||||
|
@ -645,7 +645,7 @@ public class NSClientService extends DaggerService {
|
||||||
JSONObject jsonFood = foods.getJSONObject(index);
|
JSONObject jsonFood = foods.getJSONObject(index);
|
||||||
|
|
||||||
// remove from upload queue if Ack is failing
|
// remove from upload queue if Ack is failing
|
||||||
uploadQueue.removeID(jsonFood);
|
uploadQueue.removeByNsClientIdIfExists(jsonFood);
|
||||||
|
|
||||||
String action = JsonHelper.safeGetString(jsonFood, "action");
|
String action = JsonHelper.safeGetString(jsonFood, "action");
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ public class NSClientService extends DaggerService {
|
||||||
for (Integer index = 0; index < mbgs.length(); index++) {
|
for (Integer index = 0; index < mbgs.length(); index++) {
|
||||||
JSONObject jsonMbg = mbgs.getJSONObject(index);
|
JSONObject jsonMbg = mbgs.getJSONObject(index);
|
||||||
// remove from upload queue if Ack is failing
|
// remove from upload queue if Ack is failing
|
||||||
uploadQueue.removeID(jsonMbg);
|
uploadQueue.removeByNsClientIdIfExists(jsonMbg);
|
||||||
}
|
}
|
||||||
handleNewMbg(mbgs, isDelta);
|
handleNewMbg(mbgs, isDelta);
|
||||||
}
|
}
|
||||||
|
@ -688,7 +688,7 @@ public class NSClientService extends DaggerService {
|
||||||
// Retreive actual calibration
|
// Retreive actual calibration
|
||||||
for (Integer index = 0; index < cals.length(); index++) {
|
for (Integer index = 0; index < cals.length(); index++) {
|
||||||
// remove from upload queue if Ack is failing
|
// remove from upload queue if Ack is failing
|
||||||
uploadQueue.removeID(cals.optJSONObject(index));
|
uploadQueue.removeByNsClientIdIfExists(cals.optJSONObject(index));
|
||||||
}
|
}
|
||||||
handleNewCal(cals, isDelta);
|
handleNewCal(cals, isDelta);
|
||||||
}
|
}
|
||||||
|
@ -702,7 +702,7 @@ public class NSClientService extends DaggerService {
|
||||||
NSSgv sgv = new NSSgv(jsonSgv);
|
NSSgv sgv = new NSSgv(jsonSgv);
|
||||||
// Handle new sgv here
|
// Handle new sgv here
|
||||||
// remove from upload queue if Ack is failing
|
// remove from upload queue if Ack is failing
|
||||||
uploadQueue.removeID(jsonSgv);
|
uploadQueue.removeByNsClientIdIfExists(jsonSgv);
|
||||||
//Find latest date in sgv
|
//Find latest date in sgv
|
||||||
if (sgv.getMills() != null && sgv.getMills() < System.currentTimeMillis())
|
if (sgv.getMills() != null && sgv.getMills() < System.currentTimeMillis())
|
||||||
if (sgv.getMills() > latestDateInReceivedData)
|
if (sgv.getMills() > latestDateInReceivedData)
|
||||||
|
|
|
@ -45,11 +45,11 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentServiceInterface;
|
import info.nightscout.androidaps.interfaces.TreatmentServiceInterface;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||||
import info.nightscout.androidaps.interfaces.UpdateReturn;
|
import info.nightscout.androidaps.interfaces.UpdateReturn;
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult;
|
||||||
|
@ -74,7 +74,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
private final ProfileFunction profileFunction;
|
private final ProfileFunction profileFunction;
|
||||||
private final ActivePluginProvider activePlugin;
|
private final ActivePluginProvider activePlugin;
|
||||||
private final NSUpload nsUpload;
|
private final NSUpload nsUpload;
|
||||||
private final UploadQueue uploadQueue;
|
private final UploadQueueInterface uploadQueue;
|
||||||
private final FabricPrivacy fabricPrivacy;
|
private final FabricPrivacy fabricPrivacy;
|
||||||
private final DateUtil dateUtil;
|
private final DateUtil dateUtil;
|
||||||
private final DatabaseHelperInterface databaseHelper;
|
private final DatabaseHelperInterface databaseHelper;
|
||||||
|
@ -106,7 +106,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
NSUpload nsUpload,
|
NSUpload nsUpload,
|
||||||
FabricPrivacy fabricPrivacy,
|
FabricPrivacy fabricPrivacy,
|
||||||
DateUtil dateUtil,
|
DateUtil dateUtil,
|
||||||
UploadQueue uploadQueue,
|
UploadQueueInterface uploadQueue,
|
||||||
DatabaseHelperInterface databaseHelper,
|
DatabaseHelperInterface databaseHelper,
|
||||||
AppRepository repository
|
AppRepository repository
|
||||||
) {
|
) {
|
||||||
|
@ -386,7 +386,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
if (NSUpload.isIdValid(tempBasalId)) {
|
if (NSUpload.isIdValid(tempBasalId)) {
|
||||||
nsUpload.removeCareportalEntryFromNS(tempBasalId);
|
nsUpload.removeCareportalEntryFromNS(tempBasalId);
|
||||||
} else {
|
} else {
|
||||||
uploadQueue.removeID("dbAdd", tempBasalId);
|
uploadQueue.removeByMongoId("dbAdd", tempBasalId);
|
||||||
}
|
}
|
||||||
databaseHelper.delete(tempBasal);
|
databaseHelper.delete(tempBasal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
||||||
import info.nightscout.androidaps.events.EventAutosensCalculationFinished
|
import info.nightscout.androidaps.events.EventAutosensCalculationFinished
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsBolusFragment.RecyclerViewAdapter.TreatmentsViewHolder
|
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsBolusFragment.RecyclerViewAdapter.TreatmentsViewHolder
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
@ -46,7 +46,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
||||||
@Inject lateinit var treatmentsPlugin: TreatmentsPlugin
|
@Inject lateinit var treatmentsPlugin: TreatmentsPlugin
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
@Inject lateinit var nsUpload: NSUpload
|
@Inject lateinit var nsUpload: NSUpload
|
||||||
@Inject lateinit var uploadQueue: UploadQueue
|
@Inject lateinit var uploadQueue: UploadQueueInterface
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var buildHelper: BuildHelper
|
@Inject lateinit var buildHelper: BuildHelper
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
@ -84,7 +84,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
||||||
if (NSUpload.isIdValid(treatment._id))
|
if (NSUpload.isIdValid(treatment._id))
|
||||||
nsUpload.removeCareportalEntryFromNS(treatment._id)
|
nsUpload.removeCareportalEntryFromNS(treatment._id)
|
||||||
else
|
else
|
||||||
uploadQueue.removeID("dbAdd", treatment._id)
|
uploadQueue.removeByMongoId("dbAdd", treatment._id)
|
||||||
treatmentsPlugin.service.delete(treatment)
|
treatmentsPlugin.service.delete(treatment)
|
||||||
}
|
}
|
||||||
updateGui()
|
updateGui()
|
||||||
|
@ -183,7 +183,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
||||||
if (NSUpload.isIdValid(treatment._id))
|
if (NSUpload.isIdValid(treatment._id))
|
||||||
nsUpload.removeCareportalEntryFromNS(treatment._id)
|
nsUpload.removeCareportalEntryFromNS(treatment._id)
|
||||||
else
|
else
|
||||||
uploadQueue.removeID("dbAdd", treatment._id)
|
uploadQueue.removeByMongoId("dbAdd", treatment._id)
|
||||||
treatmentsPlugin.service.delete(treatment)
|
treatmentsPlugin.service.delete(treatment)
|
||||||
}
|
}
|
||||||
updateGui()
|
updateGui()
|
||||||
|
|
|
@ -17,12 +17,12 @@ import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||||
import info.nightscout.androidaps.databinding.TreatmentsCareportalFragmentBinding
|
import info.nightscout.androidaps.databinding.TreatmentsCareportalFragmentBinding
|
||||||
import info.nightscout.androidaps.databinding.TreatmentsCareportalItemBinding
|
import info.nightscout.androidaps.databinding.TreatmentsCareportalItemBinding
|
||||||
import info.nightscout.androidaps.events.EventTherapyEventChange
|
import info.nightscout.androidaps.events.EventTherapyEventChange
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
||||||
import info.nightscout.androidaps.plugins.treatments.events.EventTreatmentUpdateGui
|
import info.nightscout.androidaps.plugins.treatments.events.EventTreatmentUpdateGui
|
||||||
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsCareportalFragment.RecyclerViewAdapter.TherapyEventsViewHolder
|
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsCareportalFragment.RecyclerViewAdapter.TherapyEventsViewHolder
|
||||||
|
@ -52,7 +52,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
||||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||||
@Inject lateinit var translator: Translator
|
@Inject lateinit var translator: Translator
|
||||||
@Inject lateinit var nsUpload: NSUpload
|
@Inject lateinit var nsUpload: NSUpload
|
||||||
@Inject lateinit var uploadQueue: UploadQueue
|
@Inject lateinit var uploadQueue: UploadQueueInterface
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var buildHelper: BuildHelper
|
@Inject lateinit var buildHelper: BuildHelper
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
@ -102,7 +102,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
||||||
if (NSUpload.isIdValid(event.interfaceIDs.nightscoutId))
|
if (NSUpload.isIdValid(event.interfaceIDs.nightscoutId))
|
||||||
nsUpload.removeCareportalEntryFromNS(event.interfaceIDs.nightscoutId)
|
nsUpload.removeCareportalEntryFromNS(event.interfaceIDs.nightscoutId)
|
||||||
else
|
else
|
||||||
uploadQueue.removeID("dbAdd", event.timestamp.toString())
|
uploadQueue.removeByMongoId("dbAdd", event.timestamp.toString())
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
aapsLogger.error(LTag.BGSOURCE, "Error while invalidating therapy event", it)
|
aapsLogger.error(LTag.BGSOURCE, "Error while invalidating therapy event", it)
|
||||||
|
@ -201,7 +201,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
||||||
.subscribe({
|
.subscribe({
|
||||||
val id = therapyEvent.interfaceIDs.nightscoutId
|
val id = therapyEvent.interfaceIDs.nightscoutId
|
||||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||||
else uploadQueue.removeID("dbAdd", therapyEvent.timestamp.toString())
|
else uploadQueue.removeByMongoId("dbAdd", therapyEvent.timestamp.toString())
|
||||||
}, {
|
}, {
|
||||||
aapsLogger.error(LTag.BGSOURCE, "Error while invalidating therapy event", it)
|
aapsLogger.error(LTag.BGSOURCE, "Error while invalidating therapy event", it)
|
||||||
})
|
})
|
||||||
|
|
|
@ -22,10 +22,10 @@ import info.nightscout.androidaps.events.EventExtendedBolusChange
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsExtendedBolusesFragment.RecyclerViewAdapter.ExtendedBolusesViewHolder
|
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsExtendedBolusesFragment.RecyclerViewAdapter.ExtendedBolusesViewHolder
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
|
@ -44,7 +44,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||||
@Inject lateinit var nsUpload: NSUpload
|
@Inject lateinit var nsUpload: NSUpload
|
||||||
@Inject lateinit var uploadQueue: UploadQueue
|
@Inject lateinit var uploadQueue: UploadQueueInterface
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
@ -126,7 +126,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
|
||||||
uel.log(Action.EXTENDED_BOLUS_REMOVED)
|
uel.log(Action.EXTENDED_BOLUS_REMOVED)
|
||||||
val id = extendedBolus._id
|
val id = extendedBolus._id
|
||||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||||
else uploadQueue.removeID("dbAdd", id)
|
else uploadQueue.removeByMongoId("dbAdd", id)
|
||||||
databaseHelper.delete(extendedBolus)
|
databaseHelper.delete(extendedBolus)
|
||||||
}, null)
|
}, null)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@ import info.nightscout.androidaps.db.Source
|
||||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
||||||
import info.nightscout.androidaps.events.EventProfileNeedsUpdate
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate
|
||||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
||||||
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
||||||
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
|
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
|
||||||
|
@ -47,7 +47,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||||
@Inject lateinit var nsUpload: NSUpload
|
@Inject lateinit var nsUpload: NSUpload
|
||||||
@Inject lateinit var uploadQueue: UploadQueue
|
@Inject lateinit var uploadQueue: UploadQueueInterface
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var buildHelper: BuildHelper
|
@Inject lateinit var buildHelper: BuildHelper
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
@ -151,7 +151,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
||||||
uel.log(Action.PROFILE_SWITCH_REMOVED, profileSwitch.profileName, ValueWithUnit(profileSwitch.date, Units.Timestamp))
|
uel.log(Action.PROFILE_SWITCH_REMOVED, profileSwitch.profileName, ValueWithUnit(profileSwitch.date, Units.Timestamp))
|
||||||
val id = profileSwitch._id
|
val id = profileSwitch._id
|
||||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||||
else uploadQueue.removeID("dbAdd", id)
|
else uploadQueue.removeByMongoId("dbAdd", id)
|
||||||
databaseHelper.delete(profileSwitch)
|
databaseHelper.delete(profileSwitch)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,12 @@ import info.nightscout.androidaps.databinding.TreatmentsTemptargetFragmentBindin
|
||||||
import info.nightscout.androidaps.databinding.TreatmentsTemptargetItemBinding
|
import info.nightscout.androidaps.databinding.TreatmentsTemptargetItemBinding
|
||||||
import info.nightscout.androidaps.events.EventTempTargetChange
|
import info.nightscout.androidaps.events.EventTempTargetChange
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
||||||
import info.nightscout.androidaps.plugins.treatments.events.EventTreatmentUpdateGui
|
import info.nightscout.androidaps.plugins.treatments.events.EventTreatmentUpdateGui
|
||||||
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsTempTargetFragment.RecyclerViewAdapter.TempTargetsViewHolder
|
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsTempTargetFragment.RecyclerViewAdapter.TempTargetsViewHolder
|
||||||
|
@ -58,7 +58,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
||||||
@Inject lateinit var profileFunction: ProfileFunction
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
@Inject lateinit var nsUpload: NSUpload
|
@Inject lateinit var nsUpload: NSUpload
|
||||||
@Inject lateinit var uploadQueue: UploadQueue
|
@Inject lateinit var uploadQueue: UploadQueueInterface
|
||||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||||
@Inject lateinit var translator: Translator
|
@Inject lateinit var translator: Translator
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
|
@ -201,7 +201,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
||||||
.subscribe({
|
.subscribe({
|
||||||
val id = tempTarget.interfaceIDs.nightscoutId
|
val id = tempTarget.interfaceIDs.nightscoutId
|
||||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||||
else uploadQueue.removeID("dbAdd", tempTarget.timestamp.toString())
|
else uploadQueue.removeByMongoId("dbAdd", tempTarget.timestamp.toString())
|
||||||
}, {
|
}, {
|
||||||
aapsLogger.error(LTag.BGSOURCE, "Error while invalidating temporary target", it)
|
aapsLogger.error(LTag.BGSOURCE, "Error while invalidating temporary target", it)
|
||||||
})
|
})
|
||||||
|
|
|
@ -10,11 +10,11 @@ import info.nightscout.androidaps.db.TDD
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentService
|
import info.nightscout.androidaps.plugins.treatments.TreatmentService
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
@ -40,7 +40,7 @@ class TddCalculator @Inject constructor(
|
||||||
fabricPrivacy: FabricPrivacy,
|
fabricPrivacy: FabricPrivacy,
|
||||||
nsUpload: NSUpload,
|
nsUpload: NSUpload,
|
||||||
private val dateUtil: DateUtil,
|
private val dateUtil: DateUtil,
|
||||||
uploadQueue: UploadQueue,
|
uploadQueue: UploadQueueInterface,
|
||||||
databaseHelper: DatabaseHelperInterface,
|
databaseHelper: DatabaseHelperInterface,
|
||||||
repository: AppRepository
|
repository: AppRepository
|
||||||
) : TreatmentsPlugin(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, context, sp, profileFunction, activePlugin, nsUpload, fabricPrivacy, dateUtil, uploadQueue, databaseHelper, repository) {
|
) : TreatmentsPlugin(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, context, sp, profileFunction, activePlugin, nsUpload, fabricPrivacy, dateUtil, uploadQueue, databaseHelper, repository) {
|
||||||
|
|
|
@ -22,7 +22,6 @@ import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Obje
|
||||||
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
|
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
||||||
|
@ -69,7 +68,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
||||||
@Mock lateinit var sensitivityOref1Plugin: SensitivityOref1Plugin
|
@Mock lateinit var sensitivityOref1Plugin: SensitivityOref1Plugin
|
||||||
@Mock lateinit var profiler: Profiler
|
@Mock lateinit var profiler: Profiler
|
||||||
@Mock lateinit var nsUpload: NSUpload
|
@Mock lateinit var nsUpload: NSUpload
|
||||||
@Mock lateinit var uploadQueue: UploadQueue
|
@Mock lateinit var uploadQueue: UploadQueueInterface
|
||||||
@Mock lateinit var uel: UserEntryLogger
|
@Mock lateinit var uel: UserEntryLogger
|
||||||
@Mock lateinit var loggerUtils: LoggerUtils
|
@Mock lateinit var loggerUtils: LoggerUtils
|
||||||
@Mock lateinit var databaseHelper: DatabaseHelperInterface
|
@Mock lateinit var databaseHelper: DatabaseHelperInterface
|
||||||
|
|
|
@ -7,8 +7,8 @@ import info.nightscout.androidaps.TestBaseWithProfile
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.db.TemporaryBasal
|
import info.nightscout.androidaps.db.TemporaryBasal
|
||||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||||
|
import info.nightscout.androidaps.interfaces.UploadQueueInterface
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
|
||||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin
|
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
|
@ -33,7 +33,7 @@ class TreatmentsPluginTest : TestBaseWithProfile() {
|
||||||
@Mock lateinit var sp: SP
|
@Mock lateinit var sp: SP
|
||||||
@Mock lateinit var treatmentService: TreatmentService
|
@Mock lateinit var treatmentService: TreatmentService
|
||||||
@Mock lateinit var nsUpload: NSUpload
|
@Mock lateinit var nsUpload: NSUpload
|
||||||
@Mock lateinit var uploadQueue: UploadQueue
|
@Mock lateinit var uploadQueue: UploadQueueInterface
|
||||||
@Mock lateinit var repository: AppRepository
|
@Mock lateinit var repository: AppRepository
|
||||||
@Mock lateinit var databaseHelper: DatabaseHelperInterface
|
@Mock lateinit var databaseHelper: DatabaseHelperInterface
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package info.nightscout.androidaps.interfaces
|
||||||
|
|
||||||
|
interface UploadQueueAdminInterface : UploadQueueInterface {
|
||||||
|
|
||||||
|
fun clearQueue()
|
||||||
|
}
|
|
@ -1,9 +1,18 @@
|
||||||
package info.nightscout.androidaps.interfaces;
|
package info.nightscout.androidaps.interfaces;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import info.nightscout.androidaps.db.DbRequest;
|
import info.nightscout.androidaps.db.DbRequest;
|
||||||
|
|
||||||
public interface UploadQueueInterface {
|
public interface UploadQueueInterface {
|
||||||
|
|
||||||
|
long size();
|
||||||
|
|
||||||
void add(DbRequest dbRequest);
|
void add(DbRequest dbRequest);
|
||||||
void removeID(final String action, final String _id);
|
|
||||||
|
void removeByNsClientIdIfExists(JSONObject record);
|
||||||
|
|
||||||
|
void removeByMongoId(final String action, final String _id);
|
||||||
|
|
||||||
|
String textList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -928,7 +928,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
||||||
final String _id = extendedBolus._id;
|
final String _id = extendedBolus._id;
|
||||||
if (NSUpload.isIdValid(_id))
|
if (NSUpload.isIdValid(_id))
|
||||||
nsUpload.removeCareportalEntryFromNS(_id);
|
nsUpload.removeCareportalEntryFromNS(_id);
|
||||||
else uploadQueue.removeID("dbAdd", _id);
|
else uploadQueue.removeByMongoId("dbAdd", _id);
|
||||||
databaseHelper.delete(extendedBolus);
|
databaseHelper.delete(extendedBolus);
|
||||||
} else
|
} else
|
||||||
treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus);
|
treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus);
|
||||||
|
@ -1436,7 +1436,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
||||||
if (extendedBolus != null) {
|
if (extendedBolus != null) {
|
||||||
final String _id = extendedBolus._id;
|
final String _id = extendedBolus._id;
|
||||||
if (NSUpload.isIdValid(_id)) nsUpload.removeCareportalEntryFromNS(_id);
|
if (NSUpload.isIdValid(_id)) nsUpload.removeCareportalEntryFromNS(_id);
|
||||||
else uploadQueue.removeID("dbAdd", _id);
|
else uploadQueue.removeByMongoId("dbAdd", _id);
|
||||||
databaseHelper.delete(extendedBolus);
|
databaseHelper.delete(extendedBolus);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue