[Woo POS] Update connection status when reader turned off #14994
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.
Closes: #14992
Merge after: #14990
Description
When we get a reader status change from the underlying
CardPresentPaymentStore
, we should always republish that to POS.Previously, we would treat empty arrays of readers from the store (nil in the
connectedReaderPublisher
) as something we don’t have to pass on, when in reality they likely represent a disconnection originating outside the app (e.g. turning the reader off, bluetooth failure, or the battery running out.)This PR updates the handling to treat these cases as a
disconnected
reader, so now the UI will update accordingly.Steps to reproduce
Connect your reader
again.Testing information
This makes other bugs reproducible: #13738 and #13876 (which are probably the same issue) – I'll tackle these separately.
I attempted to add unit tests for this, but the nature of the facade layer made this unfeasible without major changes. It's a problem with the combination of async and combine...
Screenshots
update.card.reader.status.when.turned.off.mp4
RELEASE-NOTES.txt
if necessary.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: