Jul 21 - Update to support photos' timestamp/location
This commit is contained in:
@@ -25,21 +25,39 @@ final class PendingPhoto {
|
||||
var uploadStatus: String
|
||||
var createdAt: Date
|
||||
|
||||
// ── Capture metadata (sent to the server, burned into the photo) ───────
|
||||
// Recorded when the shutter fires, NOT when the upload runs — the app is
|
||||
// offline-first, so a photo taken at 09:14 may not sync until 16:00 and
|
||||
// the stamp must show 09:14. EXIF cannot serve as a fallback here: the
|
||||
// photo is re-encoded via jpegData() on save, which strips every tag.
|
||||
// Optional so existing SwiftData stores migrate without a schema step.
|
||||
var capturedAt: Date?
|
||||
var captureLatitude: Double?
|
||||
var captureLongitude: Double?
|
||||
|
||||
var inspection: LocalInspection?
|
||||
|
||||
init(
|
||||
localFilePath: String,
|
||||
entityType: String,
|
||||
entityLocalId: String,
|
||||
fieldId: String? = nil
|
||||
fieldId: String? = nil,
|
||||
capturedAt: Date? = nil,
|
||||
captureLatitude: Double? = nil,
|
||||
captureLongitude: Double? = nil
|
||||
) {
|
||||
self.localId = UUID().uuidString
|
||||
self.localFilePath = localFilePath
|
||||
self.entityType = entityType
|
||||
self.entityLocalId = entityLocalId
|
||||
self.fieldId = fieldId
|
||||
self.serverPath = nil
|
||||
self.uploadStatus = "pending"
|
||||
self.createdAt = Date()
|
||||
self.localId = UUID().uuidString
|
||||
self.localFilePath = localFilePath
|
||||
self.entityType = entityType
|
||||
self.entityLocalId = entityLocalId
|
||||
self.fieldId = fieldId
|
||||
self.serverPath = nil
|
||||
self.uploadStatus = "pending"
|
||||
self.createdAt = Date()
|
||||
// Fall back to now when the caller has no recorded capture moment —
|
||||
// still far better than the server's upload-time default.
|
||||
self.capturedAt = capturedAt ?? Date()
|
||||
self.captureLatitude = captureLatitude
|
||||
self.captureLongitude = captureLongitude
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user