-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
58 lines (49 loc) · 1.36 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React, { Component } from 'react';
import { AppRegistry, AsyncStorage } from 'react-native';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, combineReduxers, compose } from 'redux';
import thunkMiddleware from 'redux-thunk';
import { createLogger } from 'redux-logger';
import reducer from './app/reducers';
import { LoopStatus } from './app/constants';
import navigation from './app/navigation/navigation';
const loggerMiddleware = createLogger({ predicate: (getState, action) => __DEV__ });
function configureStore(initialState) {
const enhancer = compose(
applyMiddleware(
thunkMiddleware,
loggerMiddleware,
),
);
return createStore(reducer, initialState, enhancer);
}
const store = configureStore({
user: null,
player: null,
playingStatus: false,
currentlyPlaying: {
playlistId: null,
videoId: null,
songTitle: null,
songThumbnail: { url: null },
loopStatus: LoopStatus.LOOP_SONG,
shuffleOrder: null,
},
currentlyDownloading: {
videoId: null,
songTitle: null,
songThumbnail: { url: null },
},
searchQuery: '',
searchResults: [],
searchBarFocused: false,
});
navigation.registerScreens(store, Provider);
AsyncStorage.getItem('refreshToken')
.then((token) => {
if (token) {
navigation.startApp();
} else {
navigation.startLogin();
}
});