forked from LoopKit/Loop
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix override range display, mmol/L limits #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
396df06
Make mmol/L graph limits be integers
elnjensen a1d21d9
Force minimum height for dated range rects
elnjensen 6a6c531
Make target ranges more visible
elnjensen 0b25d2e
Only show future part of override ranges
elnjensen c4800fb
Revert "Only show future part of override ranges"
elnjensen b6b4ec3
Expire overrides once they move into past
elnjensen f168e16
Set min range height via variable
elnjensen 5db1eb5
Rearrange image assets for graph menu
elnjensen e1c3886
Clarify minimum height on dated range
elnjensen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-2.6 KB
...sets.xcassets/Graph menu icons/1-hour-graph-38mm.imageset/1-hour-graph-38mm.png
Binary file not shown.
13 changes: 0 additions & 13 deletions
13
WatchApp/Assets.xcassets/Graph menu icons/1-hour-graph-38mm.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-2.62 KB
...sets.xcassets/Graph menu icons/1-hour-graph-42mm.imageset/1-hour-graph-42mm.png
Binary file not shown.
13 changes: 0 additions & 13 deletions
13
WatchApp/Assets.xcassets/Graph menu icons/1-hour-graph-42mm.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+1.03 KB
...pp/Assets.xcassets/Graph menu icons/1-hour-graph.imageset/1-hour-graph-38mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.53 KB
...pp/Assets.xcassets/Graph menu icons/1-hour-graph.imageset/1-hour-graph-42mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions
20
WatchApp/Assets.xcassets/Graph menu icons/1-hour-graph.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "idiom" : "watch", | ||
| "filename" : "1-hour-graph-38mm.png", | ||
| "screen-width" : "<=145", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "idiom" : "watch", | ||
| "filename" : "1-hour-graph-42mm.png", | ||
| "screen-width" : ">145", | ||
| "scale" : "2x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "version" : 1, | ||
| "author" : "xcode" | ||
| } | ||
| } |
Binary file removed
BIN
-2.9 KB
...sets.xcassets/Graph menu icons/2-hour-graph-38mm.imageset/2-hour-graph-38mm.png
Binary file not shown.
13 changes: 0 additions & 13 deletions
13
WatchApp/Assets.xcassets/Graph menu icons/2-hour-graph-38mm.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-3.02 KB
...sets.xcassets/Graph menu icons/2-hour-graph-42mm.imageset/2-hour-graph-42mm.png
Binary file not shown.
13 changes: 0 additions & 13 deletions
13
WatchApp/Assets.xcassets/Graph menu icons/2-hour-graph-42mm.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+1.4 KB
...pp/Assets.xcassets/Graph menu icons/2-hour-graph.imageset/2-hour-graph-38mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.9 KB
...pp/Assets.xcassets/Graph menu icons/2-hour-graph.imageset/2-hour-graph-42mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions
20
WatchApp/Assets.xcassets/Graph menu icons/2-hour-graph.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "idiom" : "watch", | ||
| "filename" : "2-hour-graph-38mm.png", | ||
| "screen-width" : "<=145", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "idiom" : "watch", | ||
| "filename" : "2-hour-graph-42mm.png", | ||
| "screen-width" : ">145", | ||
| "scale" : "2x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "version" : 1, | ||
| "author" : "xcode" | ||
| } | ||
| } |
Binary file removed
BIN
-2.97 KB
...sets.xcassets/Graph menu icons/3-hour-graph-38mm.imageset/3-hour-graph-38mm.png
Binary file not shown.
13 changes: 0 additions & 13 deletions
13
WatchApp/Assets.xcassets/Graph menu icons/3-hour-graph-38mm.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-3.08 KB
...sets.xcassets/Graph menu icons/3-hour-graph-42mm.imageset/3-hour-graph-42mm.png
Binary file not shown.
13 changes: 0 additions & 13 deletions
13
WatchApp/Assets.xcassets/Graph menu icons/3-hour-graph-42mm.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+1.62 KB
...pp/Assets.xcassets/Graph menu icons/3-hour-graph.imageset/3-hour-graph-38mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.22 KB
...pp/Assets.xcassets/Graph menu icons/3-hour-graph.imageset/3-hour-graph-42mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions
20
WatchApp/Assets.xcassets/Graph menu icons/3-hour-graph.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "idiom" : "watch", | ||
| "filename" : "3-hour-graph-38mm.png", | ||
| "screen-width" : "<=145", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "idiom" : "watch", | ||
| "filename" : "3-hour-graph-42mm.png", | ||
| "screen-width" : ">145", | ||
| "scale" : "2x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "version" : 1, | ||
| "author" : "xcode" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't make sense here, since Scaler is a implementing an API about rectangles. The fact that there's a minHeight implies that the user can specify a minimum height for whatever reason they want.
Two options:
The fact that we have a default value is really just a shortcut that's breaking the API anyway. If you really want this to be clean, then the minHeight should have no default value and we should specify "2" in the caller AND comment the caller.
Then the caller is saying "make a rectangle between these two points, but since I know that I'm drawing target ranges- also make sure that the height is 2." That's worthy of a comment, and then the Scaler API is clean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd agree with you if this were a generic rectangle-drawing function, but it's not - despite the generic title, it's a function that is always drawing a WatchDatedRange. So it doesn't make sense to imagine that there could be some other possible call to it, that would be drawing something else. That's why I didn't have it in the call when I wrote it originally. I still think it's cleaner that way, with just a minimum height in the CGSize call and a comment to explain it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify a bit more, you're saying that the comment is relevant where minHeight is defined in the call, but I disagree - it becomes relevant when you get to the point where it's actually used.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the confusion and the excessive back and forth over what probably appears to be a very minor detail. I don't think it's minor though - which I'll discuss at the end of this response.
At a high level what I'm saying that putting a comment here is a bad code smell: the code should be able to stand on its own without this level of micro comment. In my prior comment, I was suggesting two different ways that we could address this issue. I think we have 3 options, which I'll walk through.
If you were to provide a minHeight variable, and you were to set it to zero by default (ie, not overly specializing for WatchDatedRange), then you were to override the default value in the caller (eg.
scaler.rect(for: range, minHeight: 2)), you would put the comment where you do the override which would be in the caller. The comment would explain that if the minimum height is too small, the range is not visible and you'd probably only need one meta-comment for both calls.If you want to keep the minHeight default value of 2 as part of the API then you would make the comment as part of the rect API call, eg:
Any of these options resolves the problem for me, which is that we should always prefer contractual API level comments over implementation detail comments. If we don't hold the line on this, the code rapidly slides into excessive micro comments that take up space and harm maintainability.