From 6e0c97492b8e24bb56cd873981e6d69cbe539342 Mon Sep 17 00:00:00 2001 From: Daniel Barber Date: Sat, 27 Apr 2019 18:18:17 -0400 Subject: [PATCH] Some tweaks --- Persephone/DataSources/AlbumDataSource.swift | 3 +-- Persephone/Models/Album.swift | 2 +- Persephone/Models/Loading.swift | 4 ++-- Persephone/Reducers/AlbumListReducer.swift | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Persephone/DataSources/AlbumDataSource.swift b/Persephone/DataSources/AlbumDataSource.swift index 659409b..9e78c9f 100644 --- a/Persephone/DataSources/AlbumDataSource.swift +++ b/Persephone/DataSources/AlbumDataSource.swift @@ -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]) } } } diff --git a/Persephone/Models/Album.swift b/Persephone/Models/Album.swift index 1042f32..7e40e81 100644 --- a/Persephone/Models/Album.swift +++ b/Persephone/Models/Album.swift @@ -11,7 +11,7 @@ import CryptoSwift struct Album { var mpdAlbum: MPDClient.MPDAlbum - var coverArt: Loading = .notAsked + var coverArt: Loading = .notLoaded init(mpdAlbum: MPDClient.MPDAlbum) { self.mpdAlbum = mpdAlbum diff --git a/Persephone/Models/Loading.swift b/Persephone/Models/Loading.swift index 3c8a57e..db0358d 100644 --- a/Persephone/Models/Loading.swift +++ b/Persephone/Models/Loading.swift @@ -9,7 +9,7 @@ import Foundation enum Loading { - case notAsked + case notLoaded case loading case loaded(T) case error(Error) @@ -18,7 +18,7 @@ enum Loading { extension Loading: EnumEquatable { static func ~= (lhs: Loading, rhs: Loading) -> Bool { switch (lhs, rhs) { - case (.notAsked, .notAsked), + case (.notLoaded, .notLoaded), (.loading, .loading), (.loaded, .loaded), (.error, .error): diff --git a/Persephone/Reducers/AlbumListReducer.swift b/Persephone/Reducers/AlbumListReducer.swift index 66257b8..389585b 100644 --- a/Persephone/Reducers/AlbumListReducer.swift +++ b/Persephone/Reducers/AlbumListReducer.swift @@ -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 }