WIP: map route updates and custom item drag/drop fixes (broken)
- Fixed map header not updating in ItineraryTableViewWrapper using Coordinator pattern - Added routeVersion UUID to force Map re-render when routes change - Fixed determineAnchor to scan backwards for correct anchor context - Added location support to CustomItineraryItem (lat/lng/address) - Added MapKit place search to AddItemSheet - Added extensive debug logging for route waypoint calculation Known issues: - Custom items still not routing correctly after drag/drop - Anchor type determination may still have bugs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -638,6 +638,10 @@ struct CKCustomItineraryItem {
|
||||
static let sortOrderKey = "sortOrder"
|
||||
static let createdAtKey = "createdAt"
|
||||
static let modifiedAtKey = "modifiedAt"
|
||||
// Location fields for mappable items
|
||||
static let latitudeKey = "latitude"
|
||||
static let longitudeKey = "longitude"
|
||||
static let addressKey = "address"
|
||||
|
||||
let record: CKRecord
|
||||
|
||||
@@ -660,6 +664,10 @@ struct CKCustomItineraryItem {
|
||||
record[CKCustomItineraryItem.sortOrderKey] = item.sortOrder
|
||||
record[CKCustomItineraryItem.createdAtKey] = item.createdAt
|
||||
record[CKCustomItineraryItem.modifiedAtKey] = item.modifiedAt
|
||||
// Location fields (nil values are not stored in CloudKit)
|
||||
record[CKCustomItineraryItem.latitudeKey] = item.latitude
|
||||
record[CKCustomItineraryItem.longitudeKey] = item.longitude
|
||||
record[CKCustomItineraryItem.addressKey] = item.address
|
||||
self.record = record
|
||||
}
|
||||
|
||||
@@ -681,6 +689,11 @@ struct CKCustomItineraryItem {
|
||||
let anchorId = record[CKCustomItineraryItem.anchorIdKey] as? String
|
||||
let sortOrder = record[CKCustomItineraryItem.sortOrderKey] as? Int ?? 0
|
||||
|
||||
// Location fields (optional - nil if not stored)
|
||||
let latitude = record[CKCustomItineraryItem.latitudeKey] as? Double
|
||||
let longitude = record[CKCustomItineraryItem.longitudeKey] as? Double
|
||||
let address = record[CKCustomItineraryItem.addressKey] as? String
|
||||
|
||||
return CustomItineraryItem(
|
||||
id: itemId,
|
||||
tripId: tripId,
|
||||
@@ -691,7 +704,10 @@ struct CKCustomItineraryItem {
|
||||
anchorDay: anchorDay,
|
||||
sortOrder: sortOrder,
|
||||
createdAt: createdAt,
|
||||
modifiedAt: modifiedAt
|
||||
modifiedAt: modifiedAt,
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
address: address
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user