This commit is contained in:
Milos Kozak 2021-10-16 13:02:42 +02:00
commit 94cc26ffea
4 changed files with 23 additions and 25 deletions

View file

@ -1031,7 +1031,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
DateFormat.format("HH:mm", Date(this.startTime))
) + "\n"
}
val (temporaryBasal, extendedBolus, _, profile) = pumpSync.expectedPumpState()
val temporaryBasal = pumpSync.expectedPumpState().temporaryBasal
temporaryBasal?.run {
ret += resourceHelper.gs(
R.string.omnipod_common_short_status_temp_basal,
@ -1169,8 +1169,9 @@ class OmnipodDashPumpPlugin @Inject constructor(
}
private fun handleTimeChange(): PumpEnactResult {
// TODO
return PumpEnactResult(injector).success(false).enacted(false).comment("NOT IMPLEMENTED")
return profileFunction.getProfile()?.let {
setNewBasalProfile(it)
} ?: PumpEnactResult(injector).success(true).enacted(false).comment("No profile active")
}
private fun updateAlertConfiguration(): PumpEnactResult {
@ -1229,7 +1230,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
expirationReminderEnabled,
expirationHours
).andThen(
podStateManager.updateExpirationAlertSettings(
podStateManager.updateLowReservoirAlertSettings(
lowReservoirAlertEnabled,
lowReservoirAlertUnits
)
@ -1252,14 +1253,20 @@ class OmnipodDashPumpPlugin @Inject constructor(
"Time, Date and/or TimeZone changed. [timeChangeType=" + timeChangeType.name + ", eventHandlingEnabled=" + eventHandlingEnabled + "]"
)
if (timeChangeType == TimeChangeType.TimeChanged) {
when {
!eventHandlingEnabled -> {
aapsLogger.info(LTag.PUMP, "Ignoring time change because automatic time handling is disabled in configuration")
return
}
timeChangeType == TimeChangeType.TimeChanged -> {
aapsLogger.info(LTag.PUMP, "Ignoring time change because it is not a DST or TZ change")
return
} else if (!podStateManager.isPodRunning) {
}
!podStateManager.isPodRunning -> {
aapsLogger.info(LTag.PUMP, "Ignoring time change because no Pod is active")
return
}
}
aapsLogger.info(LTag.PUMP, "Handling time change")
commandQueue.customCommand(CommandHandleTimeChange(false), null)

View file

@ -631,15 +631,12 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
}
private fun updateSetTimeButton() {
// TODO
/*
if (podStateManager.isPodRunning && (podStateManager.timeDeviatesMoreThan(Duration.standardMinutes(5)) || commandQueue.isCustomCommandInQueue(CommandHandleTimeChange::class.java))) {
if (podStateManager.isActivationCompleted && !podStateManager.sameTimeZone) {
buttonBinding.buttonSetTime.visibility = View.VISIBLE
buttonBinding.buttonSetTime.isEnabled = !podStateManager.isSuspended && rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
buttonBinding.buttonSetTime.isEnabled = !podStateManager.isSuspended && isQueueEmpty()
} else {
buttonBinding.buttonSetTime.visibility = View.GONE
}
*/
}
private fun isAutomaticallySilenceAlertsEnabled(): Boolean {

View file

@ -65,13 +65,9 @@ class DashInsertCannulaViewModel @Inject constructor(
null
super.disposable += omnipodManager.activatePodPart2(basalProgram, expirationHoursBeforeShutdown)
.ignoreElements()
.andThen(podStateManager.updateExpirationAlertSettings(expirationReminderEnabled, expirationHours))
.subscribeBy(
onNext = { podEvent ->
logger.debug(
LTag.PUMP,
"Received PodEvent in Pod activation part 2: $podEvent"
)
},
onError = { throwable ->
logger.error(LTag.PUMP, "Error in Pod activation part 2", throwable)
source.onSuccess(PumpEnactResult(injector).success(false).comment(I8n.textFromException(throwable, resourceHelper)))
@ -103,7 +99,6 @@ class DashInsertCannulaViewModel @Inject constructor(
pumpSerial = podStateManager.uniqueId?.toString() ?: "n/a"
)
podStateManager.updateExpirationAlertSettings(expirationReminderEnabled, expirationHours)
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED))
source.onSuccess(PumpEnactResult(injector).success(true))
}

View file

@ -109,12 +109,11 @@
android:defaultValue="false"
android:key="@string/key_omnipod_common_suspend_delivery_button_enabled"
android:title="@string/omnipod_common_preferences_suspend_delivery_button_enabled" />
<!--
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_omnipod_common_time_change_event_enabled"
android:title="@string/omnipod_common_preferences_time_change_enabled" />
-->
</PreferenceCategory>
</androidx.preference.PreferenceScreen>