[Local catalog] Ignore time based sync eligibility inside POS #16423
+70
−13
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.

Description
This PR improves some theoretical issues with sync eligibility checking. I've not been able to really recreate these, but you probably could if you left an iPad in kiosk mode for a month or more.
We determine time-based sync eligibility based on:
These criteria are designed for syncs which are performed when POS isn't in use… if someone's actively using POS, they don't make sense.
To fix it, we can just ignore the time-based sync eligibility criteria when POS is actually in use. I achieved this by checking for a max catalog age of zero in a refresh. When that's true, we’re forcing a sync – e.g. because of a pull to refresh, or a full sync from settings, or after a purchase.
When we do this, we should ignore temporal reasons for not syncing. Otherwise, it’s possible to get into a position where syncs don’t work any more even though they should.
Test Steps
.daywith.secondin all instances in POSCatalogSyncCoordinatorRELEASE-NOTES.txtif necessary.