Skip to content

Commit 7c2634e

Browse files
committed
Use .notice view modifier and pass notice presented to booking details view
1 parent 396a379 commit 7c2634e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

WooCommerce/Classes/ViewRelated/Bookings/Booking Details/BookingDetailsView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ struct BookingDetailsView: View {
77
@State private var showingOptions = false
88
@State private var showingStatusSheet = false
99
@State private var showingCancelAlert = false
10+
@State private var notice: Notice?
1011

1112
@ObservedObject private var viewModel: BookingDetailsViewModel
1213

@@ -95,6 +96,7 @@ struct BookingDetailsView: View {
9596
} message: {
9697
Text(viewModel.cancellationAlertMessage)
9798
}
99+
.notice($notice)
98100
}
99101
}
100102

@@ -144,7 +146,9 @@ private extension BookingDetailsView {
144146
case .attendance(let content):
145147
attendanceView(with: content)
146148
case .customer(let content):
147-
CustomerDetailsView(content: content)
149+
CustomerDetailsView(content: content, showNotice: {
150+
notice = $0
151+
})
148152
case .payment(let content):
149153
paymentDetailsView(with: content)
150154
case .bookingNotes:

WooCommerce/Classes/ViewRelated/Bookings/Booking Details/CustomerDetailsView.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import SwiftUI
44
extension BookingDetailsView {
55
struct CustomerDetailsView: View {
66
@ObservedObject var content: BookingDetailsViewModel.CustomerContent
7+
let showNotice: (Notice) -> Void
78

89
private enum Row: Hashable {
910
case name(String)
@@ -77,8 +78,12 @@ extension BookingDetailsView {
7778
.padding(.vertical, Layout.rowTextVerticalPadding)
7879
.tappable {
7980
emailText.sendToPasteboard()
80-
let notice = Notice(title: Localization.emailCopiedMessage, feedbackType: .success)
81-
ServiceLocator.noticePresenter.enqueue(notice: notice)
81+
showNotice(
82+
Notice(
83+
title: Localization.emailCopiedMessage,
84+
feedbackType: .success
85+
)
86+
)
8287
}
8388
}
8489

0 commit comments

Comments
 (0)