Use correct homeserver url to check qr code login support.
This commit is contained in:
parent
b04ad4915f
commit
e83bdc3779
|
@ -25,6 +25,7 @@ import com.airbnb.mvrx.viewModel
|
|||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import im.vector.app.core.extensions.addFragment
|
||||
import im.vector.app.core.platform.SimpleFragmentActivity
|
||||
import im.vector.lib.core.utils.compat.getParcelableCompat
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
import timber.log.Timber
|
||||
|
||||
|
@ -37,7 +38,7 @@ class QrCodeLoginActivity : SimpleFragmentActivity() {
|
|||
super.onCreate(savedInstanceState)
|
||||
views.toolbar.visibility = View.GONE
|
||||
|
||||
val qrCodeLoginArgs: QrCodeLoginArgs? = intent?.extras?.getParcelable(Mavericks.KEY_ARG)
|
||||
val qrCodeLoginArgs: QrCodeLoginArgs? = intent?.extras?.getParcelableCompat(Mavericks.KEY_ARG)
|
||||
if (isFirstCreation()) {
|
||||
when (qrCodeLoginArgs?.loginType) {
|
||||
QrCodeLoginType.LOGIN -> {
|
||||
|
|
|
@ -44,7 +44,7 @@ class QrCodeLoginShowQrCodeFragment : VectorBaseFragment<FragmentQrCodeLoginShow
|
|||
|
||||
private fun initCancelButton() {
|
||||
views.qrCodeLoginShowQrCodeCancelButton.debouncedClicks {
|
||||
activity?.onBackPressed()
|
||||
activity?.onBackPressedDispatcher?.onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class QrCodeLoginStatusFragment : VectorBaseFragment<FragmentQrCodeLoginStatusBi
|
|||
|
||||
private fun initCancelButton() {
|
||||
views.qrCodeLoginStatusCancelButton.debouncedClicks {
|
||||
activity?.onBackPressed()
|
||||
activity?.onBackPressedDispatcher?.onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun observeQrCodeLoginCapability() = viewModelScope.launch {
|
||||
private fun observeQrCodeLoginCapability(homeServerUrl: String) = viewModelScope.launch {
|
||||
if (!vectorFeatures.isQrCodeLoginEnabled()) {
|
||||
setState {
|
||||
copy(
|
||||
|
@ -134,8 +134,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
}
|
||||
} else {
|
||||
// check if selected server supports MSC3882 first
|
||||
// FIXME: this should be checking the selected homeserver not defaultHomeserverUrl
|
||||
homeServerConnectionConfigFactory.create(defaultHomeserverUrl)?.let {
|
||||
homeServerConnectionConfigFactory.create(homeServerUrl)?.let {
|
||||
val canLoginWithQrCode = authenticationService.isQrLoginSupported(it)
|
||||
setState {
|
||||
copy(
|
||||
|
@ -263,7 +262,6 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
private fun handleSplashAction(action: OnboardingAction.SplashAction) {
|
||||
setState { copy(onboardingFlow = action.onboardingFlow) }
|
||||
continueToPageAfterSplash(action.onboardingFlow)
|
||||
observeQrCodeLoginCapability()
|
||||
}
|
||||
|
||||
private fun continueToPageAfterSplash(onboardingFlow: OnboardingFlow) {
|
||||
|
@ -709,6 +707,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
_viewEvents.post(OnboardingViewEvents.Failure(Throwable("Unable to create a HomeServerConnectionConfig")))
|
||||
} else {
|
||||
startAuthenticationFlow(action, homeServerConnectionConfig, serverTypeOverride, postAction)
|
||||
observeQrCodeLoginCapability(homeServerConnectionConfig.homeServerUri.toString())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue