diff --git a/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt
index d18f9c5c82..233c293f12 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt
@@ -3,6 +3,7 @@ package info.nightscout.androidaps.activities
import android.os.Bundle
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityStatsBinding
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActivityMonitor
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.stats.TddCalculator
@@ -14,6 +15,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
@Inject lateinit var tddCalculator: TddCalculator
@Inject lateinit var tirCalculator: TirCalculator
@Inject lateinit var activityMonitor: ActivityMonitor
+ @Inject lateinit var uel: UserEntryLogger
private lateinit var binding: ActivityStatsBinding
@@ -29,6 +31,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
binding.ok.setOnClickListener { finish() }
binding.reset.setOnClickListener {
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.doyouwantresetstats)) {
+ uel.log("STATS RESET")
activityMonitor.reset()
recreate()
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt
index c7cfec45eb..631a372e00 100644
--- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt
@@ -77,18 +77,13 @@ abstract class FragmentsModule {
@ContributesAndroidInjector abstract fun contributesTidepoolFragment(): TidepoolFragment
@ContributesAndroidInjector abstract fun contributesTreatmentsFragment(): TreatmentsFragment
- @ContributesAndroidInjector
- abstract fun contributesTreatmentsBolusFragment(): TreatmentsBolusFragment
- @ContributesAndroidInjector
- abstract fun contributesTreatmentsTemporaryBasalsFragment(): TreatmentsTemporaryBasalsFragment
- @ContributesAndroidInjector
- abstract fun contributesTreatmentsTempTargetFragment(): TreatmentsTempTargetFragment
- @ContributesAndroidInjector
- abstract fun contributesTreatmentsExtendedBolusesFragment(): TreatmentsExtendedBolusesFragment
- @ContributesAndroidInjector
- abstract fun contributesTreatmentsCareportalFragment(): TreatmentsCareportalFragment
- @ContributesAndroidInjector
- abstract fun contributesTreatmentsProfileSwitchFragment(): TreatmentsProfileSwitchFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsBolusFragment(): TreatmentsBolusFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsTemporaryBasalsFragment(): TreatmentsTemporaryBasalsFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsTempTargetFragment(): TreatmentsTempTargetFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsExtendedBolusesFragment(): TreatmentsExtendedBolusesFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsCareportalFragment(): TreatmentsCareportalFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsProfileSwitchFragment(): TreatmentsProfileSwitchFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsUserEntryFragment(): TreatmentsUserEntryFragment
@ContributesAndroidInjector abstract fun contributesVirtualPumpFragment(): VirtualPumpFragment
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt
index d2e9b11a4e..63acaef52c 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt
@@ -11,6 +11,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.databinding.DialogCalibrationBinding
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
import info.nightscout.androidaps.utils.HtmlHelper
import info.nightscout.androidaps.utils.XdripCalibrations
@@ -26,6 +27,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var xdripCalibrations: XdripCalibrations
+ @Inject lateinit var uel: UserEntryLogger
private var _binding: DialogCalibrationBinding? = null
@@ -75,7 +77,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
if (bg > 0) {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_calibration), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
- aapsLogger.debug("USER ENTRY: CALIBRATION $bg")
+ uel.log("CALIBRATION", d1 = bg)
xdripCalibrations.sendIntent(bg)
})
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
index 2f252f2594..59de46fc32 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
@@ -17,6 +17,7 @@ import info.nightscout.androidaps.db.Source
import info.nightscout.androidaps.db.TempTarget
import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
@@ -46,6 +47,7 @@ class CarbsDialog : DialogFragmentWithDate() {
@Inject lateinit var iobCobCalculatorPlugin: IobCobCalculatorPlugin
@Inject lateinit var nsUpload: NSUpload
@Inject lateinit var carbsGenerator: CarbsGenerator
+ @Inject lateinit var uel: UserEntryLogger
companion object {
@@ -210,7 +212,7 @@ class CarbsDialog : DialogFragmentWithDate() {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.carbs), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
when {
activitySelected -> {
- aapsLogger.debug("USER ENTRY: TEMPTARGET ACTIVITY $activityTT duration: $activityTTDuration")
+ uel.log("TT ACTIVITY", d1 = activityTT, i1 = activityTTDuration)
val tempTarget = TempTarget()
.date(System.currentTimeMillis())
.duration(activityTTDuration)
@@ -222,7 +224,7 @@ class CarbsDialog : DialogFragmentWithDate() {
}
eatingSoonSelected -> {
- aapsLogger.debug("USER ENTRY: TEMPTARGET EATING SOON $eatingSoonTT duration: $eatingSoonTTDuration")
+ uel.log("TT EATING SOON", d1 = eatingSoonTT, i1 = eatingSoonTTDuration)
val tempTarget = TempTarget()
.date(System.currentTimeMillis())
.duration(eatingSoonTTDuration)
@@ -234,7 +236,7 @@ class CarbsDialog : DialogFragmentWithDate() {
}
hypoSelected -> {
- aapsLogger.debug("USER ENTRY: TEMPTARGET HYPO $hypoTT duration: $hypoTTDuration")
+ uel.log("TT HYPO", d1 = hypoTT, i1 = hypoTTDuration)
val tempTarget = TempTarget()
.date(System.currentTimeMillis())
.duration(hypoTTDuration)
@@ -247,10 +249,10 @@ class CarbsDialog : DialogFragmentWithDate() {
}
if (carbsAfterConstraints > 0) {
if (duration == 0) {
- aapsLogger.debug("USER ENTRY: CARBS $carbsAfterConstraints time: $time")
+ uel.log("CARBS", d1 = carbsAfterConstraints.toDouble(), i1 = timeOffset)
carbsGenerator.createCarb(carbsAfterConstraints, time, CareportalEvent.CARBCORRECTION, notes)
} else {
- aapsLogger.debug("USER ENTRY: CARBS $carbsAfterConstraints time: $time duration: $duration")
+ uel.log("CARBS", d1 = carbsAfterConstraints.toDouble(), i1 = timeOffset, i2 = duration)
carbsGenerator.generateCarbs(carbsAfterConstraints, time, duration, notes)
nsUpload.uploadEvent(CareportalEvent.NOTE, DateUtil.now() - 2000, resourceHelper.gs(R.string.generated_ecarbs_note, carbsAfterConstraints, duration, timeOffset))
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt
index 3a68ab8b56..4f34ffe8d4 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt
@@ -17,6 +17,7 @@ import info.nightscout.androidaps.databinding.DialogCareBinding
import info.nightscout.androidaps.db.CareportalEvent
import info.nightscout.androidaps.db.Source
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
import info.nightscout.androidaps.utils.DateUtil
@@ -37,6 +38,7 @@ class CareDialog : DialogFragmentWithDate() {
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var nsUpload: NSUpload
@Inject lateinit var translator: Translator
+ @Inject lateinit var uel: UserEntryLogger
enum class EventType {
BGCHECK,
@@ -220,7 +222,7 @@ class CareDialog : DialogFragmentWithDate() {
EventType.ANNOUNCEMENT -> CareportalEvent.ANNOUNCEMENT
}
careportalEvent.json = json.toString()
- aapsLogger.debug("USER ENTRY: CAREPORTAL ${careportalEvent.eventType} json: ${careportalEvent.json}")
+ uel.log("CAREPORTAL", careportalEvent.eventType)
MainApp.getDbHelper().createOrUpdate(careportalEvent)
nsUpload.uploadCareportalEntryToNS(json)
}, null)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
index 0c38dacf75..03f53421f8 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
@@ -13,6 +13,7 @@ import info.nightscout.androidaps.databinding.DialogExtendedbolusBinding
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.Constraint
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.HtmlHelper
@@ -32,6 +33,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
@Inject lateinit var constraintChecker: ConstraintChecker
@Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var activePlugin: ActivePluginProvider
+ @Inject lateinit var uel: UserEntryLogger
private var _binding: DialogExtendedbolusBinding? = null
@@ -86,7 +88,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
- aapsLogger.debug("USER ENTRY: EXTENDED BOLUS $insulinAfterConstraint duration: $durationInMinutes")
+ uel.log("EXTENDED BOLUS", d1 = insulinAfterConstraint, i1 = durationInMinutes)
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
override fun run() {
if (!result.success) {
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
index ab44442bfe..1d215a3b46 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
@@ -16,6 +16,7 @@ import info.nightscout.androidaps.db.Source
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.Constraint
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.queue.Callback
@@ -37,6 +38,7 @@ class FillDialog : DialogFragmentWithDate() {
@Inject lateinit var nsUpload: NSUpload
@Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var activePlugin: ActivePluginProvider
+ @Inject lateinit var uel: UserEntryLogger
private var _binding: DialogFillBinding? = null
@@ -126,16 +128,16 @@ class FillDialog : DialogFragmentWithDate() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.primefill), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
if (insulinAfterConstraints > 0) {
- aapsLogger.debug("USER ENTRY: PRIME BOLUS $insulinAfterConstraints")
+ uel.log("PRIME BOLUS", d1 = insulinAfterConstraints)
requestPrimeBolus(insulinAfterConstraints, notes)
}
if (siteChange) {
- aapsLogger.debug("USER ENTRY: SITE CHANGE")
+ uel.log("SITE CHANGE")
nsUpload.generateCareportalEvent(CareportalEvent.SITECHANGE, eventTime, notes)
}
if (insulinChange) {
// add a second for case of both checked
- aapsLogger.debug("USER ENTRY: INSULIN CHANGE")
+ uel.log("INSULIN CHANGE")
nsUpload.generateCareportalEvent(CareportalEvent.INSULINCHANGE, eventTime + 1000, notes)
}
}, null)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
index a549824c3d..cfb84df81a 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
@@ -15,6 +15,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Profile
+import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.databinding.DialogInsulinBinding
import info.nightscout.androidaps.db.CareportalEvent
import info.nightscout.androidaps.db.Source
@@ -23,6 +24,7 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.*
@@ -46,7 +48,9 @@ class InsulinDialog : DialogFragmentWithDate() {
@Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var ctx: Context
+ @Inject lateinit var repository: AppRepository
@Inject lateinit var config: Config
+ @Inject lateinit var uel: UserEntryLogger
companion object {
@@ -175,7 +179,7 @@ class InsulinDialog : DialogFragmentWithDate() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.bolus), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
if (eatingSoonChecked) {
- aapsLogger.debug("USER ENTRY: TEMPTARGET EATING SOON $eatingSoonTT duration: $eatingSoonTTDuration")
+ uel.log("TT EATING SOON", d1 = eatingSoonTT, i1 = eatingSoonTTDuration)
val tempTarget = TempTarget()
.date(System.currentTimeMillis())
.duration(eatingSoonTTDuration)
@@ -193,11 +197,11 @@ class InsulinDialog : DialogFragmentWithDate() {
detailedBolusInfo.source = Source.USER
detailedBolusInfo.notes = notes
if (recordOnlyChecked) {
- aapsLogger.debug("USER ENTRY: BOLUS RECORD ONLY $insulinAfterConstraints")
+ uel.log("BOLUS RECORD", d1 = insulinAfterConstraints, i1 = timeOffset)
detailedBolusInfo.date = time
activePlugin.activeTreatments.addToHistoryTreatment(detailedBolusInfo, false)
} else {
- aapsLogger.debug("USER ENTRY: BOLUS $insulinAfterConstraints")
+ uel.log("BOLUS", d1 = insulinAfterConstraints)
detailedBolusInfo.date = DateUtil.now()
commandQueue.bolus(detailedBolusInfo, object : Callback() {
override fun run() {
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
index cda4b6e0be..4d4378655b 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
@@ -17,6 +17,7 @@ import info.nightscout.androidaps.databinding.DialogLoopBinding
import info.nightscout.androidaps.events.*
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
@@ -46,6 +47,7 @@ class LoopDialog : DaggerDialogFragment() {
@Inject lateinit var constraintChecker: ConstraintChecker
@Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var configBuilderPlugin: ConfigBuilderPlugin
+ @Inject lateinit var uel: UserEntryLogger
private var showOkCancel: Boolean = true
private var _binding: DialogLoopBinding? = null
@@ -237,28 +239,28 @@ class LoopDialog : DaggerDialogFragment() {
val profile = profileFunction.getProfile() ?: return true
when (v.id) {
R.id.overview_closeloop -> {
- aapsLogger.debug("USER ENTRY: CLOSED LOOP MODE")
+ uel.log("CLOSED LOOP MODE")
sp.putString(R.string.key_aps_mode, "closed")
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.closedloop)))
return true
}
R.id.overview_lgsloop -> {
- aapsLogger.debug("USER ENTRY: LGS LOOP MODE")
+ uel.log("LGS LOOP MODE")
sp.putString(R.string.key_aps_mode, "lgs")
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.lowglucosesuspend)))
return true
}
R.id.overview_openloop -> {
- aapsLogger.debug("USER ENTRY: OPEN LOOP MODE")
+ uel.log("OPEN LOOP MODE")
sp.putString(R.string.key_aps_mode, "open")
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.lowglucosesuspend)))
return true
}
R.id.overview_disable -> {
- aapsLogger.debug("USER ENTRY: LOOP DISABLED")
+ uel.log("LOOP DISABLED")
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
loopPlugin.setFragmentVisible(PluginType.LOOP, false)
configBuilderPlugin.storeSettings("DisablingLoop")
@@ -275,7 +277,7 @@ class LoopDialog : DaggerDialogFragment() {
}
R.id.overview_enable -> {
- aapsLogger.debug("USER ENTRY: LOOP ENABLED")
+ uel.log("LOOP ENABLED")
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
loopPlugin.setFragmentVisible(PluginType.LOOP, true)
configBuilderPlugin.storeSettings("EnablingLoop")
@@ -285,7 +287,7 @@ class LoopDialog : DaggerDialogFragment() {
}
R.id.overview_resume, R.id.overview_reconnect -> {
- aapsLogger.debug("USER ENTRY: RESUME")
+ uel.log("RESUME")
loopPlugin.suspendTo(0L)
rxBus.send(EventRefreshOverview("suspendmenu"))
commandQueue.cancelTempBasal(true, object : Callback() {
@@ -306,49 +308,49 @@ class LoopDialog : DaggerDialogFragment() {
}
R.id.overview_suspend_1h -> {
- aapsLogger.debug("USER ENTRY: SUSPEND 1h")
+ uel.log("SUSPEND 1h")
loopPlugin.suspendLoop(60)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_suspend_2h -> {
- aapsLogger.debug("USER ENTRY: SUSPEND 2h")
+ uel.log("SUSPEND 2h")
loopPlugin.suspendLoop(120)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_suspend_3h -> {
- aapsLogger.debug("USER ENTRY: SUSPEND 3h")
+ uel.log("SUSPEND 3h")
loopPlugin.suspendLoop(180)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_suspend_10h -> {
- aapsLogger.debug("USER ENTRY: SUSPEND 10h")
+ uel.log("SUSPEND 10h")
loopPlugin.suspendLoop(600)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_15m -> {
- aapsLogger.debug("USER ENTRY: DISCONNECT 15m")
+ uel.log("DISCONNECT 15m")
loopPlugin.disconnectPump(15, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_30m -> {
- aapsLogger.debug("USER ENTRY: DISCONNECT 30m")
+ uel.log("DISCONNECT 30m")
loopPlugin.disconnectPump(30, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_1h -> {
- aapsLogger.debug("USER ENTRY: DISCONNECT 1h")
+ uel.log("DISCONNECT 1h")
loopPlugin.disconnectPump(60, profile)
sp.putBoolean(R.string.key_objectiveusedisconnect, true)
rxBus.send(EventRefreshOverview("suspendmenu"))
@@ -356,14 +358,14 @@ class LoopDialog : DaggerDialogFragment() {
}
R.id.overview_disconnect_2h -> {
- aapsLogger.debug("USER ENTRY: DISCONNECT 2h")
+ uel.log("DISCONNECT 2h")
loopPlugin.disconnectPump(120, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_3h -> {
- aapsLogger.debug("USER ENTRY: DISCONNECT 3h")
+ uel.log("DISCONNECT 3h")
loopPlugin.disconnectPump(180, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
index d61ee9fd8c..c4ed84ba45 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
@@ -11,6 +11,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.DialogProfileswitchBinding
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.HtmlHelper
@@ -26,6 +27,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var treatmentsPlugin: TreatmentsPlugin
@Inject lateinit var activePlugin: ActivePluginProvider
+ @Inject lateinit var uel: UserEntryLogger
private var profileIndex: Int? = null
@@ -122,7 +124,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
- aapsLogger.debug("USER ENTRY: PROFILE SWITCH $profile percent: $percent timeshift: $timeShift duration: $duration")
+ uel.log("PROFILE SWITCH", d1 = percent.toDouble(), i1 = timeShift, i2 = duration)
treatmentsPlugin.doProfileSwitch(profileStore, profile, duration, percent, timeShift, eventTime)
})
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
index c5fc54adfb..098253b035 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
@@ -15,6 +15,7 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.PumpDescription
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.HtmlHelper
@@ -35,6 +36,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
@Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var ctx: Context
+ @Inject lateinit var uel: UserEntryLogger
private var isPercentPump = true
@@ -129,10 +131,10 @@ class TempBasalDialog : DialogFragmentWithDate() {
}
}
if (isPercentPump) {
- aapsLogger.debug("USER ENTRY: TEMP BASAL $percent% duration: $durationInMinutes")
+ uel.log("TEMP BASAL", d1 = percent.toDouble(), i1 = durationInMinutes)
commandQueue.tempBasalPercent(percent, durationInMinutes, true, profile, callback)
} else {
- aapsLogger.debug("USER ENTRY: TEMP BASAL $absolute duration: $durationInMinutes")
+ uel.log("TEMP BASAL", d1 = absolute, i1 = durationInMinutes)
commandQueue.tempBasalAbsolute(absolute, durationInMinutes, true, profile, callback)
}
})
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
index 54657373b3..fbe5123035 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
@@ -15,6 +15,7 @@ import info.nightscout.androidaps.db.Source
import info.nightscout.androidaps.db.TempTarget
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.utils.DefaultValueHelper
@@ -33,8 +34,9 @@ class TempTargetDialog : DialogFragmentWithDate() {
@Inject lateinit var defaultValueHelper: DefaultValueHelper
@Inject lateinit var treatmentsPlugin: TreatmentsPlugin
@Inject lateinit var activePlugin: ActivePluginProvider
+ @Inject lateinit var uel: UserEntryLogger
- lateinit var reasonList: List
+ private lateinit var reasonList: List
private var _binding: DialogTemptargetBinding? = null
@@ -162,7 +164,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
- aapsLogger.debug("USER ENTRY: TEMP TARGET $target duration: $duration")
+ uel.log("TT", d1 = target, i1 = duration)
if (target == 0.0 || duration == 0) {
val tempTarget = TempTarget()
.date(eventTime)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
index 1c0c6082f4..4ebaf3b7d2 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
@@ -19,6 +19,7 @@ import info.nightscout.androidaps.db.Source
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.Constraint
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.DecimalFormatter
@@ -41,6 +42,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
@Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var ctx: Context
@Inject lateinit var config: Config
+ @Inject lateinit var uel: UserEntryLogger
private val textWatcher: TextWatcher = object : TextWatcher {
override fun afterTextChanged(s: Editable) {}
@@ -128,7 +130,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
if (insulinAfterConstraints > 0 || carbsAfterConstraints > 0) {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_treatment_label), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
- aapsLogger.debug("USER ENTRY: BOLUS insulin $insulin carbs: $carbs")
+ uel.log("TREATMENT", d1 = insulin, i1 = carbs)
val detailedBolusInfo = DetailedBolusInfo()
if (insulinAfterConstraints == 0.0) detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION
if (carbsAfterConstraints == 0) detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt
index 4fb140d55a..3f54b6e616 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt
@@ -9,9 +9,10 @@ import info.nightscout.androidaps.events.EventRebuildTabs
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
+import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import java.util.*
@@ -25,7 +26,8 @@ class ConfigBuilderPlugin @Inject constructor(
resourceHelper: ResourceHelper,
private val sp: SP,
private val rxBus: RxBusWrapper,
- private val activePlugin: ActivePluginProvider
+ private val activePlugin: ActivePluginProvider,
+ private val uel: UserEntryLogger
) : PluginBase(PluginDescription()
.mainType(PluginType.GENERAL)
.fragmentClass(ConfigBuilderFragment::class.java.name)
@@ -137,9 +139,10 @@ class ConfigBuilderPlugin @Inject constructor(
if (allowHardwarePump || activity == null) {
performPluginSwitch(changedPlugin, newState, type)
} else {
- showConfirmation(activity, resourceHelper.gs(R.string.allow_hardware_pump_text), Runnable {
+ OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.allow_hardware_pump_text), Runnable {
performPluginSwitch(changedPlugin, newState, type)
sp.putBoolean("allow_hardware_pump", true)
+ uel.log("HW PUMP ALLOWED")
aapsLogger.debug(LTag.PUMP, "First time HW pump allowed!")
}, Runnable {
rxBus.send(EventConfigBuilderUpdateGui())
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
index 752b3b3b6d..507e2cd1eb 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
@@ -22,6 +22,7 @@ import info.nightscout.androidaps.databinding.ObjectivesItemBinding
import info.nightscout.androidaps.dialogs.NtpProgressDialog
import info.nightscout.androidaps.events.EventNtpStatus
import info.nightscout.androidaps.logging.AAPSLogger
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.constraints.objectives.activities.ObjectivesExamDialog
import info.nightscout.androidaps.plugins.constraints.objectives.events.EventObjectivesUpdateGui
@@ -52,6 +53,7 @@ class ObjectivesFragment : DaggerFragment() {
@Inject lateinit var receiverStatusStore: ReceiverStatusStore
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var sntpClient: SntpClient
+ @Inject lateinit var uel: UserEntryLogger
private val objectivesAdapter = ObjectivesAdapter()
private val handler = Handler(Looper.getMainLooper())
@@ -305,6 +307,7 @@ class ObjectivesFragment : DaggerFragment() {
holder.binding.unstart.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.doyouwantresetstart), Runnable {
+ uel.log("OBJECTVE UNSTARTED", i1 = position + 1)
objective.startedOn = 0
scrollToCurrentObjective()
rxBus.send(EventObjectivesUpdateGui())
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt
index 009812a1f2..c5b836ac71 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt
@@ -9,6 +9,7 @@ import info.nightscout.androidaps.Config
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.*
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
@@ -25,8 +26,8 @@ class ObjectivesPlugin @Inject constructor(
resourceHelper: ResourceHelper,
private val activePlugin: ActivePluginProvider,
private val sp: SP,
- private val config: Config
-
+ config: Config,
+ private val uel: UserEntryLogger
) : PluginBase(PluginDescription()
.mainType(PluginType.CONSTRAINTS)
.fragmentClass(ObjectivesFragment::class.qualifiedName)
@@ -141,6 +142,7 @@ class ObjectivesPlugin @Inject constructor(
sp.putLong("Objectives_" + "auto" + "_accomplished", DateUtil.now())
setupObjectives()
OKDialog.show(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.codeaccepted))
+ uel.log("OBJECTIVES SKIPPED")
} else {
OKDialog.show(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.codeinvalid))
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
index 56b40e8d85..af65cc9c6b 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
@@ -23,6 +23,7 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.AAPSLogger
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
@@ -61,6 +62,7 @@ class ActionsFragment : DaggerFragment() {
@Inject lateinit var protectionCheck: ProtectionCheck
@Inject lateinit var skinProvider: SkinProvider
@Inject lateinit var config: Config
+ @Inject lateinit var uel: UserEntryLogger
private var disposable: CompositeDisposable = CompositeDisposable()
@@ -152,7 +154,7 @@ class ActionsFragment : DaggerFragment() {
}
extendedBolusCancel?.setOnClickListener {
if (activePlugin.activeTreatments.isInHistoryExtendedBoluslInProgress) {
- aapsLogger.debug("USER ENTRY: CANCEL EXTENDED BOLUS")
+ uel.log("CANCEL EXTENDED BOLUS")
commandQueue.cancelExtended(object : Callback() {
override fun run() {
if (!result.success) {
@@ -172,7 +174,7 @@ class ActionsFragment : DaggerFragment() {
}
cancelTempBasal?.setOnClickListener {
if (activePlugin.activeTreatments.isTempBasalInProgress) {
- aapsLogger.debug("USER ENTRY: CANCEL TEMP BASAL")
+ uel.log("CANCEL TEMP BASAL")
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationEvent.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationEvent.kt
index ca70fd8046..4c4b43ba18 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationEvent.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationEvent.kt
@@ -18,7 +18,7 @@ class AutomationEvent(private val injector: HasAndroidInjector) {
@Inject lateinit var aapsLogger: AAPSLogger
- var title: String? = null
+ var title: String = ""
var isEnabled = true
var systemAction: Boolean = false // true = generated by AAPS, false = entered by user
var readOnly: Boolean = false // removing, editing disabled
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
index 22dbf0a92e..31819ac0bb 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
@@ -20,6 +20,7 @@ import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.AutomationEventItemBinding
import info.nightscout.androidaps.databinding.AutomationFragmentBinding
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog
import info.nightscout.androidaps.plugins.general.automation.dragHelpers.ItemTouchHelperAdapter
@@ -31,7 +32,7 @@ import info.nightscout.androidaps.plugins.general.automation.events.EventAutomat
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.HtmlHelper
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
+import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import io.reactivex.rxkotlin.plusAssign
import info.nightscout.androidaps.utils.extensions.toVisibility
import info.nightscout.androidaps.utils.resources.ResourceHelper
@@ -48,6 +49,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var automationPlugin: AutomationPlugin
@Inject lateinit var injector: HasAndroidInjector
+ @Inject lateinit var uel: UserEntryLogger
private var disposable: CompositeDisposable = CompositeDisposable()
private lateinit var eventListAdapter: EventListAdapter
@@ -212,11 +214,12 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
}
// remove event
holder.binding.iconTrash.setOnClickListener {
- showConfirmation(requireContext(), resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
- Runnable {
+ OKDialog.showConfirmation(requireContext(), resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
+ {
+ uel.log("AUTOM REMOVED", automationPlugin.at(position).title)
automationPlugin.removeAt(position)
notifyItemRemoved(position)
- }, Runnable {
+ }, {
rxBus.send(EventAutomationUpdateGui())
})
}
@@ -234,8 +237,9 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
override fun onItemDismiss(position: Int) {
activity?.let { activity ->
- showConfirmation(activity, resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
+ OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
Runnable {
+ uel.log("AUTOM REMOVED", automationPlugin.at(position).title)
automationPlugin.removeAt(position)
notifyItemRemoved(position)
rxBus.send(EventAutomationDataChanged())
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt
index b9acd8aaf2..fe08c9a3ab 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt
@@ -18,11 +18,12 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.FoodFragmentBinding
import info.nightscout.androidaps.databinding.FoodItemBinding
import info.nightscout.androidaps.events.EventFoodDatabaseChanged
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.food.FoodFragment.RecyclerViewAdapter.FoodsViewHolder
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.utils.FabricPrivacy
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
+import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import io.reactivex.disposables.CompositeDisposable
@@ -38,6 +39,7 @@ class FoodFragment : DaggerFragment() {
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var foodPlugin: FoodPlugin
@Inject lateinit var nsUpload: NSUpload
+ @Inject lateinit var uel: UserEntryLogger
private val disposable = CompositeDisposable()
private lateinit var unfiltered: List
@@ -213,7 +215,8 @@ class FoodFragment : DaggerFragment() {
binding.remove.setOnClickListener { v: View ->
val food = v.tag as Food
activity?.let { activity ->
- showConfirmation(activity, resourceHelper.gs(R.string.confirmation), resourceHelper.gs(R.string.removerecord) + "\n" + food.name, DialogInterface.OnClickListener { _: DialogInterface?, _: Int ->
+ OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.confirmation), resourceHelper.gs(R.string.removerecord) + "\n" + food.name, DialogInterface.OnClickListener { _: DialogInterface?, _: Int ->
+ uel.log("FOOD REMOVED", food.name)
if (food._id != null && food._id != "") {
nsUpload.removeFoodFromNS(food._id)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt
index d1edbbca20..98fc711d25 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt
@@ -20,13 +20,13 @@ import info.nightscout.androidaps.interfaces.ConfigInterface
import info.nightscout.androidaps.interfaces.ImportExportPrefsInterface
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.maintenance.formats.*
import info.nightscout.androidaps.utils.AndroidPermission
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog.show
import info.nightscout.androidaps.utils.alertDialogs.PrefImportSummaryDialog
import info.nightscout.androidaps.utils.alertDialogs.TwoMessagesAlertDialog
import info.nightscout.androidaps.utils.alertDialogs.WarningDialog
@@ -58,7 +58,8 @@ class ImportExportPrefs @Inject constructor(
private val androidPermission: AndroidPermission,
private val classicPrefsFormat: ClassicPrefsFormat,
private val encryptedPrefsFormat: EncryptedPrefsFormat,
- private val prefFileList: PrefFileListProvider
+ private val prefFileList: PrefFileListProvider,
+ private val uel: UserEntryLogger
) : ImportExportPrefsInterface {
override fun prefsFileExists(): Boolean {
@@ -342,7 +343,8 @@ class ImportExportPrefs @Inject constructor(
private fun restartAppAfterImport(context: Context) {
sp.putBoolean(R.string.key_setupwizard_processed, true)
- show(context, resourceHelper.gs(R.string.setting_imported), resourceHelper.gs(R.string.restartingapp), Runnable {
+ OKDialog.show(context, resourceHelper.gs(R.string.setting_imported), resourceHelper.gs(R.string.restartingapp), Runnable {
+ uel.log("IMPORT")
log.debug(LTag.CORE, "Exiting")
rxBus.send(EventAppExit())
if (context is AppCompatActivity) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt
index e2c20aa0e6..7f44689ebc 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt
@@ -13,6 +13,7 @@ import info.nightscout.androidaps.databinding.MaintenanceFragmentBinding
import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.interfaces.ImportExportPrefsInterface
import info.nightscout.androidaps.logging.AAPSLogger
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.food.FoodPlugin
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
@@ -36,6 +37,7 @@ class MaintenanceFragment : DaggerFragment() {
@Inject lateinit var importExportPrefs: ImportExportPrefsInterface
@Inject lateinit var aapsSchedulers: AapsSchedulers
@Inject lateinit var repository: AppRepository
+ @Inject lateinit var uel: UserEntryLogger
private val compositeDisposable = CompositeDisposable()
@@ -54,13 +56,13 @@ class MaintenanceFragment : DaggerFragment() {
super.onViewCreated(view, savedInstanceState)
binding.logSend.setOnClickListener { maintenancePlugin.sendLogs() }
binding.logDelete.setOnClickListener {
- aapsLogger.debug("USER ENTRY: DELETE LOGS")
+ uel.log("DELETE LOGS")
maintenancePlugin.deleteLogs()
}
binding.navResetdb.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.maintenance), resourceHelper.gs(R.string.reset_db_confirm), Runnable {
- aapsLogger.debug("USER ENTRY: RESET DATABASES")
+ uel.log("RESET DATABASES")
compositeDisposable.add(
fromAction {
MainApp.getDbHelper().resetDatabases()
@@ -81,14 +83,14 @@ class MaintenanceFragment : DaggerFragment() {
}
}
binding.navExport.setOnClickListener {
- aapsLogger.debug("USER ENTRY: EXPORT SETTINGS")
+ uel.log("EXPORT SETTINGS")
// start activity for checking permissions...
importExportPrefs.verifyStoragePermissions(this) {
importExportPrefs.exportSharedPreferences(this)
}
}
binding.navImport.setOnClickListener {
- aapsLogger.debug("USER ENTRY: IMPORT SETTINGS")
+ uel.log("IMPORT SETTINGS")
// start activity for checking permissions...
importExportPrefs.verifyStoragePermissions(this) {
importExportPrefs.importSharedPreferences(this)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.java
index 37de04a623..58bacbbf4c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.java
@@ -16,6 +16,7 @@ import javax.inject.Inject;
import dagger.android.support.DaggerFragment;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.logging.UserEntryLogger;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientNewLog;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart;
@@ -36,6 +37,7 @@ public class NSClientFragment extends DaggerFragment implements View.OnClickList
@Inject UploadQueue uploadQueue;
@Inject FabricPrivacy fabricPrivacy;
@Inject AapsSchedulers aapsSchedulers;
+ @Inject UserEntryLogger uel;
private final CompositeDisposable disposable = new CompositeDisposable();
@@ -121,6 +123,7 @@ public class NSClientFragment extends DaggerFragment implements View.OnClickList
break;
case R.id.nsclientinternal_clearqueue:
OKDialog.showConfirmation(getContext(), resourceHelper.gs(R.string.nsclientinternal), resourceHelper.gs(R.string.clearqueueconfirm), () -> {
+ uel.log("NS QUEUE CLEARED", "", 0.0, 0.0, 0, 0);
uploadQueue.clearQueue();
updateGui();
fabricPrivacy.logCustom("NSClientClearQueue");
@@ -136,6 +139,7 @@ public class NSClientFragment extends DaggerFragment implements View.OnClickList
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
switch (buttonView.getId()) {
case R.id.nsclientinternal_paused:
+ uel.log("NS PAUSED", "", 0.0, 0.0, isChecked ? 1 : 0, 0);
nsClientPlugin.pause(isChecked);
updateGui();
fabricPrivacy.logCustom("NSClientPause");
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.kt
index 06c853185a..0625114f4d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.kt
@@ -5,6 +5,7 @@ import info.nightscout.androidaps.Config
import info.nightscout.androidaps.R
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
@@ -116,7 +117,8 @@ class NSSettingsStatus @Inject constructor(
private val rxBus: RxBusWrapper,
private val defaultValueHelper: DefaultValueHelper,
private val sp: SP,
- private val config: Config
+ private val config: Config,
+ private val uel: UserEntryLogger
) {
var nightscoutVersionName = ""
@@ -233,6 +235,7 @@ class NSSettingsStatus @Inject constructor(
getExtendedWarnValue("sage", "urgent")?.let { sp.putDouble(R.string.key_statuslights_sage_critical, it) }
getExtendedWarnValue("bage", "warn")?.let { sp.putDouble(R.string.key_statuslights_bage_warning, it) }
getExtendedWarnValue("bage", "urgent")?.let { sp.putDouble(R.string.key_statuslights_bage_critical, it) }
+ uel.log("NS SETTINGS COPIED")
}
if (context != null) OKDialog.showConfirmation(context, resourceHelper.gs(R.string.statuslights), resourceHelper.gs(R.string.copyexistingvalues), action)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
index 1c6a8e088a..6050c344b2 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
@@ -33,6 +33,7 @@ import info.nightscout.androidaps.dialogs.*
import info.nightscout.androidaps.events.*
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
@@ -109,6 +110,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
@Inject lateinit var config: Config
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var databaseHelper: DatabaseHelperInterface
+ @Inject lateinit var uel: UserEntryLogger
private val disposable = CompositeDisposable()
@@ -341,7 +343,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.tempbasal_label), lastRun.constraintsProcessed?.toSpanned()
?: "".toSpanned(), {
- aapsLogger.debug("USER ENTRY: ACCEPT TEMP BASAL")
+ uel.log("ACCEPT TEMP BASAL")
binding.buttonsLayout.acceptTempButton.visibility = View.GONE
(context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).cancel(Constants.notificationID)
actionStringHandler.handleInitiate("cancelChangeRequest")
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.kt
index af7813dba8..669ae5c890 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.kt
@@ -207,7 +207,7 @@ class PersistentNotificationPlugin @Inject constructor(
builder.setCategory(NotificationCompat.CATEGORY_STATUS)
builder.setSmallIcon(iconsProvider.getNotificationIcon())
builder.setLargeIcon(resourceHelper.decodeResource(iconsProvider.getIcon()))
- if (line1 != null) builder.setContentTitle(line1)
+ builder.setContentTitle(line1)
if (line2 != null) builder.setContentText(line2)
if (line3 != null) builder.setSubText(line3)
/// Android Auto
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
index 9a5f2b6dec..748f8fe59d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
@@ -22,6 +22,7 @@ import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
@@ -68,7 +69,8 @@ class SmsCommunicatorPlugin @Inject constructor(
private val xdripCalibrations: XdripCalibrations,
private var otp: OneTimePassword,
private val config: Config,
- private val dateUtil: DateUtil
+ private val dateUtil: DateUtil,
+ private val uel: UserEntryLogger
) : PluginBase(PluginDescription()
.mainType(PluginType.GENERAL)
.fragmentClass(SmsCommunicatorFragment::class.java.name)
@@ -335,7 +337,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS LOOP DISABLE")
+ uel.log("SMS LOOP DISABLE")
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
@@ -359,7 +361,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS LOOP ENABLE")
+ uel.log("SMS LOOP ENABLE")
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_loophasbeenenabled)))
rxBus.send(EventRefreshOverview("SMS_LOOP_START"))
@@ -386,7 +388,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS LOOP RESUME")
+ uel.log("SMS LOOP RESUME")
loopPlugin.suspendTo(0L)
rxBus.send(EventRefreshOverview("SMS_LOOP_RESUME"))
commandQueue.cancelTempBasal(true, object : Callback() {
@@ -419,7 +421,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(duration) {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS LOOP SUSPEND")
+ uel.log("SMS LOOP SUSPEND")
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (result.success) {
@@ -503,7 +505,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS PUMP CONNECT")
+ uel.log("SMS PUMP CONNECT")
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
@@ -532,7 +534,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS PUMP DISCONNECT")
+ uel.log("SMS PUMP DISCONNECT")
val profile = profileFunction.getProfile()
loopPlugin.disconnectPump(duration, profile)
rxBus.send(EventRefreshOverview("SMS_PUMP_DISCONNECT"))
@@ -586,7 +588,7 @@ class SmsCommunicatorPlugin @Inject constructor(
val finalPercentage = percentage
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(list[pindex - 1] as String, finalPercentage) {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS PROFILE $reply")
+ uel.log("SMS PROFILE", reply)
activePlugin.activeTreatments.doProfileSwitch(store, list[pindex - 1] as String, 0, finalPercentage, 0, DateUtil.now())
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.profileswitchcreated)))
}
@@ -604,7 +606,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS BASAL $reply")
+ uel.log("SMS BASAL", reply)
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (result.success) {
@@ -636,7 +638,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(tempBasalPct, duration) {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS BASAL $reply")
+ uel.log("SMS BASAL", reply)
commandQueue.tempBasalPercent(anInteger(), secondInteger(), true, profile, object : Callback() {
override fun run() {
if (result.success) {
@@ -669,7 +671,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(tempBasal, duration) {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS BASAL $reply")
+ uel.log("SMS BASAL", reply)
commandQueue.tempBasalAbsolute(aDouble(), secondInteger(), true, profile, object : Callback() {
override fun run() {
if (result.success) {
@@ -697,7 +699,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS EXTENDED $reply")
+ uel.log("SMS EXTENDED", reply)
commandQueue.cancelExtended(object : Callback() {
override fun run() {
if (result.success) {
@@ -726,7 +728,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(extended, duration) {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS EXTENDED $reply")
+ uel.log("SMS EXTENDED", reply)
commandQueue.extendedBolus(aDouble(), secondInteger(), object : Callback() {
override fun run() {
if (result.success) {
@@ -762,7 +764,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(bolus) {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS BOLUS $reply")
+ uel.log("SMS BOLUS", reply)
val detailedBolusInfo = DetailedBolusInfo()
detailedBolusInfo.insulin = aDouble()
detailedBolusInfo.source = Source.USER
@@ -839,7 +841,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(grams, time) {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS CARBS $reply")
+ uel.log("SMS CARBS", reply)
val detailedBolusInfo = DetailedBolusInfo()
detailedBolusInfo.carbs = anInteger().toDouble()
detailedBolusInfo.source = Source.USER
@@ -880,7 +882,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS TARGET $reply")
+ uel.log("SMS TARGET", reply)
val units = profileFunction.getUnits()
var keyDuration = 0
var defaultTargetDuration = 0
@@ -936,7 +938,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS TARGET $reply")
+ uel.log("SMS TARGET", reply)
val tempTarget = TempTarget()
.source(Source.USER)
.date(DateUtil.now())
@@ -961,7 +963,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS SMS $reply")
+ uel.log("SMS SMS", reply)
sp.putBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_stoppedsms))
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
@@ -978,7 +980,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(cal) {
override fun run() {
- aapsLogger.debug("USER ENTRY: SMS CAL $reply")
+ uel.log("SMS CAL", reply)
val result = xdripCalibrations.sendIntent(aDouble!!)
if (result) sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_calibrationsent))) else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_calibrationfailed)))
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt
index d11ee90f70..162c128c58 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt
@@ -15,6 +15,7 @@ import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.databinding.ActivitySmscommunicatorOtpBinding
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.androidaps.plugins.general.smsCommunicator.otp.OneTimePassword
@@ -31,6 +32,7 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
@Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin
@Inject lateinit var otp: OneTimePassword
+ @Inject lateinit var uel: UserEntryLogger
private lateinit var binding: ActivitySmscommunicatorOtpBinding
@@ -70,6 +72,7 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
resourceHelper.gs(R.string.smscommunicator_otp_reset_title),
resourceHelper.gs(R.string.smscommunicator_otp_reset_prompt),
Runnable {
+ uel.log("OTP RESET")
otp.ensureKey(true)
updateGui()
ToastUtils.Long.infoToast(this, resourceHelper.gs(R.string.smscommunicator_otp_reset_successful))
@@ -85,6 +88,7 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
val clip = ClipData.newPlainText("OTP Secret", otp.provisioningSecret())
clipboard.primaryClip = clip
ToastUtils.Long.infoToast(this, resourceHelper.gs(R.string.smscommunicator_otp_export_successful))
+ uel.log("OTP EXPORT")
})
true
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
index e617f7fe52..063c4e65c4 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
@@ -16,6 +16,7 @@ import info.nightscout.androidaps.databinding.LocalprofileFragmentBinding
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.logging.AAPSLogger
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
import info.nightscout.androidaps.utils.*
@@ -38,6 +39,7 @@ class LocalProfileFragment : DaggerFragment() {
@Inject lateinit var hardLimits: HardLimits
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private var disposable: CompositeDisposable = CompositeDisposable()
@@ -159,6 +161,7 @@ class LocalProfileFragment : DaggerFragment() {
if (localProfilePlugin.isEdited) {
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
} else {
+ uel.log("NEW PROFILE")
localProfilePlugin.addNewProfile()
build()
}
@@ -168,6 +171,7 @@ class LocalProfileFragment : DaggerFragment() {
if (localProfilePlugin.isEdited) {
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
} else {
+ uel.log("CLONE PROFILE", localProfilePlugin.currentProfile()?.name ?: "")
localProfilePlugin.cloneProfile()
build()
}
@@ -176,6 +180,7 @@ class LocalProfileFragment : DaggerFragment() {
binding.profileRemove.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.deletecurrentprofile), {
+ uel.log("REMOVE PROFILE", localProfilePlugin.currentProfile()?.name ?: "")
localProfilePlugin.removeCurrentProfile()
build()
}, null)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt
index 07be4da165..e8d5dba65d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt
@@ -9,6 +9,7 @@ import info.nightscout.androidaps.events.EventProfileStoreChanged
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.utils.DateUtil
@@ -32,7 +33,8 @@ class LocalProfilePlugin @Inject constructor(
resourceHelper: ResourceHelper,
private val sp: SP,
private val profileFunction: ProfileFunction,
- private val nsUpload: NSUpload
+ private val nsUpload: NSUpload,
+ private val uel: UserEntryLogger
) : PluginBase(PluginDescription()
.mainType(PluginType.PROFILE)
.fragmentClass(LocalProfileFragment::class.java.name)
@@ -113,6 +115,7 @@ class LocalProfilePlugin @Inject constructor(
createAndStoreConvertedProfile()
isEdited = false
aapsLogger.debug(LTag.PROFILE, "Storing settings: " + rawProfile?.data.toString())
+ uel.log("STORE PROFILE")
rxBus.send(EventProfileStoreChanged())
var namesOK = true
profiles.forEach {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt
index 7e514ee650..f8c8c0ed25 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt
@@ -10,6 +10,7 @@ import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.NsprofileFragmentBinding
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.profile.ns.events.EventNSProfileUpdateGUI
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
@@ -32,6 +33,7 @@ class NSProfileFragment : DaggerFragment() {
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var nsProfilePlugin: NSProfilePlugin
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private var disposable: CompositeDisposable = CompositeDisposable()
@@ -59,6 +61,7 @@ class NSProfileFragment : DaggerFragment() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.nsprofile),
resourceHelper.gs(R.string.activate_profile) + ": " + name + " ?", Runnable {
+ uel.log("PROFILE SWITCH", name, i1 = 100)
treatmentsPlugin.doProfileSwitch(store, name, 0, 100, 0, DateUtil.now())
})
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
index 84999eb388..07038a50e5 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
@@ -17,6 +17,7 @@ import info.nightscout.androidaps.databinding.BgsourceItemBinding
import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
@@ -42,6 +43,7 @@ class BGSourceFragment : DaggerFragment() {
@Inject lateinit var databaseHelper: DatabaseHelperInterface
@Inject lateinit var repository: AppRepository
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private val disposable = CompositeDisposable()
private val millsToThePast = T.hours(12).msecs()
@@ -126,6 +128,7 @@ class BGSourceFragment : DaggerFragment() {
activity?.let { activity ->
val text = dateUtil.dateAndTimeString(glucoseValue.timestamp) + "\n" + glucoseValue.valueToUnitsString(profileFunction.getUnits())
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
+ uel.log("BG REMOVED", dateUtil.dateAndTimeString(glucoseValue.timestamp))
disposable += repository.runTransaction(InvalidateGlucoseValueTransaction(glucoseValue.id)).subscribe()
})
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt
index da33e05672..3855202408 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt
@@ -68,6 +68,10 @@ class TreatmentsFragment : DaggerFragment() {
setFragment(TreatmentsCareportalFragment())
setBackgroundColorOnSelected(it)
}
+ binding.userentry.setOnClickListener {
+ setFragment(TreatmentsUserEntryFragment())
+ setBackgroundColorOnSelected(it)
+ }
setFragment(TreatmentsBolusFragment())
setBackgroundColorOnSelected(binding.treatments)
}
@@ -109,6 +113,7 @@ class TreatmentsFragment : DaggerFragment() {
binding.tempTargets.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
binding.profileSwitches.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
binding.careportal.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
+ binding.userentry.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
selected.setBackgroundColor(resourceHelper.gc(R.color.tabBgColorSelected))
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt
index 7c7c6dd579..d830ca5414 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt
@@ -16,6 +16,7 @@ import info.nightscout.androidaps.db.Treatment
import info.nightscout.androidaps.dialogs.WizardInfoDialog
import info.nightscout.androidaps.events.EventTreatmentChange
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
@@ -48,6 +49,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private var _binding: TreatmentsBolusFragmentBinding? = null
@@ -66,6 +68,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
binding.refreshFromNightscout.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
+ uel.log("TREAT NS REFRESH")
treatmentsPlugin.service.resetTreatments()
rxBus.send(EventNSClientRestart())
}
@@ -74,6 +77,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
binding.deleteFutureTreatments.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_treatment_label), resourceHelper.gs(R.string.deletefuturetreatments) + "?", Runnable {
+ uel.log("DELETE FUTURE TREATMENTS")
val futureTreatments = treatmentsPlugin.service.getTreatmentDataFromTime(DateUtil.now() + 1000, true)
for (treatment in futureTreatments) {
if (NSUpload.isIdValid(treatment._id))
@@ -170,6 +174,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
resourceHelper.gs(R.string.carbs) + ": " + resourceHelper.gs(R.string.format_carbs, treatment.carbs.toInt()) + "\n" +
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(treatment.date)
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
+ uel.log("REMOVED TREATMENT", text)
if (treatment.source == Source.PUMP) {
treatment.isValid = false
treatmentsPlugin.service.update(treatment)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt
index 54fc2f592d..58269316be 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt
@@ -14,6 +14,7 @@ import info.nightscout.androidaps.databinding.TreatmentsCareportalFragmentBindin
import info.nightscout.androidaps.databinding.TreatmentsCareportalItemBinding
import info.nightscout.androidaps.db.CareportalEvent
import info.nightscout.androidaps.events.EventCareportalEventChange
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
@@ -44,6 +45,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private var _binding: TreatmentsCareportalFragmentBinding? = null
@@ -62,6 +64,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
binding.refreshFromNightscout.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal), resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", Runnable {
+ uel.log("CAREPORTAL NS REFRESH")
MainApp.getDbHelper().resetCareportalEvents()
rxBus.send(EventNSClientRestart())
})
@@ -70,6 +73,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
binding.removeAndroidapsStartedEvents.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal), resourceHelper.gs(R.string.careportal_removestartedevents), Runnable {
+ uel.log("REMOVED RESTART EVENTS")
val events = MainApp.getDbHelper().getCareportalEvents(false)
for (i in events.indices) {
val careportalEvent = events[i]
@@ -150,6 +154,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + careportalEvent.notes + "\n" +
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(careportalEvent.date)
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
+ uel.log("REMOVED CAREP", text)
if (NSUpload.isIdValid(careportalEvent._id))
nsUpload.removeCareportalEntryFromNS(careportalEvent._id)
else
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt
index f3a47b88ce..e223fd150a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt
@@ -20,6 +20,7 @@ import info.nightscout.androidaps.db.Source
import info.nightscout.androidaps.events.EventExtendedBolusChange
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
@@ -27,7 +28,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutos
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsExtendedBolusesFragment.RecyclerViewAdapter.ExtendedBolusesViewHolder
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
+import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import io.reactivex.disposables.CompositeDisposable
@@ -46,6 +47,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private var _binding: TreatmentsExtendedbolusFragmentBinding? = null
@@ -114,16 +116,17 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
binding.remove.setOnClickListener { v: View ->
val extendedBolus = v.tag as ExtendedBolus
context?.let {
- showConfirmation(it, resourceHelper.gs(R.string.removerecord),
+ OKDialog.showConfirmation(it, resourceHelper.gs(R.string.removerecord),
"""
${resourceHelper.gs(R.string.extended_bolus)}
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(extendedBolus.date)}
- """.trimIndent(), DialogInterface.OnClickListener { _: DialogInterface, _: Int ->
+ """.trimIndent(), { _: DialogInterface, _: Int ->
+ uel.log("REMOVED EB")
val id = extendedBolus._id
- if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
- else uploadQueue.removeID("dbAdd", id)
- MainApp.getDbHelper().delete(extendedBolus)
- }, null)
+ if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
+ else uploadQueue.removeID("dbAdd", id)
+ MainApp.getDbHelper().delete(extendedBolus)
+ }, null)
}
}
binding.remove.paintFlags = binding.remove.paintFlags or Paint.UNDERLINE_TEXT_FLAG
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
index 2ab82a8a36..1d7ba6041d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
@@ -16,6 +16,7 @@ import info.nightscout.androidaps.db.ProfileSwitch
import info.nightscout.androidaps.db.Source
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.events.EventProfileNeedsUpdate
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
@@ -49,6 +50,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private var _binding: TreatmentsProfileswitchFragmentBinding? = null
@@ -67,6 +69,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
binding.refreshFromNightscout.setOnClickListener {
activity?.let { activity ->
+ uel.log("PROFILE SWITCH NS REFRESH")
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
MainApp.getDbHelper().resetProfileSwitch()
rxBus.send(EventNSClientRestart())
@@ -143,6 +146,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord),
resourceHelper.gs(R.string.careportal_profileswitch) + ": " + profileSwitch.profileName +
"\n" + resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
+ uel.log("REMOVED PROFILE SWITCH", profileSwitch.profileName + " " + dateUtil.dateAndTimeString(profileSwitch.date))
val id = profileSwitch._id
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
else uploadQueue.removeID("dbAdd", id)
@@ -155,6 +159,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
val profileSwitch = it.tag as ProfileSwitch
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), resourceHelper.gs(R.string.copytolocalprofile) + "\n" + profileSwitch.customizedName + "\n" + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
profileSwitch.profileObject?.let {
+ uel.log("PROFILE SWITCH CLONE", profileSwitch.profileName + " " + dateUtil.dateAndTimeString(profileSwitch.date))
val nonCustomized = it.convertToNonCustomizedProfile()
if (nonCustomized.isValid(resourceHelper.gs(R.string.careportal_profileswitch, false))) {
localProfilePlugin.addProfile(localProfilePlugin.copyFrom(nonCustomized, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_")))
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt
index 9b41d72243..3265275e36 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt
@@ -20,6 +20,7 @@ import info.nightscout.androidaps.db.TempTarget
import info.nightscout.androidaps.events.EventTempTargetChange
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
@@ -27,7 +28,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientR
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsTempTargetFragment.RecyclerViewAdapter.TempTargetsViewHolder
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
+import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
@@ -48,6 +49,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private val disposable = CompositeDisposable()
@@ -66,7 +68,8 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
binding.recyclerview.adapter = RecyclerViewAdapter(activePlugin.activeTreatments.tempTargetsFromHistory)
binding.refreshFromNightscout.setOnClickListener {
context?.let { context ->
- showConfirmation(context, resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", {
+ OKDialog.showConfirmation(context, resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", {
+ uel.log("TT NS REFRESH")
MainApp.getDbHelper().resetTempTargets()
rxBus.send(EventNSClientRestart())
})
@@ -152,12 +155,13 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
binding.remove.setOnClickListener { v: View ->
val tempTarget = v.tag as TempTarget
context?.let { context ->
- showConfirmation(context, resourceHelper.gs(R.string.removerecord),
+ OKDialog.showConfirmation(context, resourceHelper.gs(R.string.removerecord),
"""
${resourceHelper.gs(R.string.careportal_temporarytarget)}: ${tempTarget.friendlyDescription(profileFunction.getUnits(), resourceHelper)}
${dateUtil.dateAndTimeString(tempTarget.date)}
""".trimIndent(),
{ _: DialogInterface?, _: Int ->
+ uel.log("TT REMOVE", tempTarget.friendlyDescription(profileFunction.getUnits(), resourceHelper))
val id = tempTarget._id
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
else uploadQueue.removeID("dbAdd", id)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt
index 82c500db21..b17933471c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt
@@ -19,13 +19,14 @@ import info.nightscout.androidaps.db.TemporaryBasal
import info.nightscout.androidaps.events.EventTempBasalChange
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsTemporaryBasalsFragment.RecyclerViewAdapter.TempBasalsViewHolder
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
+import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import io.reactivex.disposables.CompositeDisposable
@@ -42,6 +43,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private var _binding: TreatmentsTempbasalsFragmentBinding? = null
@@ -155,12 +157,13 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
binding.remove.setOnClickListener { v: View ->
val tempBasal = v.tag as TemporaryBasal
context?.let {
- showConfirmation(it, resourceHelper.gs(R.string.removerecord),
+ OKDialog.showConfirmation(it, resourceHelper.gs(R.string.removerecord),
"""
${resourceHelper.gs(R.string.tempbasal_label)}: ${tempBasal.toStringFull()}
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(tempBasal.date)}
""".trimIndent(),
- DialogInterface.OnClickListener { _: DialogInterface?, _: Int ->
+ { _: DialogInterface?, _: Int ->
+ uel.log("REMOVED TT", dateUtil.dateAndTimeString(tempBasal.date))
activePlugin.activeTreatments.removeTempBasal(tempBasal)
}, null)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsUserEntryFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsUserEntryFragment.kt
new file mode 100644
index 0000000000..3a46793e02
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsUserEntryFragment.kt
@@ -0,0 +1,82 @@
+package info.nightscout.androidaps.plugins.treatments.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import dagger.android.support.DaggerFragment
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.androidaps.database.entities.UserEntry
+import info.nightscout.androidaps.databinding.TreatmentsUserEntryFragmentBinding
+import info.nightscout.androidaps.databinding.TreatmentsUserEntryItemBinding
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.rx.AapsSchedulers
+import io.reactivex.disposables.CompositeDisposable
+import io.reactivex.rxkotlin.plusAssign
+import javax.inject.Inject
+
+class TreatmentsUserEntryFragment : DaggerFragment() {
+
+ @Inject lateinit var repository: AppRepository
+ @Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var dateUtil: DateUtil
+
+ private val disposable = CompositeDisposable()
+
+ private var _binding: TreatmentsUserEntryFragmentBinding? = null
+
+ // This property is only valid between onCreateView and
+ // onDestroyView.
+ private val binding get() = _binding!!
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
+ TreatmentsUserEntryFragmentBinding.inflate(inflater, container, false).also { _binding = it }.root
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ binding.recyclerview.setHasFixedSize(true)
+ binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
+
+ disposable += repository
+ .getAllUserEntries()
+ .observeOn(aapsSchedulers.main)
+ .subscribe { list -> binding.recyclerview.swapAdapter(UserEntryAdapter(list), true) }
+ }
+
+ @Synchronized
+ override fun onDestroyView() {
+ super.onDestroyView()
+ disposable.clear()
+ _binding = null
+ }
+
+ inner class UserEntryAdapter internal constructor(var entries: List) : RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): UserEntryViewHolder {
+ val view: View = LayoutInflater.from(parent.context).inflate(R.layout.treatments_user_entry_item, parent, false)
+ return UserEntryViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: UserEntryViewHolder, position: Int) {
+ val current = entries[position]
+ holder.binding.date.text = dateUtil.dateAndTimeAndSecondsString(current.timestamp)
+ holder.binding.action.text = current.action
+ holder.binding.s.text = current.s
+ holder.binding.d1.text = if (current.d1 != 0.0) current.d1.toString() else ""
+ holder.binding.d2.text = if (current.d2 != 0.0) current.d2.toString() else ""
+ holder.binding.i1.text = if (current.i1 != 0) current.i1.toString() else ""
+ holder.binding.i1.text = if (current.i2 != 0) current.i2.toString() else ""
+ }
+
+ inner class UserEntryViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+
+ val binding = TreatmentsUserEntryItemBinding.bind(itemView)
+ }
+
+ override fun getItemCount(): Int = entries.size
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt
index 0313207d37..78b21df59d 100644
--- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt
@@ -12,6 +12,7 @@ import info.nightscout.androidaps.databinding.ActivitySetupwizardBinding
import info.nightscout.androidaps.events.EventProfileNeedsUpdate
import info.nightscout.androidaps.events.EventProfileStoreChanged
import info.nightscout.androidaps.events.EventPumpStatusChanged
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientStatus
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
@@ -19,7 +20,7 @@ import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDevic
import info.nightscout.androidaps.setupwizard.elements.SWItem
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate
import info.nightscout.androidaps.utils.FabricPrivacy
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
+import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.locale.LocaleHelper.update
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.sharedPreferences.SP
@@ -37,6 +38,7 @@ class SetupWizardActivity : NoSplashAppCompatActivity() {
@Inject lateinit var sp: SP
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private val disposable = CompositeDisposable()
private lateinit var screens: List
@@ -143,13 +145,13 @@ class SetupWizardActivity : NoSplashAppCompatActivity() {
}
override fun onBackPressed() {
- if (currentWizardPage == 0) showConfirmation(this, resourceHelper.gs(R.string.exitwizard), Runnable { finish() }) else showPreviousPage(null)
+ if (currentWizardPage == 0) OKDialog.showConfirmation(this, resourceHelper.gs(R.string.exitwizard)) { finish() } else showPreviousPage(null)
}
@Suppress("UNUSED_PARAMETER")
fun exitPressed(view: View?) {
sp.putBoolean(R.string.key_setupwizard_processed, true)
- showConfirmation(this, resourceHelper.gs(R.string.exitwizard), Runnable { finish() })
+ OKDialog.showConfirmation(this, resourceHelper.gs(R.string.exitwizard)) { finish() }
}
@Suppress("UNUSED_PARAMETER")
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt
index 4ac9b7885f..323f52f05b 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt
@@ -22,7 +22,7 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationWithAction
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog.show
+import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
import javax.inject.Singleton
@@ -58,7 +58,7 @@ class AndroidPermission @Inject constructor(
activity.callForBatteryOptimization.launch(null)
} catch (e: ActivityNotFoundException) {
permissionBatteryOptimizationFailed = true
- show(activity, resourceHelper.gs(R.string.permission), resourceHelper.gs(R.string.alert_dialog_permission_battery_optimization_failed), Runnable { activity.recreate() })
+ OKDialog.show(activity, resourceHelper.gs(R.string.permission), resourceHelper.gs(R.string.alert_dialog_permission_battery_optimization_failed), Runnable { activity.recreate() })
}
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
index ce53f3d670..e32f62e61b 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
@@ -18,6 +18,7 @@ import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
@@ -65,6 +66,7 @@ class BolusWizard @Inject constructor(
@Inject lateinit var automationPlugin: AutomationPlugin
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var config: Config
+ @Inject lateinit var uel: UserEntryLogger
init {
injector.androidInjector().inject(this)
@@ -354,7 +356,7 @@ class BolusWizard @Inject constructor(
boluscalc = nsJSON()
source = Source.USER
notes = this@BolusWizard.notes
- aapsLogger.debug("USER ENTRY: BOLUS ADVISOR insulin $insulinAfterConstraints")
+ uel.log("BOLUS ADVISOR", d1 = insulinAfterConstraints)
if (insulin > 0) {
commandQueue.bolus(this, object : Callback() {
override fun run() {
@@ -382,7 +384,7 @@ class BolusWizard @Inject constructor(
OKDialog.showConfirmation(ctx, resourceHelper.gs(R.string.boluswizard), confirmMessage, {
if (insulinAfterConstraints > 0 || carbs > 0) {
if (useSuperBolus) {
- aapsLogger.debug("USER ENTRY: SUPERBOLUS TBR")
+ uel.log("SUPERBOLUS TBR")
if (loopPlugin.isEnabled(PluginType.LOOP)) {
loopPlugin.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000)
rxBus.send(EventRefreshOverview("WizardDialog"))
@@ -428,7 +430,7 @@ class BolusWizard @Inject constructor(
boluscalc = nsJSON()
source = Source.USER
notes = this@BolusWizard.notes
- aapsLogger.debug("USER ENTRY: BOLUS WIZARD insulin $insulinAfterConstraints carbs: $carbs")
+ uel.log("BOLUS WIZARD", "", insulinAfterConstraints, carbs)
if (insulin > 0 || pump.pumpDescription.storesCarbInfo) {
commandQueue.bolus(this, object : Callback() {
override fun run() {
diff --git a/app/src/main/res/layout/treatments_fragment.xml b/app/src/main/res/layout/treatments_fragment.xml
index 28a9bf7a02..06b6f93145 100644
--- a/app/src/main/res/layout/treatments_fragment.xml
+++ b/app/src/main/res/layout/treatments_fragment.xml
@@ -21,8 +21,8 @@
android:id="@+id/treatments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingStart="6dp"
- android:paddingEnd="6dp"
+ android:paddingStart="1dp"
+ android:paddingEnd="1dp"
android:layout_weight="1"
android:contentDescription="@string/bolus"
android:scaleX="0.8"
@@ -35,8 +35,8 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/extended_bolus"
- android:paddingStart="6dp"
- android:paddingEnd="6dp"
+ android:paddingStart="1dp"
+ android:paddingEnd="1dp"
android:scaleX="0.7"
android:scaleY="0.7"
app:srcCompat="@drawable/ic_actions_startextbolus" />
@@ -45,8 +45,8 @@
android:id="@+id/temp_basals"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingStart="6dp"
- android:paddingEnd="6dp"
+ android:paddingStart="1dp"
+ android:paddingEnd="1dp"
android:layout_weight="1"
android:contentDescription="@string/tempbasal_label"
android:scaleX="0.7"
@@ -57,8 +57,8 @@
android:id="@+id/temp_targets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingStart="6dp"
- android:paddingEnd="6dp"
+ android:paddingStart="1dp"
+ android:paddingEnd="1dp"
android:layout_weight="1"
android:contentDescription="@string/careportal_temporarytarget"
android:scaleX="0.7"
@@ -69,8 +69,8 @@
android:id="@+id/profile_switches"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingStart="6dp"
- android:paddingEnd="6dp"
+ android:paddingStart="1dp"
+ android:paddingEnd="1dp"
android:layout_weight="1"
android:contentDescription="@string/careportal_profileswitch"
android:scaleX="0.7"
@@ -81,14 +81,26 @@
android:id="@+id/careportal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingStart="6dp"
- android:paddingEnd="6dp"
+ android:paddingStart="1dp"
+ android:paddingEnd="1dp"
android:layout_weight="1"
android:contentDescription="@string/careportal"
android:scaleX="0.7"
android:scaleY="0.7"
app:srcCompat="@drawable/ic_cp_note" />
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/treatments_user_entry_item.xml b/app/src/main/res/layout/treatments_user_entry_item.xml
new file mode 100644
index 0000000000..a3c3870c9a
--- /dev/null
+++ b/app/src/main/res/layout/treatments_user_entry_item.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9b0e5ef503..272bb8e7c0 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1378,5 +1378,6 @@
Clear filter
Trend arrow
Cannula
+ User entry
diff --git a/build.gradle b/build.gradle
index 6f9baba6ee..2872ee3169 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,7 +10,7 @@ buildscript {
room_version = '2.2.6'
lifecycle_version = '2.2.0'
dagger_version = '2.31.2'
- coroutinesVersion = '1.3.7'
+ coroutinesVersion = '1.4.1'
activityVersion = '1.2.0-rc01'
fragmentktx_version = '1.3.0-rc01'
ormLiteVersion = '4.46'
diff --git a/core/core_dependencies.gradle b/core/core_dependencies.gradle
index e2a48f1d88..2e91e42d6b 100644
--- a/core/core_dependencies.gradle
+++ b/core/core_dependencies.gradle
@@ -12,7 +12,7 @@ dependencies {
api "androidx.preference:preference-ktx:$preferencektx_version"
api 'androidx.biometric:biometric:1.0.1'
api "androidx.activity:activity-ktx:${activityVersion}"
- api "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
+ api "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
api 'androidx.cardview:cardview:1.0.0'
api 'androidx.recyclerview:recyclerview:1.1.0'
api 'androidx.gridlayout:gridlayout:1.0.0'
diff --git a/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt b/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt
index edaff653ba..110096c0bd 100644
--- a/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt
+++ b/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt
@@ -12,6 +12,7 @@ import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.core.databinding.DialogErrorBinding
import info.nightscout.androidaps.logging.AAPSLogger
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
import info.nightscout.androidaps.utils.T
import javax.inject.Inject
@@ -20,6 +21,7 @@ class ErrorDialog : DaggerDialogFragment() {
@Inject lateinit var alarmSoundServiceHelper: AlarmSoundServiceHelper
@Inject lateinit var aapsLogger: AAPSLogger
+ @Inject lateinit var uel: UserEntryLogger
var helperActivity: ErrorHelperActivity? = null
var status: String = ""
@@ -56,15 +58,15 @@ class ErrorDialog : DaggerDialogFragment() {
binding.title.text = title
binding.ok.setOnClickListener {
- aapsLogger.debug("USER ENTRY: Error dialog ok button pressed")
+ uel.log("Error dialog ok button pressed")
dismiss()
}
binding.mute.setOnClickListener {
- aapsLogger.debug("USER ENTRY: Error dialog mute button pressed")
+ uel.log("Error dialog mute button pressed")
stopAlarm()
}
binding.mute5min.setOnClickListener {
- aapsLogger.debug("USER ENTRY: Error dialog mute 5 min button pressed")
+ uel.log("Error dialog mute 5 min button pressed")
stopAlarm()
loopHandler.postDelayed(this::startAlarm, T.mins(5).msecs())
}
diff --git a/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt b/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt
new file mode 100644
index 0000000000..1692be20fc
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt
@@ -0,0 +1,37 @@
+package info.nightscout.androidaps.logging
+
+import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.androidaps.database.transactions.UserEntryTransaction
+import info.nightscout.androidaps.utils.rx.AapsSchedulers
+import io.reactivex.disposables.CompositeDisposable
+import io.reactivex.rxkotlin.plusAssign
+import io.reactivex.rxkotlin.subscribeBy
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class UserEntryLogger @Inject constructor(
+ private val aapsLogger: AAPSLogger,
+ private val repository: AppRepository,
+ private val aapsSchedulers: AapsSchedulers
+) {
+
+ private val compositeDisposable = CompositeDisposable()
+
+ fun log(action: String, s: String = "", d1: Double = 0.0, d2: Double = 0.0, i1: Int = 0, i2: Int = 0) {
+ compositeDisposable += repository.runTransaction(UserEntryTransaction(
+ action = action,
+ s = s,
+ d1 = d1,
+ d2 = d2,
+ i1 = i1,
+ i2 = i2
+ ))
+ .subscribeOn(aapsSchedulers.io)
+ .observeOn(aapsSchedulers.io)
+ .subscribeBy(
+ onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $s ${if (d1 == 0.0) d1 else ""} ${if (d2 == 0.0) d2 else ""} ${if (i1 == 0) i1 else ""} ${if (i2 == 0) i2 else ""}") },
+ onComplete = { aapsLogger.debug("USER ENTRY: $action $s ${if (d1 == 0.0) d1 else ""} ${if (d2 == 0.0) d2 else ""} ${if (i1 == 0) i1 else ""} ${if (i2 == 0) i2 else ""}") }
+ )
+ }
+}
\ No newline at end of file
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt b/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt
index a5d1083fbe..1fca6ed5ef 100644
--- a/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt
@@ -20,6 +20,7 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.PumpInterface
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
+import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
import info.nightscout.androidaps.queue.events.EventQueueChanged
@@ -49,6 +50,7 @@ class DanaFragment : DaggerFragment() {
@Inject lateinit var warnColors: WarnColors
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ @Inject lateinit var uel: UserEntryLogger
private var disposable: CompositeDisposable = CompositeDisposable()
@@ -106,7 +108,7 @@ class DanaFragment : DaggerFragment() {
binding.btconnection.setOnLongClickListener {
activity?.let {
OKDialog.showConfirmation(it, resourceHelper.gs(R.string.resetpairing)) {
- aapsLogger.error("USER ENTRY: Clearing pairing keys !!!")
+ uel.log("CLEAR PAIRING KEYS")
(activePlugin.activePump as DanaPumpInterface).clearPairing()
}
}
diff --git a/database/schemas/info.nightscout.androidaps.database.AppDatabase/2.json b/database/schemas/info.nightscout.androidaps.database.AppDatabase/2.json
new file mode 100644
index 0000000000..e3e7705d83
--- /dev/null
+++ b/database/schemas/info.nightscout.androidaps.database.AppDatabase/2.json
@@ -0,0 +1,2757 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 2,
+ "identityHash": "a1db89121451334b6eb389e8c702dd2c",
+ "entities": [
+ {
+ "tableName": "apsResults",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `algorithm` TEXT NOT NULL, `glucoseStatusJson` TEXT NOT NULL, `currentTempJson` TEXT NOT NULL, `iobDataJson` TEXT NOT NULL, `profileJson` TEXT NOT NULL, `autosensDataJson` TEXT, `mealDataJson` TEXT NOT NULL, `isMicroBolusAllowed` INTEGER, `resultJson` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `apsResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "algorithm",
+ "columnName": "algorithm",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseStatusJson",
+ "columnName": "glucoseStatusJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "currentTempJson",
+ "columnName": "currentTempJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iobDataJson",
+ "columnName": "iobDataJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileJson",
+ "columnName": "profileJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "autosensDataJson",
+ "columnName": "autosensDataJson",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "mealDataJson",
+ "columnName": "mealDataJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isMicroBolusAllowed",
+ "columnName": "isMicroBolusAllowed",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "resultJson",
+ "columnName": "resultJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_apsResults_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResults_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_apsResults_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResults_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "apsResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "boluses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `amount` REAL NOT NULL, `type` TEXT NOT NULL, `isBasalInsulin` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT, `insulinEndTime` INTEGER, `peak` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isBasalInsulin",
+ "columnName": "isBasalInsulin",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_boluses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_boluses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "bolusCalculatorResults",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `targetBGLow` REAL NOT NULL, `targetBGHigh` REAL NOT NULL, `isf` REAL NOT NULL, `ic` REAL NOT NULL, `bolusIOB` REAL NOT NULL, `wasBolusIOBUsed` INTEGER NOT NULL, `basalIOB` REAL NOT NULL, `wasBasalIOBUsed` INTEGER NOT NULL, `glucoseValue` REAL NOT NULL, `wasGlucoseUsed` INTEGER NOT NULL, `glucoseDifference` REAL NOT NULL, `glucoseInsulin` REAL NOT NULL, `glucoseTrend` REAL NOT NULL, `wasTrendUsed` INTEGER NOT NULL, `trendInsulin` REAL NOT NULL, `cob` REAL NOT NULL, `wasCOBUsed` INTEGER NOT NULL, `cobInsulin` REAL NOT NULL, `carbs` REAL NOT NULL, `wereCarbsUsed` INTEGER NOT NULL, `carbsInsulin` REAL NOT NULL, `otherCorrection` REAL NOT NULL, `wasSuperbolusUsed` INTEGER NOT NULL, `superbolusInsulin` REAL NOT NULL, `wasTempTargetUsed` INTEGER NOT NULL, `totalInsulin` REAL NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `bolusCalculatorResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBGLow",
+ "columnName": "targetBGLow",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBGHigh",
+ "columnName": "targetBGHigh",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isf",
+ "columnName": "isf",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "ic",
+ "columnName": "ic",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bolusIOB",
+ "columnName": "bolusIOB",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasBolusIOBUsed",
+ "columnName": "wasBolusIOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalIOB",
+ "columnName": "basalIOB",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasBasalIOBUsed",
+ "columnName": "wasBasalIOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseValue",
+ "columnName": "glucoseValue",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasGlucoseUsed",
+ "columnName": "wasGlucoseUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseDifference",
+ "columnName": "glucoseDifference",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseInsulin",
+ "columnName": "glucoseInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseTrend",
+ "columnName": "glucoseTrend",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasTrendUsed",
+ "columnName": "wasTrendUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trendInsulin",
+ "columnName": "trendInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cob",
+ "columnName": "cob",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasCOBUsed",
+ "columnName": "wasCOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cobInsulin",
+ "columnName": "cobInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbs",
+ "columnName": "carbs",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wereCarbsUsed",
+ "columnName": "wereCarbsUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbsInsulin",
+ "columnName": "carbsInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "otherCorrection",
+ "columnName": "otherCorrection",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasSuperbolusUsed",
+ "columnName": "wasSuperbolusUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "superbolusInsulin",
+ "columnName": "superbolusInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasTempTargetUsed",
+ "columnName": "wasTempTargetUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalInsulin",
+ "columnName": "totalInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_bolusCalculatorResults_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_bolusCalculatorResults_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "bolusCalculatorResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "carbs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `amount` REAL NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `carbs`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_carbs_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_carbs_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "carbs",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "effectiveProfileSwitches",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `basalBlocks` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `effectiveProfileSwitches`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalBlocks",
+ "columnName": "basalBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_effectiveProfileSwitches_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_effectiveProfileSwitches_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "effectiveProfileSwitches",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "extendedBoluses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `amount` REAL NOT NULL, `isEmulatingTempBasal` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `extendedBoluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isEmulatingTempBasal",
+ "columnName": "isEmulatingTempBasal",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_extendedBoluses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_extendedBoluses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "extendedBoluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "glucoseValues",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `raw` REAL, `value` REAL NOT NULL, `trendArrow` TEXT NOT NULL, `noise` REAL, `sourceSensor` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `glucoseValues`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "raw",
+ "columnName": "raw",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "value",
+ "columnName": "value",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trendArrow",
+ "columnName": "trendArrow",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "noise",
+ "columnName": "noise",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "sourceSensor",
+ "columnName": "sourceSensor",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_glucoseValues_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_glucoseValues_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "glucoseValues",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "profileSwitches",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `profileName` TEXT NOT NULL, `glucoseUnit` TEXT NOT NULL, `basalBlocks` TEXT NOT NULL, `isfBlocks` TEXT NOT NULL, `icBlocks` TEXT NOT NULL, `targetBlocks` TEXT NOT NULL, `timeshift` INTEGER NOT NULL, `percentage` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT NOT NULL, `insulinEndTime` INTEGER NOT NULL, `peak` INTEGER NOT NULL, FOREIGN KEY(`referenceId`) REFERENCES `profileSwitches`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileName",
+ "columnName": "profileName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseUnit",
+ "columnName": "glucoseUnit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalBlocks",
+ "columnName": "basalBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isfBlocks",
+ "columnName": "isfBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "icBlocks",
+ "columnName": "icBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBlocks",
+ "columnName": "targetBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timeshift",
+ "columnName": "timeshift",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "percentage",
+ "columnName": "percentage",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_profileSwitches_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_profileSwitches_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "profileSwitches",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "temporaryBasals",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `type` TEXT NOT NULL, `isAbsolute` INTEGER NOT NULL, `rate` REAL NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `temporaryBasals`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAbsolute",
+ "columnName": "isAbsolute",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rate",
+ "columnName": "rate",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_temporaryBasals_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_temporaryBasals_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "temporaryBasals",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "temporaryTargets",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `reason` TEXT NOT NULL, `highTarget` REAL NOT NULL, `lowTarget` REAL NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `temporaryTargets`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "reason",
+ "columnName": "reason",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "highTarget",
+ "columnName": "highTarget",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lowTarget",
+ "columnName": "lowTarget",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_temporaryTargets_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_temporaryTargets_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "temporaryTargets",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "therapyEvents",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `type` TEXT NOT NULL, `note` TEXT, `amount` REAL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `therapyEvents`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "note",
+ "columnName": "note",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_therapyEvents_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_therapyEvents_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "therapyEvents",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "totalDailyDoses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `basalAmount` REAL, `bolusAmount` REAL, `totalAmount` REAL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `totalDailyDoses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalAmount",
+ "columnName": "basalAmount",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "bolusAmount",
+ "columnName": "bolusAmount",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "totalAmount",
+ "columnName": "totalAmount",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_totalDailyDoses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_totalDailyDoses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "totalDailyDoses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "apsResultLinks",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `apsResultId` INTEGER NOT NULL, `smbId` INTEGER, `tbrId` INTEGER, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`apsResultId`) REFERENCES `apsResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`smbId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`tbrId`) REFERENCES `temporaryBasals`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`referenceId`) REFERENCES `apsResultLinks`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "apsResultId",
+ "columnName": "apsResultId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "smbId",
+ "columnName": "smbId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "tbrId",
+ "columnName": "tbrId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_apsResultLinks_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_apsResultLinks_apsResultId",
+ "unique": false,
+ "columnNames": [
+ "apsResultId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_apsResultId` ON `${TABLE_NAME}` (`apsResultId`)"
+ },
+ {
+ "name": "index_apsResultLinks_smbId",
+ "unique": false,
+ "columnNames": [
+ "smbId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_smbId` ON `${TABLE_NAME}` (`smbId`)"
+ },
+ {
+ "name": "index_apsResultLinks_tbrId",
+ "unique": false,
+ "columnNames": [
+ "tbrId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_tbrId` ON `${TABLE_NAME}` (`tbrId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "apsResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "apsResultId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "smbId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "temporaryBasals",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "tbrId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "apsResultLinks",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "mealLinks",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `bolusId` INTEGER, `carbsId` INTEGER, `bolusCalcResultId` INTEGER, `superbolusTempBasalId` INTEGER, `noteId` INTEGER, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`bolusId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`carbsId`) REFERENCES `carbs`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`bolusCalcResultId`) REFERENCES `bolusCalculatorResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`superbolusTempBasalId`) REFERENCES `temporaryBasals`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`noteId`) REFERENCES `therapyEvents`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`referenceId`) REFERENCES `mealLinks`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "bolusId",
+ "columnName": "bolusId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "carbsId",
+ "columnName": "carbsId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "bolusCalcResultId",
+ "columnName": "bolusCalcResultId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "superbolusTempBasalId",
+ "columnName": "superbolusTempBasalId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "noteId",
+ "columnName": "noteId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_mealLinks_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_mealLinks_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_mealLinks_bolusId",
+ "unique": false,
+ "columnNames": [
+ "bolusId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_mealLinks_bolusId` ON `${TABLE_NAME}` (`bolusId`)"
+ },
+ {
+ "name": "index_mealLinks_carbsId",
+ "unique": false,
+ "columnNames": [
+ "carbsId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_mealLinks_carbsId` ON `${TABLE_NAME}` (`carbsId`)"
+ },
+ {
+ "name": "index_mealLinks_bolusCalcResultId",
+ "unique": false,
+ "columnNames": [
+ "bolusCalcResultId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_mealLinks_bolusCalcResultId` ON `${TABLE_NAME}` (`bolusCalcResultId`)"
+ },
+ {
+ "name": "index_mealLinks_superbolusTempBasalId",
+ "unique": false,
+ "columnNames": [
+ "superbolusTempBasalId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_mealLinks_superbolusTempBasalId` ON `${TABLE_NAME}` (`superbolusTempBasalId`)"
+ },
+ {
+ "name": "index_mealLinks_noteId",
+ "unique": false,
+ "columnNames": [
+ "noteId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_mealLinks_noteId` ON `${TABLE_NAME}` (`noteId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "bolusId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "carbs",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "carbsId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "bolusCalculatorResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "bolusCalcResultId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "temporaryBasals",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "superbolusTempBasalId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "therapyEvents",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "noteId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "mealLinks",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "multiwaveBolusLinks",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `bolusId` INTEGER NOT NULL, `extendedBolusId` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`bolusId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`extendedBolusId`) REFERENCES `extendedBoluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`referenceId`) REFERENCES `multiwaveBolusLinks`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "bolusId",
+ "columnName": "bolusId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "extendedBolusId",
+ "columnName": "extendedBolusId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_multiwaveBolusLinks_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_multiwaveBolusLinks_bolusId",
+ "unique": false,
+ "columnNames": [
+ "bolusId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_bolusId` ON `${TABLE_NAME}` (`bolusId`)"
+ },
+ {
+ "name": "index_multiwaveBolusLinks_extendedBolusId",
+ "unique": false,
+ "columnNames": [
+ "extendedBolusId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_extendedBolusId` ON `${TABLE_NAME}` (`extendedBolusId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "bolusId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "extendedBoluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "extendedBolusId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "multiwaveBolusLinks",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "preferenceChanges",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `key` TEXT NOT NULL, `value` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "key",
+ "columnName": "key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "value",
+ "columnName": "value",
+ "affinity": "TEXT",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "versionChanges",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `versionCode` INTEGER NOT NULL, `versionName` TEXT NOT NULL, `gitRemote` TEXT, `commitHash` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "versionCode",
+ "columnName": "versionCode",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "versionName",
+ "columnName": "versionName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "gitRemote",
+ "columnName": "gitRemote",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "commitHash",
+ "columnName": "commitHash",
+ "affinity": "TEXT",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "userEntry",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `action` TEXT NOT NULL, `s` TEXT NOT NULL, `d1` REAL NOT NULL, `d2` REAL NOT NULL, `i1` INTEGER NOT NULL, `i2` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "action",
+ "columnName": "action",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "s",
+ "columnName": "s",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "d1",
+ "columnName": "d1",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "d2",
+ "columnName": "d2",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "i1",
+ "columnName": "i1",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "i2",
+ "columnName": "i2",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [],
+ "foreignKeys": []
+ }
+ ],
+ "views": [],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'a1db89121451334b6eb389e8c702dd2c')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt b/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
index 6c474ec4da..5a943b6310 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
@@ -5,16 +5,16 @@ import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import info.nightscout.androidaps.database.daos.*
import info.nightscout.androidaps.database.entities.*
-import info.nightscout.androidaps.database.entities.APSResultLink
-import info.nightscout.androidaps.database.entities.MealLink
-import info.nightscout.androidaps.database.entities.MultiwaveBolusLink
-const val DATABASE_VERSION = 1
+const val DATABASE_VERSION = 2
-@Database(version = DATABASE_VERSION, entities = arrayOf(APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
+@Database(version = DATABASE_VERSION,
+ entities = arrayOf(APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
EffectiveProfileSwitch::class, ExtendedBolus::class, GlucoseValue::class, ProfileSwitch::class,
TemporaryBasal::class, TemporaryTarget::class, TherapyEvent::class, TotalDailyDose::class,
- APSResultLink::class, MealLink::class, MultiwaveBolusLink::class, PreferenceChange::class, VersionChange::class), exportSchema = true)
+ APSResultLink::class, MealLink::class, MultiwaveBolusLink::class, PreferenceChange::class,
+ VersionChange::class, UserEntry::class),
+ exportSchema = true)
@TypeConverters(Converters::class)
internal abstract class AppDatabase : RoomDatabase() {
@@ -50,6 +50,8 @@ internal abstract class AppDatabase : RoomDatabase() {
abstract val versionChangeDao: VersionChangeDao
+ abstract val userEntryDao: UserEntryDao
+
abstract val preferenceChangeDao: PreferenceChangeDao
}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt b/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt
index c074386d30..d9a7c2d37d 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt
@@ -2,6 +2,7 @@ package info.nightscout.androidaps.database
import info.nightscout.androidaps.database.entities.GlucoseValue
import info.nightscout.androidaps.database.entities.TemporaryTarget
+import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.interfaces.DBEntry
import info.nightscout.androidaps.database.transactions.Transaction
import io.reactivex.Completable
@@ -105,7 +106,17 @@ class AppRepository @Inject internal constructor(
fun getTemporaryTargetsCorrespondingLastHistoryRecord(lastId: Long): TemporaryTarget? =
database.temporaryTargetDao.getLastHistoryRecord(lastId)
+ // USER ENTRY
+ fun getAllUserEntries(): Single> =
+ database.userEntryDao.getAll()
+ .subscribeOn(Schedulers.io())
+
+ fun insert(word: UserEntry) {
+ database.userEntryDao.insert(word)
+ }
+
}
+
@Suppress("USELESS_CAST")
inline fun Maybe.toWrappedSingle(): Single> =
this.map { ValueWrapper.Existing(it) as ValueWrapper }
diff --git a/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt b/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
index dda8cf3917..9ef0b9e0ab 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
@@ -2,6 +2,8 @@ package info.nightscout.androidaps.database
import android.content.Context
import androidx.room.Room
+import androidx.room.migration.Migration
+import androidx.sqlite.db.SupportSQLiteDatabase
import dagger.Module
import dagger.Provides
import javax.inject.Qualifier
@@ -17,8 +19,17 @@ open class DatabaseModule {
@Provides
@Singleton
internal fun provideAppDatabase(context: Context, @DbFileName fileName: String) =
- Room.databaseBuilder(context, AppDatabase::class.java, fileName).build()
+ Room
+ .databaseBuilder(context, AppDatabase::class.java, fileName)
+ .addMigrations(migration1to2)
+ .build()
@Qualifier
annotation class DbFileName
+
+ private val migration1to2 = object : Migration(1, 2) {
+ override fun migrate(database: SupportSQLiteDatabase) {
+ database.execSQL("CREATE TABLE IF NOT EXISTS userEntry (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `action` TEXT NOT NULL, `s` TEXT NOT NULL, `d1` REAL NOT NULL, `d2` REAL NOT NULL, `i1` INTEGER NOT NULL, `i2` INTEGER NOT NULL)")
+ }
+ }
}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt b/database/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt
index 1a6e3206b0..b82cc6f379 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt
@@ -22,6 +22,7 @@ internal class DelegatedAppDatabase(val changes: MutableList, val datab
val profileSwitchDao: ProfileSwitchDao = DelegatedProfileSwitchDao(changes, database.profileSwitchDao)
val apsResultDao: APSResultDao = DelegatedAPSResultDao(changes, database.apsResultDao)
val versionChangeDao: VersionChangeDao = DelegatedVersionChangeDao(changes, database.versionChangeDao)
+ val userEntryDao: UserEntryDao = DelegatedUserEntryDao(changes, database.userEntryDao)
val preferenceChangeDao: PreferenceChangeDao = DelegatedPreferenceChangeDao(changes, database.preferenceChangeDao)
fun clearAllTables() = database.clearAllTables()
}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/TableNames.kt b/database/src/main/java/info/nightscout/androidaps/database/TableNames.kt
index 8ecb6beeff..fe7e6c3337 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/TableNames.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/TableNames.kt
@@ -16,4 +16,5 @@ const val TABLE_TEMPORARY_TARGETS = "temporaryTargets"
const val TABLE_TOTAL_DAILY_DOSES = "totalDailyDoses"
const val TABLE_THERAPY_EVENTS = "therapyEvents"
const val TABLE_PREFERENCE_CHANGES = "preferenceChanges"
-const val TABLE_VERSION_CHANGES = "versionChanges"
\ No newline at end of file
+const val TABLE_VERSION_CHANGES = "versionChanges"
+const val TABLE_USER_ENTRY = "userEntry"
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/UserEntryDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/UserEntryDao.kt
new file mode 100644
index 0000000000..adb712f0e4
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/UserEntryDao.kt
@@ -0,0 +1,19 @@
+package info.nightscout.androidaps.database.daos
+
+import androidx.room.Dao
+import androidx.room.Insert
+import androidx.room.Query
+import info.nightscout.androidaps.database.TABLE_USER_ENTRY
+import info.nightscout.androidaps.database.entities.UserEntry
+import io.reactivex.Single
+
+@Dao
+interface UserEntryDao {
+
+ @Insert
+ fun insert(userEntry: UserEntry)
+
+ @Query("SELECT * FROM $TABLE_USER_ENTRY ORDER BY id DESC")
+ fun getAll(): Single>
+
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedUserEntryDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedUserEntryDao.kt
new file mode 100644
index 0000000000..b0b8eb4c19
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedUserEntryDao.kt
@@ -0,0 +1,14 @@
+package info.nightscout.androidaps.database.daos.delegated
+
+import info.nightscout.androidaps.database.daos.UserEntryDao
+import info.nightscout.androidaps.database.entities.UserEntry
+import info.nightscout.androidaps.database.interfaces.DBEntry
+
+internal class DelegatedUserEntryDao(changes: MutableList, private val dao: UserEntryDao) : DelegatedDao(changes), UserEntryDao by dao {
+
+ override fun insert(userEntry: UserEntry) {
+ changes.add(userEntry)
+ return dao.insert(userEntry)
+ }
+
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
new file mode 100644
index 0000000000..8bd711a82c
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
@@ -0,0 +1,22 @@
+package info.nightscout.androidaps.database.entities
+
+import androidx.room.Entity
+import androidx.room.PrimaryKey
+import info.nightscout.androidaps.database.TABLE_USER_ENTRY
+import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
+import java.util.*
+
+@Entity(tableName = TABLE_USER_ENTRY)
+data class UserEntry(
+ @PrimaryKey(autoGenerate = true)
+ override var id: Long = 0L,
+ override var timestamp: Long,
+ override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
+ var action: String,
+ var s: String,
+ var d1: Double,
+ var d2: Double,
+ var i1: Int,
+ var i2: Int
+) : DBEntry, DBEntryWithTime
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/UserEntryTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/UserEntryTransaction.kt
new file mode 100644
index 0000000000..dc3b138848
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/UserEntryTransaction.kt
@@ -0,0 +1,26 @@
+package info.nightscout.androidaps.database.transactions
+
+import info.nightscout.androidaps.database.entities.UserEntry
+
+class UserEntryTransaction(
+ val action: String,
+ val s: String = "",
+ val d1: Double = 0.0,
+ val d2: Double = 0.0,
+ val i1: Int = 0,
+ val i2: Int = 0,
+) : Transaction() {
+
+ override fun run() {
+
+ database.userEntryDao.insert(UserEntry(
+ timestamp = System.currentTimeMillis(),
+ action = action,
+ s = s,
+ d1 = d1,
+ d2 = d2,
+ i1 = i1,
+ i2 = i2
+ ))
+ }
+}
\ No newline at end of file