diff --git a/apps/readest-app/src/app/library/components/ReadingProgress.tsx b/apps/readest-app/src/app/library/components/ReadingProgress.tsx index 567abdd8..4f1c5791 100644 --- a/apps/readest-app/src/app/library/components/ReadingProgress.tsx +++ b/apps/readest-app/src/app/library/components/ReadingProgress.tsx @@ -20,7 +20,7 @@ const ReadingProgress: React.FC = memo( ({ book }) => { const progressPercentage = useMemo(() => getProgressPercentage(book), [book]); - if (!progressPercentage) { + if (progressPercentage === null) { return null; } diff --git a/apps/readest-app/src/app/reader/components/HeaderBar.tsx b/apps/readest-app/src/app/reader/components/HeaderBar.tsx index 2bbb5646..7b76286a 100644 --- a/apps/readest-app/src/app/reader/components/HeaderBar.tsx +++ b/apps/readest-app/src/app/reader/components/HeaderBar.tsx @@ -60,16 +60,16 @@ const HeaderBar: React.FC = ({ onMouseEnter={() => setHoveredBookKey(bookKey)} onMouseLeave={() => setHoveredBookKey('')} > -
+
-
-

{bookTitle}

+
+

{bookTitle}

-
+
{ const dialog = document.getElementById('about_window'); @@ -15,6 +17,15 @@ export const setAboutDialogVisible = (visible: boolean) => { export const AboutWindow = () => { const _ = useTranslation(); + const [isUpdated, setIsUpdated] = React.useState(false); + + const handleCheckUpdate = async () => { + const update = await checkForAppUpdates(_); + if (!update) { + setIsUpdated(true); + } + }; + return (
@@ -31,10 +42,17 @@ export const AboutWindow = () => { App Logo

Readest

-

Bilingify LLC

- +

{_('Version {{version}}', { version: packageJson.version })} - +

+ {hasUpdater() && !isUpdated && ( + + {_('Check update')} + + )} + {isUpdated && ( +

{_('Already the latest version')}

+ )}
diff --git a/apps/readest-app/src/helpers/updater.ts b/apps/readest-app/src/helpers/updater.ts index 1497cabb..b5dc63c7 100644 --- a/apps/readest-app/src/helpers/updater.ts +++ b/apps/readest-app/src/helpers/updater.ts @@ -7,8 +7,6 @@ import { TranslationFunc } from '@/hooks/useTranslation'; const LAST_CHECK_KEY = 'lastAppUpdateCheck'; export const checkForAppUpdates = async (_: TranslationFunc) => { - if (process.env['NEXT_PUBLIC_DISABLE_UPDATER']) return; - const lastCheck = localStorage.getItem(LAST_CHECK_KEY); const now = Date.now(); if (lastCheck && now - parseInt(lastCheck, 10) < CHECK_UPDATE_INTERVAL_SEC * 1000) return; @@ -57,4 +55,5 @@ export const checkForAppUpdates = async (_: TranslationFunc) => { await relaunch(); } } + return update; }; diff --git a/apps/readest-app/src/services/environment.ts b/apps/readest-app/src/services/environment.ts index 93a7e6f5..1ba2edf0 100644 --- a/apps/readest-app/src/services/environment.ts +++ b/apps/readest-app/src/services/environment.ts @@ -10,7 +10,8 @@ declare global { export const isTauriAppPlatform = () => process.env['NEXT_PUBLIC_APP_PLATFORM'] === 'tauri'; export const isWebAppPlatform = () => process.env['NEXT_PUBLIC_APP_PLATFORM'] === 'web'; -export const hasUpdater = () => window.__READEST_UPDATER_ACCESS === true; +export const hasUpdater = () => + window.__READEST_UPDATER_ACCESS === true && !process.env['NEXT_PUBLIC_DISABLE_UPDATER']; export const hasCli = () => window.__READEST_CLI_ACCESS === true; // Dev API only in development mode and web platform diff --git a/apps/readest-app/src/services/tts/TTSController.ts b/apps/readest-app/src/services/tts/TTSController.ts index dee3c5d2..c384cd2f 100644 --- a/apps/readest-app/src/services/tts/TTSController.ts +++ b/apps/readest-app/src/services/tts/TTSController.ts @@ -91,6 +91,7 @@ export class TTSController extends EventTarget { this.#nossmlCnt++; // FIXME: in case we are at the end of the book, need a better way to handle this if (this.#nossmlCnt < 10 && this.state === 'playing') { + resolve(); await this.view.next(1); await this.forward(); }