Open
Description
Describe your environment
- Firebase SDK version: 3.3.0
- Firebase Product: Messaging/Notifications
Describe the problem
Steps to reproduce:
We cannot use reuse a struct in the message data and instead we create a new map[string]string to be send as Data of FCM Message Data . So we have to trim out boolean, int , float into string and reprocess them again on swift and android code from string to correct datatypes.
This is terrible approach unwrapping structs at golang code and wrapping back string json into android/iOS pojos in client code.
Relevant Code:
// TODO(you): code here to reproduce the problem
article := Article{}
article.Title = "Awww"
article.Message = "This is so much work."
article.Source = "New Delhi"
article.Debug = true
article.Version = 1
articleData := map[string]string{
"debug" : "true",
"version" : "1",
"source" : article.Source,
"title" : article.Title,
"message" : article.Message,
}
message := &messaging.Message{
Data: articleData,
Topic: "debug",
Notification: &messaging.Notification{Title: article.Title, Body: article.Message},
}
We should be instead be able to use
message := &messaging.Message{
Data: article,
Topic: "debug",
Notification: &messaging.Notification{Title: article.Title, Body: article.Message},
}