Skip to content

Commit 65abfbc

Browse files
authored
fix: reader browser window lifecycle (PR #3464 Fixes #3439)
1 parent dc02d52 commit 65abfbc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+799
-1040
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"start:dev:renderer:reader": "webpack-dev-server --config webpack.config.renderer-reader.js",
4545
"start:dev:renderer:pdf": "webpack --config webpack.config.renderer-pdf.js && webpack --config webpack.config.renderer-pdf-extract.js",
4646
"start:dev:renderer:preload": "webpack --config webpack.config.preload.js",
47-
"start:dev:main:electron": "cross-env DEBUG=r2:*,readium-desktop:*,proxy-agent NODE_ENV=development electron --remote-debugging-port=9223 --remote-allow-origins=\"*\" .",
47+
"start:dev:main:electron": "cross-env DEBUG=r2:*,readium-desktop:*,proxy-agent,-readium-desktop:main#streamerNoHttp,-readium-desktop:main#streamerCommon,-readium-desktop:main#sessions NODE_ENV=development electron --remote-debugging-port=9223 --remote-allow-origins=\"*\" .",
4848
"start:dev:main": "npm run build:dev:main && npm run start:dev:main:electron",
4949
"start:devex": "cross-env WEBPACK=bundle-external npm run start:dev",
5050
"start:dev": "cross-env DEBUG_COLORS=true npm run start:dev:renderer:pdf && cross-env DEBUG_COLORS=true npm run start:dev:renderer:preload && cross-env DEBUG_COLORS=true concurrently --kill-others \"npm run start:dev:renderer:library\" \"npm run start:dev:renderer:reader\" \"npm run start:dev:main\"",

src/common/constant.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ export const FORCE_PROD_DB_IN_DEV = false;
1919

2020
export const USER_DATA_FOLDER = app.getPath("userData");
2121
debug("set userData folder to", USER_DATA_FOLDER);
22+
23+
export const TIMEOUT_BROWSER_WINDOW_INITIALISATION = 20000;

src/common/models/sync.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export enum SenderType {
1515
export interface WindowSender {
1616
type: SenderType;
1717
identifier: string;
18+
reader_pubId: string | undefined; // undefined in the library only from the reader
1819
}
1920

2021
export interface WithSender {

src/common/redux/actions/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import * as settingsActions from "./settings";
3131
import * as noteExport from "./noteExport";
3232
import * as customizationActions from "./customization";
3333
import * as opdsActions from "./opds";
34+
import * as winCommonActions from "./win";
3435

3536
export {
3637
historyActions,
@@ -59,4 +60,5 @@ export {
5960
noteExport,
6061
customizationActions,
6162
opdsActions,
63+
winCommonActions,
6264
};

src/common/redux/actions/reader/closeRequest.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@ export const ID = "READER_CLOSE_REQUEST";
1212

1313
// eslint-disable-next-line @typescript-eslint/no-empty-interface
1414
export interface Payload {
15+
windowIdentifier?: string; // can be undefined if sent from reader can added to sender key from sync process
16+
publicationIdentifier?: string; // can be used to close all reader with the same publicationIdentifier
1517
}
1618

17-
export function build():
19+
export function build(windowIdentifier?: string, publicationIdentifier?: string):
1820
Action<typeof ID, Payload>
1921
& Omit<ActionWithSender<typeof ID, Payload>, keyof WithSender> & Partial<WithSender>
2022
{
2123

2224
return {
2325
type: ID,
2426
payload: {
27+
windowIdentifier,
28+
publicationIdentifier,
2529
},
2630
};
2731
}

src/common/redux/actions/reader/closeRequestFromPublication.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/common/redux/actions/reader/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ import * as clipboardCopy from "./clipboardCopy";
1010
import * as print from "./print";
1111
import * as closeError from "./closeError";
1212
import * as closeRequest from "./closeRequest";
13-
import * as closeRequestFromPublication from "./closeRequestFromPublication";
1413
import * as closeSuccess from "./closeSuccess";
1514
import * as configSetDefault from "./configSetDefault";
1615
import * as detachModeRequest from "./detachModeRequest";
1716
import * as detachModeSuccess from "./detachModeSuccess";
1817
import * as fullScreenRequest from "./fullScreenRequest";
1918
import * as openError from "./openError";
2019
import * as openRequest from "./openRequest";
21-
import * as setReduxState from "./setReduxState";
2220
import * as disableRTLFlip from "./rtlFlip";
2321
import * as setTheLock from "./setTheLock";
2422
import * as note from "./note";
@@ -39,8 +37,6 @@ export {
3937
detachModeRequest,
4038
detachModeSuccess,
4139
configSetDefault,
42-
setReduxState,
43-
closeRequestFromPublication,
4440
fullScreenRequest,
4541
clipboardCopy,
4642
disableRTLFlip,

src/common/redux/actions/reader/setReduxState.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)