Skip to content

Commit

Permalink
Removed image url from level-chagned, badges, role changed notificati…
Browse files Browse the repository at this point in the history
…ons (#51)
  • Loading branch information
ice-myles authored Jun 27, 2024
1 parent 8dc7c53 commit 91dc23a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/goccy/go-json v0.10.3
github.com/google/uuid v1.6.0
github.com/hashicorp/go-multierror v1.1.1
github.com/ice-blockchain/eskimo v1.343.0
github.com/ice-blockchain/eskimo v1.345.0
github.com/ice-blockchain/freezer v1.472.0
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb
github.com/ice-blockchain/wintr v1.142.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU
github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E=
github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc=
github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
github.com/ice-blockchain/eskimo v1.343.0 h1:GMIPNwVO283vLT2BW5w/27MlR6nnVndx4bV/EtWQjik=
github.com/ice-blockchain/eskimo v1.343.0/go.mod h1:GgnXx4x78wpFt315Aj917+36aLU5g/94Ohpl+ft++6c=
github.com/ice-blockchain/eskimo v1.345.0 h1:uYo4xdjLJhx7WsLkaZam1jwgAKLf92OkAYI0VHSoLA8=
github.com/ice-blockchain/eskimo v1.345.0/go.mod h1:GgnXx4x78wpFt315Aj917+36aLU5g/94Ohpl+ft++6c=
github.com/ice-blockchain/freezer v1.472.0 h1:YCI7btQuYb5R+1VBQf70OIJYkpshm8mujiSvbnjt9pw=
github.com/ice-blockchain/freezer v1.472.0/go.mod h1:Ep+or4+G74x/r8XBG340v07ov1S+9BWnc2eHqOC+VIY=
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb h1:8TnFP3mc7O+tc44kv2e0/TpZKnEVUaKH+UstwfBwRkk=
Expand Down
11 changes: 4 additions & 7 deletions notifications/notification_type_badge_unlocked.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func (s *achievedBadgesSource) Process(ctx context.Context, msg *messagebroker.M
}
now := time.Now()
deeplink := fmt.Sprintf("%v://profile?section=badges&userId=%v&category=%v", s.cfg.DeeplinkScheme, message.UserID, message.GroupType)
imageURL := s.pictureClient.DownloadURL(fmt.Sprintf("badges/%v.png", message.Type))
badgeIndex, err := strconv.Atoi(message.Type[1:])
log.Panic(err) //nolint:revive // Intended.
badgeIndex--
Expand All @@ -70,7 +69,6 @@ func (s *achievedBadgesSource) Process(ctx context.Context, msg *messagebroker.M
Time: now,
Data: map[string]any{
"deeplink": deeplink,
"imageUrl": imageURL,
},
Action: string(notifType),
Actor: inapp.ID{
Expand Down Expand Up @@ -110,11 +108,10 @@ func (s *achievedBadgesSource) Process(ctx context.Context, msg *messagebroker.M
for _, token := range *tokens.PushNotificationTokens {
pn = append(pn, &pushNotification{
pn: &push.Notification[push.DeviceToken]{
Data: map[string]string{"deeplink": deeplink},
Target: token,
Title: tmpl.getTitle(nil),
Body: tmpl.getBody(data),
ImageURL: imageURL,
Data: map[string]string{"deeplink": deeplink},
Target: token,
Title: tmpl.getTitle(nil),
Body: tmpl.getBody(data),
},
sn: &sentNotification{
SentAt: now,
Expand Down
11 changes: 4 additions & 7 deletions notifications/notification_type_level_changed.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ func (s *completedLevelsSource) Process(ctx context.Context, msg *messagebroker.
}
now := time.Now()
deeplink := fmt.Sprintf("%v://profile?userId=%v", s.cfg.DeeplinkScheme, message.UserID)
imageURL := s.pictureClient.DownloadURL("assets/push-notifications/level-change.png")
in := &inAppNotification{
in: &inapp.Parcel{
Time: now,
Data: map[string]any{
"deeplink": deeplink,
"imageUrl": imageURL,
},
Action: string(LevelChangedNotificationType),
Actor: inapp.ID{
Expand Down Expand Up @@ -89,11 +87,10 @@ func (s *completedLevelsSource) Process(ctx context.Context, msg *messagebroker.
for _, token := range *tokens.PushNotificationTokens {
pn = append(pn, &pushNotification{
pn: &push.Notification[push.DeviceToken]{
Data: map[string]string{"deeplink": deeplink},
Target: token,
Title: tmpl.getTitle(nil),
Body: tmpl.getBody(nil),
ImageURL: imageURL,
Data: map[string]string{"deeplink": deeplink},
Target: token,
Title: tmpl.getTitle(nil),
Body: tmpl.getBody(nil),
},
sn: &sentNotification{
SentAt: now,
Expand Down
9 changes: 4 additions & 5 deletions notifications/notification_type_role_changed.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ func (s *enabledRolesSource) Process(ctx context.Context, msg *messagebroker.Mes
for _, token := range *tokens.PushNotificationTokens {
pn = append(pn, &pushNotification{
pn: &push.Notification[push.DeviceToken]{
Data: map[string]string{"deeplink": deeplink},
Target: token,
Title: tmpl.getTitle(nil),
Body: tmpl.getBody(nil),
ImageURL: imageURL,
Data: map[string]string{"deeplink": deeplink},
Target: token,
Title: tmpl.getTitle(nil),
Body: tmpl.getBody(nil),
},
sn: &sentNotification{
SentAt: now,
Expand Down

0 comments on commit 91dc23a

Please sign in to comment.