Skip to main content

remove some dead code

ID
14e6e30
date
2023-06-09 18:57:30+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
6a55fd7
message
remove some dead code
changed files
1 file, 1 addition, 48 deletions

Changed files

BlinkReviewer/BlinkReviewer/Photos/AssetHelpers.swift (4429) → BlinkReviewer/BlinkReviewer/Photos/AssetHelpers.swift (2805)

diff --git a/BlinkReviewer/BlinkReviewer/Photos/AssetHelpers.swift b/BlinkReviewer/BlinkReviewer/Photos/AssetHelpers.swift
index 60f3c92..3e29e8d 100644
--- a/BlinkReviewer/BlinkReviewer/Photos/AssetHelpers.swift
+++ b/BlinkReviewer/BlinkReviewer/Photos/AssetHelpers.swift
@@ -7,7 +7,6 @@
 
 import Foundation
 import Photos
-import SwiftUI
 
 /// Returns a list of all the images in the Photos Library.
 func getAllPhotos() -> [PHAsset] {
@@ -37,55 +36,9 @@ extension PHAsset {
         
         return result
     }
-    
-    private func getImageForSize(size: CGSize) -> NSImage {
-        // This implementation is based on code in a Stack Overflow answer
-        // by Francois Nadeau: https://stackoverflow.com/a/48755517/1558022
-
-        let options = PHImageRequestOptions()
-        
-        // do I still need this?
-        options.isSynchronous = false
-
-        // If i don't set this value, then sometimes I get an error like
-        // this in the `info` variable:
-        //
-        //      Error Domain=PHPhotosErrorDomain Code=3164 "(null)"
-        //
-        // This means that the asset is in the cloud, and by default Photos
-        // isn't allowed to download assets here.  Apple's documentation
-        // suggests adding this option as the fix.
-        //
-        // See https://developer.apple.com/documentation/photokit/phphotoserror/phphotoserrornetworkaccessrequired
-        options.isNetworkAccessAllowed = true
-
-        var image = NSImage()
-        
-        PHCachingImageManager()
-            .requestImage(
-                for: self,
-                targetSize: size,
-                contentMode: .aspectFill,
-                options: options,
-                resultHandler: { (result, info) -> Void in
-                    print("Calling resultHandler for \(self.localIdentifier)")
-                    image = result!
-                }
-            )
 
-        return image
-    }
-    
-    func getThumbnail() -> NSImage {
-        return getImageForSize(size: CGSize(width: 70, height: 70))
-    }
-    
-    func getImage() -> NSImage {
-        return getImageForSize(size: PHImageManagerMaximumSize)
-    }
-    
     /// Returns true if an asset is in the given album, false otherwise.
-    func isInAlbum(_ album: PHAssetCollection) -> Bool {
+    private func isInAlbum(_ album: PHAssetCollection) -> Bool {
         return albums().contains(where: { collection in
             collection == album
         })