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

View file

@ -8,6 +8,6 @@ enum class BeepRepetitionType(
XXX(0x01.toByte()), // Used in lump of coal alert, LOW_RESERVOIR XXX(0x01.toByte()), // Used in lump of coal alert, LOW_RESERVOIR
XXX2(0x03.toByte()), // Used in USER_SET_EXPIRATION XXX2(0x03.toByte()), // Used in USER_SET_EXPIRATION
XXX3(0x05.toByte()), // published system expiration alert 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 XXX5(0x08.toByte()); // Lump of coal alert
} }

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_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_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> </resources>

View file

@ -93,6 +93,11 @@
android:key="@string/key_omnipod_common_notification_uncertain_bolus_sound_enabled" android:key="@string/key_omnipod_common_notification_uncertain_bolus_sound_enabled"
android:title="@string/omnipod_common_preferences_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>
<PreferenceCategory <PreferenceCategory