Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update sync_at once sync is completed #233

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Item } from '@omnivore-app/api'
import { DateTime } from 'luxon'
import {
addIcon,
normalizePath,
Expand All @@ -17,7 +18,9 @@ import {
renderFilename,
renderItemContent,
} from './settings/template'
import { OmnivoreSettingTab } from './settingsTab'
import {
DATE_FORMAT,
findFrontMatterIndex,
getQueryFromFilter,
parseDateTime,
Expand All @@ -27,7 +30,6 @@ import {
replaceIllegalCharsFolder,
setOrUpdateHighlightColors,
} from './util'
import { OmnivoreSettingTab } from './settingsTab'

export default class OmnivorePlugin extends Plugin {
settings: OmnivoreSettings
Expand Down Expand Up @@ -396,17 +398,21 @@ export default class OmnivorePlugin extends Plugin {
}
}

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)
} finally {
this.settings.syncing = false
await this.saveSettings()
manualSync && new Notice('🎉 Sync completed')
}
}

Expand Down
Loading