-
Notifications
You must be signed in to change notification settings - Fork 116
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
Store Product Image Upload statuses in UserDefaults #15264
Merged
pmusolino
merged 30 commits into
trunk
from
feat/save-product-image-upload-statuses-in-user-defaults-part-5
Mar 28, 2025
Merged
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
31e2a56
Add custom Equatable implementation for ProductImage
pmusolino 4627217
feat: use feature flag in `ProductImageUploader` and implement `Produ…
pmusolino 5f9112b
refactor: Update ProductImageStatusStorage and ProductImageUploader t…
pmusolino 38ae4e6
fix: lint warning
pmusolino e563a29
Merge branch 'feat/save-product-image-upload-statuses-in-user-default…
pmusolino 36efa22
update: variable name
pmusolino 817d080
Merge branch 'feat/save-product-image-upload-statuses-in-user-default…
pmusolino 3540180
feat: new unit tests for `ProductImageUploader` managing `backgroundP…
pmusolino 3a14b53
fix: improve error handling for image upload failures in `ProductImag…
pmusolino c720b67
Update WooCommerce/WooCommerceTests/ViewRelated/Products/Media/Produc…
pmusolino 12f4c1b
rename method name in test
pmusolino ab508e5
update: remove optional chaining from `userDefaultsStatuses` in `Prod…
pmusolino 927e199
- Remove unused code in `MockProductImageUploader.swift`
pmusolino a3f7fd4
revert: submodule pushed by mistake
pmusolino 53c87cc
Replace `userDefaultsStatuses` with `imageStatusStorage` throughout `…
pmusolino 5e34cfc
fix: imageStatusStorage.clearAllStatuses()
pmusolino ff2a952
- Remove storage update for failed image upload when feature flag is …
pmusolino 2607997
refactor: simplify notification scheduling for background image uploa…
pmusolino 782291e
refactor: remove unnecessary status observation for background image …
pmusolino cd388b6
update: removed unused variable
pmusolino 0d4be44
refactor: improve test for image upload handling and unsaved changes …
pmusolino b952002
refactor: enhance active upload tracking `test_activeUploads_are_trac…
pmusolino 2a7d9e5
Refactor: the ProductImageUploader initializer to accept imageStatusS…
pmusolino 8235551
Merge branch 'feat/save-product-image-upload-statuses-in-user-default…
pmusolino 5b719e4
fix: Exclude error updates for products being edited in ProductImageU…
pmusolino e20a9c0
fix: Use a unique UserDefaults name for each test in ProductImageUplo…
pmusolino b81ea1c
fix: failing unit test because of generic PHAsset
pmusolino 9ef4dd7
Merge branch 'feat/save-product-image-upload-statuses-in-user-default…
pmusolino ab5748a
update: removed `test_replaceLocalID_is_called_when_flag_enabled` sin…
pmusolino 1afd492
Merge branch 'trunk' into feat/save-product-image-upload-statuses-in-…
pmusolino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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 filter is redundant because we already check for this in
observeImageUploads
.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 do not think it's redundant because
errorsSubject
can receive error events from other places inProductImageUploader
besidesobserveImageUploads
. For instance, if you look at thesaveProductImagesWhenNoneIsPendingUploadAnymore
method, it callserrorsSubject.send(...)
directly when saving fails, without checkingstatusUpdatesExcludedProductKeys
. Because of that, the filter on errorSubject acts as a "final gatekeeper" ensuring that errors tied to excluded keys are reliably discarded no matter where inProductImageUploader
they're sent.If the only place errors were published was
observeImageUploads
and it always checked for excluded keys, then thefilter
might be redundant, but given errors can come from more than one place, I believe the filter is necessary to ensure excluded keys never emit errors. Wdyt?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 it was intentional that the save product errors were not filtered out. We were only filtering out upload errors because we also listened to the product form errors. The background saving is handled separately from the product form, so any failures would still be displayed. But this code exists before I joined the project so I'm not entirely sure.
If you feel strongly about hiding the background saving failures when the product form is present, please keep the current change.