fix alerts. fix display for basal rates

This commit is contained in:
Andrei Vereha 2021-10-26 22:50:03 +02:00
parent 45fb0a5a21
commit abc051d64e
4 changed files with 5 additions and 4 deletions

View file

@ -1193,7 +1193,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
val lowReservoirAlertEnabled = sp.getBoolean(R.string.key_omnipod_common_low_reservoir_alert_enabled, true) val lowReservoirAlertEnabled = sp.getBoolean(R.string.key_omnipod_common_low_reservoir_alert_enabled, true)
val lowReservoirAlertUnits = sp.getInt(R.string.key_omnipod_common_low_reservoir_alert_units, 10) val lowReservoirAlertUnits = sp.getInt(R.string.key_omnipod_common_low_reservoir_alert_units, 10)
if (!podStateManager.differentAlertSettings( if (podStateManager.sameAlertSettings(
expirationReminderEnabled, expirationReminderEnabled,
expirationHours, expirationHours,
lowReservoirAlertEnabled, lowReservoirAlertEnabled,

View file

@ -105,7 +105,7 @@ interface OmnipodDashPodStateManager {
- after getPodStatus was successful(we have an up-to-date podStatus) - after getPodStatus was successful(we have an up-to-date podStatus)
*/ */
fun recoverActivationFromPodStatus(): String? fun recoverActivationFromPodStatus(): String?
fun differentAlertSettings(expirationReminderEnabled: Boolean, expirationHours: Int, lowReservoirAlertEnabled: Boolean, lowReservoirAlertUnits: Int): Boolean fun sameAlertSettings(expirationReminderEnabled: Boolean, expirationHours: Int, lowReservoirAlertEnabled: Boolean, lowReservoirAlertUnits: Int): Boolean
fun updateExpirationAlertSettings(expirationReminderEnabled: Boolean, expirationHours: Int): Completable fun updateExpirationAlertSettings(expirationReminderEnabled: Boolean, expirationHours: Int): Completable
fun updateLowReservoirAlertSettings(lowReservoirAlertEnabled: Boolean, lowReservoirAlertUnits: Int): Completable fun updateLowReservoirAlertSettings(lowReservoirAlertEnabled: Boolean, lowReservoirAlertUnits: Int): Completable

View file

@ -435,7 +435,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
} }
} }
override fun differentAlertSettings( override fun sameAlertSettings(
expirationReminderEnabled: Boolean, expirationReminderEnabled: Boolean,
expirationHours: Int, expirationHours: Int,
lowReservoirAlertEnabled: Boolean, lowReservoirAlertEnabled: Boolean,

View file

@ -25,8 +25,9 @@ object ProfileUtil {
val basalValueValue = pumpType.determineCorrectBasalSize(basalValue.value) val basalValueValue = pumpType.determineCorrectBasalSize(basalValue.value)
val hour = basalValue.timeAsSeconds / (60 * 60) val hour = basalValue.timeAsSeconds / (60 * 60)
stringBuilder.append((if (hour < 10) "0" else "") + hour + ":00") stringBuilder.append((if (hour < 10) "0" else "") + hour + ":00")
stringBuilder.append(" ")
stringBuilder.append(String.format(Locale.ENGLISH, "%.3f", basalValueValue)) stringBuilder.append(String.format(Locale.ENGLISH, "%.3f", basalValueValue))
stringBuilder.append(", ") stringBuilder.append(",\n")
} }
return if (stringBuilder.length > 3) stringBuilder.substring(0, stringBuilder.length - 2) else stringBuilder.toString() return if (stringBuilder.length > 3) stringBuilder.substring(0, stringBuilder.length - 2) else stringBuilder.toString()
} }