From 62b8a0c8239f61e9dcd63126efd6dc27951af17b Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Wed, 22 Jan 2025 13:42:06 +0100 Subject: [PATCH] Rename some settings for clarity --- src/main.ts | 6 +++--- src/settings/settings.ts | 8 ++++---- src/settings/tab.ts | 26 +++++++++++++------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main.ts b/src/main.ts index 0f420b8..8a39ce5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -38,7 +38,7 @@ export default class GitHubSyncPlugin extends Plugin { ); await this.syncManager.loadMetadata(); - if (this.settings.uploadStrategy == "interval") { + if (this.settings.syncStrategy == "interval") { this.restartSyncInterval(); } @@ -178,7 +178,7 @@ export default class GitHubSyncPlugin extends Plugin { // when settings are changed startSyncInterval() { const intervalID = this.syncManager.startSyncInterval( - this.settings.uploadInterval, + this.settings.syncInterval, ); this.registerInterval(intervalID); } @@ -189,6 +189,6 @@ export default class GitHubSyncPlugin extends Plugin { restartSyncInterval() { this.syncManager.stopSyncInterval(); - this.syncManager.startSyncInterval(this.settings.uploadInterval); + this.syncManager.startSyncInterval(this.settings.syncInterval); } } diff --git a/src/settings/settings.ts b/src/settings/settings.ts index b108e63..1a607f3 100644 --- a/src/settings/settings.ts +++ b/src/settings/settings.ts @@ -6,8 +6,8 @@ export interface GitHubSyncSettings { githubBranch: string; repoContentDir: string; localContentDir: string; - uploadStrategy: "manual" | "interval"; - uploadInterval: number; + syncStrategy: "manual" | "interval"; + syncInterval: number; syncOnStartup: boolean; conflictHandling: "ignore" | "ask" | "overwrite"; showStatusBarItem: boolean; @@ -22,8 +22,8 @@ export const DEFAULT_SETTINGS: GitHubSyncSettings = { githubBranch: "main", repoContentDir: "", localContentDir: "", - uploadStrategy: "manual", - uploadInterval: 1, + syncStrategy: "manual", + syncInterval: 1, syncOnStartup: false, conflictHandling: "ask", showStatusBarItem: true, diff --git a/src/settings/tab.ts b/src/settings/tab.ts index 4fe7147..5f628e4 100644 --- a/src/settings/tab.ts +++ b/src/settings/tab.ts @@ -123,43 +123,43 @@ export default class GitHubSyncSettingsTab extends PluginSettingTab { containerEl.createEl("h2", { text: "Sync" }); - const uploadStrategies = { + const syncStrategies = { manual: "Manually", interval: "On Interval", }; const uploadStrategySetting = new Setting(containerEl) - .setName("Upload strategy") - .setDesc("When to upload local files to remote repository"); + .setName("Sync strategy") + .setDesc("How to sync files with remote repository"); let syncInterval = "1"; - if (this.plugin.settings.uploadInterval) { - syncInterval = this.plugin.settings.uploadInterval.toString(); + if (this.plugin.settings.syncInterval) { + syncInterval = this.plugin.settings.syncInterval.toString(); } const intervalSettings = new Setting(containerEl) - .setName("Upload interval") - .setDesc("Upload interval in minutes between automatic uploads") + .setName("Sync interval") + .setDesc("Interval in minutes between automatic syncs") .addText((text) => text .setPlaceholder("Interval in minutes") .setValue(syncInterval) .onChange(async (value) => { - this.plugin.settings.uploadInterval = parseInt(value) || 1; + this.plugin.settings.syncInterval = parseInt(value) || 1; await this.plugin.saveSettings(); // We need to restart the interval if the value is changed this.plugin.restartSyncInterval(); }), ); intervalSettings.setDisabled( - this.plugin.settings.uploadStrategy !== "interval", + this.plugin.settings.syncStrategy !== "interval", ); uploadStrategySetting.addDropdown((dropdown) => dropdown - .addOptions(uploadStrategies) - .setValue(this.plugin.settings.uploadStrategy) - .onChange(async (value: keyof typeof uploadStrategies) => { + .addOptions(syncStrategies) + .setValue(this.plugin.settings.syncStrategy) + .onChange(async (value: keyof typeof syncStrategies) => { intervalSettings.setDisabled(value !== "interval"); - this.plugin.settings.uploadStrategy = value; + this.plugin.settings.syncStrategy = value; await this.plugin.saveSettings(); if (value === "interval") { this.plugin.startSyncInterval();