-
Notifications
You must be signed in to change notification settings - Fork 0
Work on Changesets in API transmission #86
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
… on AnnotationView screen
|
|
||
| class ChangesetService { | ||
|
|
||
| private enum Constants { |
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 a small point, but we can later move the constants to the global constants file, for better centralization, or at least in a common folder for constants.
| static let workspaceId = "168" | ||
| } | ||
|
|
||
| static let shared = ChangesetService() |
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 like the idea of using singletons, and imo we should have used something like that for the SharedImageData as well (along with adding it to a global store, instead of passing it to every view)
| """ | ||
| <osmChange version="0.6" generator="GIG Change generator"> | ||
| <create> | ||
| <node id="-1" lat="\(nodeData.latitude)" lon="\(nodeData.longitude)" changeset="\(changesetId)" /> |
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.
We will have to of course, work on generalizing this on any kind of output that we get from the post-processed output of AnnotationView.
| } | ||
| .navigationBarTitle("Camera View", displayMode: .inline) | ||
| .onAppear { | ||
| openChangeset() |
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 confirm, this is the only change that has been added to openChangeset right?
Kinda confused due to the spacing changes.
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.
If the change set creation fails, then I am not sure we should be proceeding with the ContentView recording since it will be for nothing.
Let's see what kind of response we can decide upon if that happens.
I am not a fan of crashing the application, but we will have to have a retry option.
|
The changes look good to me as they are. |
|
So I had to push my own PR which was a long time due. |
| guard let xmlData = """ | ||
| <osm> | ||
| <changeset> | ||
| <tag k="created_by" v="GIG 1.0(4)" /> |
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.
In the new PR that we raise for change sets (I think we will have to considering the conflicts), we should change this to match our own arguments.
Maybe for now: created_by = iOSPointMapper
comment can be left blank for now.
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.
Both "created_by" and "comment" are according to the documentation (4 b Open a changeset): https://docs.google.com/document/d/1qPSW5pYmVb-RXOiryBm452sLfTvFl38f_TCO4SElkSY/edit?tab=t.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.
I resolved merge conflicts
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.
Yes, but that example input is for GoInfoGame. We are a different creator, so we should be having our own identifier.
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.
Ah cool. Let's proceed with this PR then
| private(set) var changesetId: String? | ||
|
|
||
| func openChangeset(completion: @escaping (Result<String, Error>) -> Void) { | ||
| guard let url = URL(string: "\(Constants.baseUrl)/changeset/create"), |
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.
So the fact that we now have two Constants structs will lead to confusion.
No problem tho, we will move all this to an ideal place in a future refactor.
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 is not a problem because the Constants enum is private for each struct
| }.resume() | ||
| } | ||
|
|
||
| func closeChangeset(completion: @escaping (Result<Void, Error>) -> Void) { |
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 think if we should be closing the ChangeSet in the ContentView as well, every time the back button is clicked.
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.
Nevermind. Change sets are generally closed automatically when this happens
himanshunaidu
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.
I am still approving and merging this request for now as it does what it is intended to do, but in the second PR we will take the comments into account.
According to the issue #84 :
Created ChangesetService:
Integrated ChangesetService in ContentView:
Integrated ChangesetService in AnnotationView:
Updated the button label in AnnotationView: