Skip to content

Commit 5483fd9

Browse files
committed
Fix another round of straightforward Periphery warnings.
1 parent f5f0634 commit 5483fd9

File tree

5 files changed

+2
-130
lines changed

5 files changed

+2
-130
lines changed

WooCommerce/Classes/POS/Models/PointOfSaleAggregateModel.swift

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,10 @@ import protocol Yosemite.PointOfSaleBarcodeScanServiceProtocol
1515
import enum Yosemite.PointOfSaleBarcodeScanError
1616

1717
protocol PointOfSaleAggregateModelProtocol {
18-
var orderStage: PointOfSaleOrderStage { get }
19-
20-
var cardReaderConnectionStatus: CardPresentPaymentReaderConnectionStatus { get }
21-
func connectCardReader()
22-
func disconnectCardReader()
23-
var paymentState: PointOfSalePaymentState { get }
24-
var cardPresentPaymentAlertViewModel: PointOfSaleCardPresentPaymentAlertType? { get set }
25-
var cardPresentPaymentInlineMessage: PointOfSaleCardPresentPaymentMessageType? { get }
26-
func cancelCardPaymentsOnboarding()
27-
func trackCardPaymentsOnboardingShown()
28-
29-
var purchasableItemsController: PointOfSaleItemsControllerProtocol { get }
30-
var purchasableItemsSearchController: PointOfSaleSearchingItemsControllerProtocol { get }
31-
var couponsController: PointOfSaleCouponsControllerProtocol { get }
32-
var couponsSearchController: PointOfSaleSearchingItemsControllerProtocol { get }
33-
3418
var cart: Cart { get }
35-
func barcodeScanned(_ result: Result<String, HIDBarcodeParserError>)
3619
func addToCart(_ item: POSItem)
37-
func remove(cartItem: CartItem)
38-
func removeAllItemsFromCart(types: [CartItemType])
39-
func addMoreToCart()
40-
func startNewCart()
4120

4221
func saveSearchTerm(_ term: String, for itemType: POSItemType)
43-
44-
var orderState: PointOfSaleOrderState { get }
45-
func checkOut() async
46-
47-
func pointOfSaleClosed()
4822
}
4923

5024
@Observable final class PointOfSaleAggregateModel: PointOfSaleAggregateModelProtocol {

WooCommerce/Classes/POS/Presentation/Item Selector/ItemList.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ struct ItemListRow: View {
151151
let item: POSItem
152152
let itemActionHandler: POSItemActionHandler
153153
@Binding var activeNavigationItem: POSItem?
154-
@Environment(PointOfSaleAggregateModel.self) private var posModel
155154

156155
var body: some View {
157156
switch item {

WooCommerce/Classes/POS/Utils/POSEnvironmentKeys.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ struct SiteTimezoneKey: EnvironmentKey {
1111
static let defaultValue: TimeZone = .current
1212
}
1313

14-
struct POSDependenciesKey: EnvironmentKey {
15-
static let defaultValue: POSDependencyProviding? = nil
16-
}
17-
1814
extension EnvironmentValues {
1915
var siteTimezone: TimeZone {
2016
get { self[SiteTimezoneKey.self] }

WooCommerce/Classes/POS/Utils/PreviewHelpers.swift

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,11 @@ final class PointOfSalePreviewItemService: PointOfSaleItemServiceProtocol {
8282
.init(items: mockVariationItems, hasMorePages: true, totalItems: nil)
8383
}
8484

85-
func providePointOfSaleItems() -> [POSItem] {
86-
return mockItems
87-
}
88-
8985
func providePointOfSaleItem() -> POSOrderableItem {
9086
POSProductPreview(id: UUID(),
9187
name: "Product 1",
9288
formattedPrice: "$1.00")
9389
}
94-
95-
var fetchStrategy: PointOfSalePurchasableItemFetchStrategy = PointOfSalePreviewPurchasableItemFetchStrategy()
9690
}
9791

9892
struct PointOfSalePreviewPurchasableItemFetchStrategy: PointOfSalePurchasableItemFetchStrategy {
@@ -121,15 +115,14 @@ final class PointOfSalePreviewItemsController: PointOfSaleSearchingItemsControll
121115
@Published var itemsViewState: ItemsViewState = ItemsViewState(containerState: .loading,
122116
itemsStack: ItemsStackState(root: .loading([]),
123117
itemStates: [:]))
124-
var itemsViewStatePublisher: any Publisher<ItemsViewState, Never> { $itemsViewState }
125118

126119
func loadItems(base: ItemListBaseItem) async {
127120
switch base {
128121
case .root:
129122
itemsViewState = ItemsViewState(containerState: .content, itemsStack: ItemsStackState(root: .loaded(mockItems, hasMoreItems: true),
130123
itemStates: [:]))
131-
case .parent(let parent):
132-
await loadInitialChildItems(for: parent)
124+
case .parent:
125+
break
133126
}
134127
}
135128

@@ -145,10 +138,6 @@ final class PointOfSalePreviewItemsController: PointOfSaleSearchingItemsControll
145138
itemsViewState = ItemsViewState(containerState: .content, itemsStack: ItemsStackState(root: .loading(mockItems),
146139
itemStates: [:]))
147140
}
148-
149-
private func loadInitialChildItems(for parent: POSItem) async {
150-
// Set `itemsViewState` instead.
151-
}
152141
}
153142

154143
final class PointOfSalePreviewItemActionHandler: POSItemActionHandler {
@@ -214,13 +203,6 @@ private var mockVariationItems: [POSItem] {
214203
]
215204
}
216205

217-
final class POSConnectivityObserverPreview: ConnectivityObserver {
218-
@Published private(set) var currentStatus: ConnectivityStatus = .unknown
219-
var statusPublisher: AnyPublisher<ConnectivityStatus, Never> {
220-
$currentStatus.eraseToAnyPublisher()
221-
}
222-
}
223-
224206
struct POSPreviewHelpers {
225207
static func makePreviewAggregateModel(
226208
itemsController: PointOfSaleItemsControllerProtocol = PointOfSalePreviewItemsController(),

WooCommerce/WooCommerceTests/POS/Mocks/MockPointOfSaleAggregateModel.swift

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -5,88 +5,9 @@ import protocol Yosemite.POSOrderableItem
55
import enum Yosemite.POSItemType
66

77
final class MockPointOfSaleAggregateModel: PointOfSaleAggregateModelProtocol {
8-
var cardReaderConnectionStatus: CardPresentPaymentReaderConnectionStatus
9-
10-
func connectCardReader() { }
11-
12-
func disconnectCardReader() { }
13-
14-
var paymentState: WooCommerce.PointOfSalePaymentState
15-
16-
var cardPresentPaymentAlertViewModel: WooCommerce.PointOfSaleCardPresentPaymentAlertType?
17-
18-
var cardPresentPaymentInlineMessage: WooCommerce.PointOfSaleCardPresentPaymentMessageType?
19-
20-
var cardPresentPaymentOnboardingViewContainer: WooCommerce.CardPresentPaymentOnboardingViewContainer?
21-
22-
func cancelCardPaymentsOnboarding() { }
23-
24-
func trackCardPaymentsOnboardingShown() { }
25-
26-
var orderStage: PointOfSaleOrderStage
27-
28-
var orderState: WooCommerce.PointOfSaleOrderState
29-
30-
var purchasableItemsController: any WooCommerce.PointOfSaleItemsControllerProtocol
31-
32-
var purchasableItemsSearchController: any WooCommerce.PointOfSaleSearchingItemsControllerProtocol
33-
34-
var couponsController: any WooCommerce.PointOfSaleCouponsControllerProtocol
35-
36-
var couponsSearchController: any WooCommerce.PointOfSaleSearchingItemsControllerProtocol
37-
38-
var blockReturnToItemSelection: Bool = false
39-
40-
init(cardReaderConnectionStatus: CardPresentPaymentReaderConnectionStatus = .disconnected,
41-
purchasableItemsController: PointOfSaleItemsControllerProtocol = MockPointOfSaleItemsController(),
42-
purchasableItemsSearchController: PointOfSaleSearchingItemsControllerProtocol = MockPointOfSalePurchasableItemsSearchController(),
43-
couponsController: PointOfSaleCouponsControllerProtocol = MockPointOfSaleCouponsController(),
44-
couponsSearchController: PointOfSaleSearchingItemsControllerProtocol = MockPointOfSaleCouponsController(),
45-
orderStage: PointOfSaleOrderStage = .building,
46-
orderState: PointOfSaleOrderState = .idle,
47-
paymentState: PointOfSalePaymentState = .idle) {
48-
self.cardReaderConnectionStatus = cardReaderConnectionStatus
49-
self.purchasableItemsController = purchasableItemsController
50-
self.purchasableItemsSearchController = purchasableItemsSearchController
51-
self.couponsController = couponsController
52-
self.couponsSearchController = couponsSearchController
53-
self.orderStage = orderStage
54-
self.orderState = orderState
55-
self.paymentState = paymentState
56-
}
57-
58-
func loadItems(base: ItemListBaseItem) async { }
59-
60-
func loadNextItems(base: ItemListBaseItem) async { }
61-
628
var cart: Cart = .init()
639

64-
func barcodeScanned(_ result: Result<String, HIDBarcodeParserError>) { }
65-
6610
func addToCart(_ item: POSItem) { }
6711

68-
func remove(cartItem: CartItem) { }
69-
70-
var removeAllItemsFromCartCalled = false
71-
func removeAllItemsFromCart() {
72-
removeAllItemsFromCartCalled = true
73-
}
74-
75-
func removeAllItemsFromCart(types: [CartItemType]) { }
76-
77-
func checkOut() async { }
78-
79-
func addMoreToCart() { }
80-
81-
func startNewCart() { }
82-
83-
func pointOfSaleClosed() { }
84-
8512
func saveSearchTerm(_ term: String, for itemType: POSItemType) { }
86-
87-
func searchHistory(for itemType: Yosemite.POSItemType) -> [String] {
88-
return []
89-
}
90-
91-
func loadPopularItems(type: Yosemite.POSItemType) async { }
9213
}

0 commit comments

Comments
 (0)