mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
🎨 Android 端前后台切换时自动触发同步 https://github.com/siyuan-note/siyuan/issues/7122
This commit is contained in:
parent
92ca6fd339
commit
61c57c9c30
1 changed files with 17 additions and 0 deletions
|
|
@ -40,6 +40,23 @@ func getBootSync(c *gin.Context) {
|
||||||
func performSync(c *gin.Context) {
|
func performSync(c *gin.Context) {
|
||||||
ret := gulu.Ret.NewResult()
|
ret := gulu.Ret.NewResult()
|
||||||
defer c.JSON(http.StatusOK, ret)
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
||||||
|
arg, ok := util.JsonArg(c, ret)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Android 端前后台切换时自动触发同步 https://github.com/siyuan-note/siyuan/issues/7122
|
||||||
|
var mobileSwitch bool
|
||||||
|
if mobileSwitchArg := arg["mobileSwitch"]; nil != mobileSwitchArg {
|
||||||
|
mobileSwitch = mobileSwitchArg.(bool)
|
||||||
|
}
|
||||||
|
if mobileSwitch {
|
||||||
|
if nil == model.Conf.User || !model.Conf.Sync.Enabled {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
model.SyncData(false, false, true)
|
model.SyncData(false, false, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue