Skip to content

Commit

Permalink
update deprecated FCM API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
franzmueller committed Mar 1, 2024
1 parent 20a6717 commit 642ce48
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.idea
*.iml
notifier
notifier
.run
.vscode
__debug*
9 changes: 5 additions & 4 deletions pkg/controller/fcm_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package controller
import (
"context"
"encoding/json"
"log"
"time"

"firebase.google.com/go/v4/errorutils"
"firebase.google.com/go/v4/messaging"
"github.com/SENERGY-Platform/notifier/pkg/auth"
"github.com/SENERGY-Platform/notifier/pkg/model"
"log"
"time"
)

func (this *Controller) PutFcmToken(token auth.Token, fcmToken string) (err error, errCode int) {
Expand Down Expand Up @@ -71,7 +72,7 @@ func (this *Controller) handleFCMNotificationUpdate(userId string, notification
}
}

responses, err := this.firebaseClient.SendMulticast(context.Background(), message)
responses, err := this.firebaseClient.SendEachForMulticast(context.Background(), message)
if err != nil {
log.Println("ERROR:", err.Error())
return
Expand All @@ -96,7 +97,7 @@ func (this *Controller) handleFCMNotificationDelete(userId string, ids []string)

encoded, _ := json.Marshal(ids)

responses, err := this.firebaseClient.SendMulticast(context.Background(), &messaging.MulticastMessage{
responses, err := this.firebaseClient.SendEachForMulticast(context.Background(), &messaging.MulticastMessage{
Tokens: tokens,
Data: map[string]string{
"type": model.WsUpdateDeleteManyType,
Expand Down

0 comments on commit 642ce48

Please sign in to comment.