Skip to content

Commit

Permalink
fix: clear autobackup/pull correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Dec 6, 2021
1 parent d5f1480 commit 1c5eeab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,13 @@ export default class ObsidianGit extends Plugin {
let wasActive = false;
if (this.timeoutIDBackup) {
window.clearTimeout(this.timeoutIDBackup);
this.timeoutIDBackup = undefined;
wasActive = true;
}
if (this.onFileModifyEventRef) {
this.autoBackupDebouncer?.cancel();
this.app.vault.offref(this.onFileModifyEventRef);
this.onFileModifyEventRef = undefined;
wasActive = true;
}
return wasActive;
Expand All @@ -393,11 +395,13 @@ export default class ObsidianGit extends Plugin {
clearAutoPull(): boolean {
if (this.timeoutIDPull) {
window.clearTimeout(this.timeoutIDPull);
this.timeoutIDPull = undefined;
return true;
}
return false;
}


async handleConflict(conflicted: string[]): Promise<void> {
this.setState(PluginState.conflicted);
const lines = [
Expand Down
8 changes: 2 additions & 6 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ export class ObsidianGitSettingsTab extends PluginSettingTab {
new Notice(
`Automatic backup enabled! Every ${plugin.settings.autoSaveInterval} minutes.`
);
} else if (
plugin.settings.autoSaveInterval <= 0 &&
plugin.timeoutIDBackup
) {
} else if (plugin.settings.autoSaveInterval <= 0) {
plugin.clearAutoBackup() &&
new Notice("Automatic backup disabled!");
}
Expand Down Expand Up @@ -72,8 +69,7 @@ export class ObsidianGitSettingsTab extends PluginSettingTab {
`Automatic pull enabled! Every ${plugin.settings.autoPullInterval} minutes.`
);
} else if (
plugin.settings.autoPullInterval <= 0 &&
plugin.timeoutIDPull
plugin.settings.autoPullInterval <= 0
) {
plugin.clearAutoPull() &&
new Notice("Automatic pull disabled!");
Expand Down

0 comments on commit 1c5eeab

Please sign in to comment.