라이브, 콘텐츠, 채널 공유하기
- 파라미터 키, 값 각각 인코딩 적용
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package kr.co.vividnext.sodalive.common
|
||||
|
||||
import java.net.URLEncoder
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
object Utils {
|
||||
fun convertDurationToString(duration: Int, showHours: Boolean = true): String {
|
||||
val durationSeconds = duration / 1000
|
||||
@@ -26,4 +29,13 @@ object Utils {
|
||||
|
||||
return 1000 * (hours * 3600 + minutes * 60 + seconds)
|
||||
}
|
||||
|
||||
fun createOneLinkUrl(params: Map<String, String>): String {
|
||||
val encodedParams = params.map { (key, value) ->
|
||||
"${URLEncoder.encode(key, StandardCharsets.UTF_8.toString())}=" +
|
||||
URLEncoder.encode(value, StandardCharsets.UTF_8.toString())
|
||||
}.joinToString("&")
|
||||
|
||||
return "https://voiceon.onelink.me/RkTm?$encodedParams"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user