Skip to content

Conversation

@mariana0412
Copy link
Contributor

According to the issue #84 :

  • Created ChangesetService:

    • Provides methods for opening a changeset, uploading changes, and closing a changeset;
    • Includes a changesetId property to track the currently opened changeset;
    • Implemented as a Singleton to be accessible in both ContentView and AnnotationView.
  • Integrated ChangesetService in ContentView:

    • A changeset is opened when ContentView appears.
  • Integrated ChangesetService in AnnotationView:

    • Changes are uploaded to the currently opened changeset when the user taps the "Next" button;
    • The changeset is closed after the user processes the last frame.
  • Updated the button label in AnnotationView:

    • The "Next" button changes to "Finish" when the user reaches the last frame.

@mariana0412 mariana0412 self-assigned this Nov 18, 2024
@himanshunaidu himanshunaidu changed the base branch from main to feature/login November 20, 2024 23:56
@himanshunaidu himanshunaidu changed the base branch from feature/login to main November 20, 2024 23:56

class ChangesetService {

private enum Constants {
Copy link
Collaborator

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()
Copy link
Collaborator

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)" />
Copy link
Collaborator

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()
Copy link
Collaborator

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.

Copy link
Collaborator

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.

@himanshunaidu
Copy link
Collaborator

The changes look good to me as they are.
I am not currently sure if we should be merging this immediately, maybe we will.
Let's give it some time before making the call.
I am hoping to merge my own class correction PRs, and we will check accordingly.

@himanshunaidu
Copy link
Collaborator

So I had to push my own PR which was a long time due.
This has caused some conflicts in ContentView.
Be wary while resolving the merge conflicts. I have changed the other views such as AnnotationView quite significantly, so the code in ContentView that reference these views are also changed.

guard let xmlData = """
<osm>
<changeset>
<tag k="created_by" v="GIG 1.0(4)" />
Copy link
Collaborator

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.

Copy link
Contributor Author

@mariana0412 mariana0412 Dec 11, 2024

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved merge conflicts

Copy link
Collaborator

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.

Copy link
Collaborator

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"),
Copy link
Collaborator

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.

Copy link
Contributor Author

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) {
Copy link
Collaborator

@himanshunaidu himanshunaidu Dec 12, 2024

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.

Copy link
Collaborator

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

Copy link
Collaborator

@himanshunaidu himanshunaidu left a 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.

@himanshunaidu himanshunaidu merged commit 51bd3f9 into main Dec 12, 2024
@himanshunaidu himanshunaidu linked an issue Dec 12, 2024 that may be closed by this pull request
@himanshunaidu himanshunaidu deleted the feature/manage-changesets branch January 8, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Work on Changesets in API transmission

3 participants