@@ -4,25 +4,25 @@ import Foundation
44/// This class serves as a bridge between the UI and the background sync manager.
55///
66final class POSCatalogSyncController {
7-
7+
88 /// Shared instance for app-wide access
99 static let shared = POSCatalogSyncController ( )
10-
10+
1111 private init ( ) { }
12-
12+
1313 /// Reference to the background sync manager from AppDelegate
1414 private var syncManager : POSCatalogSyncBackgroundTaskManager ? {
1515 return AppDelegate . shared. posCatalogSyncManager
1616 }
17-
17+
1818 // MARK: - Public Interface
19-
19+
2020 /// Checks if a full catalog sync is currently in progress
2121 var isFullSyncInProgress : Bool {
2222 // This would check the sync state - implementation depends on exposing state from the manager
2323 return false // TODO: Implement by exposing state from POSCatalogSyncBackgroundTaskManager
2424 }
25-
25+
2626 /// Starts a foreground full catalog sync that continues in background
2727 /// Returns a task that can be used to monitor progress or cancellation
2828 @discardableResult
@@ -31,29 +31,29 @@ final class POSCatalogSyncController {
3131 DDLogError ( " ⛔️ POS catalog sync manager not available " )
3232 return nil
3333 }
34-
34+
3535 DDLogInfo ( " 📱 Starting foreground POS catalog sync via controller... " )
3636 return syncManager. startForegroundFullSync ( )
3737 }
38-
38+
3939 /// Manually triggers an incremental sync (typically not needed as it's scheduled automatically)
4040 func triggerIncrementalSync( ) {
4141 guard let syncManager = syncManager else {
4242 DDLogError ( " ⛔️ POS catalog sync manager not available " )
4343 return
4444 }
45-
45+
4646 syncManager. scheduleIncrementalSync ( )
4747 DDLogInfo ( " 📱 Manually triggered incremental POS catalog sync " )
4848 }
49-
49+
5050 /// Re-schedules background syncs (useful after user settings changes)
5151 func rescheduleBackgroundSyncs( ) {
5252 guard let syncManager = syncManager else {
5353 DDLogError ( " ⛔️ POS catalog sync manager not available " )
5454 return
5555 }
56-
56+
5757 syncManager. scheduleFullCatalogSync ( )
5858 syncManager. scheduleIncrementalSync ( )
5959 DDLogInfo ( " 📱 Rescheduled POS catalog background syncs " )
@@ -62,14 +62,14 @@ final class POSCatalogSyncController {
6262
6363// MARK: - Usage Example
6464/*
65-
65+
6666 // In a POS view controller when user first logs in:
6767 if POSCatalogSyncController.shared.isFullSyncInProgress == false {
6868 let syncTask = POSCatalogSyncController.shared.startForegroundFullSync()
6969 // Show progress UI and monitor syncTask as needed
7070 }
71-
71+
7272 // In settings when user changes sync preferences:
7373 POSCatalogSyncController.shared.rescheduleBackgroundSyncs()
74-
74+
7575 */
0 commit comments