Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
jmattheis committed Sep 5, 2024
1 parent fd4bd7a commit c08e450
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions command/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,31 +80,23 @@ func doPush(ctx *cli.Context) {
Priority: priority,
}

msg.Extras = map[string]interface{}{
}
msg.Extras = map[string]interface{}{}

if contentType != "" {
msg.Extras["client::display"] = map[string]interface{}{
"contentType": contentType,
}
}

clientNotification := map[string]interface{}{}
if clickUrl != "" {
msg.Extras["client::notification"] = map[string]interface{}{
"click": map[string]string{
"url": clickUrl,
},
}
clientNotification["click"] = map[string]string{"url": clickUrl}
}

if bigImageUrl != "" {
if _, clientNotification := msg.Extras["client::notification"]; clientNotification {
msg.Extras["client::notification"].(map[string]interface{})["bigImageUrl"] = bigImageUrl;
} else {
msg.Extras["client::notification"] = map[string]interface{}{
"bigImageUrl": bigImageUrl,
}
}
clientNotification["bigImageUrl"] = bigImageUrl
}
if len(clientNotification) > 0 {
msg.Extras["client::notification"] = clientNotification
}

parsedURL, err := url.Parse(stringURL)
Expand Down

0 comments on commit c08e450

Please sign in to comment.