From 472d0cd0c61603063687f0b5e2d9b554400645a3 Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Tue, 17 Dec 2024 00:57:19 +0000 Subject: [PATCH] feat: Ace timeout preference --- package-asar-dev.json | 12 +- package-asar.json | 12 +- package.json | 12 +- src/main/store-persist.js | 7 + src/renderer/components/PreferencesModal.js | 43 +- src/shared/actions/ace.js | 6 +- src/shared/default-preferences.js | 1 + src/shared/l10n/locales/en.json | 1 + yarn.lock | 893 +++++++++++--------- 9 files changed, 537 insertions(+), 450 deletions(-) diff --git a/package-asar-dev.json b/package-asar-dev.json index 9fb6c49..b864c32 100644 --- a/package-asar-dev.json +++ b/package-asar-dev.json @@ -2,7 +2,7 @@ "name": "ace-gui", "productName": "Ace by DAISY", "description": "Ace, the EPUB accessibility checker by the DAISY Consortium (desktop application)", - "version": "1.3.3-alpha.4", + "version": "1.3.3-alpha.5", "author": { "name": "DAISY Consortium", "organization": "DAISY Consortium", @@ -14,11 +14,11 @@ "license": "MIT", "main": "main-bundle.js", "dependencies": { - "@daisy/ace-axe-runner-electron": "1.3.3-alpha.4", - "@daisy/ace-core": "1.3.3-alpha.4", - "@daisy/ace-localize": "1.3.3-alpha.4", - "@daisy/ace-logger": "1.3.3-alpha.4", - "@daisy/epub-utils": "1.3.3-alpha.4", + "@daisy/ace-axe-runner-electron": "1.3.3-alpha.5", + "@daisy/ace-core": "1.3.3-alpha.5", + "@daisy/ace-localize": "1.3.3-alpha.5", + "@daisy/ace-logger": "1.3.3-alpha.5", + "@daisy/epub-utils": "1.3.3-alpha.5", "@material-ui/core": "^4.12.4", "@material-ui/icons": "^4.11.3", "@material-ui/lab": "^4.0.0-alpha.61", diff --git a/package-asar.json b/package-asar.json index 3cffc52..99bb3ab 100644 --- a/package-asar.json +++ b/package-asar.json @@ -2,7 +2,7 @@ "name": "ace-gui", "productName": "Ace by DAISY", "description": "Ace, the EPUB accessibility checker by the DAISY Consortium (desktop application)", - "version": "1.3.3-alpha.4", + "version": "1.3.3-alpha.5", "author": { "name": "DAISY Consortium", "organization": "DAISY Consortium", @@ -14,11 +14,11 @@ "license": "MIT", "main": "main-bundle.js", "dependencies": { - "@daisy/ace-axe-runner-electron": "1.3.3-alpha.4", - "@daisy/ace-core": "1.3.3-alpha.4", - "@daisy/ace-localize": "1.3.3-alpha.4", - "@daisy/ace-logger": "1.3.3-alpha.4", - "@daisy/epub-utils": "1.3.3-alpha.4", + "@daisy/ace-axe-runner-electron": "1.3.3-alpha.5", + "@daisy/ace-core": "1.3.3-alpha.5", + "@daisy/ace-localize": "1.3.3-alpha.5", + "@daisy/ace-logger": "1.3.3-alpha.5", + "@daisy/epub-utils": "1.3.3-alpha.5", "@material-ui/core": "^4.12.4", "@material-ui/icons": "^4.11.3", "@material-ui/lab": "^4.0.0-alpha.61", diff --git a/package.json b/package.json index 8c2884a..fe4246b 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ace-gui", "description": "Ace, the EPUB accessibility checker by the DAISY Consortium (desktop application)", - "version": "1.3.3-alpha.4", + "version": "1.3.3-alpha.5", "engines": { "node": ">=18.0.0", "yarn": "^1.22.0", @@ -143,11 +143,11 @@ "i18n-check": "sync-i18n --files 'src/shared/l10n/locales/*.json' --primary en --languages fr es pt_BR da ja de --space 4 --finalnewline --newkeysempty" }, "dependencies": { - "@daisy/ace-axe-runner-electron": "1.3.3-alpha.4", - "@daisy/ace-core": "1.3.3-alpha.4", - "@daisy/ace-localize": "1.3.3-alpha.4", - "@daisy/ace-logger": "1.3.3-alpha.4", - "@daisy/epub-utils": "1.3.3-alpha.4", + "@daisy/ace-axe-runner-electron": "1.3.3-alpha.5", + "@daisy/ace-core": "1.3.3-alpha.5", + "@daisy/ace-localize": "1.3.3-alpha.5", + "@daisy/ace-logger": "1.3.3-alpha.5", + "@daisy/epub-utils": "1.3.3-alpha.5", "@material-ui/core": "^4.12.4", "@material-ui/icons": "^4.11.3", "@material-ui/lab": "^4.0.0-alpha.61", diff --git a/src/main/store-persist.js b/src/main/store-persist.js index 15fb211..91f7fdc 100644 --- a/src/main/store-persist.js +++ b/src/main/store-persist.js @@ -47,6 +47,7 @@ export function initPersistentStore() { const reportsOverwrite = electronStore.get('reports.overwrite'); const initialState = { preferences: { + timeout: electronStore.get('timeout') || defaultPreferences.timeout, language: initialLanguage, reports: { "dir": electronStore.get('reports.dir') || defaultPreferences.reports.dir, @@ -67,6 +68,12 @@ export function initPersistentStore() { const prefs = state.preferences; + if (prefs.timeout) { + electronStore.set('timeout', prefs.timeout); + } else { + electronStore.set('timeout', defaultPreferences.timeout); + } + if (prefs.language) { electronStore.set('language', prefs.language); } else { diff --git a/src/renderer/components/PreferencesModal.js b/src/renderer/components/PreferencesModal.js index a45611f..3994c1c 100644 --- a/src/renderer/components/PreferencesModal.js +++ b/src/renderer/components/PreferencesModal.js @@ -14,6 +14,7 @@ import FormControlLabel from '@material-ui/core/FormControlLabel'; import FormHelperText from '@material-ui/core/FormHelperText'; import InputLabel from '@material-ui/core/InputLabel'; import OutlinedInput from '@material-ui/core/OutlinedInput'; +import TextField from '@material-ui/core/TextField'; import Typography from '@material-ui/core/Typography'; import { hideModal } from './../../shared/actions/modal'; import { savePreferences } from './../../shared/actions/preferences'; @@ -109,6 +110,13 @@ class PreferencesModal extends React.Component { this.setState(newState); }; + handleChangeTimeout = arg => (event) => { + const newState = { + timeout: event.target.value + }; + this.setState(newState); + }; + selectReportDir = () => { ipcRenderer.send(IPC_EVENT_showFolderBrowseDialog); ipcRenderer.once(IPC_EVENT_showFolderBrowseDialog, (event, dir) => { @@ -133,7 +141,7 @@ class PreferencesModal extends React.Component { const openFile = this.props.openFile; const inputPath = this.props.inputPath; const epubBaseDir = this.props.epubBaseDir; - + setTimeout(() => { openFile(epubBaseDir || inputPath); }, 500); @@ -166,7 +174,7 @@ class PreferencesModal extends React.Component { classes={{ root: classes.prefsGroup }} > {localize("preferences.internalReportStorage")} - { this.labelRef = ReactDOM.findDOMNode(ref) }} classes={{ root: classes.browseControlInputLabel }} >{localize("preferences.reportsDataDirectory")} - - @@ -207,7 +215,7 @@ class PreferencesModal extends React.Component { onChange={this.handleChange({group: 'reports', key: 'organize'})} control={} /> - } /> - {languageSelectMenuItems} - {localize("preferences.userInterfaceLanguageTip")} + + + {localize("preferences.timeout")} + + + +