fix toggling SYNC plugins

This commit is contained in:
Milos Kozak 2023-01-20 21:35:48 +01:00
parent d67e13e105
commit 27e91182a1
2 changed files with 12 additions and 12 deletions

View file

@ -195,18 +195,18 @@ class ConfigBuilderPlugin @Inject constructor(
override fun processOnEnabledCategoryChanged(changedPlugin: PluginBase, type: PluginType) {
var pluginsInCategory: ArrayList<PluginBase>? = null
when (type) {
PluginType.INSULIN -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Insulin::class.java)
PluginType.SENSITIVITY -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Sensitivity::class.java)
PluginType.SMOOTHING -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Smoothing::class.java)
PluginType.APS -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(APS::class.java)
PluginType.PROFILE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(ProfileSource::class.java)
PluginType.BGSOURCE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(BgSource::class.java)
PluginType.PUMP -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Pump::class.java)
when {
type == PluginType.INSULIN -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Insulin::class.java)
type == PluginType.SENSITIVITY -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Sensitivity::class.java)
type == PluginType.SMOOTHING -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Smoothing::class.java)
type == PluginType.APS -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(APS::class.java)
type == PluginType.PROFILE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(ProfileSource::class.java)
type == PluginType.BGSOURCE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(BgSource::class.java)
type == PluginType.PUMP -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Pump::class.java)
// Process only NSClients
PluginType.SYNC -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(NsClient::class.java)
changedPlugin is NsClient -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(NsClient::class.java)
else -> {
else -> {
}
}
if (pluginsInCategory != null) {

View file

@ -225,9 +225,9 @@ class SWDefinition @Inject constructor(
.add(
SWEventListener(injector, EventSWSyncStatus::class.java)
.label(R.string.status)
.initialStatus(activePlugin.firstActiveSync?.status ?: "")
.initialStatus(activePlugin.activeNsClient?.status ?: "")
)
.validator { activePlugin.firstActiveSync?.connected == true && activePlugin.firstActiveSync?.hasWritePermission == true }
.validator { activePlugin.activeNsClient?.connected == true && activePlugin.activeNsClient?.hasWritePermission == true }
private val screenPatientName get() = SWScreen(injector, R.string.patient_name)
.skippable(true)