Repository navigation
Conversation
|
@jlucasvt this PR has your app icons and other project changes in it. I can't merge it unless you revert those changes and squash; it's probably easier to create a clean branch from loop/dev. I will do some code review later this weekend to help you along with future PRs. |
|
I see after I submitted the PR that it was messed up. I assume I can pull from loudnate/Loop Dev to a Local Branch |
|
|
||
| // Remaining Volume HUD for x22 pumps | ||
| if reservoirVolume > 0 { | ||
| switch NSUserDefaults.standardUserDefaults().pumpModelNumber! { |
There was a problem hiding this comment.
There's no guarantee this value exists, so force-unwrapping it could cause users to crash (especially first-time users or those who recently switched pump IDs).
It also should be made available to users with other pumps who might not have sentry packets configured for any reason, so it would be better in an else block on line 202/211:
} else if let capacity = dataManager.pumpState?.pumpModel?.reservoirCapacity {
reservoirLevel = min(1, max(0, Double(reservoirVolume / capacity) / 100)
}I know you expressed hesitation about adding reservoirCapacity to the rileylink_ios repo, but that doesn't prevent you from temporarily extending the PumpModel enum in this code base.
Extensions/PumpModel.swift
extension PumpModel {
private var size: Int {
return Int(rawValue)! / 100
}
var reservoirCapacity: Int {
switch size {
case 5:
return 176
case 7:
return 300
default:
fatalError("Unknown reservoir capacity for PumpModel.\(self)")
}
}
}|
Thank you for the Swift lesson. I hope I found all the spaces. I Added the PumpModel extension and Modified the codebase to use extension and handle the unrwapped val. |
| @@ -0,0 +1,27 @@ | |||
| // | |||
| // PumpModel.swift | |||
There was a problem hiding this comment.
There's still tabs in this file,
|
New changes look good (with a few comments) but this still needs to be squashed and rebased against dev. |
|
Closing this request and re-submitting under dev branch squash of only changes. |
Added 722 and 522 HUD Reservoir Status display. I know you want to add the Model volumes to PumpModel Enum in MinimedKit (in rileylink_ios) but those mods are in source outside my current capacity at the moment (I think).