1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00

Some tweaks

This commit is contained in:
Daniel Barber 2019-04-27 18:18:17 -04:00
parent 86feface73
commit 6e0c97492b
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
4 changed files with 6 additions and 7 deletions

View File

@ -24,7 +24,7 @@ class AlbumDataSource: NSObject, NSCollectionViewDataSource {
albumViewItem.setAlbum(albums[indexPath.item]) albumViewItem.setAlbum(albums[indexPath.item])
switch albums[indexPath.item].coverArt { switch albums[indexPath.item].coverArt {
case .notAsked: case .notLoaded:
AppDelegate.mpdClient.getAlbumFirstSong(for: albums[indexPath.item].mpdAlbum) { AppDelegate.mpdClient.getAlbumFirstSong(for: albums[indexPath.item].mpdAlbum) {
guard let song = $0 else { return } guard let song = $0 else { return }
@ -35,7 +35,6 @@ class AlbumDataSource: NSObject, NSCollectionViewDataSource {
AppDelegate.store.dispatch( AppDelegate.store.dispatch(
UpdateAlbumArt(coverArt: image, albumIndex: indexPath.item) UpdateAlbumArt(coverArt: image, albumIndex: indexPath.item)
) )
//collectionView.reloadItems(at: [indexPath])
} }
} }
} }

View File

@ -11,7 +11,7 @@ import CryptoSwift
struct Album { struct Album {
var mpdAlbum: MPDClient.MPDAlbum var mpdAlbum: MPDClient.MPDAlbum
var coverArt: Loading<NSImage?> = .notAsked var coverArt: Loading<NSImage?> = .notLoaded
init(mpdAlbum: MPDClient.MPDAlbum) { init(mpdAlbum: MPDClient.MPDAlbum) {
self.mpdAlbum = mpdAlbum self.mpdAlbum = mpdAlbum

View File

@ -9,7 +9,7 @@
import Foundation import Foundation
enum Loading<T> { enum Loading<T> {
case notAsked case notLoaded
case loading case loading
case loaded(T) case loaded(T)
case error(Error) case error(Error)
@ -18,7 +18,7 @@ enum Loading<T> {
extension Loading: EnumEquatable { extension Loading: EnumEquatable {
static func ~= (lhs: Loading<T>, rhs: Loading<T>) -> Bool { static func ~= (lhs: Loading<T>, rhs: Loading<T>) -> Bool {
switch (lhs, rhs) { switch (lhs, rhs) {
case (.notAsked, .notAsked), case (.notLoaded, .notLoaded),
(.loading, .loading), (.loading, .loading),
(.loaded, .loaded), (.loaded, .loaded),
(.error, .error): (.error, .error):

View File

@ -24,10 +24,10 @@ func albumListReducer(action: Action, state: AlbumListState?) -> AlbumListState
switch album.coverArt { switch album.coverArt {
case .loaded(let coverArt): case .loaded(let coverArt):
if coverArt == nil { if coverArt == nil {
album.coverArt = .notAsked album.coverArt = .notLoaded
} }
default: default:
album.coverArt = .notAsked album.coverArt = .notLoaded
} }
return album return album
} }