mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
🎨 改进桌面端底部状态栏通知 https://github.com/siyuan-note/siyuan/issues/5294
This commit is contained in:
parent
717f3b356c
commit
27bdcb6672
2 changed files with 15 additions and 7 deletions
|
|
@ -402,14 +402,20 @@ func indexRepoBeforeCloudSync() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
if nil != latest && latest.ID != index.ID {
|
if nil != latest {
|
||||||
|
if latest.ID != index.ID {
|
||||||
// 对新创建的快照需要更新备注,加入耗时统计
|
// 对新创建的快照需要更新备注,加入耗时统计
|
||||||
index.Memo = fmt.Sprintf("[Auto] Cloud sync, completed in [%.2fs]", elapsed.Seconds())
|
index.Memo = fmt.Sprintf("[Auto] Cloud sync, completed in [%.2fs]", elapsed.Seconds())
|
||||||
err = repo.PutIndex(index)
|
err = repo.PutIndex(index)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
util.PushStatusBar("Save data snapshot for cloud sync failed")
|
||||||
util.LogErrorf("put index into data repo before cloud sync failed: %s", err)
|
util.LogErrorf("put index into data repo before cloud sync failed: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
util.PushStatusBar("Made a new data snapshot for cloud sync")
|
||||||
|
} else {
|
||||||
|
util.PushStatusBar("Checked data snapshot and found no changes ")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if 7000 < elapsed.Milliseconds() {
|
if 7000 < elapsed.Milliseconds() {
|
||||||
util.LogWarnf("index data repo before cloud sync elapsed [%dms]", elapsed.Milliseconds())
|
util.LogWarnf("index data repo before cloud sync elapsed [%dms]", elapsed.Milliseconds())
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
"github.com/88250/melody"
|
"github.com/88250/melody"
|
||||||
|
|
@ -145,6 +146,7 @@ func PushErrMsg(msg string, timeout int) (msgId string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func PushStatusBar(msg string) {
|
func PushStatusBar(msg string) {
|
||||||
|
msg += " (" + time.Now().Format("2006-01-02 15:04:05") + ")"
|
||||||
BroadcastByType("main", "statusbar", 0, msg, nil)
|
BroadcastByType("main", "statusbar", 0, msg, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue