Skip to content

Commit 7bd2814

Browse files
authored
Merge pull request #8358 from woocommerce/issue/8355-update-tap-on-mobile-designs
[Mobile Payments] update tap on mobile designs
2 parents 47a2586 + 41d1e1f commit 7bd2814

File tree

30 files changed

+416
-80
lines changed

30 files changed

+416
-80
lines changed

WooCommerce/Classes/Extensions/UIImage+Woo.swift

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -510,18 +510,6 @@ extension UIImage {
510510
return UIImage(named: "card-reader-scanning")!
511511
}
512512

513-
static var tempBuiltInReaderCheck: UIImage {
514-
return UIImage(named: "temp-woo-tap-on-mobile-check")!
515-
}
516-
517-
static var tempBuiltInReaderPrepare: UIImage {
518-
return UIImage(named: "temp-woo-tap-on-mobile-prepare")!
519-
}
520-
521-
static var tempBuiltInReaderPayment: UIImage {
522-
return UIImage(named: "temp-woo-tap-on-mobile")!
523-
}
524-
525513
/// Found Card Reader
526514
///
527515
static var cardReaderFound: UIImage {
@@ -1155,6 +1143,33 @@ extension UIImage {
11551143
static var calendar: UIImage {
11561144
return UIImage.gridicon(.calendar)
11571145
}
1146+
1147+
// MARK: - Tap on Mobile flow images
1148+
/// Select reader type
1149+
///
1150+
static var cardPaymentsSelectReaderType: UIImage {
1151+
return UIImage(named: "card-payments-select-reader-type")!
1152+
}
1153+
1154+
/// Preparing built-in card reader: intended for use before we're ready to take payment
1155+
///
1156+
static var preparingBuiltInReader: UIImage {
1157+
return UIImage(named: "built-in-reader-preparing")!
1158+
}
1159+
1160+
/// Built-in reader Processing: intended for use when a payment is
1161+
/// underway with the iPhone's built in reader.
1162+
///
1163+
static var builtInReaderProcessing: UIImage {
1164+
return UIImage(named: "built-in-reader-processing")!
1165+
}
1166+
1167+
/// Built-in reader Success: intended for use when a transaction is complete
1168+
/// with the built-in reader
1169+
///
1170+
static var builtInReaderSuccess: UIImage {
1171+
return UIImage(named: "built-in-reader-payment-success")!
1172+
}
11581173
}
11591174

11601175
private extension UIImage {

WooCommerce/Classes/ViewModels/CardPresentPayments/CardPresentModalBuiltInConnectingToReader.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ import UIKit
33
/// Modal presented when we are connecting to a reader
44
///
55
final class CardPresentModalBuiltInConnectingToReader: CardPresentPaymentsModalViewModel {
6-
let textMode: PaymentsModalTextMode = .reducedBottomInfo
6+
let textMode: PaymentsModalTextMode = .fullInfo
77
let actionsMode: PaymentsModalActionsMode = .none
88

99
let topTitle: String = Localization.title
1010

1111
var topSubtitle: String?
1212

13-
let image: UIImage = .tempBuiltInReaderCheck
13+
let image: UIImage = .preparingBuiltInReader
1414

1515
let primaryButtonTitle: String? = nil
1616

1717
let secondaryButtonTitle: String? = nil
1818

1919
let auxiliaryButtonTitle: String? = nil
2020

21-
let bottomTitle: String? = Localization.instruction
21+
let bottomTitle: String? = nil
2222

23-
var bottomSubtitle: String?
23+
var bottomSubtitle: String? = Localization.instruction
2424

2525
var accessibilityLabel: String? {
2626
return topTitle + Localization.instruction

WooCommerce/Classes/ViewModels/CardPresentPayments/CardPresentModalBuiltInFollowReaderInstructions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ final class CardPresentModalBuiltInFollowReaderInstructions: CardPresentPayments
2222
amount
2323
}
2424

25-
let image: UIImage = .cardPresentImage
25+
let image: UIImage = .preparingBuiltInReader
2626

2727
let primaryButtonTitle: String? = nil
2828

WooCommerce/Classes/ViewModels/CardPresentPayments/CardPresentModalBuiltInReaderCheckingDeviceSupport.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ final class CardPresentModalBuiltInReaderCheckingDeviceSupport: CardPresentPayme
66
/// Called when cancel button is tapped
77
private let cancelAction: () -> Void
88

9-
let textMode: PaymentsModalTextMode = .reducedBottomInfo
9+
let textMode: PaymentsModalTextMode = .fullInfo
1010
let actionsMode: PaymentsModalActionsMode = .secondaryActionAndAuxiliaryButton
1111

1212
let topTitle: String = Localization.title
1313

1414
var topSubtitle: String?
1515

16-
let image: UIImage = .tempBuiltInReaderPrepare
16+
let image: UIImage = .preparingBuiltInReader
1717

1818
let primaryButtonTitle: String? = nil
1919

@@ -44,15 +44,12 @@ final class CardPresentModalBuiltInReaderCheckingDeviceSupport: CardPresentPayme
4444
return result
4545
}
4646

47-
let bottomTitle: String? = Localization.instruction
47+
let bottomTitle: String? = nil
4848

49-
var bottomSubtitle: String?
49+
var bottomSubtitle: String? = Localization.instruction
5050

5151
var accessibilityLabel: String? {
52-
guard let bottomTitle = bottomTitle else {
53-
return topTitle
54-
}
55-
return topTitle + bottomTitle
52+
return topTitle + Localization.instruction
5653
}
5754

5855
init(cancel: @escaping () -> Void) {
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import UIKit
2+
3+
4+
/// Modal presented while processing a payment
5+
final class CardPresentModalBuiltInReaderProcessing: CardPresentPaymentsModalViewModel {
6+
7+
/// Customer name
8+
private let name: String
9+
10+
/// Charge amount
11+
private let amount: String
12+
13+
let textMode: PaymentsModalTextMode = .reducedBottomInfo
14+
let actionsMode: PaymentsModalActionsMode = .none
15+
16+
var topTitle: String {
17+
name
18+
}
19+
20+
var topSubtitle: String? {
21+
amount
22+
}
23+
24+
let image: UIImage = .builtInReaderProcessing
25+
26+
let primaryButtonTitle: String? = nil
27+
28+
let secondaryButtonTitle: String? = nil
29+
30+
let auxiliaryButtonTitle: String? = nil
31+
32+
let bottomTitle: String?
33+
34+
let bottomSubtitle: String? = nil
35+
36+
let accessibilityLabel: String?
37+
38+
init(name: String, amount: String) {
39+
self.name = name
40+
self.amount = amount
41+
self.bottomTitle = Localization.processingPayment
42+
self.accessibilityLabel = Localization.processingPaymentAccessibilityLabel
43+
}
44+
45+
func didTapPrimaryButton(in viewController: UIViewController?) {
46+
//
47+
}
48+
49+
func didTapSecondaryButton(in viewController: UIViewController?) {
50+
//
51+
}
52+
53+
func didTapAuxiliaryButton(in viewController: UIViewController?) {
54+
//
55+
}
56+
}
57+
58+
private extension CardPresentModalBuiltInReaderProcessing {
59+
enum Localization {
60+
static let processingPayment = NSLocalizedString(
61+
"Processing payment...",
62+
comment: "Indicates that a payment is being processed"
63+
)
64+
65+
static let processingPaymentAccessibilityLabel = NSLocalizedString(
66+
"Processing payment",
67+
comment: "VoiceOver accessibility label. Indicates that a payment is being processed"
68+
)
69+
}
70+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import UIKit
2+
3+
/// Modal presented when the payment has been collected successfully
4+
final class CardPresentModalBuiltInSuccess: CardPresentPaymentsModalViewModel {
5+
6+
/// Closure to execute when primary button is tapped
7+
private let printReceiptAction: () -> Void
8+
9+
10+
/// Closure to execute when secondary button is tapped
11+
private let emailReceiptAction: () -> Void
12+
13+
/// Closure to execute when auxiliary button is tapped.
14+
private let noReceiptAction: () -> Void
15+
16+
let textMode: PaymentsModalTextMode = .noBottomInfo
17+
let actionsMode: PaymentsModalActionsMode = .twoActionAndAuxiliary
18+
19+
let topTitle: String = Localization.paymentSuccessful
20+
21+
var topSubtitle: String? = nil
22+
23+
let image: UIImage = .builtInReaderSuccess
24+
25+
let primaryButtonTitle: String? = Localization.printReceipt
26+
27+
let secondaryButtonTitle: String? = Localization.emailReceipt
28+
29+
let auxiliaryButtonTitle: String? = Localization.saveReceiptAndContinue
30+
31+
let bottomTitle: String? = nil
32+
33+
let bottomSubtitle: String? = nil
34+
35+
var accessibilityLabel: String? {
36+
return topTitle
37+
}
38+
39+
init(printReceipt: @escaping () -> Void,
40+
emailReceipt: @escaping () -> Void,
41+
noReceiptAction: @escaping () -> Void) {
42+
self.printReceiptAction = printReceipt
43+
self.emailReceiptAction = emailReceipt
44+
self.noReceiptAction = noReceiptAction
45+
}
46+
47+
func didTapPrimaryButton(in viewController: UIViewController?) {
48+
viewController?.dismiss(animated: true, completion: { [weak self] in
49+
self?.printReceiptAction()
50+
})
51+
}
52+
53+
func didTapSecondaryButton(in viewController: UIViewController?) {
54+
viewController?.dismiss(animated: true, completion: { [weak self] in
55+
self?.emailReceiptAction()
56+
})
57+
}
58+
59+
func didTapAuxiliaryButton(in viewController: UIViewController?) {
60+
viewController?.dismiss(animated: true) { [weak self] in
61+
self?.noReceiptAction()
62+
}
63+
}
64+
}
65+
66+
private extension CardPresentModalBuiltInSuccess {
67+
enum Localization {
68+
static let paymentSuccessful = NSLocalizedString(
69+
"Payment successful",
70+
comment: "Label informing users that the payment succeeded. Presented to users when a payment is collected"
71+
)
72+
73+
static let printReceipt = NSLocalizedString(
74+
"Print receipt",
75+
comment: "Button to print receipts. Presented to users after a payment has been successfully collected"
76+
)
77+
78+
static let emailReceipt = NSLocalizedString(
79+
"Email receipt",
80+
comment: "Button to email receipts. Presented to users after a payment has been successfully collected"
81+
)
82+
83+
static let saveReceiptAndContinue = NSLocalizedString(
84+
"Save receipt and continue",
85+
comment: "Button when the user does not want to print or email receipt. Presented to users after a payment has been successfully collected"
86+
)
87+
}
88+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import UIKit
2+
3+
/// Modal presented when the payment has been collected successfully
4+
final class CardPresentModalBuiltInSuccessWithoutEmail: CardPresentPaymentsModalViewModel {
5+
6+
/// Closure to execute when primary button is tapped
7+
private let printReceiptAction: () -> Void
8+
9+
/// Closure to execute when secondary button is tapped
10+
private let noReceiptAction: () -> Void
11+
12+
let textMode: PaymentsModalTextMode = .noBottomInfo
13+
let actionsMode: PaymentsModalActionsMode = .twoAction
14+
15+
let topTitle: String = Localization.paymentSuccessful
16+
17+
var topSubtitle: String? = nil
18+
19+
let image: UIImage = .builtInReaderSuccess
20+
21+
let primaryButtonTitle: String? = Localization.printReceipt
22+
23+
let secondaryButtonTitle: String? = Localization.saveReceiptAndContinue
24+
25+
let auxiliaryButtonTitle: String? = nil
26+
27+
let bottomTitle: String? = nil
28+
29+
let bottomSubtitle: String? = nil
30+
31+
var accessibilityLabel: String? {
32+
return Localization.paymentSuccessful
33+
}
34+
35+
init(printReceipt: @escaping () -> Void,
36+
noReceiptAction: @escaping () -> Void) {
37+
self.printReceiptAction = printReceipt
38+
self.noReceiptAction = noReceiptAction
39+
}
40+
41+
func didTapPrimaryButton(in viewController: UIViewController?) {
42+
viewController?.dismiss(animated: true, completion: { [weak self] in
43+
self?.printReceiptAction()
44+
})
45+
}
46+
47+
func didTapSecondaryButton(in viewController: UIViewController?) {
48+
viewController?.dismiss(animated: true) { [weak self] in
49+
self?.noReceiptAction()
50+
}
51+
}
52+
53+
func didTapAuxiliaryButton(in viewController: UIViewController?) {}
54+
}
55+
56+
private extension CardPresentModalBuiltInSuccessWithoutEmail {
57+
enum Localization {
58+
static let paymentSuccessful = NSLocalizedString(
59+
"Payment successful",
60+
comment: "Label informing users that the payment succeeded. Presented to users when a payment is collected"
61+
)
62+
63+
static let printReceipt = NSLocalizedString(
64+
"Print receipt",
65+
comment: "Button to print receipts. Presented to users after a payment has been successfully collected"
66+
)
67+
68+
static let saveReceiptAndContinue = NSLocalizedString(
69+
"Save receipt and continue",
70+
comment: "Button when the user does not want to print the receipt. Presented to users after a payment has been successfully collected"
71+
)
72+
}
73+
}

WooCommerce/Classes/ViewModels/CardPresentPayments/CardPresentModalSelectSearchType.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ final class CardPresentModalSelectSearchType: CardPresentPaymentsModalViewModel
1010

1111
var topSubtitle: String? = nil
1212

13-
var image: UIImage = .paymentsLoading
13+
var image: UIImage = .cardPaymentsSelectReaderType
1414

1515
var primaryButtonTitle: String?
1616

@@ -64,7 +64,7 @@ private extension CardPresentModalSelectSearchType {
6464
"reader type. Only shown when supported on their device.")
6565

6666
static let description = NSLocalizedString(
67-
"Your iPhone can be used as a card reader, or you can connect to an external reader via bluetooth.",
67+
"Your iPhone can be used as a card reader, or you can connect to an external reader via Bluetooth.",
6868
comment: "The description on the alert shown when connecting a card reader, asking the user to choose a " +
6969
"reader type. Only shown when supported on their device.")
7070

0 commit comments

Comments
 (0)