diff --git a/android/app/src/main/assets/js/index.js b/android/app/src/main/assets/js/index.js index 10f03a9a6..a19eb7bb1 100644 --- a/android/app/src/main/assets/js/index.js +++ b/android/app/src/main/assets/js/index.js @@ -251,12 +251,12 @@ class TextToSpeech { this.stop(); } else { this.icon.classList.add('speak'); - const selected = window.getSelection().anchorNode; - if (selected) { + const selection = window.getSelection(); + if (selection.type === 'Range') { if (this.leaf && this.TTSWrapper) { this.TTSWrapper.replaceWith(this.leaf); } - this.leaf = selected; + this.leaf = selection.anchorNode; this.makeLeafSpeakable(); this.speak(); } else { diff --git a/src/database/queries/NovelQueries.ts b/src/database/queries/NovelQueries.ts index b93f04551..6c6446ca2 100644 --- a/src/database/queries/NovelQueries.ts +++ b/src/database/queries/NovelQueries.ts @@ -339,14 +339,19 @@ const restoreObjectQuery = (table: string, obj: any) => { `; }; -export const _restoreNovelAndChapters = (backupNovel: BackupNovel) => { +export const _restoreNovelAndChapters = async (backupNovel: BackupNovel) => { const { chapters, ...novel } = backupNovel; + await new Promise(resolve => { + db.transaction(tx => { + tx.executeSql('DELETE FROM Novel WHERE id = ?', [novel.id]); + tx.executeSql( + restoreObjectQuery('Novel', novel), + Object.values(novel) as string[] | number[], + () => resolve(null), + ); + }); + }); db.transaction(tx => { - tx.executeSql('DELETE FROM Novel WHERE id = ?', [novel.id]); - tx.executeSql( - restoreObjectQuery('Novel', novel), - Object.values(novel) as string[] | number[], - ); for (const chapter of chapters) { tx.executeSql( restoreObjectQuery('Chapter', chapter), diff --git a/src/plugins/pluginManager.ts b/src/plugins/pluginManager.ts index 69d11e81d..f414d780b 100644 --- a/src/plugins/pluginManager.ts +++ b/src/plugins/pluginManager.ts @@ -12,7 +12,6 @@ import { isUrlAbsolute } from './helpers/isAbsoluteUrl'; import { fetchApi, fetchFile, fetchText } from './helpers/fetch'; import { defaultCover } from './helpers/constants'; import { encode, decode } from 'urlencode'; -import { getString } from '@strings/translations'; import TextFile from '@native/TextFile'; const pluginsFilePath = PluginDownloadFolder + '/plugins.json'; @@ -131,15 +130,7 @@ const fetchPlugins = async () => { const availablePlugins: Record> = await fetch( `https://raw.githubusercontent.com/${githubUsername}/${githubRepository}/beta-dist/.dist/plugins.min.json`, - ) - .then(res => res.json()) - .catch(() => { - throw new Error( - `${getString( - 'browseScreen.pluginsHostError', - )}: ${githubUsername}/${githubRepository}`, - ); - }); + ).then(res => res.json()); return availablePlugins; }; diff --git a/src/screens/BrowseSourceScreen/components/FilterBottomSheet.tsx b/src/screens/BrowseSourceScreen/components/FilterBottomSheet.tsx index 8052e6a86..9e6de1285 100644 --- a/src/screens/BrowseSourceScreen/components/FilterBottomSheet.tsx +++ b/src/screens/BrowseSourceScreen/components/FilterBottomSheet.tsx @@ -258,10 +258,10 @@ const FilterBottomSheet: React.FC = ({ />