Skip to content

Commit bb38ed9

Browse files
committed
POSSystemStatusService: replace storage method with PluginsService.loadPluginInStorage.
1 parent 6ed30ff commit bb38ed9

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

Modules/Sources/Yosemite/PointOfSale/Eligibility/POSSystemStatusService.swift

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,20 @@ public struct POSPluginAndFeatureInfo {
2525
public final class POSSystemStatusService: POSSystemStatusServiceProtocol {
2626
private let remote: SystemStatusRemote
2727
private let storageManager: StorageManagerType
28+
private let pluginsService: PluginsServiceProtocol
2829

2930
public init(credentials: Credentials?, storageManager: StorageManagerType) {
3031
let network = AlamofireNetwork(credentials: credentials)
3132
self.remote = SystemStatusRemote(network: network)
3233
self.storageManager = storageManager
34+
self.pluginsService = PluginsService(storageManager: storageManager)
3335
}
3436

3537
/// Test-friendly initializer that accepts a network implementation.
3638
init(network: Network, storageManager: StorageManagerType) {
3739
self.remote = SystemStatusRemote(network: network)
3840
self.storageManager = storageManager
41+
self.pluginsService = PluginsService(storageManager: storageManager)
3942
}
4043

4144
@MainActor
@@ -54,9 +57,7 @@ public final class POSSystemStatusService: POSSystemStatusServiceProtocol {
5457
})
5558

5659
// Loads WooCommerce plugin from storage.
57-
guard let wcPlugin = storageManager.viewStorage.loadSystemPlugin(siteID: siteID,
58-
fileNameWithoutExtension: Constants.wcPluginFileNameWithoutExtension,
59-
active: true)?.toReadOnly() else {
60+
guard let wcPlugin = pluginsService.loadPluginInStorage(siteID: siteID, plugin: .wooCommerce, isActive: true) else {
6061
return POSPluginAndFeatureInfo(wcPlugin: nil, featureValue: nil)
6162
}
6263

@@ -66,12 +67,6 @@ public final class POSSystemStatusService: POSSystemStatusServiceProtocol {
6667
}
6768
}
6869

69-
private extension POSSystemStatusService {
70-
enum Constants {
71-
static let wcPluginFileNameWithoutExtension = "woocommerce"
72-
}
73-
}
74-
7570
// MARK: - Network Response Structs
7671

7772
private struct POSPluginEligibilitySystemStatus: Decodable {

0 commit comments

Comments
 (0)