mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 11:26:01 +03:00
Remove duplicated method
This commit is contained in:
parent
6d53d0e12f
commit
afd2ecd384
2 changed files with 9 additions and 22 deletions
|
@ -35,3 +35,10 @@ fun StringBuilder.appendParamToUrl(param: String, value: String): StringBuilder
|
|||
|
||||
return this
|
||||
}
|
||||
|
||||
fun StringBuilder.appendParamsToUrl(params: Map<String, String>): StringBuilder {
|
||||
params.forEach { (param, value) ->
|
||||
appendParamToUrl(param, value)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
|
|
@ -20,11 +20,12 @@ import org.matrix.android.sdk.api.MatrixConfiguration
|
|||
import org.matrix.android.sdk.api.session.integrationmanager.IntegrationManagerConfig
|
||||
import org.matrix.android.sdk.api.session.integrationmanager.IntegrationManagerService
|
||||
import org.matrix.android.sdk.api.session.widgets.WidgetURLFormatter
|
||||
import org.matrix.android.sdk.api.util.appendParamToUrl
|
||||
import org.matrix.android.sdk.api.util.appendParamsToUrl
|
||||
import org.matrix.android.sdk.internal.session.SessionLifecycleObserver
|
||||
import org.matrix.android.sdk.internal.session.SessionScope
|
||||
import org.matrix.android.sdk.internal.session.integrationmanager.IntegrationManager
|
||||
import org.matrix.android.sdk.internal.session.widgets.token.GetScalarTokenTask
|
||||
import java.net.URLEncoder
|
||||
import javax.inject.Inject
|
||||
|
||||
@SessionScope
|
||||
|
@ -90,25 +91,4 @@ internal class DefaultWidgetURLFormatter @Inject constructor(private val integra
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun StringBuilder.appendParamsToUrl(params: Map<String, String>): StringBuilder {
|
||||
params.forEach { (param, value) ->
|
||||
appendParamToUrl(param, value)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
private fun StringBuilder.appendParamToUrl(param: String, value: String): StringBuilder {
|
||||
if (contains("?")) {
|
||||
append("&")
|
||||
} else {
|
||||
append("?")
|
||||
}
|
||||
|
||||
append(param)
|
||||
append("=")
|
||||
append(URLEncoder.encode(value, "utf-8"))
|
||||
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue