From 4e978360ce9672680fa13b238b9be4d40c4e2ee0 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Tue, 22 Mar 2022 16:29:36 +0900 Subject: [PATCH] rename to remove "Library" from methods --- app/hooks/cache.ts | 2 +- app/hooks/music.ts | 6 ++--- app/screens/ArtistView.tsx | 4 ++-- app/screens/Home.tsx | 2 +- app/screens/LibraryAlbums.tsx | 2 +- app/screens/LibraryArtists.tsx | 2 +- app/screens/LibraryPlaylists.tsx | 2 +- app/screens/Search.tsx | 2 +- app/screens/SearchResultsView.tsx | 2 +- app/screens/SongListView.tsx | 4 ++-- app/state/library.ts | 40 +++++++++++++++---------------- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/app/hooks/cache.ts b/app/hooks/cache.ts index a7f47d8..826e758 100644 --- a/app/hooks/cache.ts +++ b/app/hooks/cache.ts @@ -54,7 +54,7 @@ export const useCoverArtFile = (coverArt = '-1') => { export const useArtistArtFile = (artistId: string) => { const type: CacheItemTypeKey = 'artistArt' - const fetchArtistInfo = useStore(store => store.fetchLibraryArtistInfo) + const fetchArtistInfo = useStore(store => store.fetchArtistInfo) const artistInfo = useStoreDeep(store => store.entities.artistInfo[artistId]) const { file, request } = useFileRequest(type, artistId) const cacheItem = useStore(selectCache.cacheItem) diff --git a/app/hooks/music.ts b/app/hooks/music.ts index 7f321e4..dad0c3a 100644 --- a/app/hooks/music.ts +++ b/app/hooks/music.ts @@ -18,9 +18,9 @@ function starParams(id: string, type: StarrableItem): StarParams { } export const useStar = (id: string, type: StarrableItem) => { - const fetchAlbum = useStore(store => store.fetchLibraryAlbum) - const fetchArtist = useStore(store => store.fetchLibraryArtist) - const fetchSong = useStore(store => store.fetchLibrarySong) + const fetchAlbum = useStore(store => store.fetchAlbum) + const fetchArtist = useStore(store => store.fetchArtist) + const fetchSong = useStore(store => store.fetchSong) const _starred = useStore( useCallback( diff --git a/app/screens/ArtistView.tsx b/app/screens/ArtistView.tsx index 9e21a55..18061b2 100644 --- a/app/screens/ArtistView.tsx +++ b/app/screens/ArtistView.tsx @@ -107,8 +107,8 @@ const ArtistView = React.memo<{ id: string; title: string }>(({ id, title }) => useCallback(store => (albumIds ? mapById(store.entities.albums, albumIds) : undefined), [albumIds]), ) - const fetchArtist = useStore(store => store.fetchLibraryArtist) - const fetchTopSongs = useStore(store => store.fetchLibraryArtistTopSongs) + const fetchArtist = useStore(store => store.fetchArtist) + const fetchTopSongs = useStore(store => store.fetchArtistTopSongs) const coverLayout = useLayout() const headerOpacity = useSharedValue(0) diff --git a/app/screens/Home.tsx b/app/screens/Home.tsx index 01e0961..c329744 100644 --- a/app/screens/Home.tsx +++ b/app/screens/Home.tsx @@ -108,7 +108,7 @@ function useHomeStoreDeep(stateSelector: StateSelector) { const Home = () => { const [refreshing, setRefreshing] = useState(false) const types = useStore(selectSettings.homeLists) - const fetchAlbumList = useStore(store => store.fetchLibraryAlbumList) + const fetchAlbumList = useStore(store => store.fetchAlbumList) const setList = useHomeStore(store => store.setList) const refresh = useCallback(async () => { diff --git a/app/screens/LibraryAlbums.tsx b/app/screens/LibraryAlbums.tsx index 7d5cfe6..ed4bedf 100644 --- a/app/screens/LibraryAlbums.tsx +++ b/app/screens/LibraryAlbums.tsx @@ -60,7 +60,7 @@ const AlbumsList = () => { const filter = useStore(selectSettings.libraryAlbumFilter) const setFilter = useStore(selectSettings.setLibraryAlbumFilter) - const fetchAlbumList = useStore(store => store.fetchLibraryAlbumList) + const fetchAlbumList = useStore(store => store.fetchAlbumList) const fetchPage = useCallback( (size: number, offset: number) => { let params: GetAlbumList2Params diff --git a/app/screens/LibraryArtists.tsx b/app/screens/LibraryArtists.tsx index 758ea88..46a2359 100644 --- a/app/screens/LibraryArtists.tsx +++ b/app/screens/LibraryArtists.tsx @@ -20,7 +20,7 @@ const filterOptions: OptionData[] = [ ] const ArtistsList = () => { - const fetchArtists = useStore(store => store.fetchLibraryArtists) + const fetchArtists = useStore(store => store.fetchArtists) const { refreshing, refresh } = useFetchList2(fetchArtists) const artists = useStoreDeep(store => store.entities.artists) diff --git a/app/screens/LibraryPlaylists.tsx b/app/screens/LibraryPlaylists.tsx index 9a1a074..9d89cff 100644 --- a/app/screens/LibraryPlaylists.tsx +++ b/app/screens/LibraryPlaylists.tsx @@ -11,7 +11,7 @@ const PlaylistRenderItem: React.FC<{ item: Playlist }> = ({ item }) => ( ) const PlaylistsList = () => { - const fetchPlaylists = useStore(store => store.fetchLibraryPlaylists) + const fetchPlaylists = useStore(store => store.fetchPlaylists) const { refreshing, refresh } = useFetchList2(fetchPlaylists) const playlists = useStoreDeep(store => store.entities.playlists) diff --git a/app/screens/Search.tsx b/app/screens/Search.tsx index 02b5a64..d2989b4 100644 --- a/app/screens/Search.tsx +++ b/app/screens/Search.tsx @@ -105,7 +105,7 @@ const Results = React.memo<{ }) const Search = () => { - const fetchSearchResults = useStore(store => store.fetchLibrarySearchResults) + const fetchSearchResults = useStore(store => store.fetchSearchResults) const [results, setResults] = useState({ artists: [], albums: [], songs: [] }) const [refreshing, setRefreshing] = useState(false) const [text, setText] = useState('') diff --git a/app/screens/SearchResultsView.tsx b/app/screens/SearchResultsView.tsx index 5f6f9a7..a7e3f5f 100644 --- a/app/screens/SearchResultsView.tsx +++ b/app/screens/SearchResultsView.tsx @@ -41,7 +41,7 @@ const SearchResultsView: React.FC<{ type: 'album' | 'artist' | 'song' }> = ({ query, type }) => { const navigation = useNavigation() - const fetchSearchResults = useStore(store => store.fetchLibrarySearchResults) + const fetchSearchResults = useStore(store => store.fetchSearchResults) const { list, refreshing, refresh, fetchNextPage } = useFetchPaginatedList( useCallback( async (size, offset) => { diff --git a/app/screens/SongListView.tsx b/app/screens/SongListView.tsx index 05529c0..3e0cafb 100644 --- a/app/screens/SongListView.tsx +++ b/app/screens/SongListView.tsx @@ -144,7 +144,7 @@ const PlaylistView = React.memo<{ ), ) - const fetchPlaylist = useStore(store => store.fetchLibraryPlaylist) + const fetchPlaylist = useStore(store => store.fetchPlaylist) useEffect(() => { if (!playlist || !songs) { @@ -172,7 +172,7 @@ const AlbumView = React.memo<{ ), ) - const fetchAlbum = useStore(store => store.fetchLibraryAlbum) + const fetchAlbum = useStore(store => store.fetchAlbum) useEffect(() => { if (!album || !songs) { diff --git a/app/state/library.ts b/app/state/library.ts index 496e8d9..1891eab 100644 --- a/app/state/library.ts +++ b/app/state/library.ts @@ -49,20 +49,20 @@ export type LibrarySlice = { resetLibrary: (state?: WritableDraft) => void - fetchLibraryArtists: () => Promise - fetchLibraryArtist: (id: string) => Promise - fetchLibraryArtistInfo: (artistId: string) => Promise - fetchLibraryArtistTopSongs: (artistName: string) => Promise + fetchArtists: () => Promise + fetchArtist: (id: string) => Promise + fetchArtistInfo: (artistId: string) => Promise + fetchArtistTopSongs: (artistName: string) => Promise - fetchLibraryAlbum: (id: string) => Promise + fetchAlbum: (id: string) => Promise - fetchLibraryPlaylists: () => Promise - fetchLibraryPlaylist: (id: string) => Promise + fetchPlaylists: () => Promise + fetchPlaylist: (id: string) => Promise - fetchLibrarySong: (id: string) => Promise + fetchSong: (id: string) => Promise - fetchLibraryAlbumList: (params: GetAlbumList2Params) => Promise - fetchLibrarySearchResults: (params: Search3Params) => Promise + fetchAlbumList: (params: GetAlbumList2Params) => Promise + fetchSearchResults: (params: Search3Params) => Promise star: (params: StarParams) => Promise unstar: (params: StarParams) => Promise @@ -97,7 +97,7 @@ export const createLibrarySlice = (set: SetState, get: GetState): }) }, - fetchLibraryArtists: async () => { + fetchArtists: async () => { const client = get().client if (!client) { return @@ -121,7 +121,7 @@ export const createLibrarySlice = (set: SetState, get: GetState): ) }, - fetchLibraryArtist: async id => { + fetchArtist: async id => { const client = get().client if (!client) { return @@ -147,7 +147,7 @@ export const createLibrarySlice = (set: SetState, get: GetState): ) }, - fetchLibraryArtistInfo: async id => { + fetchArtistInfo: async id => { const client = get().client if (!client) { return @@ -169,7 +169,7 @@ export const createLibrarySlice = (set: SetState, get: GetState): ) }, - fetchLibraryArtistTopSongs: async artistName => { + fetchArtistTopSongs: async artistName => { const client = get().client if (!client) { return @@ -195,7 +195,7 @@ export const createLibrarySlice = (set: SetState, get: GetState): ) }, - fetchLibraryAlbum: async id => { + fetchAlbum: async id => { const client = get().client if (!client) { return @@ -223,7 +223,7 @@ export const createLibrarySlice = (set: SetState, get: GetState): ) }, - fetchLibraryPlaylists: async () => { + fetchPlaylists: async () => { const client = get().client if (!client) { return @@ -247,7 +247,7 @@ export const createLibrarySlice = (set: SetState, get: GetState): ) }, - fetchLibraryPlaylist: async id => { + fetchPlaylist: async id => { const client = get().client if (!client) { return @@ -275,7 +275,7 @@ export const createLibrarySlice = (set: SetState, get: GetState): ) }, - fetchLibrarySong: async id => { + fetchSong: async id => { const client = get().client if (!client) { return @@ -299,7 +299,7 @@ export const createLibrarySlice = (set: SetState, get: GetState): ) }, - fetchLibraryAlbumList: async params => { + fetchAlbumList: async params => { const client = get().client if (!client) { return [] @@ -324,7 +324,7 @@ export const createLibrarySlice = (set: SetState, get: GetState): return mapId(albums) }, - fetchLibrarySearchResults: async params => { + fetchSearchResults: async params => { const empty = { artists: [], albums: [], songs: [] } const client = get().client