🐛 未登录状态云端同步状态图标显示错误 Fix https://github.com/siyuan-note/siyuan/issues/7277

This commit is contained in:
Liang Ding 2023-02-07 20:35:31 +08:00
parent 5bd6bb8925
commit 448609d1a8
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -62,6 +62,10 @@ func BootSyncData() {
return
}
if !util.IsOnline() {
return
}
syncLock.Lock()
defer syncLock.Unlock()
@ -97,9 +101,13 @@ func SyncData(boot, exit, byHand bool) {
func syncData(boot, exit, byHand bool) {
defer logging.Recover()
util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
if !checkSync(boot, exit, byHand) {
util.BroadcastByType("main", "syncing", 1, "", nil)
return
}
util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
if !util.IsOnline() { // 这个操作比较耗时,所以要先推送 syncing 事件后再判断网络,这样才能给用户更即时的反馈
util.BroadcastByType("main", "syncing", 2, Conf.Language(28), nil)
return
}
@ -173,11 +181,6 @@ func checkSync(boot, exit, byHand bool) bool {
planSyncAfter(64 * time.Minute)
return false
}
if !util.IsOnline() {
util.BroadcastByType("main", "syncing", 2, Conf.Language(28), nil)
return false
}
return true
}