mirror of
https://github.com/silvanocerza/github-gitless-sync.git
synced 2026-07-22 05:41:36 +00:00
Show notice on sync start, success and failure
This commit is contained in:
parent
3f06dd4f90
commit
c0792c79e7
1 changed files with 10 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Vault, normalizePath, base64ToArrayBuffer } from "obsidian";
|
||||
import { Vault, Notice, normalizePath, base64ToArrayBuffer } from "obsidian";
|
||||
import GithubClient, {
|
||||
GetTreeResponseItem,
|
||||
NewTreeRequestItem,
|
||||
|
|
@ -262,12 +262,19 @@ export default class SyncManager {
|
|||
return;
|
||||
}
|
||||
|
||||
const notice = new Notice("Syncing...");
|
||||
this.syncing = true;
|
||||
try {
|
||||
await this.syncImpl();
|
||||
} finally {
|
||||
this.syncing = false;
|
||||
// Shown only if sync doesn't fail
|
||||
new Notice("Sync successful", 5000);
|
||||
} catch (err) {
|
||||
// Show the error to the user, it's not automatically dismissed to make sure
|
||||
// the user sees it.
|
||||
new Notice(`Error syncing. ${err}`);
|
||||
}
|
||||
this.syncing = false;
|
||||
notice.hide();
|
||||
}
|
||||
|
||||
private async syncImpl() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue