-
Notifications
You must be signed in to change notification settings - Fork 121
[Woo POS][Local Catalog] Trigger sync periodically in the system background #16244
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
Merged
staskus
merged 17 commits into
trunk
from
woomob-1095-woo-poslocal-catalog-bg-app-refresh-task-dispatching
Oct 16, 2025
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e6d4156
Merge POS catalog sync tasks into one
staskus a2d4d6b
Move TimeProvider to WooFoundation
staskus 31f5aec
Create BackgroundTaskSchedule to provide a prioritization mechanism
staskus dc026a8
Integrate BackgroundTaskSchedule into BackgroundTaskRefreshDispatcher…
staskus 9a363ce
Added various BackgroundTaskScheduleTests to verify various scenarios
staskus c3aae83
Cancel previous tasks before scheduling new ones
staskus 7abfa86
Only schedule ordersAndDashboardSync if feature flag is disabled
staskus 4dd41e5
Merge branch 'trunk' into woomob-1095-woo-poslocal-catalog-bg-app-ref…
staskus b442512
Create a performSmartSync method that decides on incremental or full …
staskus b603561
Update POSCatalogSyncCoordinator.swift
staskus 1ce075c
Improve catalog persistence logs to show number of products for a spe…
staskus 6abb109
Update catalog logs to be clear that incremental catalog is persisted…
staskus fe57312
Update POSCatalogIncrementalSyncService logs for clarity
staskus ee7506d
Add UTC suffix to smart sync logs for clarity
staskus a58294f
Fix a typo in a BackgroundTaskSchedule comment
staskus 14fd3ad
Only cancel the tasks that BackgroundTaskRefreshDispatcher handles
staskus 571f3cf
Persist preferredTaskDate to avoid any issues with the app gets termi…
staskus 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
1 change: 1 addition & 0 deletions
1
Modules/Sources/PointOfSale/Presentation/Barcode Scanning/GameControllerBarcodeParser.swift
This file contains hidden or 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
1 change: 1 addition & 0 deletions
1
Modules/Sources/PointOfSale/Presentation/Barcode Scanning/UIKitBarcodeObserver.swift
This file contains hidden or 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 hidden or 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
10 changes: 6 additions & 4 deletions
10
...ation/Barcode Scanning/TimeProvider.swift → ...ooFoundation/Utilities/TimeProvider.swift
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,18 @@ | ||
| import Foundation | ||
|
|
||
| protocol TimeProvider { | ||
| public protocol TimeProvider { | ||
| func now() -> Date | ||
| func scheduleTimer(timeInterval: TimeInterval, target: Any, selector: Selector) -> Timer | ||
| } | ||
|
|
||
| struct DefaultTimeProvider: TimeProvider { | ||
| func now() -> Date { | ||
| public struct DefaultTimeProvider: TimeProvider { | ||
| public init() {} | ||
|
|
||
| public func now() -> Date { | ||
| Date() | ||
| } | ||
|
|
||
| func scheduleTimer(timeInterval: TimeInterval, target: Any, selector: Selector) -> Timer { | ||
| public func scheduleTimer(timeInterval: TimeInterval, target: Any, selector: Selector) -> Timer { | ||
| return Timer.scheduledTimer(timeInterval: timeInterval, target: target, selector: selector, userInfo: nil, repeats: false) | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
1 change: 1 addition & 0 deletions
1
...sts/PointOfSaleTests/Presentation/Barcode Scanning/GameControllerBarcodeParserTests.swift
This file contains hidden or 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
1 change: 1 addition & 0 deletions
1
Modules/Tests/PointOfSaleTests/Presentation/Barcode Scanning/MockTimeProvider.swift
This file contains hidden or 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 hidden or 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 hidden or 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.
TIL about
PersistedSite, just for context this seems to be the table that holds each site's ID and associated catalog and sync details, in GRDB?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.
Yes,
Persistedprefix is used forGRDBentities. I'm not sure if that's great naming. We discussed that we may move all theGRDBstuff into a separate module, maybe we could ditch the prefixes.