Skip to content

Commit

Permalink
Fix: Data errors caused by not updating in time after modifying the p…
Browse files Browse the repository at this point in the history
…icture Metadata #4
  • Loading branch information
wibus-wee committed Oct 23, 2023
1 parent fc244ad commit 852a17e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions PhotosProcessor/Backend/ProcessImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,13 @@ class ProcessImage: NSObject, ObservableObject {
self.inited = true
print("[I] Loaded image: \(self.url!)")
}

func refresh() {
if !self.inited {
print("[W] Image not inited. Refresh failed.")
return
}
print("[I] Refreshed image: \(self.url!)")
self.setup(url: self.url!)
}
}
2 changes: 2 additions & 0 deletions PhotosProcessor/Views/Features/ModifyMetadataView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ struct ModifyMetadataView: View {
return
}
let _ = processImage.imageMetadata!.syncImageDate(path: processImage.imageMetadata!.url!.path)
processImage.refresh()
} label: {
Label("Sync DateTimeOriginal to CreateDate", systemImage: "arrow.clockwise")
}
Expand Down Expand Up @@ -222,6 +223,7 @@ struct ModifyMetadataView: View {
print("[E] Bug occurred when edit metadata")
InternalKit.eazyAlert(title: "Error", message: "Bug occurred when edit metadata")
}
processImage.refresh()
} label: {
Label("Modify", systemImage: "hammer")
}
Expand Down

0 comments on commit 852a17e

Please sign in to comment.