Lyumjev
This commit is contained in:
parent
4b04b66d02
commit
05125af9e7
|
@ -31,6 +31,7 @@ import info.nightscout.androidaps.plugins.general.persistentNotification.Persist
|
|||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
|
||||
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinLyumjevPlugin
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefUltraRapidActingPlugin
|
||||
|
@ -82,6 +83,12 @@ abstract class PluginsModule {
|
|||
@IntKey(40)
|
||||
abstract fun bindInsulinOrefUltraRapidActingPlugin(plugin: InsulinOrefUltraRapidActingPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(42)
|
||||
abstract fun bindInsulinLyumjevPlugin(plugin: InsulinLyumjevPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package info.nightscout.androidaps.plugins.insulin
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.interfaces.InsulinInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class InsulinLyumjevPlugin @Inject constructor(
|
||||
injector: HasAndroidInjector,
|
||||
resourceHelper: ResourceHelper,
|
||||
profileFunction: ProfileFunction,
|
||||
rxBus: RxBusWrapper, aapsLogger: AAPSLogger
|
||||
) : InsulinOrefBasePlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) {
|
||||
|
||||
|
||||
override fun getId(): Int = InsulinInterface.OREF_LYUMJEV
|
||||
|
||||
override fun getFriendlyName(): String = resourceHelper.gs(R.string.lyumjev)
|
||||
|
||||
override fun commentStandardText(): String = resourceHelper.gs(R.string.lyumjev)
|
||||
|
||||
override val peak = 45
|
||||
|
||||
init {
|
||||
pluginDescription
|
||||
.pluginName(R.string.lyumjev)
|
||||
.description(R.string.description_insulin_lyumjev)
|
||||
}
|
||||
}
|
|
@ -41,5 +41,6 @@ class InsulinOrefRapidActingPlugin @Inject constructor(
|
|||
.pluginName(R.string.rapid_acting_oref)
|
||||
.description(R.string.description_insulin_rapid)
|
||||
.setDefault()
|
||||
.enableByDefault(true)
|
||||
}
|
||||
}
|
|
@ -34,6 +34,5 @@ class InsulinOrefUltraRapidActingPlugin @Inject constructor(
|
|||
pluginDescription
|
||||
.pluginName(R.string.ultrarapid_oref)
|
||||
.description(R.string.description_insulin_ultra_rapid)
|
||||
.enableByDefault(true)
|
||||
}
|
||||
}
|
|
@ -45,6 +45,7 @@
|
|||
<string name="description_food">Displays the food presets defined in Nightscout</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="description_loop">Activate or deactivate the implementation triggering the loop.</string>
|
||||
<string name="description_ns_client">Synchronizes your data with Nightscout</string>
|
||||
|
@ -630,6 +631,7 @@
|
|||
<string name="free_peak_oref">Free-Peak Oref</string>
|
||||
<string name="rapid_acting_oref">Rapid-Acting Oref</string>
|
||||
<string name="ultrarapid_oref">Ultra-Rapid Oref</string>
|
||||
<string name="lyumjev">Lyumjev</string>
|
||||
<string name="dia_too_short">DIA of %1$f too short - using %2$f instead!</string>
|
||||
<string name="activate_profile">Activate profile</string>
|
||||
<string name="invalid">INVALID</string>
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package info.nightscout.androidaps.plugins.insulin
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.interfaces.InsulinInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mockito.ArgumentMatchers.eq
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.mockito.junit.MockitoJUnit
|
||||
import org.mockito.junit.MockitoRule
|
||||
|
||||
class InsulinLyumjevPluginTest {
|
||||
|
||||
@get:Rule
|
||||
val mockitoRule: MockitoRule = MockitoJUnit.rule()
|
||||
|
||||
private lateinit var sut: InsulinLyumjevPlugin
|
||||
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var rxBus: RxBusWrapper
|
||||
@Mock lateinit var profileFunction: ProfileFunction
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
|
||||
private var injector: HasAndroidInjector = HasAndroidInjector {
|
||||
AndroidInjector {
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
sut = InsulinLyumjevPlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `simple peak test`() {
|
||||
assertEquals(45, sut.peak)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getIdTest() {
|
||||
assertEquals(InsulinInterface.OREF_LYUMJEV, sut.id)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun commentStandardTextTest() {
|
||||
`when`(resourceHelper.gs(eq(R.string.lyumjev))).thenReturn("Lyumjev")
|
||||
assertEquals("Lyumjev", sut.commentStandardText())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getFriendlyNameTest() {
|
||||
`when`(resourceHelper.gs(eq(R.string.lyumjev))).thenReturn("Lyumjev")
|
||||
assertEquals("Lyumjev", sut.friendlyName)
|
||||
}
|
||||
|
||||
}
|
|
@ -13,6 +13,7 @@ public interface InsulinInterface {
|
|||
int OREF_RAPID_ACTING = 2;
|
||||
int OREF_ULTRA_RAPID_ACTING = 3;
|
||||
int OREF_FREE_PEAK = 4;
|
||||
int OREF_LYUMJEV = 5;
|
||||
|
||||
|
||||
int getId();
|
||||
|
|
Loading…
Reference in a new issue