@@ -37,6 +37,8 @@ struct WooShippingCreateLabelsView: View {
3737 /// Whether the origin address list sheet is presented.
3838 @State private var isOriginAddressListPresented = false
3939
40+ @State private var isReadyToShowErrorNotice = false
41+
4042 @State private var showingCustomsForm = false
4143
4244 /// Whether the destination address is verified.
@@ -199,48 +201,57 @@ private extension WooShippingCreateLabelsView {
199201 . foregroundStyle ( Color ( . primary) )
200202 . bold ( )
201203
202- // Unverified notice for origin address
203- if let originAddressUnverifiedNoticeLabel = viewModel. originAddressUnverifiedNoticeLabel {
204- verificationNotice ( with: originAddressUnverifiedNoticeLabel,
205- isVerified: false ,
206- onDismiss: {
207- withAnimation {
208- viewModel. originAddressUnverifiedNoticeLabel = nil
209- }
210- } ,
211- onTap: {
212- viewModel. editSelectedOriginAddress ( )
213- } )
214- }
204+ if isReadyToShowErrorNotice {
205+ // Unverified notice for origin address
206+ if let originAddressUnverifiedNoticeLabel = viewModel. originAddressUnverifiedNoticeLabel {
207+ verificationNotice ( with: originAddressUnverifiedNoticeLabel,
208+ isVerified: false ,
209+ onDismiss: {
210+ withAnimation {
211+ viewModel. originAddressUnverifiedNoticeLabel = nil
212+ }
213+ } ,
214+ onTap: {
215+ viewModel. editSelectedOriginAddress ( )
216+ } )
217+ }
215218
216- // Verification notice for destination address
217- if let destinationAddressStatusNoticeLabel = viewModel. destinationAddressStatusNoticeLabel {
218- verificationNotice ( with: destinationAddressStatusNoticeLabel,
219- isVerified: isDestinationAddressVerified,
220- onDismiss: {
221- withAnimation {
222- viewModel. destinationAddressStatusNoticeLabel = nil
223- }
224- } ,
225- onTap: {
226- if !isDestinationAddressVerified {
227- viewModel. editDestinationAddress ( )
228- }
229- } )
230- }
219+ // Verification notice for destination address
220+ if let destinationAddressStatusNoticeLabel = viewModel. destinationAddressStatusNoticeLabel {
221+ verificationNotice ( with: destinationAddressStatusNoticeLabel,
222+ isVerified: isDestinationAddressVerified,
223+ onDismiss: {
224+ withAnimation {
225+ viewModel. destinationAddressStatusNoticeLabel = nil
226+ }
227+ } ,
228+ onTap: {
229+ if !isDestinationAddressVerified {
230+ viewModel. editDestinationAddress ( )
231+ }
232+ } )
233+ }
231234
232- // Verification notice for missing ITN in customs form
233- if let itnMissingNoticeLabel = viewModel. itnMissingNoticeLabel {
234- verificationNotice ( with: itnMissingNoticeLabel,
235- isVerified: false ,
236- onDismiss: {
237- withAnimation {
238- viewModel. itnMissingNoticeLabel = nil
239- }
240- } ,
241- onTap: {
242- showingCustomsForm = true
243- } )
235+ // Verification notice for missing ITN in customs form
236+ if let itnMissingNoticeLabel = viewModel. itnMissingNoticeLabel {
237+ verificationNotice ( with: itnMissingNoticeLabel,
238+ isVerified: false ,
239+ onDismiss: {
240+ withAnimation {
241+ viewModel. itnMissingNoticeLabel = nil
242+ }
243+ } ,
244+ onTap: {
245+ showingCustomsForm = true
246+ } )
247+ }
248+ }
249+ }
250+ . onAppear {
251+ /// A brief delay in requesting user attention after the UI loads
252+ /// to avoid overwhelming them with too many changes at once when opening the screen.
253+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 2.0 ) {
254+ self . isReadyToShowErrorNotice = true
244255 }
245256 }
246257 }
0 commit comments