diff --git a/Sources/PediFoods/Views/Main/CheckoutView.swift b/Sources/PediFoods/Views/Main/CheckoutView.swift index 181023c..fbbe7f6 100644 --- a/Sources/PediFoods/Views/Main/CheckoutView.swift +++ b/Sources/PediFoods/Views/Main/CheckoutView.swift @@ -297,7 +297,7 @@ struct CheckoutView: View { ) VStack(alignment: .leading, spacing: 4) { - Text(isDeliveryMode ? "Casa" : (appState.cart.storeName ?? "Loja")) + Text(isDeliveryMode ? customerAddressName : (appState.cart.storeName ?? "Loja")) .font(AppTypography.heading3) .foregroundStyle(AppColors.textPrimary) Text(isDeliveryMode ? customerAddressLabel : storeAddressLabel) @@ -557,6 +557,16 @@ struct CheckoutView: View { } } + private var customerAddressName: String { + let label = (selectedCustomerAddress?.label ?? "").trimmingCharacters(in: .whitespacesAndNewlines) + if label.isEmpty == false { return label } + + let displayLabel = appState.address.display.trimmingCharacters(in: .whitespacesAndNewlines) + if displayLabel.isEmpty == false, displayLabel != "Defina seu endereco" { return displayLabel } + + return "Endereço" + } + private var customerAddressLabel: String { if let address = selectedCustomerAddress { let street = (address.address ?? "").trimmingCharacters(in: .whitespacesAndNewlines)