diff --git a/apps/readest-app/package.json b/apps/readest-app/package.json index a188e2dc..4f0d0d85 100644 --- a/apps/readest-app/package.json +++ b/apps/readest-app/package.json @@ -1,6 +1,6 @@ { "name": "@readest/readest-app", - "version": "0.9.14", + "version": "0.9.15", "private": true, "scripts": { "dev": "dotenv -e .env.tauri -- next dev", diff --git a/apps/readest-app/src/app/auth/page.tsx b/apps/readest-app/src/app/auth/page.tsx index b85b4705..ce11d004 100644 --- a/apps/readest-app/src/app/auth/page.tsx +++ b/apps/readest-app/src/app/auth/page.tsx @@ -21,7 +21,6 @@ import { onOpenUrl } from '@tauri-apps/plugin-deep-link'; import { start, cancel, onUrl, onInvalidUrl } from '@fabianlars/tauri-plugin-oauth'; import { openUrl } from '@tauri-apps/plugin-opener'; import { handleAuthCallback } from '@/helpers/auth'; -import { getOSPlatform } from '@/utils/misc'; import { getAppleIdAuth, Scope } from './utils/appleIdAuth'; type OAuthProvider = 'google' | 'apple' | 'azure' | 'github'; @@ -66,14 +65,13 @@ export default function AuthPage() { const [port, setPort] = useState(null); const isOAuthServerRunning = useRef(false); const [isMounted, setIsMounted] = useState(false); - const osPlatform = getOSPlatform(); const getTauriRedirectTo = () => { - return process.env.NODE_ENV === 'production' - ? ['android', 'ios'].includes(osPlatform) + return process.env.NODE_ENV === 'production' || appService?.isMobile + ? appService?.isMobile ? WEB_AUTH_CALLBACK : DEEPLINK_CALLBACK - : `http://localhost:${port}`; + : `http://localhost:${port}`; // only for development env on Desktop }; const tauriSignInApple = async () => { @@ -133,7 +131,7 @@ export default function AuthPage() { const startTauriOAuth = async () => { try { - if (process.env.NODE_ENV === 'production') { + if (process.env.NODE_ENV === 'production' || appService?.isMobile) { const { getCurrentWindow } = await import('@tauri-apps/api/window'); const currentWindow = getCurrentWindow(); currentWindow.listen('single-instance', ({ event, payload }) => { @@ -310,7 +308,7 @@ export default function AuthPage() { /> diff --git a/apps/readest-app/src/app/library/components/Bookshelf.tsx b/apps/readest-app/src/app/library/components/Bookshelf.tsx index 8b6ef797..bb745e79 100644 --- a/apps/readest-app/src/app/library/components/Bookshelf.tsx +++ b/apps/readest-app/src/app/library/components/Bookshelf.tsx @@ -114,14 +114,16 @@ const Bookshelf: React.FC = ({ }; const confirmDelete = async () => { - for (const id of selectedBooks) { - const book = libraryBooks.find((b) => b.hash === id || b.groupId === id); - if (book) { - await handleBookDelete(book); + selectedBooks.forEach((id) => { + for (const book of libraryBooks.filter((book) => book.hash === id || book.groupId === id)) { + if (book && !book.deletedAt) { + handleBookDelete(book); + } } - } + }); setSelectedBooks([]); setShowDeleteAlert(false); + setShowSelectModeActions(true); }; const deleteSelectedBooks = () => { diff --git a/apps/readest-app/src/app/library/page.tsx b/apps/readest-app/src/app/library/page.tsx index b09a5cc1..22f5ece0 100644 --- a/apps/readest-app/src/app/library/page.tsx +++ b/apps/readest-app/src/app/library/page.tsx @@ -323,8 +323,7 @@ const LibraryPage = () => { let files; if (isTauriAppPlatform()) { - const { type } = await import('@tauri-apps/plugin-os'); - if (['android', 'ios'].includes(type())) { + if (appService?.isMobile) { files = (await selectFilesWeb()) as [File]; } else { files = (await selectFilesTauri()) as [string]; @@ -382,7 +381,7 @@ const LibraryPage = () => { )} {libraryLoaded && - (libraryBooks.length > 0 ? ( + (libraryBooks.some((book) => !book.deletedAt) ? (
= ({ bookKey }) => { const _ = useTranslation(); - const { envConfig } = useEnv(); + const { envConfig, appService } = useEnv(); const { settings } = useSettingsStore(); const { getConfig, saveConfig, getBookData, updateBooknotes } = useBookDataStore(); const { getProgress, getView, getViewsById, getViewSettings } = useReaderStore(); @@ -143,7 +143,7 @@ const Annotator: React.FC<{ bookKey: string }> = ({ bookKey }) => { // Disable the default context menu on mobile devices, // although it should but doesn't work on iOS - if (osPlatform === 'android' || osPlatform === 'ios') { + if (appService?.isMobile) { detail.doc?.addEventListener('contextmenu', (event: Event) => { event.preventDefault(); event.stopPropagation(); diff --git a/apps/readest-app/src/app/reader/components/settings/DialogMenu.tsx b/apps/readest-app/src/app/reader/components/settings/DialogMenu.tsx index e0572345..e9b5d854 100644 --- a/apps/readest-app/src/app/reader/components/settings/DialogMenu.tsx +++ b/apps/readest-app/src/app/reader/components/settings/DialogMenu.tsx @@ -21,7 +21,7 @@ const DialogMenu: React.FC = ({ toggleDropdown }) => { return (
diff --git a/apps/readest-app/src/app/reader/components/settings/MiscPanel.tsx b/apps/readest-app/src/app/reader/components/settings/MiscPanel.tsx index eb15d652..03ca80d1 100644 --- a/apps/readest-app/src/app/reader/components/settings/MiscPanel.tsx +++ b/apps/readest-app/src/app/reader/components/settings/MiscPanel.tsx @@ -135,7 +135,10 @@ const MiscPanel: React.FC<{ bookKey: string }> = ({ bookKey }) => { >