mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 15:44:54 +00:00
Fix quality and failing test.
This commit is contained in:
committed by
Benoit Marty
parent
7647414c68
commit
2d1cede6a8
+2
-1
@@ -118,7 +118,8 @@ fun ConfirmAccountProviderView(
|
|||||||
},
|
},
|
||||||
onDismiss = {
|
onDismiss = {
|
||||||
eventSink(ConfirmAccountProviderEvents.ClearError)
|
eventSink(ConfirmAccountProviderEvents.ClearError)
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
is AccountCreationNotSupported -> {
|
is AccountCreationNotSupported -> {
|
||||||
ErrorDialog(
|
ErrorDialog(
|
||||||
|
|||||||
+3
-4
@@ -14,8 +14,8 @@ import io.element.android.features.login.impl.resolver.network.WellknownAPI
|
|||||||
import io.element.android.features.login.impl.screens.createaccount.AccountCreationNotSupported
|
import io.element.android.features.login.impl.screens.createaccount.AccountCreationNotSupported
|
||||||
import io.element.android.libraries.di.AppScope
|
import io.element.android.libraries.di.AppScope
|
||||||
import io.element.android.libraries.network.RetrofitFactory
|
import io.element.android.libraries.network.RetrofitFactory
|
||||||
import java.net.HttpURLConnection
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
import java.net.HttpURLConnection
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
interface WebClientUrlForAuthenticationRetriever {
|
interface WebClientUrlForAuthenticationRetriever {
|
||||||
@@ -35,10 +35,9 @@ class DefaultWebClientUrlForAuthenticationRetriever @Inject constructor(
|
|||||||
.create(WellknownAPI::class.java)
|
.create(WellknownAPI::class.java)
|
||||||
val result = try {
|
val result = try {
|
||||||
wellknownApi.getElementWellKnown()
|
wellknownApi.getElementWellKnown()
|
||||||
} catch (e: Exception) {
|
} catch (e: retrofit2.HttpException) {
|
||||||
throw when {
|
throw when {
|
||||||
e is retrofit2.HttpException &&
|
e.code() == HttpURLConnection.HTTP_NOT_FOUND -> AccountCreationNotSupported()
|
||||||
e.code() == HttpURLConnection.HTTP_NOT_FOUND -> AccountCreationNotSupported()
|
|
||||||
else -> e
|
else -> e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -11,6 +11,7 @@ import app.cash.molecule.RecompositionMode
|
|||||||
import app.cash.molecule.moleculeFlow
|
import app.cash.molecule.moleculeFlow
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import io.element.android.appconfig.OnBoardingConfig
|
||||||
import io.element.android.libraries.core.meta.BuildType
|
import io.element.android.libraries.core.meta.BuildType
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
import io.element.android.libraries.featureflag.api.FeatureFlags
|
||||||
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
||||||
@@ -46,7 +47,7 @@ class OnBoardingPresenterTest {
|
|||||||
assertThat(initialState.isDebugBuild).isTrue()
|
assertThat(initialState.isDebugBuild).isTrue()
|
||||||
assertThat(initialState.canLoginWithQrCode).isFalse()
|
assertThat(initialState.canLoginWithQrCode).isFalse()
|
||||||
assertThat(initialState.productionApplicationName).isEqualTo("B")
|
assertThat(initialState.productionApplicationName).isEqualTo("B")
|
||||||
assertThat(initialState.canCreateAccount).isFalse()
|
assertThat(initialState.canCreateAccount).isEqualTo(OnBoardingConfig.CAN_CREATE_ACCOUNT)
|
||||||
|
|
||||||
assertThat(awaitItem().canLoginWithQrCode).isTrue()
|
assertThat(awaitItem().canLoginWithQrCode).isTrue()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user