Resolve TODO

This commit is contained in:
Bart Sopers 2021-02-26 01:31:13 +01:00
parent 41b2602d61
commit bd0afdaf16
3 changed files with 16 additions and 11 deletions

View file

@ -14,5 +14,9 @@ enum class ActivationProgress {
PROGRAMMED_CANCEL_LOC_ETC_ALERT, PROGRAMMED_CANCEL_LOC_ETC_ALERT,
INSERTING_CANNULA, INSERTING_CANNULA,
CANNULA_INSERTED, CANNULA_INSERTED,
COMPLETED COMPLETED;
fun isBefore(other: ActivationProgress): Boolean = ordinal < other.ordinal
fun isAtLeast(other: ActivationProgress): Boolean = ordinal >= other.ordinal
} }

View file

@ -12,6 +12,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.Comm
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashPodManagementBinding import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashPodManagementBinding
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ActivationProgress
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.activation.DashPodActivationWizardActivity import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.activation.DashPodActivationWizardActivity
import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.deactivation.DashPodDeactivationWizardActivity import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.deactivation.DashPodDeactivationWizardActivity
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
@ -34,6 +36,7 @@ class DashPodManagementActivity : NoSplashAppCompatActivity() {
@Inject lateinit var injector: HasAndroidInjector @Inject lateinit var injector: HasAndroidInjector
@Inject lateinit var context: Context @Inject lateinit var context: Context
@Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var aapsSchedulers: AapsSchedulers
@Inject lateinit var podStateManager: OmnipodDashPodStateManager
private var disposables: CompositeDisposable = CompositeDisposable() private var disposables: CompositeDisposable = CompositeDisposable()
@ -46,17 +49,15 @@ class DashPodManagementActivity : NoSplashAppCompatActivity() {
setContentView(binding.root) setContentView(binding.root)
binding.buttonActivatePod.setOnClickListener { binding.buttonActivatePod.setOnClickListener {
/* TODO determine type val type: PodActivationWizardActivity.Type =
val type: PodActivationWizardActivity.Type = if (podStateManager.isPodInitialized if (podStateManager.activationProgress.isAtLeast(ActivationProgress.PRIME_COMPLETED)) {
and podStateManager.activationProgress.isAtLeast(ActivationProgress.PRIMING_COMPLETED)) { PodActivationWizardActivity.Type.SHORT
PodActivationWizardActivity.Type.SHORT } else {
} else { PodActivationWizardActivity.Type.LONG
PodActivationWizardActivity.Type.LONG }
}
*/
val intent = Intent(this, DashPodActivationWizardActivity::class.java) val intent = Intent(this, DashPodActivationWizardActivity::class.java)
intent.putExtra(PodActivationWizardActivity.KEY_TYPE, PodActivationWizardActivity.Type.LONG) intent.putExtra(PodActivationWizardActivity.KEY_TYPE, type)
startActivity(intent) startActivity(intent)
} }