diff --git a/CHANGELOG.md b/CHANGELOG.md index 29fe511..cf51d0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,22 @@ # go-utils + +## [v1.49.0] - 2026-06-26 +### New Features +- add media param on generate push notif url + + -## [v1.48.0] - 2026-06-22 +## [v1.48.0] - 2026-06-24 ### New Features -- contains prefix +- contains prefix ([#80](https://github.com/kumparan/go-utils/issues/80)) ## [v1.47.0] - 2026-05-13 ### New Features - prevent duplicate punctuation on paragraph ending +- prevent duplicate punctuation on paragraph ending @@ -429,7 +436,8 @@ - init go-utils -[Unreleased]: https://github.com/kumparan/go-utils/compare/v1.48.0...HEAD +[Unreleased]: https://github.com/kumparan/go-utils/compare/v1.49.0...HEAD +[v1.49.0]: https://github.com/kumparan/go-utils/compare/v1.48.0...v1.49.0 [v1.48.0]: https://github.com/kumparan/go-utils/compare/v1.47.0...v1.48.0 [v1.47.0]: https://github.com/kumparan/go-utils/compare/v1.46.0...v1.47.0 [v1.46.0]: https://github.com/kumparan/go-utils/compare/v1.45.0...v1.46.0 diff --git a/media.go b/media.go index a57445a..25b98c5 100644 --- a/media.go +++ b/media.go @@ -15,7 +15,7 @@ const ( // GeneratePushNotificationMediaURL Generates manipulated media URL for push notification purpose // e.g. GeneratePushNotificationMediaURL("http://mycdn.com", "http://my.image.com/image/upload/v123/image.jpg", LargeIcon) => http://mycdn.com/image/upload/v123/image.jpg -func GeneratePushNotificationMediaURL(cdnURL, mediaSrcURL, imageType string) string { +func GeneratePushNotificationMediaURL(cdnURL, mediaSrcURL, imageType, additionalParam string) string { if mediaSrcURL == "" || cdnURL == "" { return "" } @@ -36,7 +36,7 @@ func GeneratePushNotificationMediaURL(cdnURL, mediaSrcURL, imageType string) str param = "image/upload/fl_progressive,fl_lossy,c_fill,g_face,q_auto:best,w_1024,h_1024,f_jpeg" } - mediaURL := cdnURL + "/" + param + "/" + coverMediaFile + mediaURL := cdnURL + "/" + param + "/" + coverMediaFile + additionalParam - return mediaURL + return mediaURL + "" } diff --git a/media_test.go b/media_test.go index c9609c5..fff2648 100644 --- a/media_test.go +++ b/media_test.go @@ -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) - assert.Equal(t, "https://this.is/image/upload/fl_progressive,fl_lossy,c_fill,g_face,q_auto:best,w_256,ar_1:1,f_jpeg/123/234.jpg", res) + res := GeneratePushNotificationMediaURL("https://this.is", externalMediaURL, LargeIcon, "&awo=owa") + assert.Equal(t, "https://this.is/image/upload/fl_progressive,fl_lossy,c_fill,g_face,q_auto:best,w_256,ar_1:1,f_jpeg/123/234.jpg&awo=owa", res) }