Insulin -> plugins module

This commit is contained in:
Milos Kozak 2022-11-02 14:05:50 +01:00
parent befd4253b5
commit 2f85abbc84
25 changed files with 89 additions and 64 deletions

View file

@ -36,7 +36,7 @@ import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin
import info.nightscout.plugins.insulin.InsulinOrefFreePeakPlugin
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin

View file

@ -23,6 +23,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule
import info.nightscout.androidaps.plugins.pump.omnipod.dash.di.OmnipodDashModule
import info.nightscout.androidaps.plugins.pump.omnipod.eros.di.OmnipodErosModule
import info.nightscout.implementation.di.CommandQueueModule
import info.nightscout.plugins.di.InsulinModule
import info.nightscout.plugins.di.SMSCommunicatorModule
import info.nightscout.shared.di.SharedModule
import info.nightscout.ui.di.UiModule
@ -69,7 +70,8 @@ import javax.inject.Singleton
DiaconnG8Module::class,
OpenHumansModule::class,
SharedModule::class,
UiModule::class
UiModule::class,
InsulinModule::class
]
)
interface AppComponent : AndroidInjector<MainApp> {

View file

@ -43,7 +43,6 @@ import info.nightscout.androidaps.plugins.general.overview.OverviewFragment
import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWizardDialog
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolFragment
import info.nightscout.androidaps.plugins.general.wear.WearFragment
import info.nightscout.androidaps.plugins.insulin.InsulinFragment
import info.nightscout.androidaps.plugins.profile.local.LocalProfileFragment
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpFragment
import info.nightscout.androidaps.plugins.source.BGSourceFragment
@ -63,7 +62,6 @@ abstract class FragmentsModule {
@ContributesAndroidInjector abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment
@ContributesAndroidInjector abstract fun contributesFoodFragment(): FoodFragment
@ContributesAndroidInjector abstract fun contributesInsulinFragment(): InsulinFragment
@ContributesAndroidInjector abstract fun contributesLocalProfileFragment(): LocalProfileFragment
@ContributesAndroidInjector abstract fun contributesObjectivesFragment(): ObjectivesFragment
@ContributesAndroidInjector abstract fun contributesOpenAPSFragment(): OpenAPSFragment

View file

@ -37,10 +37,10 @@ import info.nightscout.androidaps.plugins.general.themes.ThemeSwitcherPlugin
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin
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
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.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin

View file

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

View file

@ -0,0 +1,13 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorFragment">
<TextView
android:id="@+id/log"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
</ScrollView>

View file

@ -32,7 +32,6 @@
<string name="key_smscommunicator_settings" translatable="false">smscommunicator</string>
<string name="key_protection_settings" translatable="false">protection</string>
<string name="key_absorption_category_settings" translatable="false">absorption_category_settings</string>
<string name="key_insulin_oref_peak_settings" translatable="false">insulin_oref_peak_settings</string>
<string name="key_ns_temporary_target_last_synced_id" translatable="false">ns_temporary_target_last_sync</string>
<string name="key_ns_temporary_target_new_data_id" translatable="false">temporary_target_new_data_id</string>
<string name="key_ns_glucose_value_last_synced_id" translatable="false">ns_glucose_value_last_sync</string>
@ -70,10 +69,6 @@
<string name="description_config_builder">Used for configuring the active plugins</string>
<string name="description_objectives">Learning program</string>
<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>
<string name="description_ama">State of the algorithm in 2017</string>
@ -225,7 +220,6 @@
<string name="button3">Button 3</string>
<string name="units_colon">Units:</string>
<string name="units">Units</string>
<string name="dia">DIA</string>
<string name="prefs_range_title">Range for Visualization</string>
<string name="prefs_range_summary">High and low mark for the charts in Overview and Smartwatch</string>
<string name="low_mark">LOW mark</string>
@ -335,9 +329,6 @@
<string name="ns_logappstartedevent">Log app start to NS</string>
<string name="restartingapp">Exiting application to apply settings.</string>
<string name="configbuilder_insulin_description">Which type of insulin are you using?</string>
<string name="fastactinginsulincomment">Novorapid, Novolog, Humalog</string>
<string name="ultrafastactinginsulincomment">Fiasp</string>
<string name="insulin_shortname">INS</string>
<string name="key_usesuperbolus" translatable="false">key_usersuperbolus</string>
<string name="enablesuperbolus">Enable superbolus in wizard</string>
<string name="enablesuperbolus_summary">Enable superbolus functionality in wizard. Do not enable until you learn what it really does. IT MAY CAUSE INSULIN OVERDOSE IF USED BLINDLY!</string>
@ -437,15 +428,6 @@
<string name="enablesmb">Enable SMB</string>
<string name="enablesmb_summary">Use Super Micro Boluses instead of temp basal for faster action</string>
<string name="enableuam_summary">Detection of Unannounced meals</string>
<string name="key_insulin_oref_peak" translatable="false">insulin_oref_peak</string>
<string name="insulin_oref_peak">IOB Curve Peak Time</string>
<string name="insulin_peak_time">Peak Time [min]</string>
<string name="insulin_peak">Peak</string>
<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>
<string name="key_wizard_include_cob" translatable="false">wizard_include_cob</string>

View file

@ -0,0 +1,12 @@
package info.nightscout.plugins.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.plugins.insulin.InsulinFragment
@Module
@Suppress("unused")
abstract class InsulinModule {
@ContributesAndroidInjector abstract fun contributesInsulinFragment(): InsulinFragment
}

View file

@ -21,7 +21,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.ActivitySmscommunicatorOtpBinding
import info.nightscout.plugins.databinding.SmscommunicatorActivityOtpBinding
import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePassword
import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePasswordValidationResult
import net.glxn.qrgen.android.QRCode
@ -34,13 +34,13 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
@Inject lateinit var otp: OneTimePassword
@Inject lateinit var uel: UserEntryLogger
private lateinit var binding: ActivitySmscommunicatorOtpBinding
private lateinit var binding: SmscommunicatorActivityOtpBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
binding = ActivitySmscommunicatorOtpBinding.inflate(layoutInflater)
binding = SmscommunicatorActivityOtpBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.otpVerifyEdit.addTextChangedListener(object : TextWatcher {

View file

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

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.InsulinFragmentBinding
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.InsulinFragmentBinding
import javax.inject.Inject
class InsulinFragment : DaggerFragment() {

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.ProfileFunction
@ -9,6 +8,7 @@ import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.plugins.R
import org.json.JSONObject
import javax.inject.Inject
import javax.inject.Singleton

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.plugins.R
import info.nightscout.androidaps.data.Iob
import info.nightscout.androidaps.database.embedments.InsulinConfiguration
import info.nightscout.androidaps.database.entities.Bolus

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.plugins.R
import info.nightscout.androidaps.extensions.putInt
import info.nightscout.androidaps.extensions.storeInt
import info.nightscout.androidaps.interfaces.Config

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.plugins.R
import info.nightscout.shared.logging.AAPSLogger
import org.json.JSONObject
import javax.inject.Inject
import javax.inject.Singleton

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.plugins.R
import info.nightscout.shared.logging.AAPSLogger
import org.json.JSONObject
import javax.inject.Inject
import javax.inject.Singleton

View file

@ -2,7 +2,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.insulin.InsulinFragment">
tools:context=".insulin.InsulinFragment">
<LinearLayout
android:layout_width="match_parent"
@ -30,7 +30,7 @@
android:layout_margin="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<info.nightscout.androidaps.plugins.insulin.ActivityGraph
<info.nightscout.plugins.insulin.ActivityGraph
android:id="@+id/graph"
android:layout_width="match_parent"
android:layout_height="200dip"

View file

@ -2,7 +2,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="info.nightscout.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity">
tools:context=".general.smsCommunicator.activities.SmsCommunicatorOtpActivity">
<LinearLayout
android:id="@+id/otp_layout"

View file

@ -111,4 +111,25 @@
<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>
<!-- 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="dia">DIA</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="insulin_peak">Peak</string>
<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="dia_too_short">DIA of %1$f too short - using %2$f instead!</string>
<string name="fastactinginsulincomment">Novorapid, Novolog, Humalog</string>
<string name="ultrafastactinginsulincomment">Fiasp</string>
</resources>

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.plugins.R
import info.nightscout.shared.logging.AAPSLogger
import org.junit.Assert.assertEquals
import org.junit.Before

View file

@ -1,11 +1,9 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.data.Iob
import info.nightscout.androidaps.database.entities.Bolus
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.ProfileFunction
@ -65,7 +63,6 @@ class InsulinOrefBasePluginTest {
@Mock lateinit var profileFunction: ProfileFunction
@Mock lateinit var rxBus: RxBus
@Mock lateinit var aapsLogger: AAPSLogger
@Mock lateinit var activePlugin: ActivePlugin
@Mock lateinit var config: Config
@Mock lateinit var hardLimits: HardLimits

View file

@ -1,8 +1,7 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.interfaces.Insulin
@ -10,6 +9,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.plugins.R
import info.nightscout.shared.sharedPreferences.SP
import org.junit.Assert.assertEquals
import org.junit.Before
@ -25,7 +25,7 @@ import org.mockito.Mockito.`when`
class InsulinOrefFreePeakPluginTest : TestBase() {
lateinit var sut: InsulinOrefFreePeakPlugin
private lateinit var sut: InsulinOrefFreePeakPlugin
@Mock lateinit var sp: SP
@Mock lateinit var rh: ResourceHelper

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.plugins.R
import info.nightscout.shared.logging.AAPSLogger
import org.junit.Assert.assertEquals
import org.junit.Before

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.insulin
package info.nightscout.plugins.insulin
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.plugins.R
import info.nightscout.shared.logging.AAPSLogger
import org.junit.Assert.assertEquals
import org.junit.Before