Merge develop into the PreviewParam rename

The 174 commits develop gained since this branch was cut touch preview data
in three ways, and each is resolved so the flipped konsist rule still holds
across the merged tree.

Two screens the branch had renamed were deleted upstream by "Remove the
account provider search screen and homeserver resolver": the
changeaccountprovider and searchaccountprovider packages. Their deletion
wins, so ChangeAccountProviderStatePreviewParam, SearchAccountProviderStatePreviewParam
and the two views that used them go with them rather than coming back
under the new name.

Two preview classes develop added still carried the old suffix and are
renamed here, along with the `@PreviewParameter` reference in each view:
GlobalSearchStateProvider -> GlobalSearchStatePreviewParam and
SendFailureDialogStateProvider -> SendFailureDialogStatePreviewParam.

Everything else merged textually. No production class extending
PreviewParameterProvider is left with a `Provider` name, and no reference
to any of the 194 renamed names survives outside the CHANGES.md entry that
records a past pull request title.
This commit is contained in:
hayaksi1
2026-08-24 10:55:40 +03:00
397 changed files with 6635 additions and 4221 deletions
@@ -24,7 +24,10 @@ import io.element.android.libraries.matrix.api.core.RoomAlias
import io.element.android.libraries.matrix.api.room.alias.ResolvedRoomAlias
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withTimeoutOrNull
import java.util.concurrent.TimeoutException
import kotlin.jvm.optionals.getOrElse
import kotlin.time.Duration.Companion.seconds
@AssistedInject
class RoomAliasResolverPresenter(
@@ -61,9 +64,14 @@ class RoomAliasResolverPresenter(
private fun CoroutineScope.resolveAlias(resolveState: MutableState<AsyncData<ResolvedRoomAlias>>) = launch {
suspend {
matrixClient.resolveRoomAlias(roomAlias)
val result = withTimeoutOrNull(ALIAS_RESOLVE_TIMEOUT_IN_SECONDS.seconds) {
matrixClient.resolveRoomAlias(roomAlias)
} ?: throw TimeoutException("Timed out while resolving ${roomAlias.value}")
result
.getOrThrow()
.getOrElse { throw RoomAliasResolverFailures.UnknownAlias }
}.runCatchingUpdatingState(resolveState)
}
}
private const val ALIAS_RESOLVE_TIMEOUT_IN_SECONDS = 10
@@ -22,10 +22,12 @@ import io.element.android.libraries.matrix.test.A_ROOM_ID
import io.element.android.libraries.matrix.test.A_SERVER_LIST
import io.element.android.libraries.matrix.test.FakeMatrixClient
import io.element.android.tests.testutils.WarmUpRule
import kotlinx.coroutines.awaitCancellation
import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test
import java.util.Optional
import java.util.concurrent.TimeoutException
class RoomAliasHelperPresenterTest {
@get:Rule
@@ -60,6 +62,22 @@ class RoomAliasHelperPresenterTest {
}
}
@Test
fun `present - a server that never answers ends up in an error state`() = runTest {
val client = FakeMatrixClient(
resolveRoomAliasResult = { awaitCancellation() }
)
val presenter = createPresenter(matrixClient = client)
moleculeFlow(RecompositionMode.Immediate) {
presenter.present()
}.test {
assertThat(awaitItem().resolveState.isUninitialized()).isTrue()
assertThat(awaitItem().resolveState.isLoading()).isTrue()
val resultState = awaitItem()
assertThat(resultState.resolveState.errorOrNull()).isInstanceOf(TimeoutException::class.java)
}
}
@Test
fun `present - resolve alias error and retry`() = runTest {
val client = FakeMatrixClient(