Fix carb entry bug, Issue 2307#557
Open
marionbarker wants to merge 2 commits intodevfrom
Open
Conversation
Contributor
|
This version does not allow "," as decimal separator. If I enter "0,5", I get "5". |
Contributor
Author
|
I tested this with 2 phones. One set for "." as a decimal separator and one for "," as a decimal separator. It does prevent the case of ",05" or ".05" being interpreted as "5" g for both types of separators. There is a difference in behavior depending on the separator:
|
ps2
reviewed
Apr 22, 2025
Collaborator
ps2
left a comment
There was a problem hiding this comment.
Not great from a locale-supporting standpoint, but I see the separatory is covered.
| if let number = formatter.number(from: input) { | ||
| quantity = number.doubleValue | ||
| let decimalSeparator = formatter.decimalSeparator ?? "." | ||
| let allowedCharacters = "0123456789" + decimalSeparator |
Collaborator
There was a problem hiding this comment.
Has anyone tested that this works for arabic/persian locales?
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
Fix for Loop Issue 2307.
Method
I asked for help on solving this and got a suggestion from @bjorkert (thanks).
Once the file that needed to be modified was identified, I checked the status of that file in the
tidepool-mergebranch,LoopKit/LoopKitUI/CarbKit/CarbQuantityRow.swifttidepool-mergeversiontidepool-mergeversionminAllowedCarbEntryof 1.0 (instead of using hard-coded 1.0) and required the entry be >=minAllowedCarbEntrybefore the continue button is enabledI'm happy to modify this as desired.
Test
This fixes the reported bug: