Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuakto committed Mar 7, 2024
2 parents dea0ace + 9e18e71 commit 450b2c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.ts
Expand Up @@ -12,6 +12,7 @@ export interface FitSettings {
branch: string;
deviceName: string;
singleButtonMode: boolean
checkEveryXMinutes: number
}

const DEFAULT_SETTINGS: FitSettings = {
Expand All @@ -20,7 +21,8 @@ const DEFAULT_SETTINGS: FitSettings = {
repo: "",
branch: "",
deviceName: "",
singleButtonMode: true
singleButtonMode: true,
checkEveryXMinutes: 5
}


Expand Down Expand Up @@ -300,7 +302,7 @@ export default class FitPlugin extends Plugin {
intervalNotice.setMessage("Remote update detected, please pull the latest changes.")
}
}
}, 10 * 1000));
}, this.settings.checkEveryXMinutes * 60 * 1000));
}

onunload() {}
Expand All @@ -313,6 +315,8 @@ export default class FitPlugin extends Plugin {
if (settings.hasOwnProperty(key)) {
if (key == "singleButtonMode") {
obj[key] = Boolean(settings[key]);
} else if (key == "checkEveryXMinutes") {
obj[key] = Number(settings[key]);
} else {
obj[key] = settings[key];
}
Expand Down
14 changes: 14 additions & 0 deletions src/fitSetting.ts
Expand Up @@ -76,5 +76,19 @@ export default class FitSettingTab extends PluginSettingTab {
await this.plugin.saveSettings();
})
)

const checkIntervalSlider = new Setting(containerEl)
.setName('Remote check interval')
.setDesc(`Automatically check for remote changes in the background every ${this.plugin.settings.checkEveryXMinutes} minutes.`)
.addSlider(slider => slider
.setLimits(1, 60, 1)
.setValue(this.plugin.settings.checkEveryXMinutes)
.setDynamicTooltip()
.onChange(async (value) => {
this.plugin.settings.checkEveryXMinutes = value;
await this.plugin.saveSettings();
checkIntervalSlider.setDesc(`Automatically check for remote changes in the background every ${value} minutes.`)
})
)
}
}

0 comments on commit 450b2c5

Please sign in to comment.