Skip to content

Commit

Permalink
clean up imagebrowserview cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
NattyNarwhal committed Mar 5, 2024
1 parent 9852779 commit 12b285b
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions Submariner/SBAlbum.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,7 @@ import CoreData

@objc(SBAlbum)
public class SBAlbum: SBMusicItem {
// #MARK: - IKImageBrowserView

// HACK: because IKImageBrowserView gets the smallest size by default. unneeded in the future?
static let nullCover = {
// 600 -> max size in image browser view for now
let config = NSImage.SymbolConfiguration(pointSize: 600, weight: .regular)
let image = NSImage(systemSymbolName: "questionmark.square.dashed", accessibilityDescription: "No Album Art")
return image!.withSymbolConfiguration(config)
}()

override public func imageTitle() -> String? {
return itemName
}

override public func imageUID() -> String? {
return itemName
}

override public func imageRepresentationType() -> String! {
// XXX: Can't use IKImageBrowserPathRepresentationType because [SBTrack coverImage] calls imageRepresentation.
return IKImageBrowserNSImageRepresentationType
}
static let nullCover = NSImage(systemSymbolName: "questionmark.square.dashed", accessibilityDescription: "No Album Art")

override public func imageRepresentation() -> Any! {
if let cover = self.cover, let path = cover.imagePath as String? {
Expand All @@ -42,18 +21,6 @@ public class SBAlbum: SBMusicItem {
return SBAlbum.nullCover;
}

override public func imageVersion() -> Int {
// Avoid constructing an image. I think this is only really used to check if it's loaded,
// since the album artwork shouldn't change normally (and if it does, rare it'll be the same size).
// XXX: Better method.
if let cover = self.cover,
let path = cover.imagePath as String?,
let attribs = try? FileManager.default.attributesOfItem(atPath: path) {
return attribs[FileAttributeKey.size] as! Int
}
return 0
}

@objc var starredBool: Bool {
get {
return starred != nil
Expand Down

0 comments on commit 12b285b

Please sign in to comment.