mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Some tweaks
This commit is contained in:
parent
86feface73
commit
6e0c97492b
@ -24,7 +24,7 @@ class AlbumDataSource: NSObject, NSCollectionViewDataSource {
|
||||
albumViewItem.setAlbum(albums[indexPath.item])
|
||||
|
||||
switch albums[indexPath.item].coverArt {
|
||||
case .notAsked:
|
||||
case .notLoaded:
|
||||
AppDelegate.mpdClient.getAlbumFirstSong(for: albums[indexPath.item].mpdAlbum) {
|
||||
guard let song = $0 else { return }
|
||||
|
||||
@ -35,7 +35,6 @@ class AlbumDataSource: NSObject, NSCollectionViewDataSource {
|
||||
AppDelegate.store.dispatch(
|
||||
UpdateAlbumArt(coverArt: image, albumIndex: indexPath.item)
|
||||
)
|
||||
//collectionView.reloadItems(at: [indexPath])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ import CryptoSwift
|
||||
|
||||
struct Album {
|
||||
var mpdAlbum: MPDClient.MPDAlbum
|
||||
var coverArt: Loading<NSImage?> = .notAsked
|
||||
var coverArt: Loading<NSImage?> = .notLoaded
|
||||
|
||||
init(mpdAlbum: MPDClient.MPDAlbum) {
|
||||
self.mpdAlbum = mpdAlbum
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import Foundation
|
||||
|
||||
enum Loading<T> {
|
||||
case notAsked
|
||||
case notLoaded
|
||||
case loading
|
||||
case loaded(T)
|
||||
case error(Error)
|
||||
@ -18,7 +18,7 @@ enum Loading<T> {
|
||||
extension Loading: EnumEquatable {
|
||||
static func ~= (lhs: Loading<T>, rhs: Loading<T>) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.notAsked, .notAsked),
|
||||
case (.notLoaded, .notLoaded),
|
||||
(.loading, .loading),
|
||||
(.loaded, .loaded),
|
||||
(.error, .error):
|
||||
|
||||
@ -24,10 +24,10 @@ func albumListReducer(action: Action, state: AlbumListState?) -> AlbumListState
|
||||
switch album.coverArt {
|
||||
case .loaded(let coverArt):
|
||||
if coverArt == nil {
|
||||
album.coverArt = .notAsked
|
||||
album.coverArt = .notLoaded
|
||||
}
|
||||
default:
|
||||
album.coverArt = .notAsked
|
||||
album.coverArt = .notLoaded
|
||||
}
|
||||
return album
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user