From 50be0a6f8586109277a7ad15e3eb908cd2dc5ab7 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Fri, 25 Jun 2021 14:26:54 +0900 Subject: [PATCH] impl songs, whole library refresh --- App.tsx | 2 + src/components/ArtistsList.tsx | 12 +-- src/components/MusicManager.tsx | 104 ++++++++++++++++++++++++++ src/components/SplashPage.tsx | 9 +-- src/components/library/AlbumsTab.tsx | 21 +----- src/components/library/ArtistsTab.tsx | 2 +- src/models/music.ts | 9 +++ src/paths.ts | 7 ++ src/state/artists.ts | 42 ----------- src/state/{albums.ts => music.ts} | 85 ++++++++++++--------- src/storage/music.ts | 96 +++++++++++++++--------- src/subsonic/api.ts | 17 ++++- src/subsonic/elements.ts | 19 +++++ src/subsonic/params.ts | 8 ++ src/subsonic/responses.ts | 30 +++++++- 15 files changed, 317 insertions(+), 146 deletions(-) create mode 100644 src/components/MusicManager.tsx create mode 100644 src/paths.ts delete mode 100644 src/state/artists.ts rename src/state/{albums.ts => music.ts} (54%) diff --git a/App.tsx b/App.tsx index 8322053..fdea0e8 100644 --- a/App.tsx +++ b/App.tsx @@ -3,10 +3,12 @@ import { NavigationContainer } from '@react-navigation/native'; import { RecoilRoot } from 'recoil'; import SplashPage from './src/components/SplashPage'; import RootNavigator from './src/components/navigation/RootNavigator'; +import MusicManager from './src/components/MusicManager'; const App = () => ( + diff --git a/src/components/ArtistsList.tsx b/src/components/ArtistsList.tsx index ede40b2..10ba613 100644 --- a/src/components/ArtistsList.tsx +++ b/src/components/ArtistsList.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { Button, FlatList, Text, View } from 'react-native'; -import { useRecoilValue, useResetRecoilState } from 'recoil'; -import { artistsState, useUpdateArtists } from '../state/artists'; +import { useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'; import { Artist } from '../models/music'; +import { artistsState, isLibraryRefreshingState, libraryRefreshState } from '../state/music'; const ArtistItem: React.FC<{ item: Artist } > = ({ item }) => ( @@ -32,7 +32,8 @@ const List = () => { const ListPlusControls = () => { const resetArtists = useResetRecoilState(artistsState); - const updateArtists = useUpdateArtists(); + const setLibraryRefresh = useSetRecoilState(libraryRefreshState); + const isLibraryRefreshing = useRecoilValue(isLibraryRefreshingState); return ( @@ -41,8 +42,9 @@ const ListPlusControls = () => { onPress={resetArtists} />