This commit is contained in:
Milos Kozak 2021-11-09 17:57:51 +01:00
parent b9a3a72e86
commit 04de964e97
28 changed files with 63 additions and 63 deletions

View file

@ -124,7 +124,7 @@ class MainActivity : NoSplashAppCompatActivity() {
})
//Check here if loop plugin is disabled. Else check via constraints
if (!loopPlugin.isEnabled(PluginType.LOOP)) versionCheckerUtils.triggerCheckVersion()
if (!loopPlugin.isEnabled()) versionCheckerUtils.triggerCheckVersion()
setUserStats()
setupViews()
disposable += rxBus

View file

@ -190,7 +190,7 @@ class LoopDialog : DaggerDialogFragment() {
binding.overviewReconnect.visibility = View.VISIBLE
}
!loopPlugin.isEnabled(PluginType.LOOP) -> {
!loopPlugin.isEnabled() -> {
binding.overviewLoop.visibility = View.VISIBLE
binding.overviewEnable.visibility = View.VISIBLE
binding.overviewDisable.visibility = View.GONE

View file

@ -250,7 +250,7 @@ class LoopPlugin @Inject constructor(
// Check if pump info is loaded
if (pump.baseBasalRate < 0.01) return
val usedAPS = activePlugin.activeAPS
if ((usedAPS as PluginBase).isEnabled(PluginType.APS)) {
if ((usedAPS as PluginBase).isEnabled()) {
usedAPS.invoke(initiator, tempBasalFallback)
apsResult = usedAPS.lastAPSResult
}
@ -616,7 +616,7 @@ class LoopPlugin @Inject constructor(
}
private fun allowPercentage(): Boolean {
return virtualPumpPlugin.isEnabled(PluginType.PUMP)
return virtualPumpPlugin.isEnabled()
}
override fun goToZeroTemp(durationInMinutes: Int, profile: Profile, reason: OfflineEvent.Reason) {

View file

@ -39,7 +39,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R
}
override fun shouldBeIgnored(): Boolean {
return !virtualPumpPlugin.isEnabled(PluginType.PUMP)
return !virtualPumpPlugin.isEnabled()
}
})
tasks.add(object : Task(this, R.string.objectives_pumpstatusavailableinns) {
@ -54,13 +54,13 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R
})
tasks.add(object : Task(this, R.string.loopenabled) {
override fun isCompleted(): Boolean {
return loopPlugin.isEnabled(PluginType.LOOP)
return loopPlugin.isEnabled()
}
})
tasks.add(object : Task(this, R.string.apsselected) {
override fun isCompleted(): Boolean {
val usedAPS = activePlugin.activeAPS
return (usedAPS as PluginBase).isEnabled(PluginType.APS)
return (usedAPS as PluginBase).isEnabled()
}
})
tasks.add(object : Task(this, R.string.activate_profile) {

View file

@ -33,7 +33,7 @@ class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(i
}.hint(Hint(R.string.usetemptarget_hint)))
tasks.add(object : Task(this, R.string.objectives_useactions) {
override fun isCompleted(): Boolean {
return sp.getBoolean(R.string.key_objectiveuseactions, false) && actionsPlugin.isEnabled(PluginType.GENERAL) && actionsPlugin.isFragmentVisible()
return sp.getBoolean(R.string.key_objectiveuseactions, false) && actionsPlugin.isEnabled() && actionsPlugin.isFragmentVisible()
}
}.hint(Hint(R.string.useaction_hint)))
tasks.add(object : Task(this, R.string.objectives_useloop) {

View file

@ -95,7 +95,7 @@ class SafetyPlugin @Inject constructor(
override fun isUAMEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
val enabled = sp.getBoolean(R.string.key_use_uam, false)
if (!enabled) value[aapsLogger, false, rh.gs(R.string.uamdisabledinpreferences)] = this
val oref1Enabled = sensitivityOref1Plugin.isEnabled(PluginType.SENSITIVITY)
val oref1Enabled = sensitivityOref1Plugin.isEnabled()
if (!oref1Enabled) value[aapsLogger, false, rh.gs(R.string.uamdisabledoref1notselected)] = this
return value
}

View file

@ -119,7 +119,7 @@ class NSClientService : DaggerService() {
.toObservable(EventConfigBuilderChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({
if (nsEnabled != nsClientPlugin.isEnabled(PluginType.GENERAL)) {
if (nsEnabled != nsClientPlugin.isEnabled()) {
latestDateInReceivedData = 0
destroy()
initialize()
@ -356,7 +356,7 @@ class NSClientService : DaggerService() {
}
fun readPreferences() {
nsEnabled = nsClientPlugin.isEnabled(PluginType.GENERAL)
nsEnabled = nsClientPlugin.isEnabled()
nsURL = sp.getString(R.string.key_nsclientinternal_url, "")
nsAPISecret = sp.getString(R.string.key_nsclientinternal_api_secret, "")
nsDevice = sp.getString("careportal_enteredby", "")

View file

@ -300,9 +300,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
}
R.id.cgm_button -> {
if (xdripPlugin.isEnabled(PluginType.BGSOURCE))
if (xdripPlugin.isEnabled())
openCgmApp("com.eveningoutpost.dexdrip")
else if (dexcomPlugin.isEnabled(PluginType.BGSOURCE)) {
else if (dexcomPlugin.isEnabled()) {
dexcomMediator.findDexcomPackageName()?.let {
openCgmApp(it)
}
@ -311,9 +311,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
}
R.id.calibration_button -> {
if (xdripPlugin.isEnabled(PluginType.BGSOURCE)) {
if (xdripPlugin.isEnabled()) {
CalibrationDialog().show(childFragmentManager, "CalibrationDialog")
} else if (dexcomPlugin.isEnabled(PluginType.BGSOURCE)) {
} else if (dexcomPlugin.isEnabled()) {
try {
dexcomMediator.findDexcomPackageName()?.let {
startActivity(Intent("com.dexcom.cgm.activities.MeterEntryActivity").setPackage(it))
@ -327,7 +327,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
R.id.accept_temp_button -> {
profileFunction.getProfile() ?: return
if (loopPlugin.isEnabled(PluginType.LOOP)) {
if (loopPlugin.isEnabled()) {
handler.post {
val lastRun = loopPlugin.lastRun
loopPlugin.invoke("Accept temp button", false)
@ -445,7 +445,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
(lastRun.lastOpenModeAccept == 0L || lastRun.lastOpenModeAccept < lastRun.lastAPSRun) &&// never accepted or before last result
lastRun.constraintsProcessed?.isChangeRequested == true // change is requested
if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && loopPlugin.isEnabled(PluginType.LOOP)) {
if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && loopPlugin.isEnabled()) {
binding.buttonsLayout.acceptTempButton.visibility = View.VISIBLE
binding.buttonsLayout.acceptTempButton.text = "${rh.gs(R.string.setbasalquestion)}\n${lastRun!!.constraintsProcessed}"
} else {
@ -459,8 +459,8 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
binding.buttonsLayout.insulinButton.visibility = (pump.isInitialized() && !pump.isSuspended() && profile != null && sp.getBoolean(R.string.key_show_insulin_button, true)).toVisibility()
// **** Calibration & CGM buttons ****
val xDripIsBgSource = xdripPlugin.isEnabled(PluginType.BGSOURCE)
val dexcomIsSource = dexcomPlugin.isEnabled(PluginType.BGSOURCE)
val xDripIsBgSource = xdripPlugin.isEnabled()
val dexcomIsSource = dexcomPlugin.isEnabled()
binding.buttonsLayout.calibrationButton.visibility = ((xDripIsBgSource || dexcomIsSource) && actualBG != null && sp.getBoolean(R.string.key_show_calibration_button, true)).toVisibility()
binding.buttonsLayout.cgmButton.visibility = (sp.getBoolean(R.string.key_show_cgm_button, false) && (xDripIsBgSource || dexcomIsSource)).toVisibility()

View file

@ -88,7 +88,7 @@ class WearPlugin @Inject constructor(
.toObservable(EventRefreshOverview::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({
if (WatchUpdaterService.shouldReportLoopStatus(loopPlugin.get().isEnabled(PluginType.LOOP)))
if (WatchUpdaterService.shouldReportLoopStatus(loopPlugin.get().isEnabled()))
sendDataToWatch(status = true, basals = false, bgValue = false)
}, fabricPrivacy::logException))
disposable.add(rxBus

View file

@ -133,7 +133,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
}
private boolean wearIntegration() {
return wearPlugin.isEnabled(PluginType.GENERAL);
return wearPlugin.isEnabled();
}
private void googleApiConnect() {
@ -740,7 +740,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
return status;
}
if (!loopPlugin.isEnabled(PluginType.LOOP)) {
if (!loopPlugin.isEnabled()) {
status += rh.gs(R.string.disabledloop) + "\n";
lastLoopStatus = false;
} else {

View file

@ -66,7 +66,7 @@ class StatusLinePlugin @Inject constructor(
super.onStart()
disposable += rxBus.toObservable(EventRefreshOverview::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ if (lastLoopStatus != loopPlugin.isEnabled(PluginType.LOOP)) sendStatus() }, fabricPrivacy::logException)
.subscribe({ if (lastLoopStatus != loopPlugin.isEnabled()) sendStatus() }, fabricPrivacy::logException)
disposable += rxBus.toObservable(EventExtendedBolusChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ sendStatus() }, fabricPrivacy::logException)
@ -113,10 +113,10 @@ class StatusLinePlugin @Inject constructor(
private fun buildStatusString(profile: Profile): String {
var status = ""
if (!loopPlugin.isEnabled(PluginType.LOOP)) {
if (!loopPlugin.isEnabled()) {
status += rh.gs(R.string.disabledloop) + "\n"
lastLoopStatus = false
} else if (loopPlugin.isEnabled(PluginType.LOOP)) {
} else if (loopPlugin.isEnabled()) {
lastLoopStatus = true
}
//Temp basal

View file

@ -204,7 +204,7 @@ class IobCobThread @Inject internal constructor(
if (previous != null && previous.cob > 0) {
// calculate sum of min carb impact from all active treatments
var totalMinCarbsImpact = 0.0
if (sensitivityAAPSPlugin.isEnabled(PluginType.SENSITIVITY) || sensitivityWeightedAveragePlugin.isEnabled(PluginType.SENSITIVITY)) {
if (sensitivityAAPSPlugin.isEnabled() || sensitivityWeightedAveragePlugin.isEnabled()) {
//when the impact depends on a max time, sum them up as smaller carb sizes make them smaller
for (ii in autosensData.activeCarbsList.indices) {
val c = autosensData.activeCarbsList[ii]

View file

@ -94,7 +94,7 @@ class DexcomPlugin @Inject constructor(
override fun doWork(): Result {
var ret = Result.success()
if (!dexcomPlugin.isEnabled(PluginType.BGSOURCE)) return Result.success(workDataOf("Result" to "Plugin not enabled"))
if (!dexcomPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
val bundle = dataWorker.pickupBundle(inputData.getLong(DataWorker.STORE_KEY, -1))
?: return Result.failure(workDataOf("Error" to "missing input data"))
try {

View file

@ -69,7 +69,7 @@ class EversensePlugin @Inject constructor(
override fun doWork(): Result {
var ret = Result.success()
if (!eversensePlugin.isEnabled(PluginType.BGSOURCE)) return Result.success(workDataOf("Result" to "Plugin not enabled"))
if (!eversensePlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
val bundle = dataWorker.pickupBundle(inputData.getLong(DataWorker.STORE_KEY, -1))
?: return Result.failure(workDataOf("Error" to "missing input data"))
if (bundle.containsKey("currentCalibrationPhase")) aapsLogger.debug(LTag.BGSOURCE, "currentCalibrationPhase: " + bundle.getString("currentCalibrationPhase"))

View file

@ -58,7 +58,7 @@ class GlimpPlugin @Inject constructor(
override fun doWork(): Result {
var ret = Result.success()
if (!glimpPlugin.isEnabled(PluginType.BGSOURCE)) return Result.success(workDataOf("Result" to "Plugin not enabled"))
if (!glimpPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
aapsLogger.debug(LTag.BGSOURCE, "Received Glimp Data: $inputData}")
val glucoseValues = mutableListOf<CgmSourceTransaction.TransactionGlucoseValue>()
glucoseValues += CgmSourceTransaction.TransactionGlucoseValue(

View file

@ -61,7 +61,7 @@ class MM640gPlugin @Inject constructor(
override fun doWork(): Result {
var ret = Result.success()
if (!mM640gPlugin.isEnabled(PluginType.BGSOURCE)) return Result.success()
if (!mM640gPlugin.isEnabled()) return Result.success()
val collection = inputData.getString("collection") ?: return Result.failure(workDataOf("Error" to "missing collection"))
if (collection == "entries") {
val data = inputData.getString("data")

View file

@ -60,7 +60,7 @@ class PoctechPlugin @Inject constructor(
override fun doWork(): Result {
var ret = Result.success()
if (!poctechPlugin.isEnabled(PluginType.BGSOURCE)) return Result.success(workDataOf("Result" to "Plugin not enabled"))
if (!poctechPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
aapsLogger.debug(LTag.BGSOURCE, "Received Poctech Data $inputData")
try {
val glucoseValues = mutableListOf<CgmSourceTransaction.TransactionGlucoseValue>()

View file

@ -84,7 +84,7 @@ class RandomBgPlugin @Inject constructor(
}
override fun specialEnableCondition(): Boolean {
// return isRunningTest() || virtualPumpPlugin.isEnabled(PluginType.PUMP) && buildHelper.isEngineeringMode()
// return isRunningTest() || virtualPumpPlugin.isEnabled() && buildHelper.isEngineeringMode()
return true
}

View file

@ -59,7 +59,7 @@ class TomatoPlugin @Inject constructor(
override fun doWork(): Result {
var ret = Result.success()
if (!tomatoPlugin.isEnabled(PluginType.BGSOURCE)) return Result.success(workDataOf("Result" to "Plugin not enabled"))
if (!tomatoPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
val glucoseValues = mutableListOf<CgmSourceTransaction.TransactionGlucoseValue>()
glucoseValues += CgmSourceTransaction.TransactionGlucoseValue(
timestamp = inputData.getLong("com.fanqies.tomatofn.Extras.Time", 0),

View file

@ -73,7 +73,7 @@ class XdripPlugin @Inject constructor(
override fun doWork(): Result {
var ret = Result.success()
if (!xdripPlugin.isEnabled(PluginType.BGSOURCE)) return Result.success(workDataOf("Result" to "Plugin not enabled"))
if (!xdripPlugin.isEnabled()) return Result.success(workDataOf("Result" to "Plugin not enabled"))
val bundle = dataWorker.pickupBundle(inputData.getLong(DataWorker.STORE_KEY, -1))
?: return Result.failure(workDataOf("Error" to "missing input data"))

View file

@ -40,7 +40,7 @@ class CommandSetProfile constructor(
// Send SMS notification if ProfileSwitch is coming from NS
val profileSwitch = repository.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet()
if (profileSwitch is ValueWrapper.Existing && r.enacted && hasNsId && !config.NSCLIENT) {
if (smsCommunicatorPlugin.isEnabled(PluginType.GENERAL))
if (smsCommunicatorPlugin.isEnabled())
smsCommunicatorPlugin.sendNotificationToAllNumbers(rh.gs(R.string.profile_set_ok))
}
}

View file

@ -170,7 +170,7 @@ class SWDefinition @Inject constructor(
configBuilder.performPluginSwitch(nsClientPlugin, true, PluginType.GENERAL)
rxBus.send(EventSWUpdate(true))
}
.visibility { !nsClientPlugin.isEnabled(PluginType.GENERAL) })
.visibility { !nsClientPlugin.isEnabled() })
.add(SWEditUrl(injector)
.preferenceId(R.string.key_nsclientinternal_url)
.updateDelay(5)
@ -343,9 +343,9 @@ class SWDefinition @Inject constructor(
configBuilder.performPluginSwitch(loopPlugin, true, PluginType.LOOP)
rxBus.send(EventSWUpdate(true))
}
.visibility { !loopPlugin.isEnabled(PluginType.LOOP) })
.validator { loopPlugin.isEnabled(PluginType.LOOP) }
.visibility { !loopPlugin.isEnabled(PluginType.LOOP) && config.APS }
.visibility { !loopPlugin.isEnabled() })
.validator { loopPlugin.isEnabled() }
.visibility { !loopPlugin.isEnabled() && config.APS }
private val screenSensitivity = SWScreen(injector, R.string.configbuilder_sensitivity)
.skippable(false)
.add(SWInfoText(injector)

View file

@ -79,7 +79,7 @@ class AndroidPermission @Inject constructor(
@Synchronized
fun notifyForSMSPermissions(activity: FragmentActivity, smsCommunicatorPlugin: SmsCommunicatorPlugin) {
if (smsCommunicatorPlugin.isEnabled(PluginType.GENERAL)) {
if (smsCommunicatorPlugin.isEnabled()) {
if (permissionNotGranted(activity, Manifest.permission.RECEIVE_SMS)) {
val notification = NotificationWithAction(injector, Notification.PERMISSION_SMS, rh.gs(R.string.smscommunicator_missingsmspermission), Notification.URGENT)
notification.action(R.string.request) {

View file

@ -373,7 +373,7 @@ class BolusWizard @Inject constructor(
if (insulinAfterConstraints > 0 || carbs > 0) {
if (useSuperBolus) {
uel.log(Action.SUPERBOLUS_TBR, Sources.WizardDialog)
if (loopPlugin.isEnabled(PluginType.LOOP)) {
if (loopPlugin.isEnabled()) {
loopPlugin.goToZeroTemp(2 * 60, profile, OfflineEvent.Reason.SUPER_BOLUS)
rxBus.send(EventRefreshOverview("WizardDialog"))
}

View file

@ -71,13 +71,13 @@ class LoopPluginTest : TestBase() {
Assert.assertEquals(R.xml.pref_loop.toLong(), loopPlugin.preferencesId.toLong())
// Plugin is disabled by default
Assert.assertEquals(false, loopPlugin.isEnabled(PluginType.LOOP))
Assert.assertEquals(false, loopPlugin.isEnabled())
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
Assert.assertEquals(true, loopPlugin.isEnabled(PluginType.LOOP))
Assert.assertEquals(true, loopPlugin.isEnabled())
// No temp basal capable pump should disable plugin
virtualPumpPlugin.pumpDescription.isTempBasalCapable = false
Assert.assertEquals(false, loopPlugin.isEnabled(PluginType.LOOP))
Assert.assertEquals(false, loopPlugin.isEnabled())
virtualPumpPlugin.pumpDescription.isTempBasalCapable = true
// Fragment is hidden by default

View file

@ -465,7 +465,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
Assert.assertEquals("Wrong format", smsCommunicatorPlugin.messages[1].text)
//NSCLIENT RESTART
`when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true)
`when`(loopPlugin.isEnabled()).thenReturn(true)
`when`(loopPlugin.isSuspended).thenReturn(false)
smsCommunicatorPlugin.messages = ArrayList()
sms = Sms("1234", "NSCLIENT RESTART")
@ -475,7 +475,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
Assert.assertTrue(smsCommunicatorPlugin.messages[1].text.contains("NSCLIENT RESTART"))
//NSCLIENT BLA BLA
`when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true)
`when`(loopPlugin.isEnabled()).thenReturn(true)
`when`(loopPlugin.isSuspended).thenReturn(false)
smsCommunicatorPlugin.messages = ArrayList()
sms = Sms("1234", "NSCLIENT BLA BLA")
@ -485,7 +485,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
Assert.assertEquals("Wrong format", smsCommunicatorPlugin.messages[1].text)
//NSCLIENT BLABLA
`when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true)
`when`(loopPlugin.isEnabled()).thenReturn(true)
`when`(loopPlugin.isSuspended).thenReturn(false)
smsCommunicatorPlugin.messages = ArrayList()
sms = Sms("1234", "NSCLIENT BLABLA")

View file

@ -63,7 +63,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constraint = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constraint.isLoopInvocationAllowed(value)
}
return value
@ -73,7 +73,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constraint = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constraint.isClosedLoopAllowed(value)
}
return value
@ -83,7 +83,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constraint = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constraint.isLgsAllowed(value)
}
return value
@ -93,7 +93,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constraint = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constraint.isAutosensModeEnabled(value)
}
return value
@ -103,7 +103,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constraint = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constraint.isSMBModeEnabled(value)
}
return value
@ -113,7 +113,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constraint = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constraint.isUAMEnabled(value)
}
return value
@ -123,7 +123,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constraint = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constraint.isAdvancedFilteringEnabled(value)
}
return value
@ -133,7 +133,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constraint = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constraint.isSuperBolusEnabled(value)
}
return value
@ -143,7 +143,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constraint = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constraint.applyBasalConstraints(absoluteRate, profile)
}
return absoluteRate
@ -153,7 +153,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constrain = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constrain.applyBasalPercentConstraints(percentRate, profile)
}
return percentRate
@ -163,7 +163,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constrain = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constrain.applyBolusConstraints(insulin)
}
return insulin
@ -173,7 +173,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constrain = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constrain.applyExtendedBolusConstraints(insulin)
}
return insulin
@ -183,7 +183,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constrain = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constrain.applyCarbsConstraints(carbs)
}
return carbs
@ -193,7 +193,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constrain = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constrain.applyMaxIOBConstraints(maxIob)
}
return maxIob
@ -203,7 +203,7 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(Constraints::class.java)
for (p in constraintsPlugins) {
val constraint = p as Constraints
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
if (!p.isEnabled()) continue
constraint.isAutomationEnabled(value)
}
return value

View file

@ -31,7 +31,7 @@ class MsgSettingMeal(
aapsLogger.debug(LTag.PUMPCOMM, "Block time: $blockTime")
aapsLogger.debug(LTag.PUMPCOMM, "Is Config U/d: " + danaPump.isConfigUD)
// DanaRKorean is not possible to set to 0.01 but it works when controlled from AAPS
if (danaRKoreanPlugin.isEnabled(PluginType.PUMP)) {
if (danaRKoreanPlugin.isEnabled()) {
danaPump.basalStep = 0.01
}
if (danaPump.basalStep != 0.01) {