diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt index 37647464e4..87cd0b8428 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt @@ -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 @@ -144,7 +145,8 @@ 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(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!") }, Runnable { rxBus.send(EventConfigBuilderUpdateGui()) @@ -154,6 +156,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) diff --git a/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt b/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt index b740f01308..b95247ddf6 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt @@ -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) } diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index d18775e7b3..fbae23f8df 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -479,6 +479,8 @@ EXPORT USER ENTRIES START AAPS EXIT AAPS + PLUGIN ENABLED + PLUGIN DISABLED UNKNOWN Formated string Source diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt index 1363fb00dd..d4347542c2 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt @@ -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) ;