Skip to content

Commit

Permalink
Merge pull request #2 from kumparan/feature/BAN-4273-generate-media-url
Browse files Browse the repository at this point in the history
refactor: export consts
  • Loading branch information
zhenqianz authored Jan 6, 2020
2 parents 4640eb3 + 4c9e57a commit 4490f2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions media.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
)

const (
// _BigPicture :nodoc:
_BigPicture = "big_picture"
// _LargeIcon :nodoc:
_LargeIcon = "large_icon"
// _IOSAttachment :nodoc:
_IOSAttachment = "ios_attahcment"
// BigPicture :nodoc:
BigPicture = "big_picture"
// LargeIcon :nodoc:
LargeIcon = "large_icon"
// IOSAttachment :nodoc:
IOSAttachment = "ios_attahcment"
)

// GeneratePushNotificationMediaURL Generates manipulated media URL for push notification purpose
Expand All @@ -26,13 +26,13 @@ func GeneratePushNotificationMediaURL(cdnURL, mediaSrcURL, imageType string) str
var param string
switch imageType {

case _LargeIcon:
case LargeIcon:
param = "image/upload/fl_progressive,fl_lossy,c_fill,g_face,q_auto:best,w_256,ar_1:1"

case _BigPicture:
case BigPicture:
param = "image/upload/fl_progressive,fl_lossy,c_fill,g_face,q_auto:best,w_1440,h_720"

case _IOSAttachment:
case IOSAttachment:
param = "image/upload/fl_progressive,fl_lossy,c_fill,g_face,q_auto:best,w_1024,h_1024"
}

Expand Down
2 changes: 1 addition & 1 deletion media_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import (

func Test_GeneratePushNotificationMediaURL(t *testing.T) {
externalMediaURL := "https://this.is/test/image/upload/123/234.jpg"
res := GeneratePushNotificationMediaURL("https://this.is", externalMediaURL, _LargeIcon)
res := GeneratePushNotificationMediaURL("https://this.is", externalMediaURL, LargeIcon)
assert.Equal(t, "https://this.is/image/upload/fl_progressive,fl_lossy,c_fill,g_face,q_auto:best,w_256,ar_1:1/123/234.jpg", res)
}

0 comments on commit 4490f2e

Please sign in to comment.