Dana: fix disabling loop

This commit is contained in:
Milos Kozak 2021-11-16 23:50:28 +01:00
parent 5569974714
commit d9f68bca3f
2 changed files with 3 additions and 14 deletions

View file

@ -56,7 +56,6 @@ class ConfigBuilderPlugin @Inject constructor(
for (plugin in activePlugin.getPluginsList()) { for (plugin in activePlugin.getPluginsList()) {
if (plugin.pluginDescription.alwaysEnabled) plugin.setPluginEnabled(plugin.getType(), true) if (plugin.pluginDescription.alwaysEnabled) plugin.setPluginEnabled(plugin.getType(), true)
} }
storeSettings("setAlwaysEnabledPluginsEnabled")
} }
override fun storeSettings(from: String) { override fun storeSettings(from: String) {
@ -68,18 +67,13 @@ class ConfigBuilderPlugin @Inject constructor(
if (p.pluginDescription.alwaysEnabled && p.pluginDescription.alwaysVisible) continue if (p.pluginDescription.alwaysEnabled && p.pluginDescription.alwaysVisible) continue
if (p.pluginDescription.alwaysEnabled && p.pluginDescription.neverVisible) continue if (p.pluginDescription.alwaysEnabled && p.pluginDescription.neverVisible) continue
savePref(p, type, true) savePref(p, type, true)
if (type == PluginType.PUMP) {
if (p is ProfileSource) { // Store state of optional Profile interface
savePref(p, PluginType.PROFILE, false)
}
}
} }
} }
private fun savePref(p: PluginBase, type: PluginType, storeVisible: Boolean) { private fun savePref(p: PluginBase, type: PluginType, storeVisible: Boolean) {
val settingEnabled = "ConfigBuilder_" + type.name + "_" + p.javaClass.simpleName + "_Enabled" val settingEnabled = "ConfigBuilder_" + type.name + "_" + p.javaClass.simpleName + "_Enabled"
sp.putBoolean(settingEnabled, p.isEnabled(type)) sp.putBoolean(settingEnabled, p.isEnabled())
aapsLogger.debug(LTag.CONFIGBUILDER, "Storing: " + settingEnabled + ":" + p.isEnabled(type)) aapsLogger.debug(LTag.CONFIGBUILDER, "Storing: " + settingEnabled + ":" + p.isEnabled())
if (storeVisible) { if (storeVisible) {
val settingVisible = "ConfigBuilder_" + type.name + "_" + p.javaClass.simpleName + "_Visible" val settingVisible = "ConfigBuilder_" + type.name + "_" + p.javaClass.simpleName + "_Visible"
sp.putBoolean(settingVisible, p.isFragmentVisible()) sp.putBoolean(settingVisible, p.isFragmentVisible())
@ -92,11 +86,6 @@ class ConfigBuilderPlugin @Inject constructor(
for (p in activePlugin.getPluginsList()) { for (p in activePlugin.getPluginsList()) {
val type = p.getType() val type = p.getType()
loadPref(p, type, true) loadPref(p, type, true)
if (p.getType() == PluginType.PUMP) {
if (p is ProfileSource) {
loadPref(p, PluginType.PROFILE, false)
}
}
} }
activePlugin.verifySelectionInCategories() activePlugin.verifySelectionInCategories()
} }

View file

@ -444,7 +444,7 @@ class DanaPump @Inject constructor(
0x06 -> PumpType.DANA_RS_KOREAN 0x06 -> PumpType.DANA_RS_KOREAN
0x07 -> PumpType.DANA_I 0x07 -> PumpType.DANA_I
0x09 -> PumpType.DANA_I 0x09 -> PumpType.DANA_I
else -> PumpType.USER else -> PumpType.DANA_RS // having here default type non TBR capable is causing problem with disabling loop
} }
// v2, RS history entries // v2, RS history entries