diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt index edcdf54bd5..dd10f4a33d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt @@ -2,7 +2,9 @@ package info.nightscout.androidaps.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R +import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin import info.nightscout.androidaps.utils.T import javax.inject.Inject @@ -10,14 +12,21 @@ import javax.inject.Inject class Objective6(injector: HasAndroidInjector) : Objective(injector, "maxiob", R.string.objectives_maxiob_objective, R.string.objectives_maxiob_gate) { @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var safetyPlugin: SafetyPlugin init { tasks.add(MinimumDurationTask(this, T.days(1).msecs())) - tasks.add(object : Task(this, R.string.maxiobset) { - override fun isCompleted(): Boolean { - val maxIOB = constraintChecker.getMaxIOBAllowed().value() - return maxIOB > 0 - } - }) + tasks.add( + object : Task(this, R.string.closedmodeenabled) { + override fun isCompleted(): Boolean = sp.getString(R.string.key_aps_mode, "open") == "closed" + }) + tasks.add( + object : Task(this, R.string.maxiobset) { + + override fun isCompleted(): Boolean { + val maxIOB = constraintChecker.getMaxIOBAllowed().value() + return maxIOB > 0 + } + }) } } \ No newline at end of file