Changeset View
Changeset View
Standalone View
Standalone View
native/redux/redux-setup.js
Show All 24 Lines | |||||
import type { Dispatch, BaseAction } from 'lib/types/redux-types.js'; | import type { Dispatch, BaseAction } from 'lib/types/redux-types.js'; | ||||
import { rehydrateActionType } from 'lib/types/redux-types.js'; | import { rehydrateActionType } from 'lib/types/redux-types.js'; | ||||
import type { SetSessionPayload } from 'lib/types/session-types.js'; | import type { SetSessionPayload } from 'lib/types/session-types.js'; | ||||
import { defaultConnectionInfo } from 'lib/types/socket-types.js'; | import { defaultConnectionInfo } from 'lib/types/socket-types.js'; | ||||
import type { ThreadStoreOperation } from 'lib/types/thread-types.js'; | import type { ThreadStoreOperation } from 'lib/types/thread-types.js'; | ||||
import { reduxLoggerMiddleware } from 'lib/utils/action-logger.js'; | import { reduxLoggerMiddleware } from 'lib/utils/action-logger.js'; | ||||
import { setNewSessionActionType } from 'lib/utils/action-utils.js'; | import { setNewSessionActionType } from 'lib/utils/action-utils.js'; | ||||
import { convertMessageStoreOperationsToClientDBOperations } from 'lib/utils/message-ops-utils.js'; | import { convertMessageStoreOperationsToClientDBOperations } from 'lib/utils/message-ops-utils.js'; | ||||
import { defaultNotifPermissionAlertInfo } from 'lib/utils/push-alerts.js'; | |||||
import { convertThreadStoreOperationsToClientDBOperations } from 'lib/utils/thread-ops-utils.js'; | import { convertThreadStoreOperationsToClientDBOperations } from 'lib/utils/thread-ops-utils.js'; | ||||
import { | import { | ||||
resetUserStateActionType, | resetUserStateActionType, | ||||
recordNotifPermissionAlertActionType, | |||||
updateDimensionsActiveType, | updateDimensionsActiveType, | ||||
updateConnectivityActiveType, | updateConnectivityActiveType, | ||||
updateThemeInfoActionType, | updateThemeInfoActionType, | ||||
updateDeviceCameraInfoActionType, | updateDeviceCameraInfoActionType, | ||||
updateDeviceOrientationActionType, | updateDeviceOrientationActionType, | ||||
updateThreadLastNavigatedActionType, | updateThreadLastNavigatedActionType, | ||||
backgroundActionTypes, | backgroundActionTypes, | ||||
setReduxStateActionType, | setReduxStateActionType, | ||||
setStoreLoadedActionType, | setStoreLoadedActionType, | ||||
type Action, | type Action, | ||||
} from './action-types.js'; | } from './action-types.js'; | ||||
import { remoteReduxDevServerConfig } from './dev-tools.js'; | import { remoteReduxDevServerConfig } from './dev-tools.js'; | ||||
import { defaultDimensionsInfo } from './dimensions-updater.react.js'; | import { defaultDimensionsInfo } from './dimensions-updater.react.js'; | ||||
import { persistConfig, setPersistor } from './persist.js'; | import { persistConfig, setPersistor } from './persist.js'; | ||||
import type { AppState } from './state-types.js'; | import type { AppState } from './state-types.js'; | ||||
import { commCoreModule } from '../native-modules.js'; | import { commCoreModule } from '../native-modules.js'; | ||||
import { defaultNavInfo } from '../navigation/default-state.js'; | import { defaultNavInfo } from '../navigation/default-state.js'; | ||||
import { getGlobalNavContext } from '../navigation/icky-global.js'; | import { getGlobalNavContext } from '../navigation/icky-global.js'; | ||||
import { activeMessageListSelector } from '../navigation/nav-selectors.js'; | import { activeMessageListSelector } from '../navigation/nav-selectors.js'; | ||||
import { defaultNotifPermissionAlertInfo } from '../push/alerts.js'; | |||||
import reactotron from '../reactotron.js'; | import reactotron from '../reactotron.js'; | ||||
import { defaultDeviceCameraInfo } from '../types/camera.js'; | import { defaultDeviceCameraInfo } from '../types/camera.js'; | ||||
import { defaultConnectivityInfo } from '../types/connectivity.js'; | import { defaultConnectivityInfo } from '../types/connectivity.js'; | ||||
import { defaultGlobalThemeInfo } from '../types/themes.js'; | import { defaultGlobalThemeInfo } from '../types/themes.js'; | ||||
import { isTaskCancelledError } from '../utils/error-handling.js'; | import { isTaskCancelledError } from '../utils/error-handling.js'; | ||||
import { isStaffRelease } from '../utils/staff-utils.js'; | import { isStaffRelease } from '../utils/staff-utils.js'; | ||||
import { | import { | ||||
defaultURLPrefix, | defaultURLPrefix, | ||||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | ) { | ||||
return state; | return state; | ||||
} | } | ||||
if (action.type === setCustomServer) { | if (action.type === setCustomServer) { | ||||
return { | return { | ||||
...state, | ...state, | ||||
customServer: action.payload, | customServer: action.payload, | ||||
}; | }; | ||||
} else if (action.type === recordNotifPermissionAlertActionType) { | |||||
return { | |||||
...state, | |||||
notifPermissionAlertInfo: { | |||||
totalAlerts: state.notifPermissionAlertInfo.totalAlerts + 1, | |||||
lastAlertTime: action.payload.time, | |||||
}, | |||||
}; | |||||
} else if (action.type === resetUserStateActionType) { | } else if (action.type === resetUserStateActionType) { | ||||
const cookie = | const cookie = | ||||
state.cookie && state.cookie.startsWith('anonymous=') | state.cookie && state.cookie.startsWith('anonymous=') | ||||
? state.cookie | ? state.cookie | ||||
: null; | : null; | ||||
const currentUserInfo = | const currentUserInfo = | ||||
state.currentUserInfo && state.currentUserInfo.anonymous | state.currentUserInfo && state.currentUserInfo.anonymous | ||||
? state.currentUserInfo | ? state.currentUserInfo | ||||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |