Skip to content

Commit

Permalink
Merge pull request #233 from omnivore-app/fix/sync-at
Browse files Browse the repository at this point in the history
fix: update sync_at once sync is completed
  • Loading branch information
sywhb authored Apr 24, 2024
2 parents 059f9d6 + e02c6e4 commit 9985c8e
Showing 1 changed file with 8 additions and 2 deletions.
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

0 comments on commit 9985c8e

Please sign in to comment.