From b0735a7514dff57e3bb91784da82dc7e7de143fe Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 21 Jul 2024 14:26:50 +0800 Subject: [PATCH] :sparkles: APNs payload present metadata --- pkg/internal/services/postman.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/internal/services/postman.go b/pkg/internal/services/postman.go index d3d3469..17f548b 100644 --- a/pkg/internal/services/postman.go +++ b/pkg/internal/services/postman.go @@ -7,6 +7,7 @@ import ( "fmt" "git.solsynth.dev/hydrogen/dealer/pkg/proto" "github.com/jordan-wright/email" + jsoniter "github.com/json-iterator/go" "github.com/rs/zerolog/log" "github.com/sideshow/apns2" payload2 "github.com/sideshow/apns2/payload" @@ -92,11 +93,15 @@ func PushAppleNotify(token string, in *proto.NotifyRequest) error { start := time.Now() + var metadata map[string]any + _ = jsoniter.Unmarshal(in.GetMetadata(), &metadata) + data := payload2. NewPayload(). AlertTitle(in.GetTitle()). AlertBody(in.GetBody()). Category(in.GetTopic()). + Custom("metadata", metadata). Sound("default"). MutableContent() if in.Avatar != nil {