Skip to content

Commit e06a16d

Browse files
authored
[Woo POS] Modularization: fix most Periphery warnings (#16185)
2 parents 4f86900 + 33f6e09 commit e06a16d

File tree

53 files changed

+43
-475
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+43
-475
lines changed

Modules/Sources/WooFoundation/Utilities/Connectivity/ConnectivityObserver.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ public protocol ConnectivityObserver {
88

99
/// Publisher for connectivity availability.
1010
var statusPublisher: AnyPublisher<ConnectivityStatus, Never> { get }
11-
12-
/// Starts the observer.
13-
func startObserving()
14-
15-
/// Stops the observer.
16-
func stopObserving()
1711
}
1812

1913
/// Defines the various states of network connectivity.

Modules/Sources/WooFoundation/Utilities/Connectivity/DefaultConnectivityObserver.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public final class DefaultConnectivityObserver: ConnectivityObserver {
2929
}
3030
}
3131

32-
public func startObserving() {
32+
private func startObserving() {
3333
networkMonitor.start(queue: observingQueue)
3434
}
3535

36-
public func stopObserving() {
36+
func stopObserving() {
3737
networkMonitor.cancel()
3838
}
3939

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/Adaptors/Card Present Payments/CardPresentPaymentCollectOrderPaymentUseCaseAdaptor.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ final class CardPresentPaymentCollectOrderPaymentUseCaseAdaptor {
3030
CardPresentPaymentTapToPayReaderConnectionAlertsProvider,
3131
CardPresentPaymentBluetoothReaderConnectionAlertsProvider,
3232
CardPresentPaymentsAlertPresenterAdaptor>,
33-
onboardingPresenter: CardPresentPaymentsOnboardingPresenting,
3433
configuration: CardPresentPaymentsConfiguration,
3534
alertsPresenter: CardPresentPaymentsAlertPresenterAdaptor,
3635
paymentEventSubject: any Subject<CardPresentPaymentEvent, Never>,

WooCommerce/Classes/POS/Adaptors/Card Present Payments/CardPresentPaymentService.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ final class CardPresentPaymentService: CardPresentPaymentFacade {
6565
let connectedReaderPublisher = await Self.createCardReaderConnectionPublisher(stores: stores)
6666
self.connectedReaderPublisher = connectedReaderPublisher
6767

68-
readerConnectionStatusPublisher = connectedReaderPublisher
68+
readerConnectionStatusPublisher = self.connectedReaderPublisher
6969
.map({ reader -> CardPresentPaymentReaderConnectionStatus in
7070
guard let reader else {
7171
return .disconnected
@@ -146,7 +146,6 @@ final class CardPresentPaymentService: CardPresentPaymentFacade {
146146
using: connectionMethod,
147147
siteID: siteID,
148148
preflightController: preflightController,
149-
onboardingPresenter: onboardingAdaptor,
150149
configuration: cardPresentPaymentsConfiguration,
151150
alertsPresenter: paymentAlertsPresenterAdaptor,
152151
paymentEventSubject: paymentEventSubject,
@@ -157,7 +156,7 @@ final class CardPresentPaymentService: CardPresentPaymentFacade {
157156
switch try await paymentTask.value {
158157
case .success:
159158
// TODO: fetch the receipt URL to return an accurate value.
160-
let transaction = CardPresentPaymentTransaction(receiptURL: URL(string: "https://example.com")!)
159+
let transaction = CardPresentPaymentTransaction()
161160
return .success(transaction)
162161
case .cancellation:
163162
return .cancellation

WooCommerce/Classes/POS/Analytics/POSCollectOrderPaymentAnalyticsTracking.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ public protocol POSCollectOrderPaymentAnalyticsTracking {
44
func trackCardReaderReady()
55
func trackCardReaderTapped()
66
func trackCheckoutTapped()
7-
func resetCheckoutTapCountTracker()
87
func trackSuccessfulCashPayment()
98
}

WooCommerce/Classes/POS/Analytics/POSItemFetchAnalytics.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Foundation
2-
import WooFoundation
32
import enum Yosemite.POSItemType
43
import protocol Yosemite.POSItemFetchAnalyticsTracking
54

WooCommerce/Classes/POS/Analytics/WooAnalyticsEvent+PointOfSale.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ extension WooAnalyticsEvent {
378378
properties: [Key.scanner: scanner.analyticsName])
379379
}
380380

381-
static func barcodeScannerSetupScannerConnected(scanner: PointOfSaleBarcodeScannerType, step: String) -> WooAnalyticsEvent {
381+
static func barcodeScannerSetupScannerConnected(scanner: PointOfSaleBarcodeScannerType) -> WooAnalyticsEvent {
382382
WooAnalyticsEvent(statName: .pointOfSaleBarcodeScannerSetupScannerConnected,
383383
properties: [Key.scanner: scanner.analyticsName])
384384
}

WooCommerce/Classes/POS/Card Present Payments/CardPresentPaymentPreviewService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class CardPresentPaymentPreviewService: CardPresentPaymentFacade {
2929
func collectPayment(for order: Yosemite.Order,
3030
using connectionMethod: CardReaderConnectionMethod,
3131
channel: PaymentChannel) async throws -> CardPresentPaymentResult {
32-
.success(CardPresentPaymentTransaction(receiptURL: URL(string: "https://example.net/receipts/123")!))
32+
.success(CardPresentPaymentTransaction())
3333
}
3434

3535
func cancelPayment() {

0 commit comments

Comments
 (0)