Fix small UI bug

This commit is contained in:
Benoit Marty 2020-05-08 16:01:11 +02:00
parent d3bc9f52fd
commit 637f4a8350
3 changed files with 8 additions and 5 deletions

View File

@ -34,8 +34,10 @@ interface IdentityService {
/**
* Update the identity server url.
* @param url the new url. Set to null to disconnect from the identity server
* @param callback will notify the user is change successful. The String will be the final url of the identity server, or null.
* The SDK can append "https://" for instance.
*/
fun setNewIdentityServer(url: String?, callback: MatrixCallback<Unit>): Cancelable
fun setNewIdentityServer(url: String?, callback: MatrixCallback<String?>): Cancelable
fun startBindSession(threePid: ThreePid, nothing: Nothing?, matrixCallback: MatrixCallback<ThreePid>)
fun finalizeBindSessionFor3PID(threePid: ThreePid, matrixCallback: MatrixCallback<Unit>)

View File

@ -130,7 +130,7 @@ internal class DefaultIdentityService @Inject constructor(
TODO("Not yet implemented")
}
override fun setNewIdentityServer(url: String?, callback: MatrixCallback<Unit>): Cancelable {
override fun setNewIdentityServer(url: String?, callback: MatrixCallback<String?>): Cancelable {
val urlCandidate = url?.let { param ->
buildString {
if (!param.startsWith("http")) {
@ -171,6 +171,7 @@ internal class DefaultIdentityService @Inject constructor(
updateAccountData(urlCandidate)
}
}
urlCandidate
}
}

View File

@ -149,11 +149,11 @@ class DiscoverySettingsViewModel @AssistedInject constructor(
)
}
session.identityService().setNewIdentityServer(action.url, object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
session.identityService().setNewIdentityServer(action.url, object : MatrixCallback<String?> {
override fun onSuccess(data: String?) {
setState {
copy(
identityServer = Success(action.url)
identityServer = Success(data)
)
}
retrieveBinding()