implement setTime. handle timezone changes
This commit is contained in:
parent
1f65ee38c7
commit
72f819b80d
3 changed files with 19 additions and 16 deletions
|
@ -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 {
|
||||
|
@ -1252,14 +1253,20 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
"Time, Date and/or TimeZone changed. [timeChangeType=" + timeChangeType.name + ", eventHandlingEnabled=" + eventHandlingEnabled + "]"
|
||||
)
|
||||
|
||||
if (timeChangeType == TimeChangeType.TimeChanged) {
|
||||
aapsLogger.info(LTag.PUMP, "Ignoring time change because it is not a DST or TZ change")
|
||||
return
|
||||
} else if (!podStateManager.isPodRunning) {
|
||||
aapsLogger.info(LTag.PUMP, "Ignoring time change because no Pod is active")
|
||||
return
|
||||
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
|
||||
}
|
||||
!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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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>
|
Loading…
Reference in a new issue