mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Merge pull request #3809 from element-hq/renovate/org.matrix.rustcomponents-sdk-android-0.x
fix(deps): update dependency org.matrix.rustcomponents:sdk-android to v0.2.59
This commit is contained in:
+4
-1
@@ -23,6 +23,7 @@ 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 kotlin.jvm.optionals.getOrElse
|
||||
|
||||
class RoomAliasResolverPresenter @AssistedInject constructor(
|
||||
@Assisted private val roomAlias: RoomAlias,
|
||||
@@ -57,7 +58,9 @@ class RoomAliasResolverPresenter @AssistedInject constructor(
|
||||
|
||||
private fun CoroutineScope.resolveAlias(resolveState: MutableState<AsyncData<ResolvedRoomAlias>>) = launch {
|
||||
suspend {
|
||||
matrixClient.resolveRoomAlias(roomAlias).getOrThrow()
|
||||
matrixClient.resolveRoomAlias(roomAlias)
|
||||
.getOrThrow()
|
||||
.getOrElse { error("Failed to resolve room alias $roomAlias") }
|
||||
}.runCatchingUpdatingState(resolveState)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -24,6 +24,7 @@ import io.element.android.tests.testutils.WarmUpRule
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import java.util.Optional
|
||||
|
||||
class RoomAliasResolverPresenterTest {
|
||||
@get:Rule
|
||||
@@ -42,7 +43,7 @@ class RoomAliasResolverPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - resolve alias to roomId`() = runTest {
|
||||
val result = aResolvedRoomAlias()
|
||||
val result = Optional.of(aResolvedRoomAlias())
|
||||
val client = FakeMatrixClient(
|
||||
resolveRoomAliasResult = { Result.success(result) }
|
||||
)
|
||||
@@ -54,7 +55,7 @@ class RoomAliasResolverPresenterTest {
|
||||
assertThat(awaitItem().resolveState.isLoading()).isTrue()
|
||||
val resultState = awaitItem()
|
||||
assertThat(resultState.roomAlias).isEqualTo(A_ROOM_ALIAS)
|
||||
assertThat(resultState.resolveState.dataOrNull()).isEqualTo(result)
|
||||
assertThat(resultState.resolveState.dataOrNull()).isEqualTo(result.get())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -28,6 +28,8 @@ import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.map
|
||||
import javax.inject.Inject
|
||||
|
||||
private const val SEARCH_BATCH_SIZE = 20
|
||||
|
||||
class RoomDirectoryPresenter @Inject constructor(
|
||||
private val dispatchers: CoroutineDispatchers,
|
||||
private val roomDirectoryService: RoomDirectoryService,
|
||||
@@ -51,7 +53,7 @@ class RoomDirectoryPresenter @Inject constructor(
|
||||
loadingMore = false
|
||||
// debounce search query
|
||||
delay(300)
|
||||
roomDirectoryList.filter(searchQuery, 20)
|
||||
roomDirectoryList.filter(filter = searchQuery, batchSize = SEARCH_BATCH_SIZE, viaServerName = null)
|
||||
}
|
||||
LaunchedEffect(loadingMore) {
|
||||
if (loadingMore) {
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ import org.junit.Test
|
||||
|
||||
@Test
|
||||
fun `present - emit search event`() = runTest {
|
||||
val filterLambda = lambdaRecorder { _: String?, _: Int ->
|
||||
val filterLambda = lambdaRecorder { _: String?, _: Int, _: String? ->
|
||||
Result.success(Unit)
|
||||
}
|
||||
val roomDirectoryList = FakeRoomDirectoryList(filterLambda = filterLambda)
|
||||
@@ -99,7 +99,7 @@ import org.junit.Test
|
||||
}
|
||||
assert(filterLambda)
|
||||
.isCalledOnce()
|
||||
.with(value("test"), any())
|
||||
.with(value("test"), any(), value(null))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user