From ba5eb8f9abd0a77ef7e2dfd6ea83fc17ee3b2fa6 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 8 Jun 2022 09:44:12 +0200 Subject: [PATCH] limit Aidex to pumpcontrol --- .../androidaps/plugins/source/AidexPlugin.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt index 459575c234..787205abb2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt @@ -10,13 +10,10 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSource -import info.nightscout.androidaps.interfaces.PluginBase -import info.nightscout.androidaps.interfaces.PluginDescription -import info.nightscout.androidaps.interfaces.PluginType +import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.receivers.DataWorker import info.nightscout.androidaps.receivers.Intents -import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import javax.inject.Inject @@ -26,7 +23,9 @@ import javax.inject.Singleton class AidexPlugin @Inject constructor( injector: HasAndroidInjector, rh: ResourceHelper, - aapsLogger: AAPSLogger + aapsLogger: AAPSLogger, + private val buildHelper: BuildHelper, + private val config: Config ) : PluginBase( PluginDescription() .mainType(PluginType.BGSOURCE) @@ -49,6 +48,11 @@ class AidexPlugin @Inject constructor( return advancedFiltering } + // Allow only for pumpcontrol or dev & engineering_mode + override fun specialEnableCondition(): Boolean { + return config.APS.not() || buildHelper.isDev() && buildHelper.isEngineeringMode() + } + // cannot be inner class because of needed injection class AidexWorker( context: Context,