Merge branch 'dev' into smoothing

This commit is contained in:
Milos Kozak 2022-12-08 18:42:11 +01:00 committed by GitHub
commit 6b8bba1699
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
165 changed files with 196 additions and 186 deletions

View file

@ -197,11 +197,11 @@ dependencies {
implementation project(':plugins:aps') implementation project(':plugins:aps')
implementation project(':plugins:automation') implementation project(':plugins:automation')
implementation project(':plugins:configuration') implementation project(':plugins:configuration')
implementation project(':plugins:constraints')
implementation project(':plugins:main') implementation project(':plugins:main')
implementation project(':plugins:openhumans') implementation project(':plugins:openhumans')
implementation project(':plugins:sensitivity') implementation project(':plugins:sensitivity')
implementation project(':plugins:smoothing') implementation project(':plugins:smoothing')
implementation project(':plugins:support')
implementation project(':plugins:sync') implementation project(':plugins:sync')
implementation project(':implementation') implementation project(':implementation')
implementation project(':database:entities') implementation project(':database:entities')

View file

@ -21,8 +21,8 @@ import info.nightscout.core.validators.di.ValidatorsModule
import info.nightscout.database.impl.DatabaseModule import info.nightscout.database.impl.DatabaseModule
import info.nightscout.implementation.di.ImplementationModule import info.nightscout.implementation.di.ImplementationModule
import info.nightscout.plugins.aps.di.ApsModule import info.nightscout.plugins.aps.di.ApsModule
import info.nightscout.plugins.constraints.di.PluginsConstraintsModule
import info.nightscout.plugins.di.PluginsModule import info.nightscout.plugins.di.PluginsModule
import info.nightscout.plugins.support.di.PluginsSupportModule
import info.nightscout.plugins.sync.di.SyncModule import info.nightscout.plugins.sync.di.SyncModule
import info.nightscout.pump.combo.di.ComboModule import info.nightscout.pump.combo.di.ComboModule
import info.nightscout.pump.combov2.di.ComboV2Module import info.nightscout.pump.combov2.di.ComboV2Module
@ -62,7 +62,7 @@ import javax.inject.Singleton
SharedImplModule::class, SharedImplModule::class,
UiModule::class, UiModule::class,
ValidatorsModule::class, ValidatorsModule::class,
PluginsSupportModule::class, PluginsConstraintsModule::class,
SyncModule::class, SyncModule::class,
WorkflowModule::class, WorkflowModule::class,

View file

@ -11,7 +11,6 @@ import info.nightscout.androidaps.insight.database.InsightDatabaseDao
import info.nightscout.androidaps.insight.database.InsightDbHelper import info.nightscout.androidaps.insight.database.InsightDbHelper
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.AppRepository
import info.nightscout.implementation.constraints.ConstraintsImpl
import info.nightscout.implementation.iob.GlucoseStatusProviderImpl import info.nightscout.implementation.iob.GlucoseStatusProviderImpl
import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck
import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraint
@ -34,6 +33,7 @@ import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin import info.nightscout.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
import info.nightscout.plugins.constraints.ConstraintsImpl
import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
import info.nightscout.plugins.constraints.objectives.objectives.Objective import info.nightscout.plugins.constraints.objectives.objectives.Objective
import info.nightscout.plugins.constraints.safety.SafetyPlugin import info.nightscout.plugins.constraints.safety.SafetyPlugin
@ -103,33 +103,33 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
@BeforeEach @BeforeEach
fun prepare() { fun prepare() {
`when`(rh.gs(info.nightscout.plugins.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.")
`when`(rh.gs(info.nightscout.plugins.R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences")
`when`(rh.gs(info.nightscout.core.ui.R.string.no_valid_basal_rate)).thenReturn("No valid basal rate read from pump") `when`(rh.gs(info.nightscout.core.ui.R.string.no_valid_basal_rate)).thenReturn("No valid basal rate read from pump")
`when`(rh.gs(info.nightscout.plugins.aps.R.string.autosens_disabled_in_preferences)).thenReturn("Autosens disabled in preferences") `when`(rh.gs(info.nightscout.plugins.aps.R.string.autosens_disabled_in_preferences)).thenReturn("Autosens disabled in preferences")
`when`(rh.gs(info.nightscout.plugins.aps.R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences") `when`(rh.gs(info.nightscout.plugins.aps.R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences")
`when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit") `when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit")
`when`(rh.gs(info.nightscout.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value") `when`(rh.gs(info.nightscout.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
`when`(rh.gs(info.nightscout.plugins.R.string.maxvalueinpreferences)).thenReturn("max value in preferences") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.maxvalueinpreferences)).thenReturn("max value in preferences")
`when`(rh.gs(info.nightscout.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier") `when`(rh.gs(info.nightscout.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier")
`when`(rh.gs(info.nightscout.plugins.aps.R.string.max_daily_basal_multiplier)).thenReturn("max daily basal multiplier") `when`(rh.gs(info.nightscout.plugins.aps.R.string.max_daily_basal_multiplier)).thenReturn("max daily basal multiplier")
`when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit") `when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit")
`when`(rh.gs(info.nightscout.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %.1f U because of %s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %.1f U because of %s")
`when`(rh.gs(info.nightscout.plugins.R.string.hardlimit)).thenReturn("hard limit") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.hardlimit)).thenReturn("hard limit")
`when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child") `when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child")
`when`(rh.gs(info.nightscout.plugins.R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s")
`when`(rh.gs(info.nightscout.plugins.aps.R.string.limiting_iob)).thenReturn("Limiting IOB to %.1f U because of %s") `when`(rh.gs(info.nightscout.plugins.aps.R.string.limiting_iob)).thenReturn("Limiting IOB to %.1f U because of %s")
`when`(rh.gs(info.nightscout.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(rh.gs(info.nightscout.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
`when`(rh.gs(info.nightscout.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value") `when`(rh.gs(info.nightscout.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
`when`(rh.gs(info.nightscout.plugins.R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode")
`when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit") `when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit")
`when`(rh.gs(info.nightscout.plugins.R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering")
`when`(rh.gs(info.nightscout.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
`when`(rh.gs(info.nightscout.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s")
`when`(rh.gs(info.nightscout.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(context.getString(info.nightscout.pump.combo.R.string.combo_pump_unsupported_operation)).thenReturn("Requested operation not supported by pump") `when`(context.getString(info.nightscout.pump.combo.R.string.combo_pump_unsupported_operation)).thenReturn("Requested operation not supported by pump")
`when`(rh.gs(info.nightscout.plugins.R.string.objectivenotstarted)).thenReturn("Objective %1\$d not started") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.objectivenotstarted)).thenReturn("Objective %1\$d not started")
// RS constructor // RS constructor
`when`(sp.getString(R.string.key_danars_name, "")).thenReturn("") `when`(sp.getString(R.string.key_danars_name, "")).thenReturn("")
@ -242,7 +242,8 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
hardLimits, hardLimits,
ConfigImpl(fileListProvider), ConfigImpl(fileListProvider),
iobCobCalculator, iobCobCalculator,
dateUtil dateUtil,
uiInteraction
) )
val constraintsPluginsList = ArrayList<PluginBase>() val constraintsPluginsList = ArrayList<PluginBase>()
constraintsPluginsList.add(safetyPlugin) constraintsPluginsList.add(safetyPlugin)

View file

@ -14,8 +14,8 @@ import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.profiling.Profiler import info.nightscout.interfaces.profiling.Profiler
import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpDescription
import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.plugins.R
import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.plugins.constraints.safety.SafetyPlugin import info.nightscout.plugins.constraints.safety.SafetyPlugin
@ -39,6 +39,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
@Mock lateinit var repository: AppRepository @Mock lateinit var repository: AppRepository
@Mock lateinit var glucoseStatusProvider: GlucoseStatusProvider @Mock lateinit var glucoseStatusProvider: GlucoseStatusProvider
@Mock lateinit var bgQualityCheck: BgQualityCheck @Mock lateinit var bgQualityCheck: BgQualityCheck
@Mock lateinit var uiInteraction: UiInteraction
private lateinit var hardLimits: HardLimits private lateinit var hardLimits: HardLimits
private lateinit var safetyPlugin: SafetyPlugin private lateinit var safetyPlugin: SafetyPlugin
@ -50,24 +51,24 @@ class SafetyPluginTest : TestBaseWithProfile() {
@BeforeEach @BeforeEach
fun prepare() { fun prepare() {
`when`(rh.gs(R.string.hardlimit)).thenReturn("hard limit") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.hardlimit)).thenReturn("hard limit")
`when`(rh.gs(info.nightscout.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value") `when`(rh.gs(info.nightscout.core.ui.R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
`when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit") `when`(rh.gs(info.nightscout.core.ui.R.string.pumplimit)).thenReturn("pump limit")
`when`(rh.gs(R.string.maxvalueinpreferences)).thenReturn("max value in preferences") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.maxvalueinpreferences)).thenReturn("max value in preferences")
`when`(rh.gs(info.nightscout.plugins.aps.R.string.max_daily_basal_multiplier)).thenReturn("max daily basal multiplier") `when`(rh.gs(info.nightscout.plugins.aps.R.string.max_daily_basal_multiplier)).thenReturn("max daily basal multiplier")
`when`(rh.gs(info.nightscout.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier") `when`(rh.gs(info.nightscout.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier")
`when`(rh.gs(info.nightscout.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s")
`when`(rh.gs(info.nightscout.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(rh.gs(info.nightscout.core.ui.R.string.limiting_iob)).thenReturn("Limiting IOB to %1\$.1f U because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limiting_iob)).thenReturn("Limiting IOB to %1\$.1f U because of %2\$s")
`when`(rh.gs(R.string.limitingcarbs)).thenReturn("Limiting carbs to %1\$d g because of %2\$s") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.limitingcarbs)).thenReturn("Limiting carbs to %1\$d g because of %2\$s")
`when`(rh.gs(info.nightscout.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") `when`(rh.gs(info.nightscout.core.ui.R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
`when`(rh.gs(R.string.pumpisnottempbasalcapable)).thenReturn("Pump is not temp basal capable") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.pumpisnottempbasalcapable)).thenReturn("Pump is not temp basal capable")
`when`(rh.gs(info.nightscout.plugins.aps.R.string.increasing_max_basal)).thenReturn("Increasing max basal value because setting is lower than your max basal in profile") `when`(rh.gs(info.nightscout.plugins.aps.R.string.increasing_max_basal)).thenReturn("Increasing max basal value because setting is lower than your max basal in profile")
`when`(rh.gs(info.nightscout.plugins.aps.R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences") `when`(rh.gs(info.nightscout.plugins.aps.R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences")
`when`(rh.gs(R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences")
`when`(rh.gs(R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.")
`when`(rh.gs(R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering")
`when`(rh.gs(R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode") `when`(rh.gs(info.nightscout.plugins.constraints.R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode")
`when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child") `when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child")
`when`(rh.gs(info.nightscout.core.ui.R.string.lowglucosesuspend)).thenReturn("Low Glucose Suspend") `when`(rh.gs(info.nightscout.core.ui.R.string.lowglucosesuspend)).thenReturn("Low Glucose Suspend")
@ -75,7 +76,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
`when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription) `when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription)
`when`(config.APS).thenReturn(true) `when`(config.APS).thenReturn(true)
hardLimits = HardLimitsMock(sp, rh) hardLimits = HardLimitsMock(sp, rh)
safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, activePlugin, hardLimits, config, iobCobCalculator, dateUtil) safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, activePlugin, hardLimits, config, iobCobCalculator, dateUtil, uiInteraction)
openAPSAMAPlugin = OpenAPSAMAPlugin( openAPSAMAPlugin = OpenAPSAMAPlugin(
injector, aapsLogger, rxBus, constraintChecker, rh, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, fabricPrivacy, injector, aapsLogger, rxBus, constraintChecker, rh, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, fabricPrivacy,
dateUtil, repository, glucoseStatusProvider, sp dateUtil, repository, glucoseStatusProvider, sp

View file

@ -0,0 +1,3 @@
package info.nightscout.interfaces.actions
interface Actions

View file

@ -5,6 +5,7 @@ import info.nightscout.database.ValueWrapper
import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.Bolus
import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.database.entities.BolusCalculatorResult
import info.nightscout.database.entities.Carbs import info.nightscout.database.entities.Carbs
import info.nightscout.database.entities.EffectiveProfileSwitch
import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.TemporaryTarget
import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.UserEntry
import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.Callback
@ -20,4 +21,5 @@ interface PersistenceLayer {
fun getTemporaryTargetActiveAt(timestamp: Long): Single<ValueWrapper<TemporaryTarget>> fun getTemporaryTargetActiveAt(timestamp: Long): Single<ValueWrapper<TemporaryTarget>>
fun getUserEntryFilteredDataFromTime(timestamp: Long): Single<List<UserEntry>> fun getUserEntryFilteredDataFromTime(timestamp: Long): Single<List<UserEntry>>
fun getEffectiveProfileSwitchActiveAt(timestamp: Long): Single<ValueWrapper<EffectiveProfileSwitch>>
} }

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:tint="?attr/defaultTextColor"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/defaultTextColor"
android:pathData="M22,12l-4,-4v3H3v2h15v3z" />
</vector>

View file

@ -165,6 +165,9 @@
<string name="isf_short">ISF</string> <string name="isf_short">ISF</string>
<string name="canceling_tbr_failed">Canceling of temporary basal failed</string> <string name="canceling_tbr_failed">Canceling of temporary basal failed</string>
<string name="canceling_eb_failed">Canceling of extended bolus failed</string> <string name="canceling_eb_failed">Canceling of extended bolus failed</string>
<string name="virtualpump_uploadstatus_title">Upload status to NS</string>
<string name="suspendloop_label">Disabled/Suspended loop</string>
<string name="iob_label">Insulin on Board (IOB)</string>
<!-- Protection--> <!-- Protection-->
<string name="wrongpassword">Wrong password</string> <string name="wrongpassword">Wrong password</string>

View file

@ -145,5 +145,8 @@
<string name="key_protection_timeout" translatable="false">protection_timeout</string> <string name="key_protection_timeout" translatable="false">protection_timeout</string>
<string name="key_objectiveuseloop" translatable="false">ObjectivesLoopUsed</string> <string name="key_objectiveuseloop" translatable="false">ObjectivesLoopUsed</string>
<string name="key_ObjectivesmanualEnacts" translatable="false">ObjectivesmanualEnacts</string> <string name="key_ObjectivesmanualEnacts" translatable="false">ObjectivesmanualEnacts</string>
<string name="key_objectiveuseactions" translatable="false">ObjectivesActionsUsed</string>
<string name="key_objectiveusescale" translatable="false">ObjectivesScaleUsed</string>
<string name="key_virtual_pump_upload_status" translatable="false">virtualpump_uploadstatus</string>
</resources> </resources>

View file

@ -27,8 +27,8 @@ files:
translation: /plugins/sync/src/main/res/values-%android_code%/strings.xml translation: /plugins/sync/src/main/res/values-%android_code%/strings.xml
translate_attributes: 0 translate_attributes: 0
content_segmentation: 0 content_segmentation: 0
- source: /plugins/support/src/main/res/values/strings.xml - source: /plugins/constraints/src/main/res/values/strings.xml
translation: /plugins/support/src/main/res/values-%android_code%/strings.xml translation: /plugins/constraints/src/main/res/values-%android_code%/strings.xml
- source: /core/graph/src/main/res/values/strings.xml - source: /core/graph/src/main/res/values/strings.xml
translation: /core/graph/src/main/res/values-%android_code%/strings.xml translation: /core/graph/src/main/res/values-%android_code%/strings.xml
- source: /core/interfaces/src/main/res/values/strings.xml - source: /core/interfaces/src/main/res/values/strings.xml

View file

@ -6,6 +6,7 @@ import info.nightscout.database.ValueWrapper
import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.Bolus
import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.database.entities.BolusCalculatorResult
import info.nightscout.database.entities.Carbs import info.nightscout.database.entities.Carbs
import info.nightscout.database.entities.EffectiveProfileSwitch
import info.nightscout.database.entities.TemporaryTarget import info.nightscout.database.entities.TemporaryTarget
import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.UserEntry
import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.AppRepository
@ -68,4 +69,5 @@ class PersistenceLayerImpl @Inject constructor(
override fun getTemporaryTargetActiveAt(timestamp: Long): Single<ValueWrapper<TemporaryTarget>> = repository.getTemporaryTargetActiveAt(timestamp) override fun getTemporaryTargetActiveAt(timestamp: Long): Single<ValueWrapper<TemporaryTarget>> = repository.getTemporaryTargetActiveAt(timestamp)
override fun getUserEntryFilteredDataFromTime(timestamp: Long): Single<List<UserEntry>> = repository.getUserEntryFilteredDataFromTime(timestamp) override fun getUserEntryFilteredDataFromTime(timestamp: Long): Single<List<UserEntry>> = repository.getUserEntryFilteredDataFromTime(timestamp)
override fun getEffectiveProfileSwitchActiveAt(timestamp: Long): Single<ValueWrapper<EffectiveProfileSwitch>> = repository.getEffectiveProfileSwitchActiveAt(timestamp)
} }

View file

@ -14,7 +14,6 @@ import info.nightscout.implementation.TrendCalculatorImpl
import info.nightscout.implementation.UserEntryLoggerImpl import info.nightscout.implementation.UserEntryLoggerImpl
import info.nightscout.implementation.XDripBroadcastImpl import info.nightscout.implementation.XDripBroadcastImpl
import info.nightscout.implementation.androidNotification.NotificationHolderImpl import info.nightscout.implementation.androidNotification.NotificationHolderImpl
import info.nightscout.implementation.constraints.ConstraintsImpl
import info.nightscout.implementation.db.PersistenceLayerImpl import info.nightscout.implementation.db.PersistenceLayerImpl
import info.nightscout.implementation.iob.GlucoseStatusProviderImpl import info.nightscout.implementation.iob.GlucoseStatusProviderImpl
import info.nightscout.implementation.logging.LoggerUtilsImpl import info.nightscout.implementation.logging.LoggerUtilsImpl
@ -47,7 +46,6 @@ import info.nightscout.interfaces.LocalAlertUtils
import info.nightscout.interfaces.NotificationHolder import info.nightscout.interfaces.NotificationHolder
import info.nightscout.interfaces.Translator import info.nightscout.interfaces.Translator
import info.nightscout.interfaces.XDripBroadcast import info.nightscout.interfaces.XDripBroadcast
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.db.PersistenceLayer import info.nightscout.interfaces.db.PersistenceLayer
import info.nightscout.interfaces.iob.GlucoseStatusProvider import info.nightscout.interfaces.iob.GlucoseStatusProvider
import info.nightscout.interfaces.logging.LoggerUtils import info.nightscout.interfaces.logging.LoggerUtils
@ -121,7 +119,6 @@ abstract class ImplementationModule {
@Binds fun bindIconsProviderInterface(iconsProvider: IconsProviderImplementation): IconsProvider @Binds fun bindIconsProviderInterface(iconsProvider: IconsProviderImplementation): IconsProvider
@Binds fun bindNotificationHolderInterface(notificationHolder: NotificationHolderImpl): NotificationHolder @Binds fun bindNotificationHolderInterface(notificationHolder: NotificationHolderImpl): NotificationHolder
@Binds fun bindCommandQueue(commandQueue: CommandQueueImplementation): CommandQueue @Binds fun bindCommandQueue(commandQueue: CommandQueueImplementation): CommandQueue
@Binds fun bindsConstraints(constraintsImpl: ConstraintsImpl): Constraints
@Binds fun bindsProfileFunction(profileFunctionImpl: ProfileFunctionImpl): ProfileFunction @Binds fun bindsProfileFunction(profileFunctionImpl: ProfileFunctionImpl): ProfileFunction
@Binds fun bindsStorage(fileStorage: FileStorage): Storage @Binds fun bindsStorage(fileStorage: FileStorage): Storage
@Binds fun bindsReceiverStatusStore(receiverStatusStoreImpl: ReceiverStatusStoreImpl): ReceiverStatusStore @Binds fun bindsReceiverStatusStore(receiverStatusStoreImpl: ReceiverStatusStoreImpl): ReceiverStatusStore

View file

@ -81,7 +81,7 @@ class UserEntryPresentationHelperImpl @Inject constructor(
Sources.Maintenance -> info.nightscout.core.ui.R.drawable.ic_maintenance Sources.Maintenance -> info.nightscout.core.ui.R.drawable.ic_maintenance
Sources.NSClient -> info.nightscout.core.ui.R.drawable.ic_nightscout_syncs Sources.NSClient -> info.nightscout.core.ui.R.drawable.ic_nightscout_syncs
Sources.NSProfile -> R.drawable.ic_nightscout_profile Sources.NSProfile -> R.drawable.ic_nightscout_profile
Sources.Objectives -> R.drawable.ic_graduation Sources.Objectives -> info.nightscout.core.ui.R.drawable.ic_graduation
Sources.Pump -> info.nightscout.core.ui.R.drawable.ic_generic_icon Sources.Pump -> info.nightscout.core.ui.R.drawable.ic_generic_icon
Sources.Dana -> info.nightscout.core.ui.R.drawable.ic_danars_128 Sources.Dana -> info.nightscout.core.ui.R.drawable.ic_danars_128
Sources.DanaR -> info.nightscout.core.ui.R.drawable.ic_danars_128 Sources.DanaR -> info.nightscout.core.ui.R.drawable.ic_danars_128

View file

@ -12,7 +12,7 @@ apply from: "${project.rootDir}/core/main/test_dependencies.gradle"
apply from: "${project.rootDir}/core/main/allopen_dependencies.gradle" apply from: "${project.rootDir}/core/main/allopen_dependencies.gradle"
apply from: "${project.rootDir}/core/main/jacoco_global.gradle" apply from: "${project.rootDir}/core/main/jacoco_global.gradle"
android { android {
namespace 'info.nightscout.plugins.support' namespace 'info.nightscout.plugins.constraints'
} }
dependencies { dependencies {
@ -20,6 +20,7 @@ dependencies {
implementation project(':core:interfaces') implementation project(':core:interfaces')
implementation project(':core:ui') implementation project(':core:ui')
implementation project(':core:utils') implementation project(':core:utils')
implementation project(':core:validators')
implementation project(':database:entities') implementation project(':database:entities')
// Phone checker // Phone checker

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>
</manifest>

View file

@ -1,4 +1,4 @@
package info.nightscout.implementation.constraints package info.nightscout.plugins.constraints
import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.constraints.Constraints

View file

@ -12,7 +12,7 @@ import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.source.DexcomBoyda import info.nightscout.interfaces.source.DexcomBoyda
import info.nightscout.plugins.support.R import info.nightscout.plugins.constraints.R
import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventBucketedDataCreated import info.nightscout.rx.events.EventBucketedDataCreated

View file

@ -0,0 +1,25 @@
package info.nightscout.plugins.constraints.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
@Module
@Suppress("unused")
abstract class ObjectivesModule {
@ContributesAndroidInjector abstract fun contributesObjectivesFragment(): info.nightscout.plugins.constraints.objectives.ObjectivesFragment
@ContributesAndroidInjector abstract fun contributesObjectivesExamDialog(): info.nightscout.plugins.constraints.objectives.activities.ObjectivesExamDialog
@ContributesAndroidInjector abstract fun contributesNtpProgressDialog(): info.nightscout.plugins.constraints.objectives.dialogs.NtpProgressDialog
@ContributesAndroidInjector abstract fun objectiveInjector(): info.nightscout.plugins.constraints.objectives.objectives.Objective
@ContributesAndroidInjector abstract fun objective0Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective0
@ContributesAndroidInjector abstract fun objective1Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective1
@ContributesAndroidInjector abstract fun objective2Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective2
@ContributesAndroidInjector abstract fun objective3Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective3
@ContributesAndroidInjector abstract fun objective4Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective4
@ContributesAndroidInjector abstract fun objective5Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective5
@ContributesAndroidInjector abstract fun objective6Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective6
@ContributesAndroidInjector abstract fun objective7Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective7
@ContributesAndroidInjector abstract fun objective9Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective9
@ContributesAndroidInjector abstract fun objective10Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective10
}

View file

@ -1,25 +1,28 @@
package info.nightscout.plugins.support.di package info.nightscout.plugins.constraints.di
import dagger.Binds import dagger.Binds
import dagger.Module import dagger.Module
import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
import info.nightscout.plugins.constraints.versionChecker.VersionCheckerUtilsImpl import info.nightscout.plugins.constraints.versionChecker.VersionCheckerUtilsImpl
@Module( @Module(
includes = [ includes = [
PluginsSupportModule.Bindings::class PluginsConstraintsModule.Bindings::class,
ObjectivesModule::class
] ]
) )
@Suppress("unused") @Suppress("unused")
abstract class PluginsSupportModule { abstract class PluginsConstraintsModule {
@Module @Module
interface Bindings { interface Bindings {
@Binds fun bindProcessedDeviceStatusData(versionCheckerUtils: VersionCheckerUtilsImpl): VersionCheckerUtils @Binds fun bindProcessedDeviceStatusData(versionCheckerUtils: VersionCheckerUtilsImpl): VersionCheckerUtils
@Binds fun bindBgQualityCheck(bgQualityCheck: BgQualityCheckPlugin): BgQualityCheck @Binds fun bindBgQualityCheck(bgQualityCheck: BgQualityCheckPlugin): BgQualityCheck
@Binds fun bindsConstraints(constraintsImpl: info.nightscout.plugins.constraints.ConstraintsImpl): Constraints
} }
} }

View file

@ -9,7 +9,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.plugins.support.R import info.nightscout.plugins.constraints.R
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -24,13 +24,13 @@ import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.interfaces.receivers.ReceiverStatusStore
import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.plugins.constraints.databinding.ObjectivesFragmentBinding
import info.nightscout.plugins.constraints.databinding.ObjectivesItemBinding
import info.nightscout.plugins.constraints.objectives.activities.ObjectivesExamDialog import info.nightscout.plugins.constraints.objectives.activities.ObjectivesExamDialog
import info.nightscout.plugins.constraints.objectives.dialogs.NtpProgressDialog import info.nightscout.plugins.constraints.objectives.dialogs.NtpProgressDialog
import info.nightscout.plugins.constraints.objectives.events.EventObjectivesUpdateGui import info.nightscout.plugins.constraints.objectives.events.EventObjectivesUpdateGui
import info.nightscout.plugins.constraints.objectives.objectives.Objective.ExamTask import info.nightscout.plugins.constraints.objectives.objectives.Objective.ExamTask
import info.nightscout.plugins.databinding.ObjectivesFragmentBinding
import info.nightscout.plugins.databinding.ObjectivesItemBinding
import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventNtpStatus import info.nightscout.rx.events.EventNtpStatus

View file

@ -15,7 +15,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.plugins.constraints.objectives.objectives.Objective import info.nightscout.plugins.constraints.objectives.objectives.Objective
import info.nightscout.plugins.constraints.objectives.objectives.Objective0 import info.nightscout.plugins.constraints.objectives.objectives.Objective0
import info.nightscout.plugins.constraints.objectives.objectives.Objective1 import info.nightscout.plugins.constraints.objectives.objectives.Objective1
@ -47,7 +47,7 @@ class ObjectivesPlugin @Inject constructor(
.fragmentClass(ObjectivesFragment::class.qualifiedName) .fragmentClass(ObjectivesFragment::class.qualifiedName)
.alwaysEnabled(config.APS) .alwaysEnabled(config.APS)
.showInList(config.APS) .showInList(config.APS)
.pluginIcon(info.nightscout.core.main.R.drawable.ic_graduation) .pluginIcon(info.nightscout.core.ui.R.drawable.ic_graduation)
.pluginName(info.nightscout.core.ui.R.string.objectives) .pluginName(info.nightscout.core.ui.R.string.objectives)
.shortName(R.string.objectives_shortname) .shortName(R.string.objectives_shortname)
.description(R.string.description_objectives), .description(R.string.description_objectives),
@ -91,9 +91,9 @@ class ObjectivesPlugin @Inject constructor(
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusedisconnect, false) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusedisconnect, false)
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusereconnect, false) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusereconnect, false)
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusetemptarget, false) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusetemptarget, false)
sp.putBoolean(R.string.key_objectiveuseactions, false) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseactions, false)
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseloop, false) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseloop, false)
sp.putBoolean(R.string.key_objectiveusescale, false) sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, false)
} }
fun allPriorAccomplished(position: Int): Boolean { fun allPriorAccomplished(position: Int): Boolean {

View file

@ -6,12 +6,12 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import dagger.android.support.DaggerDialogFragment import dagger.android.support.DaggerDialogFragment
import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.plugins.constraints.databinding.ObjectivesExamFragmentBinding
import info.nightscout.plugins.constraints.objectives.events.EventObjectivesUpdateGui import info.nightscout.plugins.constraints.objectives.events.EventObjectivesUpdateGui
import info.nightscout.plugins.constraints.objectives.objectives.Objective import info.nightscout.plugins.constraints.objectives.objectives.Objective
import info.nightscout.plugins.constraints.objectives.objectives.Objective.ExamTask import info.nightscout.plugins.constraints.objectives.objectives.Objective.ExamTask
import info.nightscout.plugins.constraints.objectives.objectives.Objective.Option import info.nightscout.plugins.constraints.objectives.objectives.Objective.Option
import info.nightscout.plugins.databinding.ObjectivesExamFragmentBinding
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.DateUtil

View file

@ -7,7 +7,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import dagger.android.support.DaggerDialogFragment import dagger.android.support.DaggerDialogFragment
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.plugins.databinding.DialogNtpProgressBinding import info.nightscout.plugins.constraints.databinding.DialogNtpProgressBinding
import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventNtpStatus import info.nightscout.rx.events.EventNtpStatus

View file

@ -7,7 +7,7 @@ import android.widget.TextView
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.DateUtil

View file

@ -2,20 +2,20 @@ package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.database.ValueWrapper import info.nightscout.database.ValueWrapper
import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.aps.Loop import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.db.PersistenceLayer
import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.plugins.R import info.nightscout.interfaces.pump.VirtualPump
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.plugins.constraints.R
import javax.inject.Inject import javax.inject.Inject
class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R.string.objectives_0_objective, R.string.objectives_0_gate) { class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R.string.objectives_0_objective, R.string.objectives_0_gate) {
@Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var virtualPumpPlugin: VirtualPumpPlugin @Inject lateinit var virtualPumpPlugin: VirtualPump
@Inject lateinit var repository: AppRepository @Inject lateinit var persistenceLayer: PersistenceLayer
@Inject lateinit var loop: Loop @Inject lateinit var loop: Loop
@Inject lateinit var iobCobCalculator: IobCobCalculator @Inject lateinit var iobCobCalculator: IobCobCalculator
@ -30,9 +30,9 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R
return activePlugin.firstActiveSync?.hasWritePermission == true return activePlugin.firstActiveSync?.hasWritePermission == true
} }
}) })
tasks.add(object : Task(this, R.string.virtualpump_uploadstatus_title) { tasks.add(object : Task(this, info.nightscout.core.ui.R.string.virtualpump_uploadstatus_title) {
override fun isCompleted(): Boolean { override fun isCompleted(): Boolean {
return sp.getBoolean(R.string.key_virtual_pump_upload_status, false) return sp.getBoolean(info.nightscout.core.utils.R.string.key_virtual_pump_upload_status, false)
} }
override fun shouldBeIgnored(): Boolean { override fun shouldBeIgnored(): Boolean {
@ -62,7 +62,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R
}) })
tasks.add(object : Task(this, info.nightscout.core.ui.R.string.activate_profile) { tasks.add(object : Task(this, info.nightscout.core.ui.R.string.activate_profile) {
override fun isCompleted(): Boolean { override fun isCompleted(): Boolean {
return repository.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing return persistenceLayer.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing
} }
}) })
} }

View file

@ -1,13 +1,17 @@
package info.nightscout.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.plugins.R import info.nightscout.interfaces.actions.Actions
import info.nightscout.plugins.general.actions.ActionsPlugin import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.plugins.constraints.R
import javax.inject.Inject import javax.inject.Inject
class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(injector, "usage", R.string.objectives_usage_objective, R.string.objectives_usage_gate) { class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(injector, "usage", R.string.objectives_usage_objective, R.string.objectives_usage_gate) {
@Inject lateinit var actionsPlugin: ActionsPlugin @Inject lateinit var activePlugin: ActivePlugin
val actionsPlugin: PluginBase
get() = activePlugin.getSpecificPluginsListByInterface(Actions::class.java)[0]
init { init {
tasks.add(object : Task(this, R.string.objectives_useprofileswitch) { tasks.add(object : Task(this, R.string.objectives_useprofileswitch) {
@ -32,7 +36,7 @@ class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(i
}.hint(Hint(R.string.usetemptarget_hint))) }.hint(Hint(R.string.usetemptarget_hint)))
tasks.add(object : Task(this, R.string.objectives_useactions) { tasks.add(object : Task(this, R.string.objectives_useactions) {
override fun isCompleted(): Boolean { override fun isCompleted(): Boolean {
return sp.getBoolean(R.string.key_objectiveuseactions, false) && actionsPlugin.isEnabled() && actionsPlugin.isFragmentVisible() return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveuseactions, false) && actionsPlugin.isEnabled() && actionsPlugin.isFragmentVisible()
} }
}.hint(Hint(R.string.useaction_hint))) }.hint(Hint(R.string.useaction_hint)))
tasks.add(object : Task(this, R.string.objectives_useloop) { tasks.add(object : Task(this, R.string.objectives_useloop) {
@ -42,7 +46,7 @@ class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(i
}.hint(Hint(R.string.useaction_hint))) }.hint(Hint(R.string.useaction_hint)))
tasks.add(object : Task(this, R.string.objectives_usescale) { tasks.add(object : Task(this, R.string.objectives_usescale) {
override fun isCompleted(): Boolean { override fun isCompleted(): Boolean {
return sp.getBoolean(R.string.key_objectiveusescale, false) return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, false)
} }
}.hint(Hint(R.string.usescale_hint))) }.hint(Hint(R.string.usescale_hint)))
} }

View file

@ -1,7 +1,7 @@
package info.nightscout.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
class Objective10(injector: HasAndroidInjector) : Objective(injector, "auto", R.string.objectives_auto_objective, R.string.objectives_auto_gate) { class Objective10(injector: HasAndroidInjector) : Objective(injector, "auto", R.string.objectives_auto_objective, R.string.objectives_auto_gate) {

View file

@ -1,7 +1,7 @@
package info.nightscout.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
class Objective2(injector: HasAndroidInjector) : Objective(injector, "exam", R.string.objectives_exam_objective, R.string.objectives_exam_gate) { class Objective2(injector: HasAndroidInjector) : Objective(injector, "exam", R.string.objectives_exam_objective, R.string.objectives_exam_gate) {
@ -172,7 +172,7 @@ class Objective2(injector: HasAndroidInjector) : Objective(injector, "exam", R.s
.option(Option(R.string.wronginsulin_prime, true)) .option(Option(R.string.wronginsulin_prime, true))
.option(Option(R.string.wrongcarbs_donothing, false)) .option(Option(R.string.wrongcarbs_donothing, false))
) )
tasks.add(ExamTask(this, R.string.iob_label, R.string.blank, "iob") tasks.add(ExamTask(this, info.nightscout.core.ui.R.string.iob_label, R.string.blank, "iob")
.option(Option(R.string.iob_value, true)) .option(Option(R.string.iob_value, true))
.option(Option(R.string.iob_hightemp, false)) .option(Option(R.string.iob_hightemp, false))
.option(Option(R.string.iob_negiob, true)) .option(Option(R.string.iob_negiob, true))

View file

@ -2,7 +2,7 @@ package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
import javax.inject.Inject import javax.inject.Inject

View file

@ -1,7 +1,7 @@
package info.nightscout.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
class Objective4(injector: HasAndroidInjector) : Objective(injector, "maxbasal", R.string.objectives_maxbasal_objective, R.string.objectives_maxbasal_gate) class Objective4(injector: HasAndroidInjector) : Objective(injector, "maxbasal", R.string.objectives_maxbasal_objective, R.string.objectives_maxbasal_gate)

View file

@ -2,7 +2,7 @@ package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.plugins.constraints.safety.SafetyPlugin import info.nightscout.plugins.constraints.safety.SafetyPlugin
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
import javax.inject.Inject import javax.inject.Inject

View file

@ -2,7 +2,7 @@ package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
import javax.inject.Inject import javax.inject.Inject

View file

@ -1,7 +1,7 @@
package info.nightscout.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
class Objective7(injector: HasAndroidInjector) : Objective(injector, "autosens", R.string.objectives_autosens_objective, R.string.objectives_autosens_gate) { class Objective7(injector: HasAndroidInjector) : Objective(injector, "autosens", R.string.objectives_autosens_objective, R.string.objectives_autosens_gate) {

View file

@ -1,7 +1,7 @@
package info.nightscout.plugins.constraints.objectives.objectives package info.nightscout.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
class Objective9(injector: HasAndroidInjector) : Objective(injector, "smb", R.string.objectives_smb_objective, R.string.objectives_smb_gate) { class Objective9(injector: HasAndroidInjector) : Objective(injector, "smb", R.string.objectives_smb_objective, R.string.objectives_smb_gate) {

View file

@ -8,7 +8,7 @@ import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.plugins.support.R import info.nightscout.plugins.constraints.R
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import javax.inject.Inject import javax.inject.Inject

View file

@ -1,7 +1,6 @@
package info.nightscout.plugins.constraints.safety package info.nightscout.plugins.constraints.safety
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.extensions.putDouble import info.nightscout.core.extensions.putDouble
import info.nightscout.core.extensions.putInt import info.nightscout.core.extensions.putInt
import info.nightscout.core.extensions.putString import info.nightscout.core.extensions.putString
@ -20,10 +19,11 @@ import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpDescription
import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.DecimalFormatter
import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.interfaces.utils.Round import info.nightscout.interfaces.utils.Round
import info.nightscout.plugins.R import info.nightscout.plugins.constraints.R
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
@ -45,7 +45,8 @@ class SafetyPlugin @Inject constructor(
private val hardLimits: HardLimits, private val hardLimits: HardLimits,
private val config: Config, private val config: Config,
private val iobCobCalculator: IobCobCalculator, private val iobCobCalculator: IobCobCalculator,
private val dateUtil: DateUtil private val dateUtil: DateUtil,
private val uiInteraction: UiInteraction
) : PluginBase( ) : PluginBase(
PluginDescription() PluginDescription()
.mainType(PluginType.CONSTRAINTS) .mainType(PluginType.CONSTRAINTS)
@ -70,8 +71,7 @@ class SafetyPlugin @Inject constructor(
if (mode == "open") value.set(aapsLogger, false, rh.gs(R.string.closedmodedisabledinpreferences), this) if (mode == "open") value.set(aapsLogger, false, rh.gs(R.string.closedmodedisabledinpreferences), this)
if (!config.isEngineeringModeOrRelease()) { if (!config.isEngineeringModeOrRelease()) {
if (value.value()) { if (value.value()) {
val n = Notification(Notification.TOAST_ALARM, rh.gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL) uiInteraction.addNotification(Notification.TOAST_ALARM, rh.gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL)
rxBus.send(EventNewNotification(n))
} }
value.set(aapsLogger, false, rh.gs(R.string.closed_loop_disabled_on_dev_branch), this) value.set(aapsLogger, false, rh.gs(R.string.closed_loop_disabled_on_dev_branch), this)
} }

View file

@ -12,7 +12,7 @@ import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.plugins.support.R import info.nightscout.plugins.constraints.R
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP

View file

@ -12,7 +12,7 @@ import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.plugins.support.R import info.nightscout.plugins.constraints.R
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -10,7 +10,7 @@ import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
import info.nightscout.plugins.support.R import info.nightscout.plugins.constraints.R
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -8,7 +8,7 @@ import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.interfaces.receivers.ReceiverStatusStore
import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
import info.nightscout.plugins.support.R import info.nightscout.plugins.constraints.R
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="constraints.objectives.activities.ObjectivesExamDialog"> tools:context=".constraints.objectives.activities.ObjectivesExamDialog">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

Some files were not shown because too many files have changed in this diff Show more