From 9b7e2899fa2766d0e0d441de616dfd050b379172 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Wed, 24 Apr 2024 09:43:05 +0800 Subject: [PATCH 1/2] fix: update sync_at once sync is completed --- src/main.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 8bbd097..67fd471 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ import { Item } from '@omnivore-app/api' +import { DateTime } from 'luxon' import { addIcon, normalizePath, @@ -17,7 +18,9 @@ import { renderFilename, renderItemContent, } from './settings/template' +import { OmnivoreSettingTab } from './settingsTab' import { + DATE_FORMAT, findFrontMatterIndex, getQueryFromFilter, parseDateTime, @@ -27,7 +30,6 @@ import { replaceIllegalCharsFolder, setOrUpdateHighlightColors, } from './util' -import { OmnivoreSettingTab } from './settingsTab' export default class OmnivorePlugin extends Plugin { settings: OmnivoreSettings @@ -396,6 +398,10 @@ export default class OmnivorePlugin extends Plugin { } } + manualSync && new Notice('🎉 Sync completed') + + this.settings.syncAt = DateTime.local().toFormat(DATE_FORMAT) + if (!hasNextPage) { break } @@ -406,7 +412,6 @@ export default class OmnivorePlugin extends Plugin { } finally { this.settings.syncing = false await this.saveSettings() - manualSync && new Notice('🎉 Sync completed') } } From e02c6e494a1ff16f0ae252ae68eb170f49a3d543 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Wed, 24 Apr 2024 09:54:11 +0800 Subject: [PATCH 2/2] add logs --- src/main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 67fd471..b0fc2d7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -398,14 +398,15 @@ export default class OmnivorePlugin extends Plugin { } } - manualSync && new Notice('🎉 Sync completed') - this.settings.syncAt = DateTime.local().toFormat(DATE_FORMAT) if (!hasNextPage) { break } } + + console.log('obsidian-omnivore sync completed', this.settings.syncAt) + manualSync && new Notice('🎉 Sync completed') } catch (e) { new Notice('Failed to fetch items') console.error(e)