Clean up welcome screen logic
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
18
src/app.tsx
18
src/app.tsx
@@ -5,15 +5,13 @@ import { SafeAreaProvider } from 'react-native-safe-area-context';
|
||||
import { RealmProvider } from '@realm/react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { PersistGate } from 'redux-persist/integration/react';
|
||||
import { openDocumentTree } from 'react-native-scoped-storage';
|
||||
import type {} from 'redux-thunk/extend-redux';
|
||||
import { lightTheme, darkTheme } from './theme';
|
||||
import { Meme, Tag } from './database';
|
||||
import NavigationContainer from './navigation';
|
||||
import { store, persistor, updateStorageUri, validateSettings } from './state';
|
||||
import { store, persistor, validateSettings } from './state';
|
||||
import { LoadingView } from './components';
|
||||
import { Welcome } from './screens';
|
||||
import { noOp } from './utilities';
|
||||
|
||||
const App = () => {
|
||||
const [showWelcome, setShowWelcome] = useState(false);
|
||||
@@ -32,7 +30,6 @@ const App = () => {
|
||||
useEffect(() => {
|
||||
const subscription = AppState.addEventListener('change', async state => {
|
||||
if (state !== 'active') return;
|
||||
|
||||
await store.dispatch(validateSettings());
|
||||
const { settings } = store.getState();
|
||||
if (!settings.storageUri) {
|
||||
@@ -55,18 +52,7 @@ const App = () => {
|
||||
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
|
||||
backgroundColor={theme.colors.background}
|
||||
/>
|
||||
{showWelcome ? (
|
||||
<Welcome
|
||||
selectStorageLocation={async () => {
|
||||
const uri = await openDocumentTree(true).catch(noOp);
|
||||
if (!uri) return;
|
||||
await store.dispatch(updateStorageUri(uri.uri));
|
||||
setShowWelcome(false);
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<NavigationContainer />
|
||||
)}
|
||||
{showWelcome ? <Welcome /> : <NavigationContainer />}
|
||||
</SafeAreaProvider>
|
||||
</RealmProvider>
|
||||
</PersistGate>
|
||||
|
Reference in New Issue
Block a user