✨ APNs payload present metadata
This commit is contained in:
parent
d74cdddbaf
commit
b0735a7514
@ -7,6 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
|
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
|
||||||
"github.com/jordan-wright/email"
|
"github.com/jordan-wright/email"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/sideshow/apns2"
|
"github.com/sideshow/apns2"
|
||||||
payload2 "github.com/sideshow/apns2/payload"
|
payload2 "github.com/sideshow/apns2/payload"
|
||||||
@ -92,11 +93,15 @@ func PushAppleNotify(token string, in *proto.NotifyRequest) error {
|
|||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
|
var metadata map[string]any
|
||||||
|
_ = jsoniter.Unmarshal(in.GetMetadata(), &metadata)
|
||||||
|
|
||||||
data := payload2.
|
data := payload2.
|
||||||
NewPayload().
|
NewPayload().
|
||||||
AlertTitle(in.GetTitle()).
|
AlertTitle(in.GetTitle()).
|
||||||
AlertBody(in.GetBody()).
|
AlertBody(in.GetBody()).
|
||||||
Category(in.GetTopic()).
|
Category(in.GetTopic()).
|
||||||
|
Custom("metadata", metadata).
|
||||||
Sound("default").
|
Sound("default").
|
||||||
MutableContent()
|
MutableContent()
|
||||||
if in.Avatar != nil {
|
if in.Avatar != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user