Skip to content

Commit

Permalink
Setting field to enter delay value for plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
saertna committed Nov 1, 2023
1 parent 210e41f commit ffbcb76
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
11 changes: 8 additions & 3 deletions main.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,22 @@ export default class gamification extends Plugin {
this.addSettingTab(new GamificationPluginSettings(this.app, this));



await this.loadSettings();

// take care to reset when opened on a new day, don't wait for trigger
setTimeout(async () => {
// Code that you want to execute after the delay
await this.loadSettings();
await this.resetDailyGoals()
}, 2000); // 2000 milliseconds = 2 seconds
await this.updateStatusBar(this.statusbarGamification)
}, this.getSettingNumber('delayLoadTime')*1000); // 2000 milliseconds = 2 seconds


// to set timer for reset daily and weekly goals
this.timerInterval = 30 * 60 * 1000; // minutes x seconds x milliseconds
this.timerId = window.setInterval(this.resetDailyGoals.bind(this), this.timerInterval);

await this.updateStatusBar(this.statusbarGamification)



if (this.getSettingBoolean('debug')){
Expand Down
20 changes: 9 additions & 11 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,20 +360,18 @@ export class GamificationPluginSettings extends PluginSettingTab {
}),
);

/*
new Setting(containerEl)
.setName('limit the visible month in the chart on your avatar page: ' + this.plugin.settings.avatarPageName)
.setDesc('if 0, all month will be shown. Enter a number how many month shall be shown.')
new Setting(containerEl)
.setName('Delay Settings at startup')
.setDesc('Enter in seconds to delay the load time. e.g. when GIT pull is performed before and settings get merge conflicts. Without GIT usage, keep it to 0.')
.addText(text => text
.setPlaceholder('Number of Month to show')
//.setValue(decryptNumber(this.plugin.settings.chartReduzierungMonate).toString())
.setValue("0")
.setPlaceholder('0')
.setValue(decryptNumber(this.plugin.settings.delayLoadTime).toString())
//.setValue("0")
.onChange(async (value) => {
this.plugin.settings.chartReduzierungMonate = encryptNumber(parseInt(value));
this.plugin.settings.delayLoadTime = encryptNumber(parseInt(value));
await this.plugin.saveSettings();
}));
*/

}));

new Setting(containerEl)
.setName('Progressive Summarization')
Expand Down

0 comments on commit ffbcb76

Please sign in to comment.