:plugins:insulin module

This commit is contained in:
Milos Kozak 2022-12-09 13:13:21 +01:00
parent 8791e93cc9
commit 2024956aef
33 changed files with 214 additions and 106 deletions

View file

@ -199,6 +199,7 @@ dependencies {
implementation project(':plugins:automation') implementation project(':plugins:automation')
implementation project(':plugins:configuration') implementation project(':plugins:configuration')
implementation project(':plugins:constraints') implementation project(':plugins:constraints')
implementation project(':plugins:insulin')
implementation project(':plugins:main') implementation project(':plugins:main')
implementation project(':plugins:openhumans') implementation project(':plugins:openhumans')
implementation project(':plugins:sensitivity') implementation project(':plugins:sensitivity')

View file

@ -28,6 +28,7 @@ import info.nightscout.automation.AutomationPlugin
import info.nightscout.configuration.maintenance.MaintenancePlugin import info.nightscout.configuration.maintenance.MaintenancePlugin
import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.implementation.plugin.PluginStore import info.nightscout.implementation.plugin.PluginStore
import info.nightscout.insulin.InsulinOrefFreePeakPlugin
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.nsclient.NSSettingsStatus import info.nightscout.interfaces.nsclient.NSSettingsStatus
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
@ -47,7 +48,6 @@ import info.nightscout.plugins.general.autotune.AutotunePlugin
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.plugins.general.wear.WearPlugin import info.nightscout.plugins.general.wear.WearPlugin
import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin
import info.nightscout.plugins.insulin.InsulinOrefFreePeakPlugin
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
import info.nightscout.plugins.source.AidexPlugin import info.nightscout.plugins.source.AidexPlugin
import info.nightscout.plugins.source.DexcomPlugin import info.nightscout.plugins.source.DexcomPlugin

View file

@ -20,6 +20,7 @@ import info.nightscout.core.di.CoreModule
import info.nightscout.core.validators.di.ValidatorsModule 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.insulin.di.InsulinModule
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.constraints.di.PluginsConstraintsModule
import info.nightscout.plugins.di.PluginsModule import info.nightscout.plugins.di.PluginsModule
@ -55,6 +56,7 @@ import javax.inject.Singleton
CoreModule::class, CoreModule::class,
DatabaseModule::class, DatabaseModule::class,
ImplementationModule::class, ImplementationModule::class,
InsulinModule::class,
OpenHumansModule::class, OpenHumansModule::class,
PluginsModule::class, PluginsModule::class,
RxModule::class, RxModule::class,

View file

@ -8,7 +8,6 @@ import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
import info.nightscout.plugins.general.persistentNotification.PersistentNotificationPlugin
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
@ -17,6 +16,10 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugi
import info.nightscout.automation.AutomationPlugin import info.nightscout.automation.AutomationPlugin
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
import info.nightscout.configuration.maintenance.MaintenancePlugin import info.nightscout.configuration.maintenance.MaintenancePlugin
import info.nightscout.insulin.InsulinLyumjevPlugin
import info.nightscout.insulin.InsulinOrefFreePeakPlugin
import info.nightscout.insulin.InsulinOrefRapidActingPlugin
import info.nightscout.insulin.InsulinOrefUltraRapidActingPlugin
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.plugins.aps.loop.LoopPlugin import info.nightscout.plugins.aps.loop.LoopPlugin
import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
@ -31,14 +34,11 @@ import info.nightscout.plugins.general.autotune.AutotunePlugin
import info.nightscout.plugins.general.dataBroadcaster.DataBroadcastPlugin import info.nightscout.plugins.general.dataBroadcaster.DataBroadcastPlugin
import info.nightscout.plugins.general.food.FoodPlugin import info.nightscout.plugins.general.food.FoodPlugin
import info.nightscout.plugins.general.overview.OverviewPlugin import info.nightscout.plugins.general.overview.OverviewPlugin
import info.nightscout.plugins.general.persistentNotification.PersistentNotificationPlugin
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.plugins.general.themes.ThemeSwitcherPlugin import info.nightscout.plugins.general.themes.ThemeSwitcherPlugin
import info.nightscout.plugins.general.wear.WearPlugin import info.nightscout.plugins.general.wear.WearPlugin
import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin
import info.nightscout.plugins.insulin.InsulinLyumjevPlugin
import info.nightscout.plugins.insulin.InsulinOrefFreePeakPlugin
import info.nightscout.plugins.insulin.InsulinOrefRapidActingPlugin
import info.nightscout.plugins.insulin.InsulinOrefUltraRapidActingPlugin
import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
import info.nightscout.plugins.profile.ProfilePlugin import info.nightscout.plugins.profile.ProfilePlugin
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin

View file

@ -1,4 +1,4 @@
package info.nightscout.plugins.insulin package info.nightscout.core.graph
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color

View file

@ -21,6 +21,8 @@ files:
translation: /plugins/openhumans/src/main/res/values-%android_code%/strings.xml translation: /plugins/openhumans/src/main/res/values-%android_code%/strings.xml
- source: /plugins/sensitivity/src/main/res/values/strings.xml - source: /plugins/sensitivity/src/main/res/values/strings.xml
translation: /plugins/sensitivity/src/main/res/values-%android_code%/strings.xml translation: /plugins/sensitivity/src/main/res/values-%android_code%/strings.xml
- source: /plugins/insulin/src/main/res/values/strings.xml
translation: /plugins/insulin/src/main/res/values-%android_code%/strings.xml
- source: /plugins/configuration/src/main/res/values/strings.xml - source: /plugins/configuration/src/main/res/values/strings.xml
translation: /plugins/configuration/src/main/res/values-%android_code%/strings.xml translation: /plugins/configuration/src/main/res/values-%android_code%/strings.xml
- source: /plugins/sync/src/main/res/values/strings.xml - source: /plugins/sync/src/main/res/values/strings.xml

1
plugins/insulin/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,28 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
id 'kotlin-allopen'
id 'com.hiya.jacoco-android'
}
apply from: "${project.rootDir}/core/main/android_dependencies.gradle"
apply from: "${project.rootDir}/core/main/android_module_dependencies.gradle"
apply from: "${project.rootDir}/core/main/allopen_dependencies.gradle"
apply from: "${project.rootDir}/core/main/test_dependencies.gradle"
apply from: "${project.rootDir}/core/main/jacoco_global.gradle"
android {
namespace 'info.nightscout.insulin'
}
dependencies {
implementation project(':app-wear-shared:shared')
implementation project(':core:graph')
implementation project(':core:graphview')
implementation project(':core:interfaces')
implementation project(':core:ui')
implementation project(':core:utils')
implementation project(':core:validators')
implementation project(':database:entities')
}

View file

21
plugins/insulin/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View file

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

View file

@ -1,12 +1,12 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import dagger.android.support.DaggerFragment import dagger.android.support.DaggerFragment
import info.nightscout.insulin.databinding.InsulinFragmentBinding
import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.plugins.databinding.InsulinFragmentBinding
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import javax.inject.Inject import javax.inject.Inject

View file

@ -1,11 +1,11 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.insulin.Insulin
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
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.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
@ -21,8 +21,9 @@ class InsulinLyumjevPlugin @Inject constructor(
rxBus: RxBus, rxBus: RxBus,
aapsLogger: AAPSLogger, aapsLogger: AAPSLogger,
config: Config, config: Config,
hardLimits: HardLimits hardLimits: HardLimits,
) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) { uiInteraction: UiInteraction
) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits, uiInteraction) {
override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_LYUMJEV override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_LYUMJEV
override val friendlyName get(): String = rh.gs(R.string.lyumjev) override val friendlyName get(): String = rh.gs(R.string.lyumjev)

View file

@ -1,7 +1,6 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.core.events.EventNewNotification
import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.Bolus
import info.nightscout.database.entities.embedments.InsulinConfiguration import info.nightscout.database.entities.embedments.InsulinConfiguration
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
@ -12,8 +11,8 @@ 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.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
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.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
@ -34,7 +33,8 @@ abstract class InsulinOrefBasePlugin(
val rxBus: RxBus, val rxBus: RxBus,
aapsLogger: AAPSLogger, aapsLogger: AAPSLogger,
config: Config, config: Config,
val hardLimits: HardLimits val hardLimits: HardLimits,
val uiInteraction: UiInteraction
) : PluginBase( ) : PluginBase(
PluginDescription() PluginDescription()
.mainType(PluginType.INSULIN) .mainType(PluginType.INSULIN)
@ -61,8 +61,7 @@ abstract class InsulinOrefBasePlugin(
open fun sendShortDiaNotification(dia: Double) { open fun sendShortDiaNotification(dia: Double) {
if (System.currentTimeMillis() - lastWarned > 60 * 1000) { if (System.currentTimeMillis() - lastWarned > 60 * 1000) {
lastWarned = System.currentTimeMillis() lastWarned = System.currentTimeMillis()
val notification = Notification(Notification.SHORT_DIA, String.format(notificationPattern, dia, hardLimits.minDia()), Notification.URGENT) uiInteraction.addNotification(Notification.SHORT_DIA, String.format(notificationPattern, dia, hardLimits.minDia()), Notification.URGENT)
rxBus.send(EventNewNotification(notification))
} }
} }

View file

@ -1,4 +1,4 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.core.extensions.putInt import info.nightscout.core.extensions.putInt
@ -6,8 +6,8 @@ import info.nightscout.core.extensions.storeInt
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.insulin.Insulin
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
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.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
@ -28,16 +28,17 @@ class InsulinOrefFreePeakPlugin @Inject constructor(
rxBus: RxBus, rxBus: RxBus,
aapsLogger: AAPSLogger, aapsLogger: AAPSLogger,
config: Config, config: Config,
hardLimits: HardLimits hardLimits: HardLimits,
) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) { uiInteraction: UiInteraction
) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits, uiInteraction) {
override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_FREE_PEAK override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_FREE_PEAK
override val friendlyName get(): String = rh.gs(R.string.free_peak_oref) override val friendlyName get(): String = rh.gs(R.string.free_peak_oref)
override fun configuration(): JSONObject = JSONObject().putInt(R.string.key_insulin_oref_peak, sp, rh) override fun configuration(): JSONObject = JSONObject().putInt(info.nightscout.core.utils.R.string.key_insulin_oref_peak, sp, rh)
override fun applyConfiguration(configuration: JSONObject) { override fun applyConfiguration(configuration: JSONObject) {
configuration.storeInt(R.string.key_insulin_oref_peak, sp, rh) configuration.storeInt(info.nightscout.core.utils.R.string.key_insulin_oref_peak, sp, rh)
} }
override fun commentStandardText(): String { override fun commentStandardText(): String {
@ -45,7 +46,7 @@ class InsulinOrefFreePeakPlugin @Inject constructor(
} }
override val peak: Int override val peak: Int
get() = sp.getInt(R.string.key_insulin_oref_peak, DEFAULT_PEAK) get() = sp.getInt(info.nightscout.core.utils.R.string.key_insulin_oref_peak, DEFAULT_PEAK)
companion object { companion object {

View file

@ -1,11 +1,11 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.insulin.Insulin
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
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.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
@ -24,8 +24,9 @@ class InsulinOrefRapidActingPlugin @Inject constructor(
rxBus: RxBus, rxBus: RxBus,
aapsLogger: AAPSLogger, aapsLogger: AAPSLogger,
config: Config, config: Config,
hardLimits: HardLimits hardLimits: HardLimits,
) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) { uiInteraction: UiInteraction
) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits, uiInteraction) {
override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_RAPID_ACTING override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_RAPID_ACTING
override val friendlyName get(): String = rh.gs(R.string.rapid_acting_oref) override val friendlyName get(): String = rh.gs(R.string.rapid_acting_oref)

View file

@ -1,11 +1,11 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.insulin.Insulin
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
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.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
@ -24,8 +24,9 @@ class InsulinOrefUltraRapidActingPlugin @Inject constructor(
rxBus: RxBus, rxBus: RxBus,
aapsLogger: AAPSLogger, aapsLogger: AAPSLogger,
config: Config, config: Config,
hardLimits: HardLimits hardLimits: HardLimits,
) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) { uiInteraction: UiInteraction
) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits, uiInteraction) {
override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING
override val friendlyName get(): String = rh.gs(R.string.ultra_rapid_oref) override val friendlyName get(): String = rh.gs(R.string.ultra_rapid_oref)

View file

@ -1,8 +1,8 @@
package info.nightscout.plugins.di package info.nightscout.insulin.di
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
import info.nightscout.plugins.insulin.InsulinFragment import info.nightscout.insulin.InsulinFragment
@Module @Module
@Suppress("unused") @Suppress("unused")

View file

@ -2,7 +2,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=".insulin.InsulinFragment"> tools:context="info.nightscout.insulin.InsulinFragment">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -30,7 +30,7 @@
android:layout_margin="10dp" android:layout_margin="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
<info.nightscout.plugins.insulin.ActivityGraph <info.nightscout.core.graph.ActivityGraph
android:id="@+id/graph" android:id="@+id/graph"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="200dip" android:layout_height="200dip"

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Insulin -->
<string name="key_insulin_oref_peak_settings" translatable="false">insulin_oref_peak_settings</string>
<string name="lyumjev">Lyumjev</string>
<string name="description_insulin_rapid">Insulin preset for Humalog and NovoRapid / NovoLog</string>
<string name="description_insulin_ultra_rapid">Insulin preset for Fiasp</string>
<string name="description_insulin_lyumjev">Insulin preset for Lyumjev</string>
<string name="description_insulin_free_peak">Allows you to define the peak of the insulin activity and should only be used by advanced users</string>
<string name="insulin_shortname">INS</string>
<string name="insulin_oref_peak">IOB Curve Peak Time</string>
<string name="insulin_peak_time">Peak Time [min]</string>
<string name="free_peak_oref">Free-Peak Oref</string>
<string name="rapid_acting_oref">Rapid-Acting Oref</string>
<string name="ultra_rapid_oref">Ultra-Rapid Oref</string>
<string name="dia_too_short">DIA of %1$f too short - using %2$f instead!</string>
<string name="fast_acting_insulin_comment">Novorapid, Novolog, Humalog</string>
<string name="ultra_fast_acting_insulin_comment">Fiasp</string>
</resources>

View file

@ -0,0 +1,37 @@
package info.nightscout.androidaps
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.TestAapsSchedulers
import info.nightscout.rx.logging.AAPSLoggerTest
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.extension.ExtendWith
import org.mockito.Mockito
import org.mockito.junit.jupiter.MockitoExtension
import org.mockito.junit.jupiter.MockitoSettings
import org.mockito.quality.Strictness
import java.util.Locale
@ExtendWith(MockitoExtension::class)
@MockitoSettings(strictness = Strictness.LENIENT)
open class TestBase {
val aapsLogger = AAPSLoggerTest()
val aapsSchedulers: AapsSchedulers = TestAapsSchedulers()
@BeforeEach
fun setupLocale() {
Locale.setDefault(Locale.ENGLISH)
System.setProperty("disableFirebase", "true")
}
// Workaround for Kotlin nullability.
// https://medium.com/@elye.project/befriending-kotlin-and-mockito-1c2e7b0ef791
// https://stackoverflow.com/questions/30305217/is-it-possible-to-use-mockito-in-kotlin
fun <T> anyObject(): T {
Mockito.any<T>()
return uninitialized()
}
@Suppress("Unchecked_Cast")
fun <T> uninitialized(): T = null as T
}

View file

@ -1,16 +1,16 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.insulin.Insulin
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
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.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
import org.junit.Assert.assertEquals import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.extension.ExtendWith
@ -33,6 +33,7 @@ class InsulinLyumjevPluginTest {
@Mock lateinit var aapsLogger: AAPSLogger @Mock lateinit var aapsLogger: AAPSLogger
@Mock lateinit var config: Config @Mock lateinit var config: Config
@Mock lateinit var hardLimits: HardLimits @Mock lateinit var hardLimits: HardLimits
@Mock lateinit var uiInteraction: UiInteraction
private var injector: HasAndroidInjector = HasAndroidInjector { private var injector: HasAndroidInjector = HasAndroidInjector {
AndroidInjector { AndroidInjector {
@ -41,29 +42,29 @@ class InsulinLyumjevPluginTest {
@BeforeEach @BeforeEach
fun setup() { fun setup() {
sut = InsulinLyumjevPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) sut = InsulinLyumjevPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits, uiInteraction)
} }
@Test @Test
fun `simple peak test`() { fun `simple peak test`() {
assertEquals(45, sut.peak) Assertions.assertEquals(45, sut.peak)
} }
@Test @Test
fun getIdTest() { fun getIdTest() {
assertEquals(Insulin.InsulinType.OREF_LYUMJEV, sut.id) Assertions.assertEquals(Insulin.InsulinType.OREF_LYUMJEV, sut.id)
} }
@Test @Test
fun commentStandardTextTest() { fun commentStandardTextTest() {
`when`(rh.gs(eq(R.string.lyumjev))).thenReturn("Lyumjev") `when`(rh.gs(eq(R.string.lyumjev))).thenReturn("Lyumjev")
assertEquals("Lyumjev", sut.commentStandardText()) Assertions.assertEquals("Lyumjev", sut.commentStandardText())
} }
@Test @Test
fun getFriendlyNameTest() { fun getFriendlyNameTest() {
`when`(rh.gs(eq(R.string.lyumjev))).thenReturn("Lyumjev") `when`(rh.gs(eq(R.string.lyumjev))).thenReturn("Lyumjev")
assertEquals("Lyumjev", sut.friendlyName) Assertions.assertEquals("Lyumjev", sut.friendlyName)
} }
} }

View file

@ -1,4 +1,4 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
@ -7,12 +7,13 @@ import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.insulin.Insulin
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HardLimits
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
import org.json.JSONObject import org.json.JSONObject
import org.junit.Assert import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.extension.ExtendWith
@ -38,7 +39,7 @@ class InsulinOrefBasePluginTest {
aapsLogger: AAPSLogger, aapsLogger: AAPSLogger,
config: Config, config: Config,
hardLimits: HardLimits hardLimits: HardLimits
) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) { ) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits, uiInteraction) {
override fun sendShortDiaNotification(dia: Double) { override fun sendShortDiaNotification(dia: Double) {
shortDiaNotificationSend = true shortDiaNotificationSend = true
@ -65,6 +66,7 @@ class InsulinOrefBasePluginTest {
@Mock lateinit var aapsLogger: AAPSLogger @Mock lateinit var aapsLogger: AAPSLogger
@Mock lateinit var config: Config @Mock lateinit var config: Config
@Mock lateinit var hardLimits: HardLimits @Mock lateinit var hardLimits: HardLimits
@Mock lateinit var uiInteraction: UiInteraction
private var injector: HasAndroidInjector = HasAndroidInjector { private var injector: HasAndroidInjector = HasAndroidInjector {
AndroidInjector { AndroidInjector {
@ -79,12 +81,12 @@ class InsulinOrefBasePluginTest {
@Test @Test
fun testGetDia() { fun testGetDia() {
Assert.assertEquals(5.0, sut.dia, 0.0) Assertions.assertEquals(5.0, sut.dia, 0.0)
testUserDefinedDia = 5.0 + 1 testUserDefinedDia = 5.0 + 1
Assert.assertEquals(5.0 + 1, sut.dia, 0.0) Assertions.assertEquals(5.0 + 1, sut.dia, 0.0)
testUserDefinedDia = 5.0 - 1 testUserDefinedDia = 5.0 - 1
Assert.assertEquals(5.0, sut.dia, 0.0) Assertions.assertEquals(5.0, sut.dia, 0.0)
Assert.assertTrue(shortDiaNotificationSend) Assertions.assertTrue(shortDiaNotificationSend)
} }
@Test @Test
@ -96,22 +98,22 @@ class InsulinOrefBasePluginTest {
// check directly after bolus // check directly after bolus
treatment.timestamp = time treatment.timestamp = time
treatment.amount = 10.0 treatment.amount = 10.0
Assert.assertEquals(10.0, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) Assertions.assertEquals(10.0, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1)
// check after 1 hour // check after 1 hour
treatment.timestamp = time - 1 * 60 * 60 * 1000 // 1 hour treatment.timestamp = time - 1 * 60 * 60 * 1000 // 1 hour
treatment.amount = 10.0 treatment.amount = 10.0
Assert.assertEquals(3.92, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) Assertions.assertEquals(3.92, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1)
// check after 2 hour // check after 2 hour
treatment.timestamp = time - 2 * 60 * 60 * 1000 // 2 hours treatment.timestamp = time - 2 * 60 * 60 * 1000 // 2 hours
treatment.amount = 10.0 treatment.amount = 10.0
Assert.assertEquals(0.77, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) Assertions.assertEquals(0.77, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1)
// check after 3 hour // check after 3 hour
treatment.timestamp = time - 3 * 60 * 60 * 1000 // 3 hours treatment.timestamp = time - 3 * 60 * 60 * 1000 // 3 hours
treatment.amount = 10.0 treatment.amount = 10.0
Assert.assertEquals(0.10, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) Assertions.assertEquals(0.10, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1)
// check after dia // check after dia
treatment.timestamp = time - 4 * 60 * 60 * 1000 // 4 hours treatment.timestamp = time - 4 * 60 * 60 * 1000 // 4 hours
treatment.amount = 10.0 treatment.amount = 10.0
Assert.assertEquals(0.0, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) Assertions.assertEquals(0.0, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1)
} }
} }

View file

@ -1,4 +1,4 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
@ -6,12 +6,12 @@ import info.nightscout.androidaps.TestBase
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.insulin.Insulin
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
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.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.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import org.junit.Assert.assertEquals import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyInt
@ -33,6 +33,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() {
@Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var profileFunction: ProfileFunction
@Mock lateinit var config: Config @Mock lateinit var config: Config
@Mock lateinit var hardLimits: HardLimits @Mock lateinit var hardLimits: HardLimits
@Mock lateinit var uiInteraction: UiInteraction
private var injector: HasAndroidInjector = HasAndroidInjector { private var injector: HasAndroidInjector = HasAndroidInjector {
AndroidInjector { AndroidInjector {
@ -41,30 +42,30 @@ class InsulinOrefFreePeakPluginTest : TestBase() {
@BeforeEach @BeforeEach
fun setup() { fun setup() {
sut = InsulinOrefFreePeakPlugin(injector, sp, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) sut = InsulinOrefFreePeakPlugin(injector, sp, rh, profileFunction, rxBus, aapsLogger, config, hardLimits, uiInteraction)
} }
@Test @Test
fun `simple peak test`() { fun `simple peak test`() {
`when`(sp.getInt(eq(R.string.key_insulin_oref_peak), anyInt())).thenReturn(90) `when`(sp.getInt(eq(info.nightscout.core.utils.R.string.key_insulin_oref_peak), anyInt())).thenReturn(90)
assertEquals(90, sut.peak) Assertions.assertEquals(90, sut.peak)
} }
@Test @Test
fun getIdTest() { fun getIdTest() {
assertEquals(Insulin.InsulinType.OREF_FREE_PEAK, sut.id) Assertions.assertEquals(Insulin.InsulinType.OREF_FREE_PEAK, sut.id)
} }
@Test @Test
fun commentStandardTextTest() { fun commentStandardTextTest() {
`when`(sp.getInt(eq(R.string.key_insulin_oref_peak), anyInt())).thenReturn(90) `when`(sp.getInt(eq(info.nightscout.core.utils.R.string.key_insulin_oref_peak), anyInt())).thenReturn(90)
`when`(rh.gs(eq(R.string.insulin_peak_time))).thenReturn("Peak Time [min]") `when`(rh.gs(eq(R.string.insulin_peak_time))).thenReturn("Peak Time [min]")
assertEquals("Peak Time [min]: 90", sut.commentStandardText()) Assertions.assertEquals("Peak Time [min]: 90", sut.commentStandardText())
} }
@Test @Test
fun getFriendlyNameTest() { fun getFriendlyNameTest() {
`when`(rh.gs(eq(R.string.free_peak_oref))).thenReturn("Free-Peak Oref") `when`(rh.gs(eq(R.string.free_peak_oref))).thenReturn("Free-Peak Oref")
assertEquals("Free-Peak Oref", sut.friendlyName) Assertions.assertEquals("Free-Peak Oref", sut.friendlyName)
} }
} }

View file

@ -1,16 +1,16 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.insulin.Insulin
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
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.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
import org.junit.Assert.assertEquals import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.extension.ExtendWith
@ -33,6 +33,7 @@ class InsulinOrefRapidActingPluginTest {
@Mock lateinit var aapsLogger: AAPSLogger @Mock lateinit var aapsLogger: AAPSLogger
@Mock lateinit var config: Config @Mock lateinit var config: Config
@Mock lateinit var hardLimits: HardLimits @Mock lateinit var hardLimits: HardLimits
@Mock lateinit var uiInteraction: UiInteraction
private var injector: HasAndroidInjector = HasAndroidInjector { private var injector: HasAndroidInjector = HasAndroidInjector {
AndroidInjector { AndroidInjector {
@ -41,29 +42,29 @@ class InsulinOrefRapidActingPluginTest {
@BeforeEach @BeforeEach
fun setup() { fun setup() {
sut = InsulinOrefRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) sut = InsulinOrefRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits, uiInteraction)
} }
@Test @Test
fun `simple peak test`() { fun `simple peak test`() {
assertEquals(75, sut.peak) Assertions.assertEquals(75, sut.peak)
} }
@Test @Test
fun getIdTest() { fun getIdTest() {
assertEquals(Insulin.InsulinType.OREF_RAPID_ACTING, sut.id) Assertions.assertEquals(Insulin.InsulinType.OREF_RAPID_ACTING, sut.id)
} }
@Test @Test
fun commentStandardTextTest() { fun commentStandardTextTest() {
`when`(rh.gs(eq(R.string.fast_acting_insulin_comment))).thenReturn("Novorapid, Novolog, Humalog") `when`(rh.gs(eq(R.string.fast_acting_insulin_comment))).thenReturn("Novorapid, Novolog, Humalog")
assertEquals("Novorapid, Novolog, Humalog", sut.commentStandardText()) Assertions.assertEquals("Novorapid, Novolog, Humalog", sut.commentStandardText())
} }
@Test @Test
fun getFriendlyNameTest() { fun getFriendlyNameTest() {
`when`(rh.gs(eq(R.string.rapid_acting_oref))).thenReturn("Rapid-Acting Oref") `when`(rh.gs(eq(R.string.rapid_acting_oref))).thenReturn("Rapid-Acting Oref")
assertEquals("Rapid-Acting Oref", sut.friendlyName) Assertions.assertEquals("Rapid-Acting Oref", sut.friendlyName)
} }
} }

View file

@ -1,16 +1,16 @@
package info.nightscout.plugins.insulin package info.nightscout.insulin
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.insulin.Insulin import info.nightscout.interfaces.insulin.Insulin
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
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.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
import org.junit.Assert.assertEquals import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.extension.ExtendWith
@ -33,6 +33,7 @@ class InsulinOrefUltraRapidActingPluginTest {
@Mock lateinit var aapsLogger: AAPSLogger @Mock lateinit var aapsLogger: AAPSLogger
@Mock lateinit var config: Config @Mock lateinit var config: Config
@Mock lateinit var hardLimits: HardLimits @Mock lateinit var hardLimits: HardLimits
@Mock lateinit var uiInteraction: UiInteraction
private var injector: HasAndroidInjector = HasAndroidInjector { private var injector: HasAndroidInjector = HasAndroidInjector {
AndroidInjector { AndroidInjector {
@ -41,29 +42,29 @@ class InsulinOrefUltraRapidActingPluginTest {
@BeforeEach @BeforeEach
fun setup() { fun setup() {
sut = InsulinOrefUltraRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) sut = InsulinOrefUltraRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits, uiInteraction)
} }
@Test @Test
fun `simple peak test`() { fun `simple peak test`() {
assertEquals(55, sut.peak) Assertions.assertEquals(55, sut.peak)
} }
@Test @Test
fun getIdTest() { fun getIdTest() {
assertEquals(Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING, sut.id) Assertions.assertEquals(Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING, sut.id)
} }
@Test @Test
fun commentStandardTextTest() { fun commentStandardTextTest() {
`when`(rh.gs(eq(R.string.ultra_fast_acting_insulin_comment))).thenReturn("Fiasp") `when`(rh.gs(eq(R.string.ultra_fast_acting_insulin_comment))).thenReturn("Fiasp")
assertEquals("Fiasp", sut.commentStandardText()) Assertions.assertEquals("Fiasp", sut.commentStandardText())
} }
@Test @Test
fun getFriendlyNameTest() { fun getFriendlyNameTest() {
`when`(rh.gs(eq(R.string.ultra_rapid_oref))).thenReturn("Ultra-Rapid Oref") `when`(rh.gs(eq(R.string.ultra_rapid_oref))).thenReturn("Ultra-Rapid Oref")
assertEquals("Ultra-Rapid Oref", sut.friendlyName) Assertions.assertEquals("Ultra-Rapid Oref", sut.friendlyName)
} }
} }

View file

@ -14,7 +14,6 @@ import info.nightscout.plugins.iob.iobCobCalculator.data.AutosensDataObject
@Module( @Module(
includes = [ includes = [
PluginsModule.Bindings::class, PluginsModule.Bindings::class,
InsulinModule::class,
FoodModule::class, FoodModule::class,
SMSCommunicatorModule::class, SMSCommunicatorModule::class,
ProfileModule::class, ProfileModule::class,

View file

@ -129,7 +129,7 @@ class IobCobCalculatorPlugin @Inject constructor(
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_absorption_cutoff)) || event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_absorption_cutoff)) ||
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max)) || event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max)) ||
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min)) || event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min)) ||
event.isChanged(rh.gs(R.string.key_insulin_oref_peak)) event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_insulin_oref_peak))
) { ) {
resetDataAndRunCalculation("onEventPreferenceChange", event) resetDataAndRunCalculation("onEventPreferenceChange", event)
} }

View file

@ -198,7 +198,7 @@
</LinearLayout> </LinearLayout>
<info.nightscout.plugins.insulin.ActivityGraph <info.nightscout.core.graph.ActivityGraph
android:id="@+id/insulin_graph" android:id="@+id/insulin_graph"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="100dip" android:layout_height="100dip"

View file

@ -109,25 +109,6 @@
<string name="sms_wrong_tbr_duration">TBR duration must be a multiple of %1$d minutes and greater than 0.</string> <string name="sms_wrong_tbr_duration">TBR duration must be a multiple of %1$d minutes and greater than 0.</string>
<string name="a11y_otp_qr_code">QR Code for setup one time password</string> <string name="a11y_otp_qr_code">QR Code for setup one time password</string>
<!-- Insulin -->
<string name="key_insulin_oref_peak" translatable="false">insulin_oref_peak</string>
<string name="key_insulin_oref_peak_settings" translatable="false">insulin_oref_peak_settings</string>
<string name="lyumjev">Lyumjev</string>
<string name="description_insulin_rapid">Insulin preset for Humalog and NovoRapid / NovoLog</string>
<string name="description_insulin_ultra_rapid">Insulin preset for Fiasp</string>
<string name="description_insulin_lyumjev">Insulin preset for Lyumjev</string>
<string name="description_insulin_free_peak">Allows you to define the peak of the insulin activity and should only be used by advanced users</string>
<string name="insulin_shortname">INS</string>
<string name="insulin_oref_peak">IOB Curve Peak Time</string>
<string name="insulin_peak_time">Peak Time [min]</string>
<string name="free_peak_oref">Free-Peak Oref</string>
<string name="rapid_acting_oref">Rapid-Acting Oref</string>
<string name="ultra_rapid_oref">Ultra-Rapid Oref</string>
<string name="dia_too_short">DIA of %1$f too short - using %2$f instead!</string>
<string name="fast_acting_insulin_comment">Novorapid, Novolog, Humalog</string>
<string name="ultra_fast_acting_insulin_comment">Fiasp</string>
<!-- xDrip status line --> <!-- xDrip status line -->
<string name="key_xdrip_status_detailed_iob" translatable="false">xdripstatus_detailediob</string> <string name="key_xdrip_status_detailed_iob" translatable="false">xdripstatus_detailediob</string>
<string name="key_xdrip_status_show_bgi" translatable="false">xdripstatus_showbgi</string> <string name="key_xdrip_status_show_bgi" translatable="false">xdripstatus_showbgi</string>

View file

@ -18,6 +18,7 @@ include ':implementation'
include ':plugins:aps' include ':plugins:aps'
include ':plugins:automation' include ':plugins:automation'
include ':plugins:configuration' include ':plugins:configuration'
include ':plugins:insulin'
include ':plugins:main' include ':plugins:main'
include ':plugins:openhumans' include ':plugins:openhumans'
include ':plugins:sensitivity' include ':plugins:sensitivity'