05/11 Update issue image upload
This commit is contained in:
@@ -293,7 +293,7 @@ struct MyInspectionsView: View {
|
||||
}
|
||||
// Delete associated local issues
|
||||
for issue in inspection.localIssues {
|
||||
if let path = issue.photoLocalPath {
|
||||
for path in issue.photoLocalPaths {
|
||||
try? FileManager.default.removeItem(atPath: path)
|
||||
}
|
||||
context.delete(issue)
|
||||
@@ -860,16 +860,18 @@ struct IssueDetailView: View {
|
||||
}
|
||||
}
|
||||
|
||||
if let photoPath = issue.photoLocalPath {
|
||||
Section("Photo") {
|
||||
if let img = UIImage(contentsOfFile: photoPath) {
|
||||
Image(uiImage: img)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.clipShape(RoundedRectangle(cornerRadius: 8))
|
||||
} else {
|
||||
Label("Photo pending upload", systemImage: "photo")
|
||||
.foregroundStyle(.secondary)
|
||||
if !issue.photoLocalPaths.isEmpty {
|
||||
Section("Photos (\(issue.photoLocalPaths.count))") {
|
||||
ForEach(issue.photoLocalPaths, id: \.self) { path in
|
||||
if let img = UIImage(contentsOfFile: path) {
|
||||
Image(uiImage: img)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.clipShape(RoundedRectangle(cornerRadius: 8))
|
||||
} else {
|
||||
Label("Photo pending upload", systemImage: "photo")
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user