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 2e19e04
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,
}
}

clientNotifications := map[string]interface{}{}
if clickUrl != "" {
msg.Extras["client::notification"] = map[string]interface{}{
"click": map[string]string{
"url": clickUrl,
},
}
clientNotifications["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,
}
}
clientNotifications["bigImageUrl"] = bigImageUrl
}
if len(clientNotifications) > 0 {
msg.Extras["client::notification"] = clientNotifications
}

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

0 comments on commit 2e19e04

Please sign in to comment.