diff --git a/src/main/redux/reducers/reader/defaultConfig.ts b/src/common/redux/reducers/reader/defaultConfig.ts similarity index 100% rename from src/main/redux/reducers/reader/defaultConfig.ts rename to src/common/redux/reducers/reader/defaultConfig.ts diff --git a/src/common/redux/states/commonRootState.ts b/src/common/redux/states/commonRootState.ts index 1dfa57bdc..b25f33250 100644 --- a/src/common/redux/states/commonRootState.ts +++ b/src/common/redux/states/commonRootState.ts @@ -7,8 +7,12 @@ import { ISessionState } from "readium-desktop/common/redux/states/session"; import { IKeyboardState } from "readium-desktop/common/redux/states/keyboard"; +import { ReaderConfig } from "readium-desktop/common/models/reader"; export interface ICommonRootState { session: ISessionState keyboard: IKeyboardState; + reader: { + defaultConfig: ReaderConfig, + }; } diff --git a/src/common/redux/states/renderer/readerRootState.ts b/src/common/redux/states/renderer/readerRootState.ts index 27f620442..527cbe8ef 100644 --- a/src/common/redux/states/renderer/readerRootState.ts +++ b/src/common/redux/states/renderer/readerRootState.ts @@ -35,4 +35,5 @@ export interface IReaderStateReader { mounter: TMapState; }; divina: IDivinaState; + defaultConfig: ReaderConfig; // sync across all app } diff --git a/src/main/redux/middleware/sync.ts b/src/main/redux/middleware/sync.ts index 3491f76a6..e2c535768 100644 --- a/src/main/redux/middleware/sync.ts +++ b/src/main/redux/middleware/sync.ts @@ -59,6 +59,8 @@ const SYNCHRONIZABLE_ACTIONS: string[] = [ catalogActions.setCatalog.ID, // send new catalogView to library catalogActions.setTagView.ID, + + readerActions.configSetDefault.ID, // readerConfig ]; export const reduxSyncMiddleware: Middleware diff --git a/src/main/redux/reducers/index.ts b/src/main/redux/reducers/index.ts index 863449335..98d36f798 100644 --- a/src/main/redux/reducers/index.ts +++ b/src/main/redux/reducers/index.ts @@ -16,7 +16,7 @@ import { combineReducers } from "redux"; import { appActions, publicationActions, winActions } from "../actions"; import { lcpReducer } from "./lcp"; -import { readerDefaultConfigReducer } from "./reader/defaultConfig"; +import { readerDefaultConfigReducer } from "../../../common/redux/reducers/reader/defaultConfig"; import { winRegistryReaderReducer } from "./win/registry/reader"; import { winSessionLibraryReducer } from "./win/session/library"; import { winSessionReaderReducer } from "./win/session/reader"; diff --git a/src/main/redux/states/index.ts b/src/main/redux/states/index.ts index 4ff1a4e23..e706c5fdd 100644 --- a/src/main/redux/states/index.ts +++ b/src/main/redux/states/index.ts @@ -5,7 +5,7 @@ // that can be found in the LICENSE file exposed on Github (readium) in the project repository. // ==LICENSE-END== -import { ReaderConfig, ReaderMode } from "readium-desktop/common/models/reader"; +import { ReaderMode } from "readium-desktop/common/models/reader"; import { I18NState } from "readium-desktop/common/redux/states/i18n"; import { IKeyboardState } from "readium-desktop/common/redux/states/keyboard"; import { OpdsFeedDocument } from "readium-desktop/main/db/document/opds"; @@ -25,9 +25,6 @@ export interface RootState extends ICommonRootState { // net: NetState; i18n: I18NState; streamer: StreamerState; - reader: { - defaultConfig: ReaderConfig, - }; // update: UpdateState; win: { session: { diff --git a/src/renderer/common/redux/states/renderer/readerRootState.ts b/src/renderer/common/redux/states/renderer/readerRootState.ts index 120932b7e..baa189ef3 100644 --- a/src/renderer/common/redux/states/renderer/readerRootState.ts +++ b/src/renderer/common/redux/states/renderer/readerRootState.ts @@ -15,4 +15,5 @@ export interface IReaderRootState extends IRendererCommonRootState { export interface IReaderStateReader { config: ReaderConfig; info: ReaderInfo; + defaultConfig: ReaderConfig; } diff --git a/src/renderer/library/redux/middleware/sync.ts b/src/renderer/library/redux/middleware/sync.ts index 6bf94611b..1ab93be45 100644 --- a/src/renderer/library/redux/middleware/sync.ts +++ b/src/renderer/library/redux/middleware/sync.ts @@ -39,6 +39,8 @@ const SYNCHRONIZABLE_ACTIONS: string[] = [ lcpActions.unlockPublicationWithPassphrase.ID, catalogActions.getCatalog.ID, // request to get catalog view + + readerActions.configSetDefault.ID, // readerConfig ]; export const reduxSyncMiddleware = syncFactory(SYNCHRONIZABLE_ACTIONS); diff --git a/src/renderer/library/redux/reducers/index.ts b/src/renderer/library/redux/reducers/index.ts index f27afe05d..9c775843a 100644 --- a/src/renderer/library/redux/reducers/index.ts +++ b/src/renderer/library/redux/reducers/index.ts @@ -26,9 +26,13 @@ import { RouterState } from "redux-first-history"; import { sessionReducer } from "readium-desktop/common/redux/reducers/session"; import { catalogViewReducer } from "./catalog"; import { tagReducer } from "./tag"; +import { readerDefaultConfigReducer } from "readium-desktop/common/redux/reducers/reader/defaultConfig"; export const rootReducer = (routerReducer: Reducer) => { return combineReducers({ + reader: combineReducers({ + defaultConfig: readerDefaultConfigReducer, + }), session: sessionReducer, i18n: i18nReducer, opds: combineReducers({ diff --git a/src/renderer/reader/redux/middleware/sync.ts b/src/renderer/reader/redux/middleware/sync.ts index e84eeb9ca..97b0c73ae 100644 --- a/src/renderer/reader/redux/middleware/sync.ts +++ b/src/renderer/reader/redux/middleware/sync.ts @@ -20,7 +20,7 @@ const SYNCHRONIZABLE_ACTIONS: string[] = [ readerActions.closeRequest.ID, readerActions.detachModeRequest.ID, readerActions.setReduxState.ID, - readerActions.configSetDefault.ID, + readerActions.configSetDefault.ID, // readerConfig // readerActions.saveBookmarkRequest.ID, readerActions.fullScreenRequest.ID, diff --git a/src/renderer/reader/redux/reducers/index.ts b/src/renderer/reader/redux/reducers/index.ts index adabf5a21..0d7f6b329 100644 --- a/src/renderer/reader/redux/reducers/index.ts +++ b/src/renderer/reader/redux/reducers/index.ts @@ -31,6 +31,7 @@ import { priorityQueueReducer } from "readium-desktop/utils/redux-reducers/pqueu import { winModeReducer } from "readium-desktop/common/redux/reducers/winModeReducer"; import { readerDivinaReducer } from "./divina"; import { sessionReducer } from "readium-desktop/common/redux/reducers/session"; +import { readerDefaultConfigReducer } from "readium-desktop/common/redux/reducers/reader/defaultConfig"; export const rootReducer = () => { return combineReducers({ @@ -38,6 +39,7 @@ export const rootReducer = () => { api: apiReducer, i18n: i18nReducer, reader: combineReducers({ // dehydrated from main process registry (preloaded state) + defaultConfig: readerDefaultConfigReducer, config: readerConfigReducer, info: readerInfoReducer, locator: readerLocatorReducer,