mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-04 20:00:17 +01:00
🎨 Support sending notifications on Android https://github.com/siyuan-note/siyuan/issues/17114
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
8c02c2cb93
commit
c5931e6da1
1 changed files with 20 additions and 6 deletions
|
|
@ -40,14 +40,28 @@ func sendDeviceNotification(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
title := arg["title"].(string)
|
||||
body := arg["body"].(string)
|
||||
evt := util.NewCmdResult("sendDeviceNotification", 0, util.PushModeSingleSelf)
|
||||
evt.Data = map[string]interface{}{
|
||||
var title string
|
||||
if nil != arg["title"] {
|
||||
title = strings.TrimSpace(arg["title"].(string))
|
||||
} else {
|
||||
ret.Code = -1
|
||||
ret.Msg = "title can't be empty"
|
||||
return
|
||||
}
|
||||
|
||||
var body string
|
||||
if nil != arg["body"] {
|
||||
body = strings.TrimSpace(arg["body"].(string))
|
||||
} else {
|
||||
ret.Code = -1
|
||||
ret.Msg = "body can't be empty"
|
||||
return
|
||||
}
|
||||
|
||||
util.BroadcastByType("main", "sendDeviceNotification", 0, "", map[string]interface{}{
|
||||
"title": title,
|
||||
"body": body,
|
||||
}
|
||||
util.PushEvent(evt)
|
||||
})
|
||||
}
|
||||
|
||||
func pushMsg(c *gin.Context) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue