add notification sound when delivery is suspended

This commit is contained in:
Andrei Vereha 2021-08-02 23:28:54 +02:00
parent 770a58abd2
commit 52eb723db2
5 changed files with 17 additions and 9 deletions

View file

@ -147,13 +147,12 @@ class OmnipodDashPumpPlugin @Inject constructor(
} else {
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED))
if (podStateManager.isSuspended) {
val notification =
Notification(
Notification.OMNIPOD_POD_SUSPENDED,
"Insulin delivery suspended",
Notification.NORMAL
)
rxBus.send(EventNewNotification(notification))
showNotification(
Notification.OMNIPOD_POD_SUSPENDED,
"Insulin delivery suspended",
Notification.NORMAL,
R.raw.boluserror
)
} else {
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED))
if (!podStateManager.sameTimeZone) {
@ -1391,6 +1390,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
sp.getBoolean(R.string.key_omnipod_common_notification_uncertain_tbr_sound_enabled, true)
Notification.OMNIPOD_UNCERTAIN_SMB ->
sp.getBoolean(R.string.key_omnipod_common_notification_uncertain_smb_sound_enabled, true)
Notification.OMNIPOD_POD_SUSPENDED ->
sp.getBoolean(R.string.key_omnipod_common_notification_delivery_suspended_sound_enabled, true)
else -> true
}
}

View file

@ -8,6 +8,6 @@ enum class BeepRepetitionType(
XXX(0x01.toByte()), // Used in lump of coal alert, LOW_RESERVOIR
XXX2(0x03.toByte()), // Used in USER_SET_EXPIRATION
XXX3(0x05.toByte()), // published system expiration alert
XXX4(0x06.toByte()), // Used in imminent pod expiration alert
XXX4(0x06.toByte()), // Used in imminent pod expiration alert, suspend in progress
XXX5(0x08.toByte()); // Lump of coal alert
}

View file

@ -4,6 +4,6 @@ enum class BeepType(val value: Byte) {
SILENT(0x00.toByte()),
FOUR_TIMES_BIP_BEEP(0x02.toByte()), // Used in low reservoir alert, user expiration alert, expiration alert, imminent expiration alert, lump of coal alert
XXX(0x04.toByte()), // Used during suspend
XXX(0x04.toByte()), // Used during suspend
LONG_SINGLE_BEEP(0x06.toByte()); // Used in stop delivery command
}

View file

@ -21,4 +21,6 @@
<string name="key_omnipod_common_preferences_category_confirmation_beeps" translatable="false">omnipod_common_preferences_category_confirmation</string>
<string name="key_common_preferences_category_other_settings" translatable="false">common_preferences_category_other</string>
<string name="key_omnipod_common_notification_delivery_suspended_sound_enabled">AAPS.Omnipod.notification_delivery_suspended_sound_enabled</string>
<string name="omnipod_common_preferences_notification_delivery_suspended_sound_enabled">Sound when delivery suspended notification enabled</string>
</resources>

View file

@ -93,6 +93,11 @@
android:key="@string/key_omnipod_common_notification_uncertain_bolus_sound_enabled"
android:title="@string/omnipod_common_preferences_notification_uncertain_bolus_sound_enabled" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_omnipod_common_notification_delivery_suspended_sound_enabled"
android:title="@string/omnipod_common_preferences_notification_delivery_suspended_sound_enabled" />
</PreferenceCategory>
<PreferenceCategory