Fix crash when invalid url is entered #7672
This commit is contained in:
parent
c20500ab7a
commit
341967bf3c
@ -118,7 +118,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkQrCodeLoginCapability(homeServerUrl: String) {
|
private suspend fun checkQrCodeLoginCapability(config: HomeServerConnectionConfig) {
|
||||||
if (!vectorFeatures.isQrCodeLoginEnabled()) {
|
if (!vectorFeatures.isQrCodeLoginEnabled()) {
|
||||||
setState {
|
setState {
|
||||||
copy(
|
copy(
|
||||||
@ -133,16 +133,12 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewModelScope.launch {
|
// check if selected server supports MSC3882 first
|
||||||
// check if selected server supports MSC3882 first
|
val canLoginWithQrCode = authenticationService.isQrLoginSupported(config)
|
||||||
homeServerConnectionConfigFactory.create(homeServerUrl)?.let {
|
setState {
|
||||||
val canLoginWithQrCode = authenticationService.isQrLoginSupported(it)
|
copy(
|
||||||
setState {
|
canLoginWithQrCode = canLoginWithQrCode
|
||||||
copy(
|
)
|
||||||
canLoginWithQrCode = canLoginWithQrCode
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -710,7 +706,6 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||||||
_viewEvents.post(OnboardingViewEvents.Failure(Throwable("Unable to create a HomeServerConnectionConfig")))
|
_viewEvents.post(OnboardingViewEvents.Failure(Throwable("Unable to create a HomeServerConnectionConfig")))
|
||||||
} else {
|
} else {
|
||||||
startAuthenticationFlow(action, homeServerConnectionConfig, serverTypeOverride, postAction)
|
startAuthenticationFlow(action, homeServerConnectionConfig, serverTypeOverride, postAction)
|
||||||
checkQrCodeLoginCapability(homeServerConnectionConfig.homeServerUri.toString())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,6 +764,8 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||||||
_viewEvents.post(OnboardingViewEvents.OutdatedHomeserver)
|
_viewEvents.post(OnboardingViewEvents.OutdatedHomeserver)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkQrCodeLoginCapability(config)
|
||||||
|
|
||||||
when (trigger) {
|
when (trigger) {
|
||||||
is OnboardingAction.HomeServerChange.SelectHomeServer -> {
|
is OnboardingAction.HomeServerChange.SelectHomeServer -> {
|
||||||
onHomeServerSelected(config, serverTypeOverride, authResult)
|
onHomeServerSelected(config, serverTypeOverride, authResult)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user