Skip to content

Commit 4fe42e7

Browse files
authored
Merge pull request #5386 from woocommerce/issue/5344-connect-summary
2 parents 5d390ed + 135a023 commit 4fe42e7

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

WooCommerce/Classes/ViewRelated/Orders/Simple Payments/SimplePaymentsAmount.swift

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ struct SimplePaymentsAmount: View {
8585
///
8686
@ObservedObject private(set) var viewModel: SimplePaymentsAmountViewModel
8787

88+
/// Tracks if the summary view should be presented.
89+
///
90+
@State private var showSummaryView: Bool = false
91+
8892
var body: some View {
8993
VStack(alignment: .center, spacing: Layout.mainVerticalSpacing) {
9094

@@ -104,11 +108,19 @@ struct SimplePaymentsAmount: View {
104108
Spacer()
105109

106110
// Done button
107-
Button(Localization.buttonTitle) {
108-
viewModel.createSimplePaymentsOrder()
111+
Button(Localization.buttonTitle()) {
112+
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.simplePaymentsPrototype) {
113+
showSummaryView.toggle()
114+
} else {
115+
viewModel.createSimplePaymentsOrder()
116+
}
109117
}
110118
.buttonStyle(PrimaryLoadingButtonStyle(isLoading: viewModel.loading))
111119
.disabled(viewModel.shouldDisableDoneButton)
120+
121+
LazyNavigationLink(destination: SimplePaymentsSummary(noteContent: nil), isActive: $showSummaryView) {
122+
EmptyView()
123+
}
112124
}
113125
.padding()
114126
.navigationTitle(Localization.title)
@@ -128,9 +140,16 @@ private extension SimplePaymentsAmount {
128140
enum Localization {
129141
static let title = NSLocalizedString("Take Payment", comment: "Title for the simple payments screen")
130142
static let instructions = NSLocalizedString("Enter Amount", comment: "Short instructions label in the simple payments screen")
131-
static let buttonTitle = NSLocalizedString("Done", comment: "Title for the button to confirm the amount in the simple payments screen")
132143
static let cancelTitle = NSLocalizedString("Cancel", comment: "Title for the button to cancel the simple payments screen")
133144
static let error = NSLocalizedString("There was an error creating the order", comment: "Notice text after failing to create a simple payments order.")
145+
146+
static func buttonTitle() -> String {
147+
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.simplePaymentsPrototype) {
148+
return NSLocalizedString("Next", comment: "Title for the button to confirm the amount in the simple payments screen")
149+
} else {
150+
return NSLocalizedString("Done", comment: "Title for the button to confirm the amount in the simple payments screen")
151+
}
152+
}
134153
}
135154

136155
enum Layout {

WooCommerce/Classes/ViewRelated/Orders/Simple Payments/SimplePaymentsSummary.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ struct SimplePaymentsSummary: View {
3131

3232
TakePaymentSection()
3333
}
34-
.background(Color(.listBackground))
34+
.background(Color(.listBackground).ignoresSafeArea())
35+
.navigationTitle(Localization.title)
3536
}
3637
}
3738

@@ -191,7 +192,7 @@ private struct TakePaymentSection: View {
191192
.padding()
192193

193194
}
194-
.background(Color(.listForeground))
195+
.background(Color(.listForeground).ignoresSafeArea())
195196
}
196197
}
197198

@@ -206,6 +207,7 @@ private extension SimplePaymentsSummary {
206207
}
207208

208209
enum Localization {
210+
static let title = NSLocalizedString("Take Payment", comment: "Title for the simple payments screen")
209211
static let customAmount = NSLocalizedString("Custom Amount",
210212
comment: "Title text of the row that shows the provided amount when creating a simple payment")
211213
static let email = NSLocalizedString("Email",

0 commit comments

Comments
 (0)