Merge pull request #1382 from bnjbvr/use-raw-homeserver-url
feat: use the raw homeserver URL instead of manually removing the scheme
This commit is contained in:
commit
4e246b8539
3 changed files with 3 additions and 8 deletions
1
changelog.d/1382.feature
Normal file
1
changelog.d/1382.feature
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Let the SDK figure the best scheme given an homeserver URL (thus allowing HTTP homeservers)
|
||||||
|
|
@ -27,11 +27,9 @@ import io.element.android.features.login.impl.error.ChangeServerError
|
||||||
import io.element.android.libraries.architecture.Async
|
import io.element.android.libraries.architecture.Async
|
||||||
import io.element.android.libraries.architecture.Presenter
|
import io.element.android.libraries.architecture.Presenter
|
||||||
import io.element.android.libraries.architecture.runCatchingUpdatingState
|
import io.element.android.libraries.architecture.runCatchingUpdatingState
|
||||||
import io.element.android.libraries.core.data.tryOrNull
|
|
||||||
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.net.URL
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ChangeServerPresenter @Inject constructor(
|
class ChangeServerPresenter @Inject constructor(
|
||||||
|
|
@ -65,8 +63,7 @@ class ChangeServerPresenter @Inject constructor(
|
||||||
changeServerAction: MutableState<Async<Unit>>,
|
changeServerAction: MutableState<Async<Unit>>,
|
||||||
) = launch {
|
) = launch {
|
||||||
suspend {
|
suspend {
|
||||||
val domain = tryOrNull { URL(data.title) }?.host ?: data.title
|
authenticationService.setHomeserver(data.title).map {
|
||||||
authenticationService.setHomeserver(domain).map {
|
|
||||||
authenticationService.getHomeserverDetails().value!!
|
authenticationService.getHomeserverDetails().value!!
|
||||||
// Valid, remember user choice
|
// Valid, remember user choice
|
||||||
accountProviderDataSource.userSelection(data)
|
accountProviderDataSource.userSelection(data)
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,9 @@ import io.element.android.features.login.impl.oidc.customtab.DefaultOidcActionFl
|
||||||
import io.element.android.libraries.architecture.Async
|
import io.element.android.libraries.architecture.Async
|
||||||
import io.element.android.libraries.architecture.Presenter
|
import io.element.android.libraries.architecture.Presenter
|
||||||
import io.element.android.libraries.architecture.runCatchingUpdatingState
|
import io.element.android.libraries.architecture.runCatchingUpdatingState
|
||||||
import io.element.android.libraries.core.data.tryOrNull
|
|
||||||
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.net.URL
|
|
||||||
|
|
||||||
class ConfirmAccountProviderPresenter @AssistedInject constructor(
|
class ConfirmAccountProviderPresenter @AssistedInject constructor(
|
||||||
@Assisted private val params: Params,
|
@Assisted private val params: Params,
|
||||||
|
|
@ -97,8 +95,7 @@ class ConfirmAccountProviderPresenter @AssistedInject constructor(
|
||||||
loginFlowAction: MutableState<Async<LoginFlow>>,
|
loginFlowAction: MutableState<Async<LoginFlow>>,
|
||||||
) = launch {
|
) = launch {
|
||||||
suspend {
|
suspend {
|
||||||
val domain = tryOrNull { URL(homeserverUrl) }?.host ?: homeserverUrl
|
authenticationService.setHomeserver(homeserverUrl).map {
|
||||||
authenticationService.setHomeserver(domain).map {
|
|
||||||
val matrixHomeServerDetails = authenticationService.getHomeserverDetails().value!!
|
val matrixHomeServerDetails = authenticationService.getHomeserverDetails().value!!
|
||||||
if (matrixHomeServerDetails.supportsOidcLogin) {
|
if (matrixHomeServerDetails.supportsOidcLogin) {
|
||||||
// Retrieve the details right now
|
// Retrieve the details right now
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue