Skip to content

Commit 59b41b3

Browse files
committed
Fix more Periphery warnings. To test: POS search history, shadow.
1 parent 5483fd9 commit 59b41b3

File tree

5 files changed

+0
-59
lines changed

5 files changed

+0
-59
lines changed

Modules/Sources/Yosemite/PointOfSale/POSSearchHistoryService.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import Storage
44
public protocol POSSearchHistoryProviding {
55
func saveSuccessfulSearch(term: String, for itemType: POSItemType)
66
func searchHistory(for itemType: POSItemType) -> [String]
7-
func clearSearchHistory(for itemType: POSItemType)
8-
func clearAllSearchHistory()
97
}
108

119
/// Service for managing search history in the Point of Sale
@@ -60,18 +58,4 @@ public final class POSSearchHistoryService: POSSearchHistoryProviding {
6058
public func searchHistory(for itemType: POSItemType) -> [String] {
6159
return siteSpecificAppSettingsStoreMethods.getSearchTerms(for: itemType, siteID: siteID)
6260
}
63-
64-
/// Clears the search history for a specific item type
65-
/// - Parameter itemType: The type of item to clear search history for
66-
public func clearSearchHistory(for itemType: POSItemType) {
67-
siteSpecificAppSettingsStoreMethods.setSearchTerms([], for: itemType, siteID: siteID)
68-
}
69-
70-
/// Clears all search history
71-
public func clearAllSearchHistory() {
72-
// Clear search history for all item types
73-
POSItemType.allCases.forEach { itemType in
74-
clearSearchHistory(for: itemType)
75-
}
76-
}
7761
}

Modules/Tests/YosemiteTests/PointOfSale/POSSearchHistoryServiceTests.swift

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -89,38 +89,6 @@ struct POSSearchHistoryServiceTests {
8989
#expect(history.isEmpty)
9090
}
9191

92-
@Test func clearSearchHistory_clears_history_for_specific_item_type() throws {
93-
// Given
94-
sut.saveSuccessfulSearch(term: "product", for: .product)
95-
sut.saveSuccessfulSearch(term: "coupon", for: .coupon)
96-
97-
// When
98-
sut.clearSearchHistory(for: .product)
99-
100-
// Then
101-
let productsSearchHistory = try #require(mockStoreMethods.mockSearchTerms[.product])
102-
let couponsSearchHistory = try #require(mockStoreMethods.mockSearchTerms[.coupon])
103-
#expect(productsSearchHistory.isEmpty)
104-
#expect(couponsSearchHistory.count == 1)
105-
#expect(couponsSearchHistory.first == "coupon")
106-
}
107-
108-
@Test func clearAllSearchHistory_clears_all_history() throws {
109-
// Given
110-
mockStoreMethods.mockSearchTerms[.product] = ["product"]
111-
mockStoreMethods.mockSearchTerms[.coupon] = ["coupon"]
112-
113-
// When
114-
sut.clearAllSearchHistory()
115-
116-
// Then
117-
#expect(mockStoreMethods.setSearchTermsCalled)
118-
let productsSearchHistory = try #require(mockStoreMethods.mockSearchTerms[.product])
119-
let couponsSearchHistory = try #require(mockStoreMethods.mockSearchTerms[.coupon])
120-
#expect(productsSearchHistory.isEmpty)
121-
#expect(couponsSearchHistory.isEmpty)
122-
}
123-
12492
@Test func search_history_is_separate_for_different_item_types() {
12593
// Given
12694
mockStoreMethods.mockSearchTerms[.product] = ["product"]

WooCommerce/Classes/POS/Utils/POSShadowStyle.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ extension View {
108108
private class MultiShadowView: UIView {
109109
var cornerRadius: CGFloat = 0
110110
var shadowLayers: [POSShadowLayer] = []
111-
var fillColor: UIColor = .clear
112111

113112
override func layoutSubviews() {
114113
super.layoutSubviews()
@@ -141,14 +140,12 @@ private struct RasterizedShadowBackground: UIViewRepresentable {
141140
let view = MultiShadowView()
142141
view.cornerRadius = cornerRadius
143142
view.shadowLayers = shadowLayers
144-
view.fillColor = backgroundColor
145143
return view
146144
}
147145

148146
func updateUIView(_ uiView: MultiShadowView, context: Context) {
149147
uiView.cornerRadius = cornerRadius
150148
uiView.shadowLayers = shadowLayers
151-
uiView.fillColor = backgroundColor
152149
uiView.setNeedsLayout()
153150
}
154151
}

WooCommerce/Classes/POS/Utils/PreviewHelpers.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ final class PointOfSalePreviewHistoryService: POSSearchHistoryProviding {
150150
func searchHistory(for itemType: POSItemType) -> [String] {
151151
return []
152152
}
153-
154-
func clearSearchHistory(for itemType: POSItemType) {}
155-
156-
func clearAllSearchHistory() {}
157153
}
158154

159155
private var mockItems: [POSItem] {

WooCommerce/WooCommerceTests/POS/Mocks/MockPOSSearchHistoryService.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,4 @@ struct MockPOSSearchHistoryService: POSSearchHistoryProviding {
77
func searchHistory(for itemType: POSItemType) -> [String] {
88
return []
99
}
10-
11-
func clearSearchHistory(for itemType: POSItemType) {}
12-
13-
func clearAllSearchHistory() {}
1410
}

0 commit comments

Comments
 (0)