diff --git a/lib/reducers/custom-server-reducer.js b/lib/reducers/custom-server-reducer.js new file mode 100644 --- /dev/null +++ b/lib/reducers/custom-server-reducer.js @@ -0,0 +1,15 @@ +// @flow + +import { setCustomServerActionType } from '../actions/custom-server-actions.js'; +import type { BaseAction } from '../types/redux-types'; + +export default function reduceCustomServer( + state: ?string, + action: BaseAction, +): ?string { + if (action.type === setCustomServerActionType) { + return action.payload; + } + + return state; +} diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js --- a/lib/reducers/master-reducer.js +++ b/lib/reducers/master-reducer.js @@ -2,6 +2,7 @@ import reduceCalendarFilters from './calendar-filters-reducer.js'; import { reduceCalendarQuery } from './calendar-query-reducer.js'; +import reduceCustomerServer from './custom-server-reducer.js'; import reduceDataLoaded from './data-loaded-reducer.js'; import { reduceDraftStore } from './draft-reducer.js'; import reduceEnabledApps from './enabled-apps-reducer.js'; @@ -179,6 +180,7 @@ threadStoreOperations, ), globalThemeInfo: reduceGlobalThemeInfo(state.globalThemeInfo, action), + customServer: reduceCustomerServer(state.customServer, action), }, storeOperations: { draftStoreOperations, diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js --- a/lib/types/redux-types.js +++ b/lib/types/redux-types.js @@ -148,6 +148,7 @@ +threadActivityStore: ThreadActivityStore, +integrityStore: IntegrityStore, +globalThemeInfo: GlobalThemeInfo, + +customServer: ?string, ... }; diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js --- a/native/redux/redux-setup.js +++ b/native/redux/redux-setup.js @@ -6,7 +6,6 @@ import thunk from 'redux-thunk'; import { setClientDBStoreActionType } from 'lib/actions/client-db-store-actions.js'; -import { setCustomServerActionType } from 'lib/actions/custom-server-actions.js'; import { siweAuthActionTypes } from 'lib/actions/siwe-actions.js'; import { logOutActionTypes, @@ -146,12 +145,7 @@ return state; } - if (action.type === setCustomServerActionType) { - return { - ...state, - customServer: action.payload, - }; - } else if (action.type === updateDimensionsActiveType) { + if (action.type === updateDimensionsActiveType) { return { ...state, dimensions: { diff --git a/web/redux/default-state.js b/web/redux/default-state.js --- a/web/redux/default-state.js +++ b/web/redux/default-state.js @@ -85,6 +85,7 @@ initialStateLoaded: false, integrityStore: { threadHashes: {}, threadHashingStatus: 'starting' }, globalThemeInfo: defaultGlobalThemeInfo, + customServer: null, }); export { defaultWebState }; diff --git a/web/redux/persist.js b/web/redux/persist.js --- a/web/redux/persist.js +++ b/web/redux/persist.js @@ -211,6 +211,7 @@ 'commServicesAccessToken', 'keyserverStore', 'globalThemeInfo', + 'customServer', ]; const rootKey = 'root'; diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js --- a/web/redux/redux-setup.js +++ b/web/redux/redux-setup.js @@ -93,6 +93,7 @@ +initialStateLoaded: boolean, +integrityStore: IntegrityStore, +globalThemeInfo: GlobalThemeInfo, + +customServer: ?string, }; export type Action =