Skip to content

Commit

Permalink
fix: add a setting to disable sync on start (omnivore-app#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhb committed Feb 20, 2024
1 parent 8dd9db2 commit d9c5fb2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export default class OmnivorePlugin extends Plugin {

this.scheduleSync()

// sync when the app is loaded if frequency is greater than zero
if (this.settings.frequency > 0) {
// sync when the app is loaded if syncOnStart is true
if (this.settings.syncOnStart) {
await this.fetchOmnivore()
}
}
Expand Down Expand Up @@ -529,7 +529,6 @@ class OmnivoreSettingTab extends PluginSettingTab {
this.plugin.settings.customQuery = value
this.plugin.settings.syncAt = ''
await this.plugin.saveSettings()
this.display()
}),
)

Expand Down Expand Up @@ -644,6 +643,20 @@ class OmnivoreSettingTab extends PluginSettingTab {
})
})

new Setting(containerEl)
.setName('Sync on Start')
.setDesc(
'Check this box if you want to sync with Omnivore when the app is loaded',
)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.syncOnStart)
.onChange(async (value) => {
this.plugin.settings.syncOnStart = value
await this.plugin.saveSettings()
}),
)

new Setting(containerEl)
.setName('Frequency')
.setDesc(
Expand Down
2 changes: 2 additions & 0 deletions src/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const DEFAULT_SETTINGS: OmnivoreSettings = {
intervalId: 0,
frontMatterVariables: [],
frontMatterTemplate: '',
syncOnStart: true,
}

export enum Filter {
Expand Down Expand Up @@ -78,4 +79,5 @@ export interface OmnivoreSettings {
frontMatterVariables: string[]
frontMatterTemplate: string
filenameDateFormat: string
syncOnStart: boolean
}

0 comments on commit d9c5fb2

Please sign in to comment.