From d04d950e744b5673166c76948faa2e205ba4d0d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Advaita=20K=E1=B9=9B=E1=B9=A3=E1=B9=87a=20D=C4=81sa?= Date: Sun, 28 May 2023 16:37:04 +0200 Subject: [PATCH 1/3] fix --- ios/App/App/Info.plist | 2 ++ src/app/decks/inbox/pages/InboxDeckPage.vue | 8 +++-- src/app/decks/review/pages/ReviewDeckPage.vue | 7 +++-- src/app/home/components/HomePage.vue | 8 ----- .../composables/useLoadLibraryIntoMemory.ts | 3 +- .../library/composables/useSyncLibraryTask.ts | 2 +- src/app/library/index.ts | 1 + src/app/library/pages/LibraryPage.vue | 15 ++++------ src/app/settings/pages/AccountPage.vue | 7 ++++- src/app/settings/pages/SettingsPage.vue | 9 ++++-- src/app/shared/components/BackgroundTasks.vue | 30 +++++++++++++++++++ src/app/shared/index.ts | 3 +- 12 files changed, 67 insertions(+), 28 deletions(-) create mode 100644 src/app/shared/components/BackgroundTasks.vue diff --git a/ios/App/App/Info.plist b/ios/App/App/Info.plist index 44d8251c..f324a0fd 100644 --- a/ios/App/App/Info.plist +++ b/ios/App/App/Info.plist @@ -73,6 +73,8 @@ LSApplicationQueriesSchemes mailto + googlegmail + ms-outlook diff --git a/src/app/decks/inbox/pages/InboxDeckPage.vue b/src/app/decks/inbox/pages/InboxDeckPage.vue index af3bf1b9..608d827e 100644 --- a/src/app/decks/inbox/pages/InboxDeckPage.vue +++ b/src/app/decks/inbox/pages/InboxDeckPage.vue @@ -6,6 +6,10 @@ {{ $t('decks.inbox.title') }} + + + + @@ -51,9 +55,9 @@ \ No newline at end of file diff --git a/src/app/shared/index.ts b/src/app/shared/index.ts index 4d543ec0..6b5a88c1 100644 --- a/src/app/shared/index.ts +++ b/src/app/shared/index.ts @@ -18,4 +18,5 @@ export * from './tasks/runSyncTask' // components: export { default as ConfettiExplosion } from './components/ConfettiExplosion.vue' export { default as VerseAudioPlayer } from './components/VerseAudioPlayer.vue' -export { default as DarkImage } from './components/DarkImage.vue' \ No newline at end of file +export { default as DarkImage } from './components/DarkImage.vue' +export { default as BackgroundTasks } from './components/BackgroundTasks.vue' From 4193f95c9583a08f79a34dd383d598b806e530c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Advaita=20K=E1=B9=9B=E1=B9=A3=E1=B9=87a=20D=C4=81sa?= Date: Sun, 28 May 2023 16:41:59 +0200 Subject: [PATCH 2/3] fixes --- .../composables/useLoadLibraryIntoMemory.ts | 37 ++++++++++--------- .../library/composables/useSyncLibraryTask.ts | 3 +- src/app/shared/components/BackgroundTasks.vue | 5 ++- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/app/library/composables/useLoadLibraryIntoMemory.ts b/src/app/library/composables/useLoadLibraryIntoMemory.ts index abafe478..288c2678 100644 --- a/src/app/library/composables/useLoadLibraryIntoMemory.ts +++ b/src/app/library/composables/useLoadLibraryIntoMemory.ts @@ -9,27 +9,30 @@ export function useLoadLibraryIntoMemory( ) { async function sync() { inProgress.value = true - const docs: any = await libraryDatabase.db.find({ selector: { '@type': 'verse' }}) + try { + const docs: any = await libraryDatabase.db.find({ selector: { '@type': 'verse' } }) - for (const verse of docs.docs) { - const synonyms = [] - for (const w of verse.synonyms) { - synonyms.push(new Synonym(w.words.join(' '), w.translation, w.lineNumber)) - } + for (const verse of docs.docs) { + const synonyms = [] + for (const w of verse.synonyms) { + synonyms.push(new Synonym(w.words.join(' '), w.translation, w.lineNumber)) + } - const v = new Verse( - new VerseId(verse._id), - new VerseNumber(verse.number), - verse.reference, - new Language(verse.language, verse.language), - new Text(verse.text), - new Translation(verse.translation), - synonyms - ) + const v = new Verse( + new VerseId(verse._id), + new VerseNumber(verse.number), + verse.reference, + new Language(verse.language, verse.language), + new Text(verse.text), + new Translation(verse.translation), + synonyms + ) - await app.repositories.verses.save(v) + await app.repositories.verses.save(v) + } + } finally { + inProgress.value = false } - inProgress.value = false } return { sync, inProgress } diff --git a/src/app/library/composables/useSyncLibraryTask.ts b/src/app/library/composables/useSyncLibraryTask.ts index 10e1d33b..e1f5e06f 100644 --- a/src/app/library/composables/useSyncLibraryTask.ts +++ b/src/app/library/composables/useSyncLibraryTask.ts @@ -24,8 +24,9 @@ export function useSyncLibraryTask( logger.debug('Library synced') } catch (err) { logger.error('Failed to sync static data', err) + } finally { + inProgress.value = false } - inProgress.value = false } return { sync, inProgress } diff --git a/src/app/shared/components/BackgroundTasks.vue b/src/app/shared/components/BackgroundTasks.vue index c4729184..59b02571 100644 --- a/src/app/shared/components/BackgroundTasks.vue +++ b/src/app/shared/components/BackgroundTasks.vue @@ -26,5 +26,8 @@ const loadLibrary = useLoadLibraryIntoMemory(application.instance(), libraryData /* State */ /* -------------------------------------------------------------------------- */ -const visible = computed(_ => syncTask.inProgress.value || syncLibraryTask.inProgress || loadLibrary.inProgress) +const visible = computed(_ => + syncTask.inProgress.value + || syncLibraryTask.inProgress.value + || loadLibrary.inProgress.value) \ No newline at end of file From 5de201d46f3f5c25933d81fb46b6f0e465efe550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Advaita=20K=E1=B9=9B=E1=B9=A3=E1=B9=87a=20D=C4=81sa?= Date: Mon, 29 May 2023 15:14:29 +0200 Subject: [PATCH 3/3] fix --- src/app/shared/components/BackgroundTasks.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/shared/components/BackgroundTasks.vue b/src/app/shared/components/BackgroundTasks.vue index 59b02571..7c9b3ff5 100644 --- a/src/app/shared/components/BackgroundTasks.vue +++ b/src/app/shared/components/BackgroundTasks.vue @@ -26,8 +26,9 @@ const loadLibrary = useLoadLibraryIntoMemory(application.instance(), libraryData /* State */ /* -------------------------------------------------------------------------- */ -const visible = computed(_ => +const visible = computed(() => syncTask.inProgress.value || syncLibraryTask.inProgress.value - || loadLibrary.inProgress.value) + || loadLibrary.inProgress.value +) \ No newline at end of file