impl cache create/delete with server create/delete

also impl test connection
This commit is contained in:
austinried
2021-08-18 12:11:44 +09:00
parent 52223e6979
commit b7a05ca955
10 changed files with 288 additions and 145 deletions
+1 -19
View File
@@ -1,23 +1,7 @@
import React, { useEffect, useState } from 'react'
import { Text, View } from 'react-native'
import RNFS from 'react-native-fs'
import paths from '@app/util/paths'
import { Store, useStore } from '@app/state/store'
async function mkdir(path: string): Promise<void> {
const exists = await RNFS.exists(path)
if (exists) {
const isDir = (await RNFS.stat(path)).isDirectory()
if (!isDir) {
throw new Error(`path exists and is not a directory: ${path}`)
} else {
return
}
}
return await RNFS.mkdir(path)
}
const selectHydrated = (store: Store) => store.hydrated
const SplashPage: React.FC<{}> = ({ children }) => {
@@ -27,9 +11,7 @@ const SplashPage: React.FC<{}> = ({ children }) => {
const minSplashTime = new Promise(resolve => setTimeout(resolve, 1))
const prepare = async () => {
await mkdir(paths.imageCache)
await mkdir(paths.songCache)
await mkdir(paths.songs)
return
}
const promise = Promise.all([prepare(), minSplashTime])