Merge pull request #18 from alexwlchan/remove-dead-code
- ID
152cc54- date
2023-06-11 20:04:17+00:00- author
Alex Chan <alex@alexwlchan.net>- parents
d6cc5e9,9d375d8- message
Merge pull request #18 from alexwlchan/remove-dead-code Remove some old/debugging code- changed files
2 files, 9 additions, 31 deletions
Changed files
BlinkReviewer/Blink/Views/PhotoReviewer.swift (14929) → BlinkReviewer/Blink/Views/PhotoReviewer.swift (14408)
diff --git a/BlinkReviewer/Blink/Views/PhotoReviewer.swift b/BlinkReviewer/Blink/Views/PhotoReviewer.swift
index fb5670c..d569979 100644
--- a/BlinkReviewer/Blink/Views/PhotoReviewer.swift
+++ b/BlinkReviewer/Blink/Views/PhotoReviewer.swift
@@ -131,20 +131,6 @@ struct PhotoReviewer: View {
return
}
- let start = DispatchTime.now()
- var elapsed = start
-
- func printElapsed(_ label: String) -> Void {
- let now = DispatchTime.now()
-
- let totalInterval = Double(now.uptimeNanoseconds - start.uptimeNanoseconds) / 1_000_000_000
- let elapsedInterval = Double(now.uptimeNanoseconds - elapsed.uptimeNanoseconds) / 1_000_000_000
-
- elapsed = DispatchTime.now()
-
- print("Time to \(label):\n \(elapsedInterval) seconds (\(totalInterval) total)")
- }
-
// The ChangeDetails can tell us how many assets were inserted/removed by
// the change, but only if it was a small change -- if it was a bigger change,
// we're meant to reload from scratch.
BlinkReviewer/Blink/Views/Thumbnails/ThumbnailImage.swift (1979) → BlinkReviewer/Blink/Views/Thumbnails/ThumbnailImage.swift (1601)
diff --git a/BlinkReviewer/Blink/Views/Thumbnails/ThumbnailImage.swift b/BlinkReviewer/Blink/Views/Thumbnails/ThumbnailImage.swift
index ce45de1..e968d7e 100644
--- a/BlinkReviewer/Blink/Views/Thumbnails/ThumbnailImage.swift
+++ b/BlinkReviewer/Blink/Views/Thumbnails/ThumbnailImage.swift
@@ -7,6 +7,15 @@ import Photos
/// mean some information gets cropped out -- that's okay, these are only
/// small previews, not complete images.
struct ThumbnailImage: View {
+
+ // Implementation note: the reason we pass in a bunch of individual
+ // properties rather than the whole asset is because we need an
+ // @EnvironmentObject (the PhotosLibrary) to create the PHAssetImage,
+ // so we can stick the latter in an @ObservedObject.
+ //
+ // But EnvironmentObject values aren't passed down until you call the
+ // `body` method, which is too late! So instead we have the parent
+ // view call into PhotosLibrary and pass in the relevant values here.
@ObservedObject var assetImage: PHAssetImage
var state: ReviewState?
var isFocused: Bool
@@ -19,23 +28,6 @@ struct ThumbnailImage: View {
private func cornerRadius() -> CGFloat {
isFocused ? 7 : 5
}
-
- // Implementation note: the reason we pass in a bunch of individual
- // properties rather than the whole asset is because we need an
- // @EnvironmentObject (the PhotosLibrary) to create the PHAssetImage,
- // so we can stick the latter in an @ObservedObject.
- //
- // But EnvironmentObject values aren't passed down until you call the
- // `body` method, which is too late! So instead we have the parent
- // view call into PhotosLibrary and pass in the relevant values here.
-// init(_ assetImage: PHAssetImage, state: ReviewState?, isFavorite: Bool, isFocused: Bool) {
-// print("Redrawing thumbnail image! \(assetImage.asset?.localIdentifier ?? "(unknown)") @ \(DispatchTime.now())")
-//
-// self.assetImage = assetImage
-// self.state = state
-// self.isFavorite = isFavorite
-// self.isFocused = isFocused
-// }
var body: some View {
Image(nsImage: assetImage.image)