Skip to content

Commit 283d7f6

Browse files
committed
Create the local database when feature flag is on
1 parent 94c3625 commit 283d7f6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

WooCommerce/Classes/POS/TabBar/POSTabCoordinator.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import SwiftUI
44
import Yosemite
55
import class WooFoundation.CurrencySettings
66
import protocol Storage.StorageManagerType
7+
import protocol Storage.GRDBManagerProtocol
78

89
/// View controller that provides the tab bar item for the Point of Sale tab.
910
/// It is never visible on the screen, only used to provide the tab bar item as all POS UI is full-screen.
@@ -26,6 +27,7 @@ final class POSTabCoordinator {
2627
private let storesManager: StoresManager
2728
private let credentials: Credentials?
2829
private let storageManager: StorageManagerType
30+
private let grdbManager: GRDBManagerProtocol?
2931
private let currencySettings: CurrencySettings
3032
private let pushNotesManager: PushNotesManager
3133
private let eligibilityChecker: POSEntryPointEligibilityCheckerProtocol
@@ -77,6 +79,13 @@ final class POSTabCoordinator {
7779
self.eligibilityChecker = eligibilityChecker
7880

7981
tabContainerController.wrappedController = POSTabViewController()
82+
83+
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleLocalCatalogi1) {
84+
self.grdbManager = ServiceLocator.grdbManager
85+
logDatabaseSchema()
86+
} else {
87+
self.grdbManager = nil
88+
}
8089
}
8190

8291
func onTabSelected() {
@@ -155,3 +164,11 @@ private extension POSTabCoordinator {
155164
TracksProvider.setPOSMode(isPointOfSaleActive)
156165
}
157166
}
167+
168+
private extension POSTabCoordinator {
169+
func logDatabaseSchema() {
170+
try? grdbManager?.databaseConnection.read { db in
171+
return try db.dumpSchema()
172+
}
173+
}
174+
}

0 commit comments

Comments
 (0)