-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Take2: allow NON_US share server and custom share server #509
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
Conversation
ps2
left a comment
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.
Looking good!
| options: [ | ||
| (title: NSLocalizedString("US", comment: "U.S. share server option title"), | ||
| value: DexcomShareURL.absoluteString) | ||
| value: DexcomShareURL.absoluteString), |
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.
DexcomShareURL should be replaced everywhere with the new string constants from Mark’s lib
| if let username = username, let password = password, url != nil { | ||
| isAuthorized = true | ||
| client = ShareClient(username: username, password: password) | ||
| client = ShareClient(username: username, password: password, shareServer: url!.absoluteString) |
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.
Should avoid use of ! with let url = url, in the if statement above
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.
Yeah, agreed. Can you explain why the url != nil was added in the first place (rather than let url = url)..?
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.
url wasn't used at that point; it would not compile with a let (would be an unused variable), so it was just a hint.
| } | ||
|
|
||
| let client = ShareClient(username: username, password: password) | ||
| let client = ShareClient(username: username, password: password, shareServer: url!.absoluteString) |
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.
Avoid !
| ) | ||
| ] | ||
|
|
||
| if customServer.characters.count > 0 { |
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.
Using nullable/optional var here would be better than counting chars.
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 started doing that, but realized having an optional set to an initial state of nil would be more difficult to grasp for novice users not accustomed to editing code, instead of editing just the contents between two quotation marks.
I guess i could use an optional with a more extensive description
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.
Or maybe don't even set a string at all in the no-custom-server case; just have a block of code that is completely commented out.
|
|
||
| init(username: String?, password: String?, url: URL?) { | ||
| // change the contents of the variable below to point to your custom share server | ||
| let customServer = "" |
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.
Feel free to expand upon how to do this; like linking to your repo/blog. Also, do you want to describe how to change the name as shown in the UI from "Custom"?
|
The requested changes should now been added. Please verify :) |
This adds an option to select US and NON_US share servers in the GUI. Also, if the customServer variable is filled out, a third option for selecting "Custom" share server will appear in the GUI