Jul 21 - Update to support photos' timestamp/location
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user