Jul 21 - Update to support photos' timestamp/location

This commit is contained in:
2026-07-21 16:22:13 -04:00
parent 2a0b264a5c
commit 1921f95faf
18 changed files with 261 additions and 5172 deletions
@@ -643,11 +643,17 @@ struct ExecuteInspectionView: View {
private func handlePhotoSelected(localPath: String, field: [String: Any]) {
let fid = fieldId(field)
formValues[fid] = "local://\(localPath)"
// Stamp capture time + the current fix now; the upload may be hours
// later on a slow sync and must not use its own clock.
let fix = locationManager.lastLocation ?? PhotoLocationProvider.shared.lastLocation
let photo = PendingPhoto(
localFilePath: localPath,
entityType: "inspection",
entityLocalId: inspection.localId,
fieldId: fid
localFilePath: localPath,
entityType: "inspection",
entityLocalId: inspection.localId,
fieldId: fid,
capturedAt: Date(),
captureLatitude: fix?.coordinate.latitude,
captureLongitude: fix?.coordinate.longitude
)
inspection.pendingPhotos.append(photo)
context.insert(photo)