uel.log for plugin enabled / disabled

This commit is contained in:
Philoul 2021-04-10 19:55:24 +02:00
parent c728f8689b
commit baa37c4e3a
4 changed files with 17 additions and 1 deletions

View file

@ -5,6 +5,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.entities.UserEntry.Action import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources 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.EventAppInitialized
import info.nightscout.androidaps.events.EventConfigBuilderChange import info.nightscout.androidaps.events.EventConfigBuilderChange
import info.nightscout.androidaps.events.EventRebuildTabs import info.nightscout.androidaps.events.EventRebuildTabs
@ -144,7 +145,8 @@ class ConfigBuilderPlugin @Inject constructor(
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.allow_hardware_pump_text), Runnable { OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.allow_hardware_pump_text), Runnable {
performPluginSwitch(changedPlugin, newState, type) performPluginSwitch(changedPlugin, newState, type)
sp.putBoolean("allow_hardware_pump", true) 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!") aapsLogger.debug(LTag.PUMP, "First time HW pump allowed!")
}, Runnable { }, Runnable {
rxBus.send(EventConfigBuilderUpdateGui()) rxBus.send(EventConfigBuilderUpdateGui())
@ -154,6 +156,14 @@ class ConfigBuilderPlugin @Inject constructor(
} }
override fun performPluginSwitch(changedPlugin: PluginBase, enabled: Boolean, type: PluginType) { 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.setPluginEnabled(type, enabled)
changedPlugin.setFragmentVisible(type, enabled) changedPlugin.setFragmentVisible(type, enabled)
processOnEnabledCategoryChanged(changedPlugin, type) processOnEnabledCategoryChanged(changedPlugin, type)

View file

@ -96,6 +96,8 @@ class Translator @Inject internal constructor(
Action.STOP_SMS -> resourceHelper.gs(R.string.uel_stop_sms) Action.STOP_SMS -> resourceHelper.gs(R.string.uel_stop_sms)
Action.START_AAPS -> resourceHelper.gs(R.string.uel_start_aaps) Action.START_AAPS -> resourceHelper.gs(R.string.uel_start_aaps)
Action.EXIT_AAPS -> resourceHelper.gs(R.string.uel_exit_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) Action.UNKNOWN -> resourceHelper.gs(R.string.unknown)
} }

View file

@ -479,6 +479,8 @@
<string name="uel_export_csv">EXPORT USER ENTRIES</string> <string name="uel_export_csv">EXPORT USER ENTRIES</string>
<string name="uel_start_aaps">START AAPS</string> <string name="uel_start_aaps">START AAPS</string>
<string name="uel_exit_aaps">EXIT 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="uel_unknown">UNKNOWN</string>
<string name="ue_formated_string">Formated string</string> <string name="ue_formated_string">Formated string</string>
<string name="ue_source">Source</string> <string name="ue_source">Source</string>

View file

@ -96,6 +96,8 @@ data class UserEntry(
EXPORT_CSV (ColorGroup.Aaps), EXPORT_CSV (ColorGroup.Aaps),
START_AAPS (ColorGroup.Aaps), START_AAPS (ColorGroup.Aaps),
EXIT_AAPS (ColorGroup.Aaps), EXIT_AAPS (ColorGroup.Aaps),
PLUGIN_ENABLED (ColorGroup.Aaps),
PLUGIN_DISABLED (ColorGroup.Aaps),
UNKNOWN (ColorGroup.Aaps) UNKNOWN (ColorGroup.Aaps)
; ;