-
Notifications
You must be signed in to change notification settings - Fork 121
[Local Catalog] Implement POS catalog download & parsing for full sync #16042
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
|
|
joshheald
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.
Works well, thanks!
| /// - downloadURL: Download URL of the catalog file. | ||
| /// - Returns: List of products and variations in the POS catalog. | ||
| public func downloadCatalog(for siteID: Int64, downloadURL: String) async throws -> POSCatalog { | ||
| // TODO: WOOMOB-1173 - move download task to the background using `URLSessionConfiguration.background` |
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'll have to change the function signature when we do this. I don't think it will be an async returning function any more. The app will get a callback when it's done, and have to handle the data there instead of here.
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.
Yup, the background download could be tricky as we might need to handle related events from app delegate from this part of the documentation:
If your app is in the background, the system may suspend your app while the download is performed in another process. In this case, when the download finishes, the system resumes the app and calls the UIApplicationDelegate method application(_:handleEventsForBackgroundURLSession:completionHandler:). This method receives the session identifier you created in Creating a background URL session as its second parameter.
Going to start checking out the background download implementation today.
…ated with the app yet.

For WOOMOB-1174
Description
This PR extends the
POSCatalogSyncRemoteimplementation with basic catalog download functionality and returns the catalog of products and variations. Background download will be implemented separately in WOOMOB-1173.Key Changes:
downloadCatalog()method with mapping from a full list ofPOSProductto products and variations based on whether the product type isvariationor not (the API response schema could change later, I'm keeping this mapping logic in the networking layer for now)POSCatalogto contain arrays of products and variationsdownloadCatalogendpoint including success scenarios, error handling, and edge cases. The success case uses a mock response with a simple product, variable product, and 2 associated variationsSteps to reproduce
Just CI passing is sufficient, as the remote isn't used in the app yet.
Testing information
I tested with
in the app to verify that the products & variations counts are as expected for the site.
RELEASE-NOTES.txtif necessary.