Skip to content

Commit

Permalink
fix(fcm): nested data in input message (#785)
Browse files Browse the repository at this point in the history
Co-authored-by: Закиров Алихан <zakirov@tutu.tech>
  • Loading branch information
alikhanz and Закиров Алихан committed Jun 18, 2024
1 parent 2d98064 commit b3b7733
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion notify/notification_fcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,15 @@ func GetAndroidNotification(req *PushNotification) []*messaging.Message {
if len(req.Data) > 0 {
data = make(map[string]string, len(req.Data))
for k, v := range req.Data {
data[k] = fmt.Sprintf("%v", v)
switch v.(type) {
case string:
data[k] = fmt.Sprintf("%s", v)
default:
jsonValue, err := json.Marshal(v)
if err == nil {
data[k] = string(jsonValue)
}
}
}
}

Expand Down

0 comments on commit b3b7733

Please sign in to comment.