From 50ff8304e46564e3afaa358e0607dc3520eee9c2 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 28 Dec 2024 11:02:33 +0800 Subject: [PATCH] :bug: Fix firebase push notification subtitle issue --- pkg/internal/provider/firebase.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/internal/provider/firebase.go b/pkg/internal/provider/firebase.go index 477348c..e081bf3 100644 --- a/pkg/internal/provider/firebase.go +++ b/pkg/internal/provider/firebase.go @@ -2,9 +2,10 @@ package provider import ( "context" + "fmt" + firebase "firebase.google.com/go" "firebase.google.com/go/messaging" - "fmt" "git.solsynth.dev/hypernet/pusher/pkg/pushkit" "github.com/rs/zerolog/log" ) @@ -20,14 +21,17 @@ func (v *FirebaseNotifyProvider) Push(in pushkit.Notification, tk string) error return fmt.Errorf("failed to create firebase client") } - var subtitle string + var body string if len(in.Subtitle) > 0 { - subtitle = "\n" + in.Subtitle + body = fmt.Sprintf("%s\n%s", in.Body, in.Subtitle) + } else { + body = in.Body } + message := &messaging.Message{ Notification: &messaging.Notification{ Title: in.Title, - Body: subtitle + in.Body, + Body: body, }, Token: tk, }