Update uel.log entries, Increase database version 3=>4, update migration3to4
This commit is contained in:
parent
95e32c3406
commit
8798be0c34
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps.activities
|
|||
|
||||
import android.os.Bundle
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.ActivityStatsBinding
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.utils.ActivityMonitor
|
||||
|
@ -32,7 +32,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
|
|||
binding.ok.setOnClickListener { finish() }
|
||||
binding.reset.setOnClickListener {
|
||||
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.doyouwantresetstats)) {
|
||||
uel.log(UserEntry.Action.STAT_RESET)
|
||||
uel.log(Action.STAT_RESET)
|
||||
activityMonitor.reset()
|
||||
recreate()
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
|
|||
if (bg > 0) {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_calibration), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
uel.log(Action.CALIBRATION, ValueWithUnit(bg, if (units == Constants.MMOL) Units.Mmol_L else Units.Mg_Dl))
|
||||
uel.log(Action.CALIBRATION, ValueWithUnit(bg, units))
|
||||
xdripCalibrations.sendIntent(bg)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.carbs), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
when {
|
||||
activitySelected -> {
|
||||
uel.log(Action.TT_ACTIVITY, ValueWithUnit(activityTT, if (units == Constants.MMOL) Units.Mmol_L else Units.Mg_Dl) , ValueWithUnit(activityTTDuration, Units.M))
|
||||
uel.log(Action.TT_ACTIVITY, ValueWithUnit(activityTT, units) , ValueWithUnit(activityTTDuration, Units.M))
|
||||
val tempTarget = TempTarget()
|
||||
.date(System.currentTimeMillis())
|
||||
.duration(activityTTDuration)
|
||||
|
@ -225,7 +225,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
|
||||
eatingSoonSelected -> {
|
||||
uel.log(Action.TT_EATING_SOON, ValueWithUnit(eatingSoonTT, if (units == Constants.MMOL) Units.Mmol_L else Units.Mg_Dl) , ValueWithUnit(eatingSoonTTDuration, Units.M))
|
||||
uel.log(Action.TT_EATING_SOON, ValueWithUnit(eatingSoonTT, units) , ValueWithUnit(eatingSoonTTDuration, Units.M))
|
||||
val tempTarget = TempTarget()
|
||||
.date(System.currentTimeMillis())
|
||||
.duration(eatingSoonTTDuration)
|
||||
|
@ -237,7 +237,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
|
||||
hypoSelected -> {
|
||||
uel.log(Action.TT_HYPO, ValueWithUnit(hypoTT, if (units == Constants.MMOL) Units.Mmol_L else Units.Mg_Dl) , ValueWithUnit(hypoTTDuration, Units.M))
|
||||
uel.log(Action.TT_HYPO, ValueWithUnit(hypoTT, units) , ValueWithUnit(hypoTTDuration, Units.M))
|
||||
val tempTarget = TempTarget()
|
||||
.date(System.currentTimeMillis())
|
||||
.duration(hypoTTDuration)
|
||||
|
|
|
@ -13,7 +13,7 @@ import info.nightscout.androidaps.Constants
|
|||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.DialogCareBinding
|
||||
import info.nightscout.androidaps.db.CareportalEvent
|
||||
import info.nightscout.androidaps.db.Source
|
||||
|
@ -223,7 +223,7 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
EventType.ANNOUNCEMENT -> CareportalEvent.ANNOUNCEMENT
|
||||
}
|
||||
careportalEvent.json = json.toString()
|
||||
uel.log(UserEntry.Action.CAREPORTAL, careportalEvent.eventType)
|
||||
uel.log(Action.CAREPORTAL, ValueWithUnit(careportalEvent.eventType, Units.CPEvent))
|
||||
MainApp.getDbHelper().createOrUpdate(careportalEvent)
|
||||
nsUpload.uploadCareportalEntryToNS(json)
|
||||
}, null)
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.view.ViewGroup
|
|||
import com.google.common.base.Joiner
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.DialogExtendedbolusBinding
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
|
@ -88,7 +88,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
|||
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
uel.log(UserEntry.Action.EXTENDED_BOLUS, d1 = insulinAfterConstraint, i1 = durationInMinutes)
|
||||
uel.log(Action.EXTENDED_BOLUS, ValueWithUnit(insulinAfterConstraint, Units.U), ValueWithUnit(durationInMinutes, Units.M))
|
||||
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.google.common.base.Joiner
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.DialogFillBinding
|
||||
import info.nightscout.androidaps.db.CareportalEvent
|
||||
import info.nightscout.androidaps.db.Source
|
||||
|
@ -128,16 +128,16 @@ class FillDialog : DialogFragmentWithDate() {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.primefill), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
if (insulinAfterConstraints > 0) {
|
||||
uel.log(UserEntry.Action.PRIME_BOLUS, d1 = insulinAfterConstraints)
|
||||
uel.log(Action.PRIME_BOLUS, ValueWithUnit(insulinAfterConstraints, Units.U))
|
||||
requestPrimeBolus(insulinAfterConstraints, notes)
|
||||
}
|
||||
if (siteChange) {
|
||||
uel.log(UserEntry.Action.SITE_CHANGE)
|
||||
uel.log(Action.SITE_CHANGE)
|
||||
nsUpload.generateCareportalEvent(CareportalEvent.SITECHANGE, eventTime, notes)
|
||||
}
|
||||
if (insulinChange) {
|
||||
// add a second for case of both checked
|
||||
uel.log(UserEntry.Action.INSULIN_CHANGE)
|
||||
uel.log(Action.INSULIN_CHANGE)
|
||||
nsUpload.generateCareportalEvent(CareportalEvent.INSULINCHANGE, eventTime + 1000, notes)
|
||||
}
|
||||
}, null)
|
||||
|
|
|
@ -15,7 +15,7 @@ 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.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.DialogInsulinBinding
|
||||
import info.nightscout.androidaps.db.CareportalEvent
|
||||
import info.nightscout.androidaps.db.Source
|
||||
|
@ -179,7 +179,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
if (eatingSoonChecked) {
|
||||
uel.log(UserEntry.Action.TT_EATING_SOON, d1 = eatingSoonTT, i1 = eatingSoonTTDuration)
|
||||
uel.log(Action.TT_EATING_SOON, ValueWithUnit(eatingSoonTT, units), ValueWithUnit(eatingSoonTTDuration, Units.M))
|
||||
val tempTarget = TempTarget()
|
||||
.date(System.currentTimeMillis())
|
||||
.duration(eatingSoonTTDuration)
|
||||
|
@ -197,11 +197,11 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
detailedBolusInfo.source = Source.USER
|
||||
detailedBolusInfo.notes = notes
|
||||
if (recordOnlyChecked) {
|
||||
uel.log(UserEntry.Action.BOLUS_RECORD, d1 = insulinAfterConstraints, i1 = timeOffset)
|
||||
uel.log(Action.BOLUS_RECORD, ValueWithUnit(insulinAfterConstraints, Units.U), ValueWithUnit(timeOffset, Units.M))
|
||||
detailedBolusInfo.date = time
|
||||
activePlugin.activeTreatments.addToHistoryTreatment(detailedBolusInfo, false)
|
||||
} else {
|
||||
uel.log(UserEntry.Action.BOLUS, d1 = insulinAfterConstraints)
|
||||
uel.log(Action.BOLUS, ValueWithUnit(insulinAfterConstraints, Units.U))
|
||||
detailedBolusInfo.date = DateUtil.now()
|
||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
|
|
|
@ -12,7 +12,7 @@ import androidx.fragment.app.FragmentManager
|
|||
import dagger.android.support.DaggerDialogFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.DialogLoopBinding
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
|
@ -239,28 +239,28 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
val profile = profileFunction.getProfile() ?: return true
|
||||
when (v.id) {
|
||||
R.id.overview_closeloop -> {
|
||||
uel.log(UserEntry.Action.CLOSED_LOOP_MODE)
|
||||
uel.log(Action.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 -> {
|
||||
uel.log(UserEntry.Action.LGS_LOOP_MODE)
|
||||
uel.log(Action.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 -> {
|
||||
uel.log(UserEntry.Action.OPEN_LOOP_MODE)
|
||||
uel.log(Action.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 -> {
|
||||
uel.log(UserEntry.Action.LOOP_DISABLED)
|
||||
uel.log(Action.LOOP_DISABLED)
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, false)
|
||||
configBuilderPlugin.storeSettings("DisablingLoop")
|
||||
|
@ -277,7 +277,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_enable -> {
|
||||
uel.log(UserEntry.Action.LOOP_ENABLED)
|
||||
uel.log(Action.LOOP_ENABLED)
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, true)
|
||||
configBuilderPlugin.storeSettings("EnablingLoop")
|
||||
|
@ -287,7 +287,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_resume, R.id.overview_reconnect -> {
|
||||
uel.log(if (v.id==R.id.overview_resume) UserEntry.Action.RESUME else UserEntry.Action.RECONNECT )
|
||||
uel.log(if (v.id==R.id.overview_resume) Action.RESUME else Action.RECONNECT )
|
||||
loopPlugin.suspendTo(0L)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
|
@ -303,49 +303,49 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_suspend_1h -> {
|
||||
uel.log(UserEntry.Action.SUSPEND_1H)
|
||||
uel.log(Action.SUSPEND_1H)
|
||||
loopPlugin.suspendLoop(60)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_2h -> {
|
||||
uel.log(UserEntry.Action.SUSPEND_2H)
|
||||
uel.log(Action.SUSPEND_2H)
|
||||
loopPlugin.suspendLoop(120)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_3h -> {
|
||||
uel.log(UserEntry.Action.SUSPEND_3H)
|
||||
uel.log(Action.SUSPEND_3H)
|
||||
loopPlugin.suspendLoop(180)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_10h -> {
|
||||
uel.log(UserEntry.Action.SUSPEND_10H)
|
||||
uel.log(Action.SUSPEND_10H)
|
||||
loopPlugin.suspendLoop(600)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_15m -> {
|
||||
uel.log(UserEntry.Action.DISCONNECT_15M)
|
||||
uel.log(Action.DISCONNECT_15M)
|
||||
loopPlugin.disconnectPump(15, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_30m -> {
|
||||
uel.log(UserEntry.Action.DISCONNECT_30M)
|
||||
uel.log(Action.DISCONNECT_30M)
|
||||
loopPlugin.disconnectPump(30, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_1h -> {
|
||||
uel.log(UserEntry.Action.DISCONNECT_1H)
|
||||
uel.log(Action.DISCONNECT_1H)
|
||||
loopPlugin.disconnectPump(60, profile)
|
||||
sp.putBoolean(R.string.key_objectiveusedisconnect, true)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
|
@ -353,14 +353,14 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_disconnect_2h -> {
|
||||
uel.log(UserEntry.Action.DISCONNECT_2H)
|
||||
uel.log(Action.DISCONNECT_2H)
|
||||
loopPlugin.disconnectPump(120, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_3h -> {
|
||||
uel.log(UserEntry.Action.DISCONNECT_3H)
|
||||
uel.log(Action.DISCONNECT_3H)
|
||||
loopPlugin.disconnectPump(180, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.widget.ArrayAdapter
|
|||
import com.google.common.base.Joiner
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.DialogProfileswitchBinding
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
|
@ -125,7 +125,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
|||
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
uel.log(UserEntry.Action.PROFILE_SWITCH, d1 = percent.toDouble(), i1 = timeShift, i2 = duration)
|
||||
uel.log(Action.PROFILE_SWITCH, ValueWithUnit(percent, Units.Percent), ValueWithUnit(timeShift, Units.H), ValueWithUnit(duration, Units.M))
|
||||
treatmentsPlugin.doProfileSwitch(profileStore, profile, duration, percent, timeShift, eventTime)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.view.ViewGroup
|
|||
import com.google.common.base.Joiner
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.DialogTempbasalBinding
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
|
@ -126,10 +126,10 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
}
|
||||
if (isPercentPump) {
|
||||
uel.log(UserEntry.Action.TEMP_BASAL, d1 = percent.toDouble(), i1 = durationInMinutes)
|
||||
uel.log(Action.TEMP_BASAL, ValueWithUnit(percent, Units.Percent), ValueWithUnit(durationInMinutes, Units.M))
|
||||
commandQueue.tempBasalPercent(percent, durationInMinutes, true, profile, callback)
|
||||
} else {
|
||||
uel.log(UserEntry.Action.TEMP_BASAL, d1 = absolute, i1 = durationInMinutes)
|
||||
uel.log(Action.TEMP_BASAL, ValueWithUnit(absolute, Units.U), ValueWithUnit(durationInMinutes, Units.M))
|
||||
commandQueue.tempBasalAbsolute(absolute, durationInMinutes, true, profile, callback)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.google.common.collect.Lists
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.DialogTemptargetBinding
|
||||
import info.nightscout.androidaps.db.Source
|
||||
import info.nightscout.androidaps.db.TempTarget
|
||||
|
@ -167,12 +167,13 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
|||
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
val units = profileFunction.getUnits()
|
||||
when(reason) {
|
||||
resourceHelper.gs(R.string.eatingsoon) -> uel.log(UserEntry.Action.TT_EATING_SOON, d1 = target, i1 = duration)
|
||||
resourceHelper.gs(R.string.activity) -> uel.log(UserEntry.Action.TT_ACTIVITY, d1 = target, i1 = duration)
|
||||
resourceHelper.gs(R.string.hypo) -> uel.log(UserEntry.Action.TT_HYPO, d1 = target, i1 = duration)
|
||||
resourceHelper.gs(R.string.manual) -> uel.log(UserEntry.Action.TT, d1 = target, i1 = duration)
|
||||
resourceHelper.gs(R.string.stoptemptarget) -> uel.log(UserEntry.Action.CANCEL_TT)
|
||||
resourceHelper.gs(R.string.eatingsoon) -> uel.log(Action.TT_EATING_SOON, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M))
|
||||
resourceHelper.gs(R.string.activity) -> uel.log(Action.TT_ACTIVITY, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M))
|
||||
resourceHelper.gs(R.string.hypo) -> uel.log(Action.TT_HYPO, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M))
|
||||
resourceHelper.gs(R.string.manual) -> uel.log(Action.TT, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M))
|
||||
resourceHelper.gs(R.string.stoptemptarget) -> uel.log(Action.CANCEL_TT)
|
||||
}
|
||||
if (target == 0.0 || duration == 0) {
|
||||
val tempTarget = TempTarget()
|
||||
|
|
|
@ -12,7 +12,7 @@ import info.nightscout.androidaps.Config
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.DialogTreatmentBinding
|
||||
import info.nightscout.androidaps.db.CareportalEvent
|
||||
import info.nightscout.androidaps.db.Source
|
||||
|
@ -130,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("<br/>").join(actions)), {
|
||||
uel.log(UserEntry.Action.TREATMENT, d1 = insulin, i1 = carbs)
|
||||
uel.log(Action.TREATMENT, ValueWithUnit(insulin, Units.U), ValueWithUnit(carbs, Units.G))
|
||||
val detailedBolusInfo = DetailedBolusInfo()
|
||||
if (insulinAfterConstraints == 0.0) detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION
|
||||
if (carbsAfterConstraints == 0) detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.configBuilder
|
|||
import androidx.fragment.app.FragmentActivity
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.events.EventAppInitialized
|
||||
import info.nightscout.androidaps.events.EventConfigBuilderChange
|
||||
import info.nightscout.androidaps.events.EventRebuildTabs
|
||||
|
@ -143,7 +143,7 @@ class ConfigBuilderPlugin @Inject constructor(
|
|||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.allow_hardware_pump_text), Runnable {
|
||||
performPluginSwitch(changedPlugin, newState, type)
|
||||
sp.putBoolean("allow_hardware_pump", true)
|
||||
uel.log(UserEntry.Action.HW_PUMP_ALLOWED)
|
||||
uel.log(Action.HW_PUMP_ALLOWED)
|
||||
aapsLogger.debug(LTag.PUMP, "First time HW pump allowed!")
|
||||
}, Runnable {
|
||||
rxBus.send(EventConfigBuilderUpdateGui())
|
||||
|
|
|
@ -17,7 +17,7 @@ import androidx.recyclerview.widget.LinearSmoothScroller
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.ObjectivesFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.ObjectivesItemBinding
|
||||
import info.nightscout.androidaps.dialogs.NtpProgressDialog
|
||||
|
@ -308,7 +308,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(UserEntry.Action.OBJECTIVE_UNSTARTED, i1 = position + 1)
|
||||
uel.log(Action.OBJECTIVE_UNSTARTED, ValueWithUnit(position + 1, Units.None))
|
||||
objective.startedOn = 0
|
||||
scrollToCurrentObjective()
|
||||
rxBus.send(EventObjectivesUpdateGui())
|
||||
|
|
|
@ -7,7 +7,7 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.androidaps.Config
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -143,7 +143,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(UserEntry.Action.OBJECTIVES_SKIPPED)
|
||||
uel.log(Action.OBJECTIVES_SKIPPED)
|
||||
} else {
|
||||
OKDialog.show(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.codeinvalid))
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import info.nightscout.androidaps.Constants
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.activities.TDDStatsActivity
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.dialogs.*
|
||||
import info.nightscout.androidaps.events.*
|
||||
import info.nightscout.androidaps.historyBrowser.HistoryBrowseActivity
|
||||
|
@ -155,7 +155,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
}
|
||||
extendedBolusCancel?.setOnClickListener {
|
||||
if (activePlugin.activeTreatments.isInHistoryExtendedBoluslInProgress) {
|
||||
uel.log(UserEntry.Action.CANCEL_EXTENDED_BOLUS)
|
||||
uel.log(Action.CANCEL_EXTENDED_BOLUS)
|
||||
commandQueue.cancelExtended(object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
@ -170,7 +170,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
}
|
||||
cancelTempBasal?.setOnClickListener {
|
||||
if (activePlugin.activeTreatments.isTempBasalInProgress) {
|
||||
uel.log(UserEntry.Action.CANCEL_TEMP_BASAL)
|
||||
uel.log(Action.CANCEL_TEMP_BASAL)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import dagger.android.HasAndroidInjector
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.AutomationEventItemBinding
|
||||
import info.nightscout.androidaps.databinding.AutomationFragmentBinding
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -217,7 +217,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
|
|||
holder.binding.iconTrash.setOnClickListener {
|
||||
OKDialog.showConfirmation(requireContext(), resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
|
||||
{
|
||||
uel.log(UserEntry.Action.AUTOMATION_REMOVED, automationPlugin.at(position).title)
|
||||
uel.log(Action.AUTOMATION_REMOVED, automationPlugin.at(position).title)
|
||||
automationPlugin.removeAt(position)
|
||||
notifyItemRemoved(position)
|
||||
}, {
|
||||
|
@ -240,7 +240,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
|
||||
Runnable {
|
||||
uel.log(UserEntry.Action.AUTOMATION_REMOVED, automationPlugin.at(position).title)
|
||||
uel.log(Action.AUTOMATION_REMOVED, automationPlugin.at(position).title)
|
||||
automationPlugin.removeAt(position)
|
||||
notifyItemRemoved(position)
|
||||
rxBus.send(EventAutomationDataChanged())
|
||||
|
|
|
@ -15,7 +15,7 @@ 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.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.FoodFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.FoodItemBinding
|
||||
import info.nightscout.androidaps.events.EventFoodDatabaseChanged
|
||||
|
@ -217,7 +217,7 @@ class FoodFragment : DaggerFragment() {
|
|||
val food = v.tag as Food
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.confirmation), resourceHelper.gs(R.string.removerecord) + "\n" + food.name, DialogInterface.OnClickListener { _: DialogInterface?, _: Int ->
|
||||
uel.log(UserEntry.Action.FOOD_REMOVED, food.name)
|
||||
uel.log(Action.FOOD_REMOVED, food.name)
|
||||
if (food._id != null && food._id != "") {
|
||||
nsUpload.removeFoodFromNS(food._id)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import info.nightscout.androidaps.BuildConfig
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.androidaps.activities.PreferencesActivity
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.events.EventAppExit
|
||||
import info.nightscout.androidaps.interfaces.ConfigInterface
|
||||
import info.nightscout.androidaps.interfaces.ImportExportPrefsInterface
|
||||
|
@ -345,7 +345,7 @@ class ImportExportPrefs @Inject constructor(
|
|||
private fun restartAppAfterImport(context: Context) {
|
||||
sp.putBoolean(R.string.key_setupwizard_processed, true)
|
||||
OKDialog.show(context, resourceHelper.gs(R.string.setting_imported), resourceHelper.gs(R.string.restartingapp), Runnable {
|
||||
uel.log(UserEntry.Action.IMPORT_SETTINGS)
|
||||
uel.log(Action.IMPORT_SETTINGS)
|
||||
log.debug(LTag.CORE, "Exiting")
|
||||
rxBus.send(EventAppExit())
|
||||
if (context is AppCompatActivity) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.MaintenanceFragmentBinding
|
||||
import info.nightscout.androidaps.events.EventNewBG
|
||||
import info.nightscout.androidaps.interfaces.ImportExportPrefsInterface
|
||||
|
@ -57,13 +57,13 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
binding.logSend.setOnClickListener { maintenancePlugin.sendLogs() }
|
||||
binding.logDelete.setOnClickListener {
|
||||
uel.log(UserEntry.Action.DELETE_LOGS)
|
||||
uel.log(Action.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 {
|
||||
uel.log(UserEntry.Action.RESET_DATABASES)
|
||||
uel.log(Action.RESET_DATABASES)
|
||||
compositeDisposable.add(
|
||||
fromAction {
|
||||
MainApp.getDbHelper().resetDatabases()
|
||||
|
@ -84,14 +84,14 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
}
|
||||
}
|
||||
binding.navExport.setOnClickListener {
|
||||
uel.log(UserEntry.Action.EXPORT_SETTINGS)
|
||||
uel.log(Action.EXPORT_SETTINGS)
|
||||
// start activity for checking permissions...
|
||||
importExportPrefs.verifyStoragePermissions(this) {
|
||||
importExportPrefs.exportSharedPreferences(this)
|
||||
}
|
||||
}
|
||||
binding.navImport.setOnClickListener {
|
||||
uel.log(UserEntry.Action.IMPORT_SETTINGS)
|
||||
uel.log(Action.IMPORT_SETTINGS)
|
||||
// start activity for checking permissions...
|
||||
importExportPrefs.verifyStoragePermissions(this) {
|
||||
importExportPrefs.importSharedPreferences(this)
|
||||
|
|
|
@ -17,6 +17,7 @@ import javax.inject.Inject;
|
|||
import dagger.android.support.DaggerFragment;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.database.entities.UserEntry;
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*;
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientNewLog;
|
||||
|
@ -124,7 +125,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(UserEntry.Action.NS_QUEUE_CLEARED, "", 0.0, 0.0, 0, 0);
|
||||
uel.log(Action.NS_QUEUE_CLEARED, new ValueWithUnit(0, Units.None));
|
||||
uploadQueue.clearQueue();
|
||||
updateGui();
|
||||
fabricPrivacy.logCustom("NSClientClearQueue");
|
||||
|
@ -140,7 +141,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(UserEntry.Action.NS_PAUSED, "", 0.0, 0.0, isChecked ? 1 : 0, 0);
|
||||
uel.log(Action.NS_PAUSED, new ValueWithUnit(isChecked ? 1 : 0, Units.None));
|
||||
nsClientPlugin.pause(isChecked);
|
||||
updateGui();
|
||||
fabricPrivacy.logCustom("NSClientPause");
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.data
|
|||
import android.content.Context
|
||||
import info.nightscout.androidaps.Config
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -236,7 +236,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(UserEntry.Action.NS_SETTINGS_COPIED)
|
||||
uel.log(Action.NS_SETTINGS_COPIED)
|
||||
}
|
||||
|
||||
if (context != null) OKDialog.showConfirmation(context, resourceHelper.gs(R.string.statuslights), resourceHelper.gs(R.string.copyexistingvalues), action)
|
||||
|
|
|
@ -28,7 +28,7 @@ import info.nightscout.androidaps.Config
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.OverviewFragmentBinding
|
||||
import info.nightscout.androidaps.dialogs.*
|
||||
import info.nightscout.androidaps.events.*
|
||||
|
@ -343,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(), {
|
||||
uel.log(UserEntry.Action.ACCEPTS_TEMP_BASAL)
|
||||
uel.log(Action.ACCEPTS_TEMP_BASAL)
|
||||
binding.buttonsLayout.acceptTempButton.visibility = View.GONE
|
||||
(context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).cancel(Constants.notificationID)
|
||||
rxBus.send(EventWearDoAction("cancelChangeRequest"))
|
||||
|
|
|
@ -15,7 +15,7 @@ import info.nightscout.androidaps.Constants
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.db.Source
|
||||
import info.nightscout.androidaps.db.TempTarget
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
|
@ -338,7 +338,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
uel.log(UserEntry.Action.SMS_LOOP_DISABLED)
|
||||
uel.log(Action.SMS_LOOP_DISABLED)
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
|
@ -362,7 +362,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
uel.log(UserEntry.Action.SMS_LOOP_ENABLED)
|
||||
uel.log(Action.SMS_LOOP_ENABLED)
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_loophasbeenenabled)))
|
||||
rxBus.send(EventRefreshOverview("SMS_LOOP_START"))
|
||||
|
@ -389,7 +389,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
uel.log(UserEntry.Action.SMS_LOOP_RESUME)
|
||||
uel.log(Action.SMS_LOOP_RESUME)
|
||||
loopPlugin.suspendTo(0L)
|
||||
rxBus.send(EventRefreshOverview("SMS_LOOP_RESUME"))
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
|
@ -422,7 +422,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(duration) {
|
||||
override fun run() {
|
||||
uel.log(UserEntry.Action.SMS_LOOP_SUSPEND)
|
||||
uel.log(Action.SMS_LOOP_SUSPEND)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (result.success) {
|
||||
|
@ -506,7 +506,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
uel.log(UserEntry.Action.SMS_PUMP_CONNECT)
|
||||
uel.log(Action.SMS_PUMP_CONNECT)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
@ -535,7 +535,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
uel.log(UserEntry.Action.SMS_PUMP_DISCONNECT)
|
||||
uel.log(Action.SMS_PUMP_DISCONNECT)
|
||||
val profile = profileFunction.getProfile()
|
||||
loopPlugin.disconnectPump(duration, profile)
|
||||
rxBus.send(EventRefreshOverview("SMS_PUMP_DISCONNECT"))
|
||||
|
@ -592,7 +592,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
activePlugin.activeTreatments.doProfileSwitch(store, list[pindex - 1] as String, 0, finalPercentage, 0, DateUtil.now())
|
||||
val replyText = resourceHelper.gs(R.string.profileswitchcreated)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_PROFILE, replyText)
|
||||
uel.log(Action.SMS_PROFILE, ValueWithUnit(R.string.profileswitchcreated, Units.R_String))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -614,12 +614,12 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalcanceled)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_BASAL, replyText)
|
||||
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalcanceled, Units.R_String))
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalcancelfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_BASAL, replyText)
|
||||
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalcancelfailed, Units.R_String))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -647,12 +647,15 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
var replyText = if (result.isPercent) String.format(resourceHelper.gs(R.string.smscommunicator_tempbasalset_percent), result.percent, result.duration) else String.format(resourceHelper.gs(R.string.smscommunicator_tempbasalset), result.absolute, result.duration)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_BASAL, replyText)
|
||||
if (result.isPercent)
|
||||
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalset_percent, Units.R_String), ValueWithUnit(result.percent, Units.Percent), ValueWithUnit(result.duration, Units.M))
|
||||
else
|
||||
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalset, Units.R_String), ValueWithUnit(result.absolute, Units.U_H), ValueWithUnit(result.duration, Units.M))
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_BASAL, replyText)
|
||||
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalfailed, Units.R_String))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -682,12 +685,15 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
else String.format(resourceHelper.gs(R.string.smscommunicator_tempbasalset), result.absolute, result.duration)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_BASAL, replyText)
|
||||
if (result.isPercent)
|
||||
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalset_percent, Units.R_String), ValueWithUnit(result.percent, Units.Percent), ValueWithUnit(result.duration, Units.M))
|
||||
else
|
||||
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalset, Units.R_String), ValueWithUnit(result.absolute, Units.U_H), ValueWithUnit(result.duration, Units.M))
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_BASAL, replyText)
|
||||
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalfailed, Units.R_String))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -714,7 +720,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
var replyText = resourceHelper.gs(R.string.smscommunicator_extendedcancelfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_EXTENDED_BOLUS, replyText)
|
||||
uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true),ValueWithUnit(R.string.smscommunicator_extendedcanceled, Units.R_String))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -740,12 +746,15 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
if (config.APS) replyText += "\n" + resourceHelper.gs(R.string.loopsuspended)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_EXTENDED_BOLUS, replyText)
|
||||
if (config.APS)
|
||||
uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_extendedset, Units.R_String), ValueWithUnit(aDouble, Units.U), ValueWithUnit(duration, Units.M), ValueWithUnit(R.string.loopsuspended, Units.R_String))
|
||||
else
|
||||
uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_extendedset, Units.R_String), ValueWithUnit(aDouble, Units.U), ValueWithUnit(duration, Units.M))
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_extendedfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_EXTENDED_BOLUS, replyText)
|
||||
uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true),ValueWithUnit(R.string.smscommunicator_extendedfailed, Units.R_String))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -814,12 +823,12 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_BOLUS, replyText)
|
||||
uel.log(Action.SMS_BOLUS, replyText)
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_bolusfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_BOLUS, replyText)
|
||||
uel.log(Action.SMS_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_bolusfailed, Units.R_String))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -859,12 +868,12 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
var replyText = String.format(resourceHelper.gs(R.string.smscommunicator_carbsset), anInteger)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_CARBS, replyText)
|
||||
uel.log(Action.SMS_CARBS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_carbsset, Units.R_String), ValueWithUnit(anInteger,Units.G))
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_carbsfailed)
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_carbsfailed, anInteger)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_CARBS, replyText)
|
||||
uel.log(Action.SMS_CARBS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_carbsfailed, Units.R_String), ValueWithUnit(anInteger,Units.G))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -873,7 +882,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
var replyText = String.format(resourceHelper.gs(R.string.smscommunicator_carbsset), anInteger)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_CARBS, replyText)
|
||||
uel.log(Action.SMS_CARBS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_carbsset, Units.R_String), ValueWithUnit(anInteger,Units.G))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -938,7 +947,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val ttString = if (units == Constants.MMOL) DecimalFormatter.to1Decimal(tt) else DecimalFormatter.to0Decimal(tt)
|
||||
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_tt_set), ttString, ttDuration)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_TT, replyText)
|
||||
uel.log(Action.SMS_TT, ValueWithUnit(R.string.smscommunicator_tt_set, Units.R_String), ValueWithUnit(tt, units), ValueWithUnit(ttDuration, Units.M))
|
||||
}
|
||||
})
|
||||
} else if (isStop) {
|
||||
|
@ -956,7 +965,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
activePlugin.activeTreatments.addToHistoryTempTarget(tempTarget)
|
||||
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_tt_canceled))
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_TT, reply)
|
||||
uel.log(Action.SMS_TT, ValueWithUnit(R.string.smscommunicator_tt_canceled, Units.R_String))
|
||||
}
|
||||
})
|
||||
} else
|
||||
|
@ -975,7 +984,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
sp.putBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)
|
||||
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_stoppedsms))
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_SMS, replyText)
|
||||
uel.log(Action.SMS_SMS, ValueWithUnit(R.string.smscommunicator_stoppedsms, Units.R_String))
|
||||
}
|
||||
})
|
||||
} else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
|
||||
|
@ -993,7 +1002,10 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val replyText =
|
||||
if (result) resourceHelper.gs(R.string.smscommunicator_calibrationsent) else resourceHelper.gs(R.string.smscommunicator_calibrationfailed)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(UserEntry.Action.SMS_CAL, replyText)
|
||||
if (result)
|
||||
uel.log(Action.SMS_CAL, ValueWithUnit(R.string.smscommunicator_calibrationsent, Units.R_String))
|
||||
else
|
||||
uel.log(Action.SMS_CAL, ValueWithUnit(R.string.smscommunicator_calibrationfailed, Units.R_String))
|
||||
}
|
||||
})
|
||||
} else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.google.common.primitives.Ints.min
|
|||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.ActivitySmscommunicatorOtpBinding
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
|
@ -73,7 +73,7 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
|
|||
resourceHelper.gs(R.string.smscommunicator_otp_reset_title),
|
||||
resourceHelper.gs(R.string.smscommunicator_otp_reset_prompt),
|
||||
Runnable {
|
||||
uel.log(UserEntry.Action.OTP_RESET)
|
||||
uel.log(Action.OTP_RESET)
|
||||
otp.ensureKey(true)
|
||||
updateGui()
|
||||
ToastUtils.Long.infoToast(this, resourceHelper.gs(R.string.smscommunicator_otp_reset_successful))
|
||||
|
@ -89,7 +89,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(UserEntry.Action.OTP_EXPORT)
|
||||
uel.log(Action.OTP_EXPORT)
|
||||
})
|
||||
|
||||
true
|
||||
|
|
|
@ -12,7 +12,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.LocalprofileFragmentBinding
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
|
@ -163,7 +163,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (localProfilePlugin.isEdited) {
|
||||
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
|
||||
} else {
|
||||
uel.log(UserEntry.Action.NEW_PROFILE)
|
||||
uel.log(Action.NEW_PROFILE)
|
||||
localProfilePlugin.addNewProfile()
|
||||
build()
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (localProfilePlugin.isEdited) {
|
||||
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
|
||||
} else {
|
||||
uel.log(UserEntry.Action.CLONE_PROFILE, localProfilePlugin.currentProfile()?.name ?: "")
|
||||
uel.log(Action.CLONE_PROFILE, localProfilePlugin.currentProfile()?.name ?: "")
|
||||
localProfilePlugin.cloneProfile()
|
||||
build()
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
binding.profileRemove.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.deletecurrentprofile), {
|
||||
uel.log(UserEntry.Action.PROFILE_REMOVED, localProfilePlugin.currentProfile()?.name ?: "")
|
||||
uel.log(Action.PROFILE_REMOVED, localProfilePlugin.currentProfile()?.name ?: "")
|
||||
localProfilePlugin.removeCurrentProfile()
|
||||
build()
|
||||
}, null)
|
||||
|
|
|
@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.events.EventProfileStoreChanged
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
|
@ -116,7 +116,7 @@ class LocalProfilePlugin @Inject constructor(
|
|||
createAndStoreConvertedProfile()
|
||||
isEdited = false
|
||||
aapsLogger.debug(LTag.PROFILE, "Storing settings: " + rawProfile?.data.toString())
|
||||
uel.log(UserEntry.Action.STORE_PROFILE)
|
||||
uel.log(Action.STORE_PROFILE)
|
||||
rxBus.send(EventProfileStoreChanged())
|
||||
var namesOK = true
|
||||
profiles.forEach {
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.widget.AdapterView
|
|||
import android.widget.ArrayAdapter
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.NsprofileFragmentBinding
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -62,7 +62,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(UserEntry.Action.PROFILE_SWITCH, name, i1 = 100)
|
||||
uel.log(Action.PROFILE_SWITCH, name, ValueWithUnit(100.toInt(), Units.Percent))
|
||||
treatmentsPlugin.doProfileSwitch(store, name, 0, 100, 0, DateUtil.now())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.database.transactions.InvalidateGlucoseValueTransaction
|
||||
import info.nightscout.androidaps.databinding.BgsourceFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.BgsourceItemBinding
|
||||
|
@ -129,7 +129,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(UserEntry.Action.BG_REMOVED, dateUtil.dateAndTimeString(glucoseValue.timestamp))
|
||||
uel.log(Action.BG_REMOVED, ValueWithUnit(glucoseValue.timestamp, Units.Timestamp))
|
||||
disposable += repository.runTransaction(InvalidateGlucoseValueTransaction(glucoseValue.id)).subscribe()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ 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.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.TreatmentsBolusFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsBolusItemBinding
|
||||
import info.nightscout.androidaps.db.Source
|
||||
|
@ -69,7 +69,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
|||
binding.refreshFromNightscout.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
|
||||
uel.log(UserEntry.Action.TREATMENTS_NS_REFRESH)
|
||||
uel.log(Action.TREATMENTS_NS_REFRESH)
|
||||
treatmentsPlugin.service.resetTreatments()
|
||||
rxBus.send(EventNSClientRestart())
|
||||
}
|
||||
|
@ -78,7 +78,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(UserEntry.Action.DELETE_FUTURE_TREATMENTS)
|
||||
uel.log(Action.DELETE_FUTURE_TREATMENTS)
|
||||
val futureTreatments = treatmentsPlugin.service.getTreatmentDataFromTime(DateUtil.now() + 1000, true)
|
||||
for (treatment in futureTreatments) {
|
||||
if (NSUpload.isIdValid(treatment._id))
|
||||
|
@ -175,7 +175,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(UserEntry.Action.TREATMENT_REMOVED, text)
|
||||
uel.log(Action.TREATMENT_REMOVED, ValueWithUnit(treatment.date, Units.Timestamp), ValueWithUnit(treatment.insulin, Units.U), ValueWithUnit(treatment.carbs.toInt(), Units.G))
|
||||
if (treatment.source == Source.PUMP) {
|
||||
treatment.isValid = false
|
||||
treatmentsPlugin.service.update(treatment)
|
||||
|
|
|
@ -10,7 +10,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.TreatmentsCareportalFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsCareportalItemBinding
|
||||
import info.nightscout.androidaps.db.CareportalEvent
|
||||
|
@ -65,7 +65,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(UserEntry.Action.CAREPORTAL_NS_REFRESH)
|
||||
uel.log(Action.CAREPORTAL_NS_REFRESH)
|
||||
MainApp.getDbHelper().resetCareportalEvents()
|
||||
rxBus.send(EventNSClientRestart())
|
||||
})
|
||||
|
@ -74,7 +74,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(UserEntry.Action.RESTART_EVENTS_REMOVED)
|
||||
uel.log(Action.RESTART_EVENTS_REMOVED)
|
||||
val events = MainApp.getDbHelper().getCareportalEvents(false)
|
||||
for (i in events.indices) {
|
||||
val careportalEvent = events[i]
|
||||
|
@ -155,7 +155,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(UserEntry.Action.CAREPORTAL_REMOVED, text)
|
||||
uel.log(Action.CAREPORTAL_REMOVED, careportalEvent.notes, ValueWithUnit(careportalEvent.eventType, Units.CPEvent), ValueWithUnit(careportalEvent.date, Units.Timestamp))
|
||||
if (NSUpload.isIdValid(careportalEvent._id))
|
||||
nsUpload.removeCareportalEntryFromNS(careportalEvent._id)
|
||||
else
|
||||
|
|
|
@ -13,7 +13,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Intervals
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.TreatmentsExtendedbolusFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsExtendedbolusItemBinding
|
||||
import info.nightscout.androidaps.db.ExtendedBolus
|
||||
|
@ -122,7 +122,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
|
|||
${resourceHelper.gs(R.string.extended_bolus)}
|
||||
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(extendedBolus.date)}
|
||||
""".trimIndent(), { _: DialogInterface, _: Int ->
|
||||
uel.log(UserEntry.Action.EXTENDED_BOLUS_REMOVED)
|
||||
uel.log(Action.EXTENDED_BOLUS_REMOVED)
|
||||
val id = extendedBolus._id
|
||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||
else uploadQueue.removeID("dbAdd", id)
|
||||
|
|
|
@ -10,7 +10,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.TreatmentsProfileswitchFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsProfileswitchItemBinding
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
|
@ -70,7 +70,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
|
||||
binding.refreshFromNightscout.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
uel.log(UserEntry.Action.PROFILE_SWITCH_NS_REFRESH)
|
||||
uel.log(Action.PROFILE_SWITCH_NS_REFRESH)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
|
||||
MainApp.getDbHelper().resetProfileSwitch()
|
||||
rxBus.send(EventNSClientRestart())
|
||||
|
@ -147,7 +147,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(UserEntry.Action.PROFILE_SWITCH_REMOVED, profileSwitch.profileName + " " + dateUtil.dateAndTimeString(profileSwitch.date))
|
||||
uel.log(Action.PROFILE_SWITCH_REMOVED, profileSwitch.profileName, ValueWithUnit(profileSwitch.date, Units.Timestamp))
|
||||
val id = profileSwitch._id
|
||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||
else uploadQueue.removeID("dbAdd", id)
|
||||
|
@ -160,7 +160,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(UserEntry.Action.PROFILE_SWITCH_CLONED, profileSwitch.profileName + " " + dateUtil.dateAndTimeString(profileSwitch.date))
|
||||
uel.log(Action.PROFILE_SWITCH_CLONED, profileSwitch.profileName, ValueWithUnit(profileSwitch.date, Units.Timestamp))
|
||||
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(".", "_")))
|
||||
|
|
|
@ -13,7 +13,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Intervals
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.TreatmentsTemptargetFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsTemptargetItemBinding
|
||||
import info.nightscout.androidaps.db.Source
|
||||
|
@ -70,7 +70,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
|||
binding.refreshFromNightscout.setOnClickListener {
|
||||
context?.let { context ->
|
||||
OKDialog.showConfirmation(context, resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", {
|
||||
uel.log(UserEntry.Action.TT_NS_REFRESH)
|
||||
uel.log(Action.TT_NS_REFRESH)
|
||||
MainApp.getDbHelper().resetTempTargets()
|
||||
rxBus.send(EventNSClientRestart())
|
||||
})
|
||||
|
@ -162,7 +162,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
|||
${dateUtil.dateAndTimeString(tempTarget.date)}
|
||||
""".trimIndent(),
|
||||
{ _: DialogInterface?, _: Int ->
|
||||
uel.log(UserEntry.Action.TT_REMOVED, tempTarget.friendlyDescription(profileFunction.getUnits(), resourceHelper))
|
||||
uel.log(Action.TT_REMOVED, ValueWithUnit(tempTarget.reason, Units.TT_Reason), ValueWithUnit(tempTarget.date, Units.Timestamp), ValueWithUnit(tempTarget.low, Units.Mg_Dl), ValueWithUnit(tempTarget.high, Units.Mg_Dl), ValueWithUnit(tempTarget.durationInMinutes, Units.M))
|
||||
val id = tempTarget._id
|
||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||
else uploadQueue.removeID("dbAdd", id)
|
||||
|
|
|
@ -12,7 +12,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.Intervals
|
||||
import info.nightscout.androidaps.data.IobTotal
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.databinding.TreatmentsTempbasalsFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsTempbasalsItemBinding
|
||||
import info.nightscout.androidaps.db.Source
|
||||
|
@ -164,7 +164,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
|
|||
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(tempBasal.date)}
|
||||
""".trimIndent(),
|
||||
{ _: DialogInterface?, _: Int ->
|
||||
uel.log(UserEntry.Action.TT_REMOVED, dateUtil.dateAndTimeString(tempBasal.date))
|
||||
uel.log(Action.TT_REMOVED, ValueWithUnit(tempBasal.date, Units.Timestamp))
|
||||
activePlugin.activeTreatments.removeTempBasal(tempBasal)
|
||||
}, null)
|
||||
}
|
||||
|
|
|
@ -68,10 +68,13 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
|
|||
holder.binding.date.text = dateUtil.dateAndTimeAndSecondsString(current.timestamp)
|
||||
holder.binding.action.text = resourceHelper.gs(current.action.stringId())
|
||||
if (current.s != "") holder.binding.s.text = current.s else holder.binding.s.visibility = View.GONE
|
||||
/*
|
||||
if (current.d1 != 0.0) holder.binding.d1.text = current.d1.toString() else holder.binding.d1.visibility = View.GONE
|
||||
if (current.d2 != 0.0) holder.binding.d2.text = current.d2.toString() else holder.binding.d2.visibility = View.GONE
|
||||
if (current.i1 != 0) holder.binding.i1.text = current.i1.toString() else holder.binding.i1.visibility = View.GONE
|
||||
if (current.i2 != 0) holder.binding.i2.text = current.i2.toString() else holder.binding.i2.visibility = View.GONE
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
inner class UserEntryViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
|
|
|
@ -10,7 +10,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.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.db.CareportalEvent
|
||||
import info.nightscout.androidaps.db.Source
|
||||
import info.nightscout.androidaps.db.TempTarget
|
||||
|
@ -347,7 +347,7 @@ class BolusWizard @Inject constructor(
|
|||
boluscalc = nsJSON()
|
||||
source = Source.USER
|
||||
notes = this@BolusWizard.notes
|
||||
uel.log(UserEntry.Action.BOLUS_ADVISOR, d1 = insulinAfterConstraints)
|
||||
uel.log(Action.BOLUS_ADVISOR, ValueWithUnit(insulinAfterConstraints, Units.U))
|
||||
if (insulin > 0) {
|
||||
commandQueue.bolus(this, object : Callback() {
|
||||
override fun run() {
|
||||
|
@ -370,7 +370,7 @@ class BolusWizard @Inject constructor(
|
|||
OKDialog.showConfirmation(ctx, resourceHelper.gs(R.string.boluswizard), confirmMessage, {
|
||||
if (insulinAfterConstraints > 0 || carbs > 0) {
|
||||
if (useSuperBolus) {
|
||||
uel.log(UserEntry.Action.SUPERBOLUS_TBR)
|
||||
uel.log(Action.SUPERBOLUS_TBR)
|
||||
if (loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||
loopPlugin.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000)
|
||||
rxBus.send(EventRefreshOverview("WizardDialog"))
|
||||
|
@ -411,7 +411,7 @@ class BolusWizard @Inject constructor(
|
|||
boluscalc = nsJSON()
|
||||
source = Source.USER
|
||||
notes = this@BolusWizard.notes
|
||||
uel.log(UserEntry.Action.BOLUS_WIZARD, "", insulinAfterConstraints, carbs)
|
||||
uel.log(Action.BOLUS_WIZARD, notes, ValueWithUnit(insulinAfterConstraints, Units.U), ValueWithUnit(this@BolusWizard.carbs, Units.G), ValueWithUnit(carbTime, Units.M))
|
||||
if (insulin > 0 || pump.pumpDescription.storesCarbInfo) {
|
||||
commandQueue.bolus(this, object : Callback() {
|
||||
override fun run() {
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package info.nightscout.androidaps;
|
||||
|
||||
import info.nightscout.androidaps.utils.T;
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*;
|
||||
|
||||
/**
|
||||
* Created by mike on 07.06.2016.
|
||||
*/
|
||||
public class Constants {
|
||||
public static final String MGDL = "mg/dl"; // This is Nightscout's representation
|
||||
public static final String MMOL = "mmol";
|
||||
public static final String MGDL = Units.Mg_Dl.name(); // This is Nightscout's representation
|
||||
public static final String MMOL = Units.Mmol_L.name();
|
||||
|
||||
public static final double MMOLL_TO_MGDL = 18; // 18.0182;
|
||||
public static final double MGDL_TO_MMOLL = 1 / MMOLL_TO_MGDL;
|
||||
|
|
|
@ -11,7 +11,7 @@ import dagger.android.support.DaggerDialogFragment
|
|||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.core.databinding.DialogErrorBinding
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
|
||||
|
@ -59,15 +59,15 @@ class ErrorDialog : DaggerDialogFragment() {
|
|||
|
||||
binding.title.text = title
|
||||
binding.ok.setOnClickListener {
|
||||
uel.log(UserEntry.Action.ERROR_DIALOG_OK)
|
||||
uel.log(Action.ERROR_DIALOG_OK)
|
||||
dismiss()
|
||||
}
|
||||
binding.mute.setOnClickListener {
|
||||
uel.log(UserEntry.Action.ERROR_DIALOG_MUTE)
|
||||
uel.log(Action.ERROR_DIALOG_MUTE)
|
||||
stopAlarm()
|
||||
}
|
||||
binding.mute5min.setOnClickListener {
|
||||
uel.log(UserEntry.Action.ERROR_DIALOG_MUTE_5MIN)
|
||||
uel.log(Action.ERROR_DIALOG_MUTE_5MIN)
|
||||
stopAlarm()
|
||||
loopHandler.postDelayed(this::startAlarm, T.mins(5).msecs())
|
||||
}
|
||||
|
|
|
@ -23,12 +23,7 @@ class UserEntryLogger @Inject constructor(
|
|||
fun log(action: Action, s: String, vararg listvalues: ValueWithUnit) {
|
||||
val values = mutableListOf<ValueWithUnit>()
|
||||
for (v in listvalues){
|
||||
var vConverted = v
|
||||
// Convertion to always store all values in the same units in database
|
||||
when(v.unit) {
|
||||
Units.Mmol_L -> { vConverted = ValueWithUnit(v.dValue * Constants.MMOLL_TO_MGDL, Units.Mg_Dl)}
|
||||
}
|
||||
values.add(vConverted)
|
||||
values.add(v)
|
||||
}
|
||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
||||
action = action,
|
||||
|
@ -38,20 +33,15 @@ class UserEntryLogger @Inject constructor(
|
|||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribeBy(
|
||||
//onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $s ${if (d1.dValue != 0.0) d1 else ""} ${if (d2.dValue != 0.0) d2 else ""} ${if (i1.iValue != 0) i1 else ""} ${if (i2.iValue != 0) i2 else ""}") },
|
||||
//onComplete = { aapsLogger.debug("USER ENTRY: $action $s ${if (d1.dValue != 0.0) d1 else ""} ${if (d2.dValue != 0.0) d2 else ""} ${if (i1.iValue != 0) i1 else ""} ${if (i2.iValue != 0) i2 else ""}") }
|
||||
onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $s $values") },
|
||||
onComplete = { aapsLogger.debug("USER ENTRY: $action $s $values") }
|
||||
)
|
||||
}
|
||||
|
||||
fun log(action: Action, vararg listvalues: ValueWithUnit) {
|
||||
val values = mutableListOf<ValueWithUnit>()
|
||||
for (v in listvalues){
|
||||
var vConverted = v
|
||||
// Convertion to always store all values in the same units in database
|
||||
when(v.unit) {
|
||||
Units.Mmol_L -> { vConverted = ValueWithUnit(v.dValue * Constants.MMOLL_TO_MGDL, Units.Mg_Dl)}
|
||||
}
|
||||
values.add(vConverted)
|
||||
values.add(v)
|
||||
}
|
||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
||||
action = action,
|
||||
|
@ -61,15 +51,15 @@ class UserEntryLogger @Inject constructor(
|
|||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribeBy(
|
||||
//onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $s ${if (d1.dValue != 0.0) d1 else ""} ${if (d2.dValue != 0.0) d2 else ""} ${if (i1.iValue != 0) i1 else ""} ${if (i2.iValue != 0) i2 else ""}") },
|
||||
//onComplete = { aapsLogger.debug("USER ENTRY: $action $s ${if (d1.dValue != 0.0) d1 else ""} ${if (d2.dValue != 0.0) d2 else ""} ${if (i1.iValue != 0) i1 else ""} ${if (i2.iValue != 0) i2 else ""}") }
|
||||
onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $values") },
|
||||
onComplete = { aapsLogger.debug("USER ENTRY: $action $values") }
|
||||
)
|
||||
}
|
||||
|
||||
fun log(action: Action) {
|
||||
fun log(action: Action, s: String = "") {
|
||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
||||
action = action,
|
||||
s = ""
|
||||
s = s
|
||||
))
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
|
|
|
@ -14,7 +14,7 @@ fun UserEntry.Units.stringId(): Int {
|
|||
this == UserEntry.Units.G -> R.string.shortgram
|
||||
this == UserEntry.Units.M -> R.string.shortminute
|
||||
this == UserEntry.Units.H -> R.string.shorthour
|
||||
this == UserEntry.Units.Percent -> R.string.percent
|
||||
this == UserEntry.Units.Percent -> R.string.shortpercent
|
||||
else -> 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
<string name="mgdl">mg/dl</string>
|
||||
<string name="mmol">mmol/l</string>
|
||||
<string name="shortgram">g</string>
|
||||
<string name="percent">%%</string>
|
||||
<string name="shortpercent">%%</string>
|
||||
<string name="advancedsettings_title">Advanced Settings</string>
|
||||
<string name="bluetooth">Bluetooth</string>
|
||||
<string name="btwatchdog_title">BT Watchdog</string>
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.view.ViewGroup
|
|||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.activities.TDDStatsActivity
|
||||
import info.nightscout.androidaps.dana.databinding.DanarFragmentBinding
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
||||
import info.nightscout.androidaps.events.EventExtendedBolusChange
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged
|
||||
|
@ -109,7 +109,7 @@ class DanaFragment : DaggerFragment() {
|
|||
binding.btconnection.setOnLongClickListener {
|
||||
activity?.let {
|
||||
OKDialog.showConfirmation(it, resourceHelper.gs(R.string.resetpairing)) {
|
||||
uel.log(UserEntry.Action.CLEAR_PAIRING_KEYS)
|
||||
uel.log(Action.CLEAR_PAIRING_KEYS)
|
||||
(activePlugin.activePump as DanaPumpInterface).clearPairing()
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,7 @@ import androidx.room.TypeConverters
|
|||
import info.nightscout.androidaps.database.daos.*
|
||||
import info.nightscout.androidaps.database.entities.*
|
||||
|
||||
const val DATABASE_VERSION = 3
|
||||
const val DATABASE_VERSION = 4
|
||||
|
||||
@Database(version = DATABASE_VERSION,
|
||||
entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
|
||||
|
|
|
@ -5,6 +5,7 @@ import info.nightscout.androidaps.database.data.Block
|
|||
import info.nightscout.androidaps.database.data.TargetBlock
|
||||
import info.nightscout.androidaps.database.embedments.InterfaceIDs
|
||||
import info.nightscout.androidaps.database.entities.*
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
|
||||
|
@ -16,48 +17,32 @@ class Converters {
|
|||
@TypeConverter
|
||||
fun toAction(action: String?) = action?.let { UserEntry.Action.fromString(it) }
|
||||
|
||||
@TypeConverter
|
||||
fun fromValueWithUnit(valueWithUnit: UserEntry.ValueWithUnit?): String? {
|
||||
if (valueWithUnit == null) return null
|
||||
val jsonObject = JSONObject()
|
||||
jsonObject.put("sValue", valueWithUnit.sValue)
|
||||
jsonObject.put("dValue", valueWithUnit.dValue)
|
||||
jsonObject.put("iValue", valueWithUnit.iValue)
|
||||
jsonObject.put("lValue", valueWithUnit.lValue)
|
||||
jsonObject.put("unit", valueWithUnit.unit.name)
|
||||
return jsonObject.toString()
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toValueWithUnit(jsonString: String?): UserEntry.ValueWithUnit? {
|
||||
if (jsonString == null) return null
|
||||
val jsonObject = JSONObject(jsonString)
|
||||
return UserEntry.ValueWithUnit(jsonObject.getString("sValue"), jsonObject.getDouble("dValue"), jsonObject.getInt("iValue"), jsonObject.getLong("lValue"), UserEntry.Units.fromString(jsonObject.getString("unit")) )
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun fromMutableListOfValueWithUnit(values: MutableList<UserEntry.ValueWithUnit>?): String? {
|
||||
if (values == null) return null
|
||||
val jsonArray = JSONArray()
|
||||
values.forEach {
|
||||
val jsonObject = JSONObject()
|
||||
jsonObject.put("dValue", it.dValue)
|
||||
jsonObject.put("iValue", it.iValue)
|
||||
jsonObject.put("lValue", it.lValue)
|
||||
jsonObject.put("unit", it.unit.name)
|
||||
if (!it.dValue.equals(0.0)) jsonObject.put("dValue", it.dValue).put("unit", it.unit.name)
|
||||
if (!it.iValue.equals(0)) jsonObject.put("iValue", it.iValue).put("unit", it.unit.name)
|
||||
if (!it.lValue.equals(0)) jsonObject.put("lValue", it.lValue).put("unit", it.unit.name)
|
||||
if (!it.sValue.equals("")) jsonObject.put("sValue", it.sValue).put("unit", it.unit.name)
|
||||
jsonArray.put(jsonObject)
|
||||
}
|
||||
return jsonArray.toString()
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toMutableListOfValueWithUnit(jsonString: String?): List<Block>? {
|
||||
fun toMutableListOfValueWithUnit(jsonString: String?): MutableList<UserEntry.ValueWithUnit>? {
|
||||
if (jsonString == null) return null
|
||||
val jsonArray = JSONArray(jsonString)
|
||||
val list = mutableListOf<Block>()
|
||||
val list = mutableListOf<UserEntry.ValueWithUnit>()
|
||||
for (i in 0 until jsonArray.length()) {
|
||||
val jsonObject = jsonArray.getJSONObject(i)
|
||||
list.add(Block(jsonObject.getLong("duration"), jsonObject.getDouble("amount")))
|
||||
if (jsonObject.has("dValue")) list.add(ValueWithUnit(jsonObject.getDouble("dValue"), jsonObject.getString("unit")))
|
||||
if (jsonObject.has("iValue")) list.add(ValueWithUnit(jsonObject.getDouble("iValue"), jsonObject.getString("unit")))
|
||||
if (jsonObject.has("lValue")) list.add(ValueWithUnit(jsonObject.getDouble("lValue"), jsonObject.getString("unit")))
|
||||
if (jsonObject.has("sValue")) list.add(ValueWithUnit(jsonObject.getDouble("sValue"), jsonObject.getString("unit")))
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ open class DatabaseModule {
|
|||
Room
|
||||
.databaseBuilder(context, AppDatabase::class.java, fileName)
|
||||
.addMigrations(migration1to2)
|
||||
.addMigrations(migration3to4)
|
||||
.fallbackToDestructiveMigration()
|
||||
.build()
|
||||
|
||||
|
@ -36,7 +37,8 @@ open class DatabaseModule {
|
|||
|
||||
private val migration3to4 = object : Migration(3, 4) {
|
||||
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` TEXT NOT NULL, `d2` TEXT NOT NULL, `i1` TEXT NOT NULL, `i2` TEXT NOT NULL)")
|
||||
database.execSQL("DROP TABLE IF EXISTS userEntry")
|
||||
database.execSQL("CREATE TABLE 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` TEXT NOT NULL, `d2` TEXT NOT NULL, `i1` TEXT NOT NULL, `i2` TEXT NOT NULL)")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.database.entities
|
|||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import info.nightscout.androidaps.database.R
|
||||
import info.nightscout.androidaps.database.TABLE_USER_ENTRY
|
||||
import info.nightscout.androidaps.database.interfaces.DBEntry
|
||||
import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
|
||||
|
@ -120,26 +119,31 @@ data class UserEntry(
|
|||
fun fromString(source: String?) = UserEntry.Action.values().firstOrNull { it.name == source } ?: UserEntry.Action.UNKNOWN
|
||||
}
|
||||
}
|
||||
data class ValueWithUnit (val dValue: Double, val iValue: Int, val lValue: Long, val unit: Units) {
|
||||
constructor(dvalue:Double, unit:Units) : this(dvalue,0, 0, unit)
|
||||
constructor(ivalue:Int, unit:Units) : this(0.0, ivalue, 0, unit)
|
||||
constructor(lvalue:Long, unit:Units) : this(0.0,0, lvalue, unit)
|
||||
data class ValueWithUnit (val dValue: Double, val iValue: Int, val lValue: Long, val sValue: String, val unit: Units) {
|
||||
constructor(dvalue:Double?, unit:Units) : this(dvalue ?:0.0,0, 0, "", unit)
|
||||
constructor(ivalue:Int?, unit:Units) : this(0.0, ivalue ?:0, 0, "", unit)
|
||||
constructor(lvalue:Long?, unit:Units) : this(0.0,0, lvalue ?:0, "", unit)
|
||||
constructor(svalue:String?, unit:Units) : this(0.0,0, 0, svalue ?:"", unit)
|
||||
constructor(dvalue:Double?, unit:String) : this(dvalue ?:0.0,0, 0, "", Units.fromString(unit))
|
||||
}
|
||||
enum class Units {
|
||||
@SerializedName("None") None,
|
||||
@SerializedName("Mg_Dl") Mg_Dl,
|
||||
@SerializedName("Mmol_L") Mmol_L,
|
||||
@SerializedName("mg/dl") Mg_Dl,
|
||||
@SerializedName("mmol") Mmol_L,
|
||||
@SerializedName("Timestamp") Timestamp,
|
||||
@SerializedName("U") U,
|
||||
@SerializedName("U_H") U_H,
|
||||
@SerializedName("G") G,
|
||||
@SerializedName("M") M,
|
||||
@SerializedName("H") H,
|
||||
@SerializedName("Percent") Percent
|
||||
@SerializedName("U/h") U_H,
|
||||
@SerializedName("g") G,
|
||||
@SerializedName("m") M,
|
||||
@SerializedName("h") H,
|
||||
@SerializedName("Percent") Percent,
|
||||
@SerializedName("CPEvent") CPEvent,
|
||||
@SerializedName("TT_Reason") TT_Reason,
|
||||
@SerializedName("R_String") R_String
|
||||
;
|
||||
|
||||
companion object {
|
||||
fun fromString(unit: String?) = UserEntry.Units.values().firstOrNull { it.name == unit } ?: UserEntry.Units.None
|
||||
fun fromString(unit: String?) = values().firstOrNull { it.name == unit } ?: None
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue