Merge pull request #468 from Philoul/meallink_VWU_v2
Fix double Entries in Treatment Dialog (+ add new uel.log for plugin enabled/disabled
This commit is contained in:
commit
b0a12dab1a
|
@ -167,18 +167,18 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
{ aapsLogger.error(LTag.DATABASE, "Error while saving carbs", it) }
|
||||
)
|
||||
} else {
|
||||
if (detailedBolusInfo.insulin > 0)
|
||||
if (detailedBolusInfo.insulin > 0) {
|
||||
uel.log(action, Sources.TreatmentDialog,
|
||||
ValueWithUnit.Insulin(insulinAfterConstraints),
|
||||
ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
|
||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
} else
|
||||
uel.log(action, Sources.TreatmentDialog,
|
||||
ValueWithUnit.Insulin(insulinAfterConstraints),
|
||||
ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
|
||||
}
|
||||
}
|
||||
})
|
||||
else
|
||||
} else
|
||||
uel.log(action, Sources.TreatmentDialog,
|
||||
ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbs != 0 })
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.events.EventAppInitialized
|
||||
import info.nightscout.androidaps.events.EventConfigBuilderChange
|
||||
import info.nightscout.androidaps.events.EventRebuildTabs
|
||||
|
@ -147,7 +148,8 @@ class ConfigBuilderPlugin @Inject constructor(
|
|||
performPluginSwitch(changedPlugin, newState, type)
|
||||
pumpSync.connectNewPump()
|
||||
sp.putBoolean("allow_hardware_pump", true)
|
||||
uel.log(Action.HW_PUMP_ALLOWED, Sources.ConfigBuilder)
|
||||
uel.log(Action.HW_PUMP_ALLOWED, Sources.ConfigBuilder,
|
||||
ValueWithUnit.StringResource(changedPlugin.pluginDescription.pluginName))
|
||||
aapsLogger.debug(LTag.PUMP, "First time HW pump allowed!")
|
||||
}, {
|
||||
rxBus.send(EventConfigBuilderUpdateGui())
|
||||
|
@ -157,6 +159,14 @@ class ConfigBuilderPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun performPluginSwitch(changedPlugin: PluginBase, enabled: Boolean, type: PluginType) {
|
||||
if(enabled && !changedPlugin.isEnabled()) {
|
||||
uel.log(Action.PLUGIN_ENABLED, Sources.ConfigBuilder,
|
||||
ValueWithUnit.StringResource(changedPlugin.pluginDescription.pluginName))
|
||||
}
|
||||
else if(!enabled) {
|
||||
uel.log(Action.PLUGIN_DISABLED, Sources.ConfigBuilder,
|
||||
ValueWithUnit.StringResource(changedPlugin.pluginDescription.pluginName))
|
||||
}
|
||||
changedPlugin.setPluginEnabled(type, enabled)
|
||||
changedPlugin.setFragmentVisible(type, enabled)
|
||||
processOnEnabledCategoryChanged(changedPlugin, type)
|
||||
|
|
|
@ -96,6 +96,8 @@ class Translator @Inject internal constructor(
|
|||
Action.STOP_SMS -> resourceHelper.gs(R.string.uel_stop_sms)
|
||||
Action.START_AAPS -> resourceHelper.gs(R.string.uel_start_aaps)
|
||||
Action.EXIT_AAPS -> resourceHelper.gs(R.string.uel_exit_aaps)
|
||||
Action.PLUGIN_ENABLED -> resourceHelper.gs(R.string.uel_plugin_enabled)
|
||||
Action.PLUGIN_DISABLED -> resourceHelper.gs(R.string.uel_plugin_disabled)
|
||||
Action.UNKNOWN -> resourceHelper.gs(R.string.unknown)
|
||||
}
|
||||
|
||||
|
|
|
@ -483,6 +483,8 @@
|
|||
<string name="uel_export_csv">EXPORT USER ENTRIES</string>
|
||||
<string name="uel_start_aaps">START AAPS</string>
|
||||
<string name="uel_exit_aaps">EXIT AAPS</string>
|
||||
<string name="uel_plugin_enabled">PLUGIN ENABLED</string>
|
||||
<string name="uel_plugin_disabled">PLUGIN DISABLED</string>
|
||||
<string name="uel_unknown">UNKNOWN</string>
|
||||
<string name="ue_formated_string">Formated string</string>
|
||||
<string name="ue_source">Source</string>
|
||||
|
|
|
@ -96,6 +96,8 @@ data class UserEntry(
|
|||
EXPORT_CSV (ColorGroup.Aaps),
|
||||
START_AAPS (ColorGroup.Aaps),
|
||||
EXIT_AAPS (ColorGroup.Aaps),
|
||||
PLUGIN_ENABLED (ColorGroup.Aaps),
|
||||
PLUGIN_DISABLED (ColorGroup.Aaps),
|
||||
UNKNOWN (ColorGroup.Aaps)
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in a new issue