This commit is contained in:
Andrei Vereha 2021-07-17 11:45:28 +02:00
parent e98e1fb485
commit b9af0c3f6f
4 changed files with 20 additions and 9 deletions

View file

@ -364,7 +364,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
} }
Completable.error(java.lang.IllegalStateException("Command not confirmed")) Completable.error(java.lang.IllegalStateException("Command not confirmed"))
} else { } else {
showNotification(Notification.PROFILE_SET_OK, "Profile set OK", Notification.INFO, null); showNotification(Notification.PROFILE_SET_OK, "Profile set OK", Notification.INFO, null)
Completable.complete() Completable.complete()
} }
@ -413,6 +413,14 @@ class OmnipodDashPumpPlugin @Inject constructor(
it.isChanged( it.isChanged(
resourceHelper, resourceHelper,
R.string.key_omnipod_common_expiration_reminder_hours_before_shutdown R.string.key_omnipod_common_expiration_reminder_hours_before_shutdown
) ||
it.isChanged(
resourceHelper,
R.string.key_omnipod_common_low_reservoir_alert_enabled
) ||
it.isChanged(
resourceHelper,
R.string.key_omnipod_common_low_reservoir_alert_units
) )
) { ) {
commandQueue.customCommand(CommandUpdateAlertConfiguration(), null) commandQueue.customCommand(CommandUpdateAlertConfiguration(), null)
@ -551,9 +559,12 @@ class OmnipodDashPumpPlugin @Inject constructor(
) )
} else { } else {
if (podStateManager.activeCommand != null) { if (podStateManager.activeCommand != null) {
val sound = if (sp.getBoolean(R.string val sound = if (sp.getBoolean(
R.string
.key_omnipod_common_notification_uncertain_bolus_sound_enabled, .key_omnipod_common_notification_uncertain_bolus_sound_enabled,
true)) true
)
)
R.raw.boluserror R.raw.boluserror
else else
0 0
@ -1345,8 +1356,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
rxBus.send(EventNewNotification(notification)) rxBus.send(EventNewNotification(notification))
} }
private fun soundEnabledForNotificationType(notificationType: Int): Boolean{ private fun soundEnabledForNotificationType(notificationType: Int): Boolean {
return when(notificationType) { return when (notificationType) {
Notification.OMNIPOD_TBR_ALERTS -> Notification.OMNIPOD_TBR_ALERTS ->
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 ->

View file

@ -41,7 +41,7 @@ interface OmnipodDashManager {
fun deactivatePod(): Observable<PodEvent> fun deactivatePod(): Observable<PodEvent>
fun disconnect(closeGatt: Boolean=false) fun disconnect(closeGatt: Boolean = false)
fun connect(stop: CountDownLatch): Observable<PodEvent> fun connect(stop: CountDownLatch): Observable<PodEvent>
} }

View file

@ -23,5 +23,5 @@ interface OmnipodDashBleManager {
fun pairNewPod(): Observable<PodEvent> fun pairNewPod(): Observable<PodEvent>
fun disconnect(closeGatt: Boolean=false) fun disconnect(closeGatt: Boolean = false)
} }

View file

@ -40,7 +40,7 @@ class BleCommCallbacks(
if (newState == BluetoothProfile.STATE_CONNECTED && status == BluetoothGatt.GATT_SUCCESS) { if (newState == BluetoothProfile.STATE_CONNECTED && status == BluetoothGatt.GATT_SUCCESS) {
connected.countDown() connected.countDown()
} }
if (newState == BluetoothProfile.STATE_DISCONNECTED && status != BluetoothGatt.GATT_SUCCESS ) { if (newState == BluetoothProfile.STATE_DISCONNECTED && status != BluetoothGatt.GATT_SUCCESS) {
// If status == SUCCESS, it means that we initiated the disconnect. // If status == SUCCESS, it means that we initiated the disconnect.
disconnectHandler.onConnectionLost(status) disconnectHandler.onConnectionLost(status)
} }