Fix Build 2
This commit is contained in:
parent
654ca35dd1
commit
87fecfd255
9 changed files with 55 additions and 62 deletions
|
@ -61,7 +61,8 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
|
||||
private var options: EventType = EventType.BGCHECK
|
||||
private var valuesWithUnit = mutableListOf<XXXValueWithUnit?>()
|
||||
//private var valuesWithUnit = mutableListOf<XXXValueWithUnit?>()
|
||||
private var valuesWithUnit = mutableListOf<ValueWithUnit>()
|
||||
|
||||
@StringRes
|
||||
private var event: Int = R.string.none
|
||||
|
@ -203,13 +204,16 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
actions.add(resourceHelper.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(profileFunction, binding.bg.value) + " " + resourceHelper.gs(unitResId))
|
||||
therapyEvent.glucoseType = meterType
|
||||
therapyEvent.glucose = binding.bg.value
|
||||
valuesWithUnit.add(XXXValueWithUnit.fromGlucoseUnit(binding.bg.value.toDouble(), profileFunction.getUnits()))
|
||||
valuesWithUnit.add(XXXValueWithUnit.TherapyEventMeterType(meterType))
|
||||
//valuesWithUnit.add(XXXValueWithUnit.fromGlucoseUnit(binding.bg.value.toDouble(), profileFunction.getUnits()))
|
||||
//valuesWithUnit.add(XXXValueWithUnit.TherapyEventMeterType(meterType))
|
||||
valuesWithUnit.add(ValueWithUnit(binding.bg.value.toDouble(), profileFunction.getUnits()))
|
||||
valuesWithUnit.add(ValueWithUnit(meterType.text, Units.TherapyEvent))
|
||||
}
|
||||
if (options == EventType.NOTE || options == EventType.EXERCISE) {
|
||||
actions.add(resourceHelper.gs(R.string.careportal_newnstreatment_duration_label) + ": " + resourceHelper.gs(R.string.format_mins, binding.duration.value.toInt()))
|
||||
therapyEvent.duration = T.mins(binding.duration.value.toLong()).msecs()
|
||||
valuesWithUnit.add(XXXValueWithUnit.Minute(binding.duration.value.toInt()).takeIf { !binding.duration.value.equals(0.0) })
|
||||
//valuesWithUnit.add(XXXValueWithUnit.Minute(binding.duration.value.toInt()).takeIf { !binding.duration.value.equals(0.0) })
|
||||
valuesWithUnit.add(ValueWithUnit(binding.duration.value.toInt(), Units.M, !binding.duration.value.equals(0.0)))
|
||||
}
|
||||
val notes = binding.notesLayout.notes.text.toString()
|
||||
if (notes.isNotEmpty()) {
|
||||
|
@ -239,8 +243,10 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
}, {
|
||||
aapsLogger.error(LTag.BGSOURCE, "Error while saving therapy event", it)
|
||||
})
|
||||
valuesWithUnit.add(0, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
|
||||
valuesWithUnit.add(1, XXXValueWithUnit.TherapyEventType(therapyEvent.type))
|
||||
//valuesWithUnit.add(0, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
|
||||
//valuesWithUnit.add(1, XXXValueWithUnit.TherapyEventType(therapyEvent.type))
|
||||
valuesWithUnit.add(0, ValueWithUnit(eventTime, Units.Timestamp, eventTimeChanged))
|
||||
valuesWithUnit.add(1, ValueWithUnit(therapyEvent.type.text, Units.TherapyEvent))
|
||||
uel.log(Action.CAREPORTAL, notes, valuesWithUnit)
|
||||
}, null)
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ 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.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.databinding.ObjectivesFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.ObjectivesItemBinding
|
||||
import info.nightscout.androidaps.dialogs.NtpProgressDialog
|
||||
|
@ -36,11 +36,11 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
|||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
import info.nightscout.androidaps.utils.SntpClient
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
|
||||
class ObjectivesFragment : DaggerFragment() {
|
||||
|
@ -309,7 +309,8 @@ 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(Action.OBJECTIVE_UNSTARTED, XXXValueWithUnit.SimpleInt(position + 1))
|
||||
//uel.log(Action.OBJECTIVE_UNSTARTED, XXXValueWithUnit.SimpleInt(position + 1))
|
||||
uel.log(Action.OBJECTIVE_UNSTARTED, ValueWithUnit(position + 1, Units.None))
|
||||
objective.startedOn = 0
|
||||
scrollToCurrentObjective()
|
||||
rxBus.send(EventObjectivesUpdateGui())
|
||||
|
|
|
@ -63,7 +63,8 @@ class NSProfileFragment : DaggerFragment() {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.nsprofile),
|
||||
resourceHelper.gs(R.string.activate_profile) + ": " + name + " ?", Runnable {
|
||||
uel.log(Action.PROFILE_SWITCH, XXXValueWithUnit.SimpleString(name), XXXValueWithUnit.Percent(100))
|
||||
//uel.log(Action.PROFILE_SWITCH, XXXValueWithUnit.SimpleString(name), XXXValueWithUnit.Percent(100))
|
||||
uel.log(Action.PROFILE_SWITCH, ValueWithUnit(name, Units.None), ValueWithUnit(100.toInt(), Units.Percent))
|
||||
treatmentsPlugin.doProfileSwitch(store, name, 0, 100, 0, DateUtil.now())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -130,7 +130,8 @@ 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(Action.BG_REMOVED, XXXValueWithUnit.Timestamp(glucoseValue.timestamp))
|
||||
//uel.log(Action.BG_REMOVED, XXXValueWithUnit.Timestamp(glucoseValue.timestamp))
|
||||
uel.log(Action.BG_REMOVED, ValueWithUnit(glucoseValue.timestamp, Units.Timestamp))
|
||||
disposable += repository.runTransaction(InvalidateGlucoseValueTransaction(glucoseValue.id)).subscribe()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ class BolusWizard @Inject constructor(
|
|||
source = Source.USER
|
||||
notes = this@BolusWizard.notes
|
||||
//uel.log(Action.BOLUS_ADVISOR, notes, XXXValueWithUnit.TherapyEventType(eventType), XXXValueWithUnit.Insulin(insulinAfterConstraints))
|
||||
uel.log(Action.BOLUS_ADVISOR, notes, ValueWithUnit(Sources.WizardDialog), ValueWithUnit(eventType, Units.TherapyEvent), ValueWithUnit(insulinAfterConstraints, Units.U))
|
||||
uel.log(Action.BOLUS_ADVISOR, notes, ValueWithUnit(Sources.WizardDialog), ValueWithUnit(eventType.text, Units.TherapyEvent), ValueWithUnit(insulinAfterConstraints, Units.U))
|
||||
if (insulin > 0) {
|
||||
commandQueue.bolus(this, object : Callback() {
|
||||
override fun run() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.logging
|
||||
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
|
@ -20,7 +21,7 @@ class UserEntryLogger @Inject constructor(
|
|||
|
||||
private val compositeDisposable = CompositeDisposable()
|
||||
|
||||
/* fun log(action: Action, s: String? ="", vararg listvalues: ValueWithUnit) {
|
||||
fun log(action: Action, s: String? ="", vararg listvalues: ValueWithUnit) {
|
||||
val values = mutableListOf<ValueWithUnit>()
|
||||
for (v in listvalues){
|
||||
if (v.condition) values.add(v)
|
||||
|
@ -36,15 +37,15 @@ class UserEntryLogger @Inject constructor(
|
|||
onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $s $values") },
|
||||
onComplete = { aapsLogger.debug("USER ENTRY: $action $s $values") }
|
||||
)
|
||||
}*/
|
||||
}
|
||||
|
||||
fun log(action: Action, vararg listvalues: XXXValueWithUnit?) = Unit // TODO
|
||||
//fun log(action: Action, vararg listvalues: XXXValueWithUnit?) = Unit // TODO
|
||||
|
||||
fun log(action: Action, s: String? = "", values: List<XXXValueWithUnit?>) = Unit
|
||||
//fun log(action: Action, s: String? = "", values: List<XXXValueWithUnit?>) = Unit
|
||||
|
||||
fun log(action: Action, s: String? , vararg listvalues: XXXValueWithUnit?) = Unit
|
||||
//fun log(action: Action, s: String? , vararg listvalues: XXXValueWithUnit?) = Unit
|
||||
|
||||
/* fun log(action: Action, vararg listvalues: ValueWithUnit) {
|
||||
fun log(action: Action, vararg listvalues: ValueWithUnit) {
|
||||
val values = mutableListOf<ValueWithUnit>()
|
||||
for (v in listvalues){
|
||||
if (v.condition) values.add(v)
|
||||
|
@ -73,19 +74,19 @@ class UserEntryLogger @Inject constructor(
|
|||
onError = { aapsLogger.debug("ERRORED USER ENTRY: $action") },
|
||||
onComplete = { aapsLogger.debug("USER ENTRY: $action") }
|
||||
)
|
||||
}*/
|
||||
}
|
||||
|
||||
// fun log(action: Action, s: String? = "", values: List<ValueWithUnit>) { // TODO re-enable with new signature
|
||||
// compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
||||
// action = action,
|
||||
// s = s ?:"",
|
||||
// values = values
|
||||
// ))
|
||||
// .subscribeOn(aapsSchedulers.io)
|
||||
// .observeOn(aapsSchedulers.io)
|
||||
// .subscribeBy(
|
||||
// onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $s $values") },
|
||||
// onComplete = { aapsLogger.debug("USER ENTRY: $action $s $values") }
|
||||
// )
|
||||
// }
|
||||
fun log(action: Action, s: String? = "", values: MutableList<ValueWithUnit>) {
|
||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
||||
action = action,
|
||||
s = s ?:"",
|
||||
values = values
|
||||
))
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribeBy(
|
||||
onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $s $values") },
|
||||
onComplete = { aapsLogger.debug("USER ENTRY: $action $s $values") }
|
||||
)
|
||||
}
|
||||
}
|
|
@ -19,7 +19,6 @@ class Translator @Inject internal constructor(
|
|||
fun translate(action: Action): String = when(action) {
|
||||
Action.BOLUS -> resourceHelper.gs(R.string.uel_bolus)
|
||||
Action.BOLUS_ADVISOR -> resourceHelper.gs(R.string.uel_bolus_advisor)
|
||||
Action.BOLUS_RECORD -> resourceHelper.gs(R.string.uel_bolus_record)
|
||||
Action.EXTENDED_BOLUS -> resourceHelper.gs(R.string.uel_extended_bolus)
|
||||
Action.SUPERBOLUS_TBR -> resourceHelper.gs(R.string.uel_superbolus_tbr)
|
||||
Action.CARBS -> resourceHelper.gs(R.string.uel_carbs)
|
||||
|
@ -58,6 +57,7 @@ class Translator @Inject internal constructor(
|
|||
Action.BG_REMOVED -> resourceHelper.gs(R.string.uel_bg_removed)
|
||||
Action.CAREPORTAL_REMOVED -> resourceHelper.gs(R.string.uel_careportal_removed)
|
||||
Action.EXTENDED_BOLUS_REMOVED -> resourceHelper.gs(R.string.uel_extended_bolus_removed)
|
||||
Action.FOOD -> resourceHelper.gs(R.string.uel_food)
|
||||
Action.FOOD_REMOVED -> resourceHelper.gs(R.string.uel_food_removed)
|
||||
Action.PROFILE_REMOVED -> resourceHelper.gs(R.string.uel_profile_removed)
|
||||
Action.PROFILE_SWITCH_REMOVED -> resourceHelper.gs(R.string.uel_profile_switch_removed)
|
||||
|
@ -84,27 +84,9 @@ class Translator @Inject internal constructor(
|
|||
Action.IMPORT_DATABASES -> resourceHelper.gs(R.string.uel_import_databases)
|
||||
Action.OTP_EXPORT -> resourceHelper.gs(R.string.uel_otp_export)
|
||||
Action.OTP_RESET -> resourceHelper.gs(R.string.uel_otp_reset)
|
||||
Action.SMS_BASAL -> resourceHelper.gs(R.string.uel_sms_basal)
|
||||
Action.SMS_BOLUS -> resourceHelper.gs(R.string.uel_sms_bolus)
|
||||
Action.SMS_CAL -> resourceHelper.gs(R.string.uel_sms_cal)
|
||||
Action.SMS_CARBS -> resourceHelper.gs(R.string.uel_sms_carbs)
|
||||
Action.SMS_EXTENDED_BOLUS -> resourceHelper.gs(R.string.uel_sms_extended_bolus)
|
||||
Action.SMS_LOOP_DISABLED -> resourceHelper.gs(R.string.uel_sms_loop_disabled)
|
||||
Action.SMS_LOOP_ENABLED -> resourceHelper.gs(R.string.uel_sms_loop_enabled)
|
||||
Action.SMS_LOOP_RESUME -> resourceHelper.gs(R.string.uel_sms_loop_resume)
|
||||
Action.SMS_LOOP_SUSPEND -> resourceHelper.gs(R.string.uel_sms_loop_suspend)
|
||||
Action.SMS_PROFILE -> resourceHelper.gs(R.string.uel_sms_profile)
|
||||
Action.SMS_PUMP_CONNECT -> resourceHelper.gs(R.string.uel_sms_pump_connect)
|
||||
Action.SMS_PUMP_DISCONNECT -> resourceHelper.gs(R.string.uel_sms_pump_disconnect)
|
||||
Action.SMS_SMS -> resourceHelper.gs(R.string.uel_sms_sms)
|
||||
Action.SMS_TT -> resourceHelper.gs(R.string.uel_sms_tt)
|
||||
Action.TT_DELETED_FROM_NS -> resourceHelper.gs(R.string.uel_tt_deleted_from_ns)
|
||||
Action.TT_FROM_NS -> resourceHelper.gs(R.string.uel_tt_from_ns)
|
||||
Action.TT_CANCELED_FROM_NS -> resourceHelper.gs(R.string.uel_tt_canceleted_from_ns)
|
||||
Action.CAREPORTAL_DELETED_FROM_NS -> resourceHelper.gs(R.string.uel_careportal_deleted_from_ns)
|
||||
Action.CAREPORTAL_FROM_NS -> resourceHelper.gs(R.string.uel_careportal_from_ns)
|
||||
Action.EXPORT_CSV -> resourceHelper.gs(R.string.uel_export_csv)
|
||||
Action.FOOD_FROM_NS -> resourceHelper.gs(R.string.unknown) // TODO?
|
||||
Action.SMB -> TODO()
|
||||
Action.STOP_SMS -> TODO()
|
||||
Action.UNKNOWN -> resourceHelper.gs(R.string.unknown)
|
||||
}
|
||||
|
||||
|
@ -172,14 +154,14 @@ class Translator @Inject internal constructor(
|
|||
}
|
||||
|
||||
fun translate(source: Sources): String = when(source) {
|
||||
Sources.Automation.text -> resourceHelper.gs(R.string.automation)
|
||||
Sources.Loop.text -> resourceHelper.gs(R.string.loop)
|
||||
Sources.NSClient.text -> resourceHelper.gs(R.string.ns)
|
||||
Sources.Pump.text -> resourceHelper.gs(R.string.pump)
|
||||
Sources.SMS.text -> resourceHelper.gs(R.string.smb_shortname)
|
||||
Sources.Wear.text -> resourceHelper.gs(R.string.wear)
|
||||
Sources.Unknown.text -> resourceHelper.gs(R.string.unknown)
|
||||
Sources.Automation -> resourceHelper.gs(R.string.automation)
|
||||
Sources.Loop -> resourceHelper.gs(R.string.loop)
|
||||
Sources.NSClient -> resourceHelper.gs(R.string.ns)
|
||||
Sources.Pump -> resourceHelper.gs(R.string.pump)
|
||||
Sources.SMS -> resourceHelper.gs(R.string.smb_shortname)
|
||||
Sources.Wear -> resourceHelper.gs(R.string.wear)
|
||||
Sources.Unknown -> resourceHelper.gs(R.string.unknown)
|
||||
|
||||
else -> resourceHelper.gs(R.string.unknown)
|
||||
else -> resourceHelper.gs(R.string.unknown)
|
||||
}
|
||||
}
|
|
@ -443,6 +443,7 @@
|
|||
<string name="uel_bg_removed">BG REMOVED</string>
|
||||
<string name="uel_careportal_removed">CAREPORTAL REMOVED</string>
|
||||
<string name="uel_extended_bolus_removed">EXTENDED BOLUS REMOVED</string>
|
||||
<string name="uel_food">FOOD</string>
|
||||
<string name="uel_food_removed">FOOD REMOVED</string>
|
||||
<string name="uel_profile_removed">PROFILE REMOVED</string>
|
||||
<string name="uel_profile_switch_removed">PROFILE SWITCH REMOVED</string>
|
||||
|
|
|
@ -13,7 +13,7 @@ class UserEntryTransaction(
|
|||
database.userEntryDao.insert(UserEntry(
|
||||
timestamp = System.currentTimeMillis(),
|
||||
action = action,
|
||||
remark = s,
|
||||
s = s,
|
||||
values = values
|
||||
))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue