notification sounds
This commit is contained in:
parent
bf7ad8e697
commit
5283295eda
3 changed files with 57 additions and 8 deletions
|
@ -13,7 +13,11 @@
|
|||
<string name="key_omnipod_common_low_reservoir_alert_units" translatable="false">AAPS.Omnipod.low_reservoir_alert_units</string>
|
||||
<string name="key_omnipod_common_automatically_silence_alerts_enabled" translatable="false">AAPS.Omnipod.automatically_acknowledge_alerts_enabled</string>
|
||||
<string name="key_common_preferences_category_alerts_settings" translatable="false">common_preferences_category_alerts</string>
|
||||
|
||||
<string name="key_omnipod_common_preferences_category_notifications_settings"
|
||||
translatable="false">common_preferences_category_notifications_settings</string>
|
||||
<string name="key_omnipod_common_notification_uncertain_tbr_sound_enabled" translatable="false">AAPS.Omnipod.notification_uncertain_tbr_sound_enabled</string>
|
||||
<string name="key_omnipod_common_notification_uncertain_smb_sound_enabled" translatable="false">AAPS.Omnipod.notification_uncertain_smb_sound_enabled</string>
|
||||
<string name="key_omnipod_common_notification_uncertain_bolus_sound_enabled" translatable="false">AAPS.Omnipod.notification_uncertain_bolus_sound_enabled</string>
|
||||
<!-- Omnipod - Pod Management -->
|
||||
<string name="omnipod_common_pod_management_title">Pod Management</string>
|
||||
<string name="omnipod_common_pod_management_heading_actions">Actions</string>
|
||||
|
@ -132,6 +136,11 @@
|
|||
<string name="omnipod_common_preferences_category_other">Other</string>
|
||||
<string name="omnipod_common_preferences_category_alerts">Alerts</string>
|
||||
<string name="omnipod_common_preferences_category_confirmation_beeps">Confirmation Beeps</string>
|
||||
<string name="omnipod_common_preferences_category_notifications">Notifications</string>
|
||||
<string name="omnipod_common_preferences_notification_uncertain_tbr_sound_enabled">Sound for uncertain TBR notifications enabled</string>
|
||||
<string name="omnipod_common_preferences_notification_uncertain_smb_sound_enabled">Sound for
|
||||
uncertain SMB notifications enabled</string>
|
||||
<string name="omnipod_common_preferences_notification_uncertain_bolus_sound_enabled">Sound for uncertain bolus notifications enabled</string>
|
||||
|
||||
<!-- Omnipod - Pod Status -->
|
||||
<string name="omnipod_common_pod_status_no_active_pod">No Active Pod</string>
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -65,11 +65,34 @@
|
|||
validate:maxNumber="50"
|
||||
validate:minNumber="5"
|
||||
validate:testType="numericRange" />
|
||||
<!--
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/key_omnipod_common_automatically_silence_alerts_enabled"
|
||||
android:title="@string/omnipod_common_preferences_automatically_silence_alerts" />
|
||||
-->
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="@string/key_omnipod_common_preferences_category_notifications_settings"
|
||||
android:title="@string/omnipod_common_preferences_category_notifications"
|
||||
app:initialExpandedChildrenCount="0">
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/key_omnipod_common_automatically_silence_alerts_enabled"
|
||||
android:title="@string/omnipod_common_preferences_automatically_silence_alerts" />
|
||||
android:key="@string/key_omnipod_common_notification_uncertain_tbr_sound_enabled"
|
||||
android:title="@string/omnipod_common_preferences_notification_uncertain_tbr_sound_enabled" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_omnipod_common_notification_uncertain_smb_sound_enabled"
|
||||
android:title="@string/omnipod_common_preferences_notification_uncertain_smb_sound_enabled" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_omnipod_common_notification_uncertain_bolus_sound_enabled"
|
||||
android:title="@string/omnipod_common_preferences_notification_uncertain_bolus_sound_enabled" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
|
Loading…
Reference in a new issue