From c4353e2e3eb698393aeba587e9a19ab4304ed31e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 21 Jan 2023 17:13:25 +0100 Subject: [PATCH] do not call PluginStore::verifySelectionInCategories twice --- .../configBuilder/ConfigBuilderPlugin.kt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/ConfigBuilderPlugin.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/ConfigBuilderPlugin.kt index 6aa8cb324c..5d73e8c498 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/ConfigBuilderPlugin.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/configBuilder/ConfigBuilderPlugin.kt @@ -59,7 +59,6 @@ class ConfigBuilderPlugin @Inject constructor( ), ConfigBuilder { override fun initialize() { - activePlugin.loadDefaults() loadSettings() setAlwaysEnabledPluginsEnabled() rxBus.send(EventAppInitialized()) @@ -103,18 +102,14 @@ class ConfigBuilderPlugin @Inject constructor( private fun loadPref(p: PluginBase, type: PluginType) { val settingEnabled = "ConfigBuilder_" + type.name + "_" + p.javaClass.simpleName + "_Enabled" - if (sp.contains(settingEnabled)) p.setPluginEnabled( - type, - sp.getBoolean(settingEnabled, false) - ) else if (p.getType() == type && (p.pluginDescription.enableByDefault || p.pluginDescription.alwaysEnabled)) { + if (sp.contains(settingEnabled)) p.setPluginEnabled(type, sp.getBoolean(settingEnabled, false)) + else if (p.getType() == type && (p.pluginDescription.enableByDefault || p.pluginDescription.alwaysEnabled)) { p.setPluginEnabled(type, true) } aapsLogger.debug(LTag.CONFIGBUILDER, "Loaded: " + settingEnabled + ":" + p.isEnabled(type)) val settingVisible = "ConfigBuilder_" + type.name + "_" + p.javaClass.simpleName + "_Visible" - if (sp.contains(settingVisible)) p.setFragmentVisible( - type, - sp.getBoolean(settingVisible, false) && sp.getBoolean(settingEnabled, false) - ) else if (p.getType() == type && p.pluginDescription.visibleByDefault) { + if (sp.contains(settingVisible)) p.setFragmentVisible(type, sp.getBoolean(settingVisible, false) && sp.getBoolean(settingEnabled, false)) + else if (p.getType() == type && p.pluginDescription.visibleByDefault) { p.setFragmentVisible(type, true) } aapsLogger.debug(LTag.CONFIGBUILDER, "Loaded: " + settingVisible + ":" + p.isFragmentVisible())