mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +03:00
Code review
This commit is contained in:
parent
60dee6eea3
commit
871360754e
3 changed files with 5 additions and 6 deletions
|
@ -33,8 +33,8 @@ internal class DefaultPermalinkService @Inject constructor(
|
|||
return permalinkFactory.createPermalink(id)
|
||||
}
|
||||
|
||||
override fun createRoomPermalink(roomId: String, via: List<String>?): String? {
|
||||
return permalinkFactory.createRoomPermalink(roomId, via)
|
||||
override fun createRoomPermalink(roomId: String, viaServers: List<String>?): String? {
|
||||
return permalinkFactory.createRoomPermalink(roomId, viaServers)
|
||||
}
|
||||
|
||||
override fun createPermalink(roomId: String, eventId: String): String {
|
||||
|
|
|
@ -48,7 +48,7 @@ internal class PermalinkFactory @Inject constructor(
|
|||
append(MATRIX_TO_URL_BASE)
|
||||
append(escape(roomId))
|
||||
append(
|
||||
via?.takeIf { it.isNotEmpty() }?.let { viaParameterFinder.computeViaParams(it) }
|
||||
via?.takeIf { it.isNotEmpty() }?.let { viaParameterFinder.asUrlViaParameters(it) }
|
||||
?: viaParameterFinder.computeViaParams(userId, roomId)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -39,11 +39,10 @@ internal class ViaParameterFinder @Inject constructor(
|
|||
* current user one.
|
||||
*/
|
||||
fun computeViaParams(userId: String, roomId: String): String {
|
||||
return computeViaParams(userId, roomId, 3)
|
||||
.joinToString(prefix = "?via=", separator = "&via=") { URLEncoder.encode(it, "utf-8") }
|
||||
return asUrlViaParameters(computeViaParams(userId, roomId, 3))
|
||||
}
|
||||
|
||||
fun computeViaParams(viaList: List<String>): String {
|
||||
fun asUrlViaParameters(viaList: List<String>): String {
|
||||
return viaList.joinToString(prefix = "?via=", separator = "&via=") { URLEncoder.encode(it, "utf-8") }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue