diff --git a/omnipod-common/src/main/res/values/strings.xml b/omnipod-common/src/main/res/values/strings.xml index eb3ae323c6..040757704d 100644 --- a/omnipod-common/src/main/res/values/strings.xml +++ b/omnipod-common/src/main/res/values/strings.xml @@ -13,7 +13,11 @@ AAPS.Omnipod.low_reservoir_alert_units AAPS.Omnipod.automatically_acknowledge_alerts_enabled common_preferences_category_alerts - + common_preferences_category_notifications_settings + AAPS.Omnipod.notification_uncertain_tbr_sound_enabled + AAPS.Omnipod.notification_uncertain_smb_sound_enabled + AAPS.Omnipod.notification_uncertain_bolus_sound_enabled Pod Management Actions @@ -132,6 +136,11 @@ Other Alerts Confirmation Beeps + Notifications + Sound for uncertain TBR notifications enabled + Sound for + uncertain SMB notifications enabled + Sound for uncertain bolus notifications enabled No Active Pod diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt index b73e730e5b..22fbb357ec 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt @@ -364,6 +364,8 @@ class OmnipodDashPumpPlugin @Inject constructor( } Completable.error(java.lang.IllegalStateException("Command not confirmed")) } else { + showNotification(Notification.PROFILE_SET_OK, "Profile set OK", Notification.INFO, null); + Completable.complete() } } @@ -549,9 +551,16 @@ class OmnipodDashPumpPlugin @Inject constructor( ) } else { if (podStateManager.activeCommand != null) { + val sound = if (sp.getBoolean(R.string + .key_omnipod_common_notification_uncertain_tbr_sound_enabled, + true)) + R.raw.boluserror + else + 0 + showErrorDialog( "Bolus delivery status uncertain. Refresh pod status to confirm or deny.", - R.raw.boluserror + sound ) } } @@ -1330,14 +1339,22 @@ class OmnipodDashPumpPlugin @Inject constructor( message, urgency ) - // TODO add back sound when we have options to disable it - /* - if (sound != null) { + if (sound != null && soundEnabledForNotificationType(id)) { notification.soundId = sound - }*/ + } rxBus.send(EventNewNotification(notification)) } + private fun soundEnabledForNotificationType(notificationType: Int): Boolean{ + return when(notificationType) { + Notification.OMNIPOD_TBR_ALERTS -> + 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) + else -> true + } + } + private fun dismissNotification(id: Int) { rxBus.send(EventDismissNotification(id)) } diff --git a/omnipod-dash/src/main/res/xml/omnipod_dash_preferences.xml b/omnipod-dash/src/main/res/xml/omnipod_dash_preferences.xml index 633be9fc6e..0e1d2dd11a 100644 --- a/omnipod-dash/src/main/res/xml/omnipod_dash_preferences.xml +++ b/omnipod-dash/src/main/res/xml/omnipod_dash_preferences.xml @@ -65,11 +65,34 @@ validate:maxNumber="50" validate:minNumber="5" validate:testType="numericRange" /> + + + + + android:key="@string/key_omnipod_common_notification_uncertain_tbr_sound_enabled" + android:title="@string/omnipod_common_preferences_notification_uncertain_tbr_sound_enabled" /> + + + + +