diff --git a/src/main.ts b/src/main.ts index c3f1e38..4630854 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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() } } @@ -529,7 +529,6 @@ class OmnivoreSettingTab extends PluginSettingTab { this.plugin.settings.customQuery = value this.plugin.settings.syncAt = '' await this.plugin.saveSettings() - this.display() }), ) @@ -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( diff --git a/src/settings/index.ts b/src/settings/index.ts index d72c167..2c4f63a 100644 --- a/src/settings/index.ts +++ b/src/settings/index.ts @@ -42,6 +42,7 @@ export const DEFAULT_SETTINGS: OmnivoreSettings = { intervalId: 0, frontMatterVariables: [], frontMatterTemplate: '', + syncOnStart: true, } export enum Filter { @@ -78,4 +79,5 @@ export interface OmnivoreSettings { frontMatterVariables: string[] frontMatterTemplate: string filenameDateFormat: string + syncOnStart: boolean }