Commit Graph

5 Commits

Author SHA1 Message Date
Daniel Arantes Loverde
f706492823 [cart-checkout] Match selected address by coordinates before label, not after
CustomerAddress.id is genuinely optional (Services/ApiModels.swift:46) —
some address book entries have no id. AddressesView.selectAddress sets
appState.address.selectedId = address.id directly with no fallback, so
picking one of those addresses leaves selectedId nil. The matching
cascade in both CartView and CheckoutView+Logic then skipped straight to
a label match, which silently collides whenever two addresses share an
empty or duplicate label (common for unnamed entries), and finally fell
back to addresses.first — always redisplaying whatever's first in the
list regardless of what was tapped, with no error surfaced anywhere.

Coordinates are set immediately and reliably at selection time and are
far less likely to collide than a label. Checkout already had a lat/lng
fallback but ordered after the weak label match; promoted it ahead of
label matching in both files, and added the same fallback to Cart, which
didn't have one at all.
2026-07-10 10:49:18 -03:00
Daniel Arantes Loverde
4fc6a666b2 [cart-checkout] Fix delivery fee and address sync using stale cached profile
Cart's delivery fee and Checkout's address validation both fetched the
customer profile without forcing a cache refresh (2h TTL), then let that
possibly-stale address book unconditionally overwrite the just-picked
appState.address coordinates before building the fee/validation payload.
Result: changing the address on Home didn't reliably move the cart's
delivery fee, and Checkout's 'Alterar' could silently revert to the old
address when the stale coordinates made the backend report it as not
served.

Force-refresh the profile fetch and only use it to fill genuine gaps in
appState.address, never to override a live user selection.
2026-07-10 10:23:59 -03:00
Daniel Arantes Loverde
a2df5d5e7b Update ContentView.swift 2026-07-09 15:51:29 -03:00
Daniel Arantes Loverde
91c53c90d5 [legal-api-links] Load Terms of Use and Privacy Policy from Atomenta API
Terms and Privacy screens now fetch the real PediFoods customer PDFs
from the backend instead of showing static placeholder text. Also
surfaces both links on the Profile screen below the version label,
not just during registration.
2026-07-09 09:55:36 -03:00
Daniel Arantes Loverde
e51c99973f Commit 2026-07-07 15:11:31 -03:00