EROS: show discard button in engineering mode

This commit is contained in:
Milos Kozak 2022-06-25 15:53:40 +02:00
parent 9cfcf238a1
commit 00f0446c21

View file

@ -32,6 +32,7 @@ import info.nightscout.androidaps.queue.events.EventQueueChanged
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.extensions.toVisibility import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.interfaces.BuildHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.ui.UIRunnable import info.nightscout.androidaps.utils.ui.UIRunnable
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
@ -53,6 +54,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
@Inject lateinit var omnipodErosPumpPlugin: OmnipodErosPumpPlugin @Inject lateinit var omnipodErosPumpPlugin: OmnipodErosPumpPlugin
@Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor @Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor
@Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var aapsSchedulers: AapsSchedulers
@Inject lateinit var buildHelper: BuildHelper
private var disposables: CompositeDisposable = CompositeDisposable() private var disposables: CompositeDisposable = CompositeDisposable()
private val handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper) private val handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper)
@ -160,7 +162,8 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
// Only show the discard button to reset a cached Pod address before the Pod has actually been initialized // Only show the discard button to reset a cached Pod address before the Pod has actually been initialized
// Otherwise, users should use the Deactivate Pod Wizard. In case proper deactivation fails, // Otherwise, users should use the Deactivate Pod Wizard. In case proper deactivation fails,
// they will get an option to discard the Pod state there // they will get an option to discard the Pod state there
val discardButtonEnabled = podStateManager.hasPodState() && !podStateManager.isPodInitialized // Milos Kozak: allow to show button by activating engineering mode
val discardButtonEnabled = podStateManager.hasPodState() && (!podStateManager.isPodInitialized || buildHelper.isEngineeringMode())
binding.buttonDiscardPod.visibility = discardButtonEnabled.toVisibility() binding.buttonDiscardPod.visibility = discardButtonEnabled.toVisibility()
val pulseLogButtonEnabled = aapsOmnipodManager.isPulseLogButtonEnabled val pulseLogButtonEnabled = aapsOmnipodManager.isPulseLogButtonEnabled