Skip to content

Commit 0eda7b2

Browse files
authored
Merge pull request #7497 from woocommerce/issue/7488-show-all-manuals
[Mobile payments] Improve CardReaderType cases when has no Manual associated
2 parents 7134b2b + 0f5938e commit 0eda7b2

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

Hardware/Hardware/CardReader/CardReaderType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// Card reader type. Indicates if a reader is meant to be used
22
/// handheld or as a countertop device
3-
public enum CardReaderType {
3+
public enum CardReaderType: CaseIterable {
44
/// Chipper
55
case chipper
66
/// Stripe M2

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/CardReaderManualsViewModel.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Foundation
2-
import SwiftUI
32
import Yosemite
43

54
struct Manual: Identifiable, Equatable {
@@ -14,9 +13,9 @@ final class CardReaderManualsViewModel {
1413
let manuals: [Manual]
1514

1615
init() {
17-
// Initialize the View Model only with the supported readers for a specific Store
16+
// Initialize the ViewModel only with the supported readers for the specific store's country
1817
self.configurationLoader = CardPresentConfigurationLoader()
1918
let supportedReaders = configurationLoader.configuration.supportedReaders
20-
self.manuals = supportedReaders.map { $0.manual }
19+
self.manuals = supportedReaders.compactMap { $0.manual }
2120
}
2221
}

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/CardReaderType+Manual.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import Foundation
22
import Yosemite
33

44
extension CardReaderType {
5-
6-
var manual: Manual {
5+
var manual: Manual? {
76
switch self {
87
case .chipper:
98
return Manual(
@@ -27,7 +26,7 @@ extension CardReaderType {
2726
urlString: "https://stripe.com/files/docs/terminal/wp3_product_sheet.pdf"
2827
)
2928
case .other:
30-
return Manual(id: 5, image: .cardReaderManualIcon, name: "", urlString: "")
29+
return nil
3130
}
3231
}
3332
}

0 commit comments

Comments
 (0)