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
3c3a065776
commit
f07ae1fc75
2 changed files with 24 additions and 0 deletions
|
|
@ -25,6 +25,29 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func sendDeviceNotification(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
if util.ContainerAndroid != util.Container {
|
||||
ret.Code = -1
|
||||
ret.Msg = "Just support Android"
|
||||
return
|
||||
}
|
||||
|
||||
payload := arg["payload"].(string)
|
||||
evt := util.NewCmdResult("sendDeviceNotification", 0, util.PushModeSingleSelf)
|
||||
evt.Data = map[string]interface{}{
|
||||
"payload": payload,
|
||||
}
|
||||
util.PushEvent(evt)
|
||||
}
|
||||
|
||||
func pushMsg(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue