Add appropriate constraint so isLgsAllowed Constraint can be properly checked

This commit is contained in:
Tim Gunn 2021-03-07 02:53:01 +13:00
parent 23c23ea0b8
commit 6ecdd4d7fc
No known key found for this signature in database
GPG key ID: C9BC1E9D0D0AED8C

View file

@ -18,6 +18,9 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
fun isClosedLoopAllowed(): Constraint<Boolean> =
isClosedLoopAllowed(Constraint(true))
fun isLgsAllowed(): Constraint<Boolean> =
isLgsAllowed(Constraint(true))
fun isAutosensModeEnabled(): Constraint<Boolean> =
isAutosensModeEnabled(Constraint(true))
@ -77,6 +80,16 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
return value
}
override fun isLgsAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(ConstraintsInterface::class.java)
for (p in constraintsPlugins) {
val constraint = p as ConstraintsInterface
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
constraint.isLgsAllowed(value)
}
return value
}
override fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(ConstraintsInterface::class.java)
for (p in constraintsPlugins) {