Changeset View
Changeset View
Standalone View
Standalone View
native/redux/redux-setup.js
// @flow | // @flow | ||||
import { AppState as NativeAppState, Platform, Alert } from 'react-native'; | import { AppState as NativeAppState, Platform, Alert } from 'react-native'; | ||||
import Orientation from 'react-native-orientation-locker'; | import Orientation from 'react-native-orientation-locker'; | ||||
import { createStore, applyMiddleware, type Store, compose } from 'redux'; | import { createStore, applyMiddleware, type Store, compose } from 'redux'; | ||||
import { persistStore, persistReducer } from 'redux-persist'; | import { persistStore, persistReducer } from 'redux-persist'; | ||||
import thunk from 'redux-thunk'; | import thunk from 'redux-thunk'; | ||||
import { setClientDBStoreActionType } from 'lib/actions/client-db-store-actions.js'; | import { setClientDBStoreActionType } from 'lib/actions/client-db-store-actions.js'; | ||||
import { siweAuthActionTypes } from 'lib/actions/siwe-actions.js'; | import { siweAuthActionTypes } from 'lib/actions/siwe-actions.js'; | ||||
import { | import { | ||||
logOutActionTypes, | logOutActionTypes, | ||||
deleteAccountActionTypes, | deleteAccountActionTypes, | ||||
logInActionTypes, | logInActionTypes, | ||||
} from 'lib/actions/user-actions.js'; | } from 'lib/actions/user-actions.js'; | ||||
import { reduceDeviceToken } from 'lib/reducers/device-token-reducer.js'; | |||||
import baseReducer from 'lib/reducers/master-reducer.js'; | import baseReducer from 'lib/reducers/master-reducer.js'; | ||||
import { processThreadStoreOperations } from 'lib/reducers/thread-reducer.js'; | import { processThreadStoreOperations } from 'lib/reducers/thread-reducer.js'; | ||||
import { | import { | ||||
invalidSessionDowngrade, | invalidSessionDowngrade, | ||||
invalidSessionRecovery, | invalidSessionRecovery, | ||||
} from 'lib/shared/account-utils.js'; | } from 'lib/shared/account-utils.js'; | ||||
import { isStaff } from 'lib/shared/user-utils.js'; | import { isStaff } from 'lib/shared/user-utils.js'; | ||||
import { defaultEnabledApps } from 'lib/types/enabled-apps.js'; | import { defaultEnabledApps } from 'lib/types/enabled-apps.js'; | ||||
▲ Show 20 Lines • Show All 302 Lines • ▼ Show 20 Lines | if (action.type === setClientDBStoreActionType) { | ||||
) { | ) { | ||||
// If user is logged out now, was logged out at the time action was | // If user is logged out now, was logged out at the time action was | ||||
// dispatched or their ID changed between action dispatch and a | // dispatched or their ID changed between action dispatch and a | ||||
// call to reducer we ignore the SQLite data since it is not valid | // call to reducer we ignore the SQLite data since it is not valid | ||||
return state; | return state; | ||||
} | } | ||||
} | } | ||||
state = { | |||||
...state, | |||||
deviceToken: reduceDeviceToken(state.deviceToken, action), | |||||
}; | |||||
const baseReducerResult = baseReducer(state, (action: BaseAction)); | const baseReducerResult = baseReducer(state, (action: BaseAction)); | ||||
state = baseReducerResult.state; | state = baseReducerResult.state; | ||||
const { storeOperations } = baseReducerResult; | const { storeOperations } = baseReducerResult; | ||||
const { | const { | ||||
draftStoreOperations, | draftStoreOperations, | ||||
threadStoreOperations, | threadStoreOperations, | ||||
messageStoreOperations, | messageStoreOperations, | ||||
▲ Show 20 Lines • Show All 181 Lines • Show Last 20 Lines |