Merge pull request #2730 from element-hq/renovate/org.matrix.rustcomponents-sdk-android-0.x
Update dependency org.matrix.rustcomponents:sdk-android to v0.2.16
This commit is contained in:
@@ -154,7 +154,7 @@ jsoup = "org.jsoup:jsoup:1.17.2"
|
||||
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
|
||||
molecule-runtime = "app.cash.molecule:molecule-runtime:1.4.2"
|
||||
timber = "com.jakewharton.timber:timber:5.0.1"
|
||||
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.15"
|
||||
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.16"
|
||||
matrix_richtexteditor = { module = "io.element.android:wysiwyg", version.ref = "wysiwyg" }
|
||||
matrix_richtexteditor_compose = { module = "io.element.android:wysiwyg-compose", version.ref = "wysiwyg" }
|
||||
sqldelight-driver-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.matrix.rustcomponents.sdk.TimelineEventTypeFilter
|
||||
/** Returns a `Room` with an initialized timeline using the given [filter]. */
|
||||
suspend fun RoomListItem.fullRoomWithTimeline(filter: TimelineEventTypeFilter? = null): Room {
|
||||
if (!isTimelineInitialized()) {
|
||||
initTimeline(filter)
|
||||
initTimeline(filter, "live")
|
||||
}
|
||||
return fullRoom()
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.buffer
|
||||
import kotlinx.coroutines.flow.callbackFlow
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import org.matrix.rustcomponents.sdk.BackPaginationStatusListener
|
||||
import org.matrix.rustcomponents.sdk.PaginationStatusListener
|
||||
import org.matrix.rustcomponents.sdk.Timeline
|
||||
import org.matrix.rustcomponents.sdk.TimelineDiff
|
||||
import org.matrix.rustcomponents.sdk.TimelineItem
|
||||
import org.matrix.rustcomponents.sdk.TimelineListener
|
||||
import timber.log.Timber
|
||||
import uniffi.matrix_sdk_ui.BackPaginationStatus
|
||||
import uniffi.matrix_sdk_ui.PaginationStatus
|
||||
|
||||
internal fun Timeline.timelineDiffFlow(onInitialList: suspend (List<TimelineItem>) -> Unit): Flow<List<TimelineDiff>> =
|
||||
callbackFlow {
|
||||
@@ -58,10 +58,10 @@ internal fun Timeline.timelineDiffFlow(onInitialList: suspend (List<TimelineItem
|
||||
Timber.d(it, "timelineDiffFlow() failed")
|
||||
}.buffer(Channel.UNLIMITED)
|
||||
|
||||
internal fun Timeline.backPaginationStatusFlow(): Flow<BackPaginationStatus> =
|
||||
internal fun Timeline.backPaginationStatusFlow(): Flow<PaginationStatus> =
|
||||
mxCallbackFlow {
|
||||
val listener = object : BackPaginationStatusListener {
|
||||
override fun onUpdate(status: BackPaginationStatus) {
|
||||
val listener = object : PaginationStatusListener {
|
||||
override fun onUpdate(status: PaginationStatus) {
|
||||
trySendBlocking(status)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ import org.matrix.rustcomponents.sdk.Timeline
|
||||
import org.matrix.rustcomponents.sdk.TimelineDiff
|
||||
import org.matrix.rustcomponents.sdk.TimelineItem
|
||||
import timber.log.Timber
|
||||
import uniffi.matrix_sdk_ui.BackPaginationStatus
|
||||
import uniffi.matrix_sdk_ui.EventItemOrigin
|
||||
import uniffi.matrix_sdk_ui.PaginationStatus
|
||||
import java.util.Date
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
@@ -152,21 +152,21 @@ class RustMatrixTimeline(
|
||||
)
|
||||
}
|
||||
when (paginationStatus) {
|
||||
BackPaginationStatus.IDLE -> {
|
||||
PaginationStatus.IDLE -> {
|
||||
MatrixTimeline.PaginationState(
|
||||
isBackPaginating = false,
|
||||
hasMoreToLoadBackwards = true,
|
||||
beginningOfRoomReached = false,
|
||||
)
|
||||
}
|
||||
BackPaginationStatus.PAGINATING -> {
|
||||
PaginationStatus.PAGINATING -> {
|
||||
MatrixTimeline.PaginationState(
|
||||
isBackPaginating = true,
|
||||
hasMoreToLoadBackwards = true,
|
||||
beginningOfRoomReached = false,
|
||||
)
|
||||
}
|
||||
BackPaginationStatus.TIMELINE_START_REACHED -> {
|
||||
PaginationStatus.TIMELINE_END_REACHED -> {
|
||||
MatrixTimeline.PaginationState(
|
||||
isBackPaginating = false,
|
||||
hasMoreToLoadBackwards = false,
|
||||
@@ -229,7 +229,12 @@ class RustMatrixTimeline(
|
||||
runCatching {
|
||||
if (!canBackPaginate()) throw TimelineException.CannotPaginate
|
||||
Timber.v("Start back paginating for room ${matrixRoom.roomId} ")
|
||||
innerTimeline.paginateBackwards(paginationOptions)
|
||||
innerTimeline.paginateBackwards(
|
||||
when (paginationOptions) {
|
||||
is PaginationOptions.SimpleRequest -> paginationOptions.eventLimit
|
||||
is PaginationOptions.UntilNumItems -> paginationOptions.eventLimit
|
||||
}
|
||||
)
|
||||
}.onFailure { error ->
|
||||
if (error is TimelineException.CannotPaginate) {
|
||||
Timber.d("Can't paginate backwards on room ${matrixRoom.roomId}, we're already at the start")
|
||||
@@ -238,7 +243,7 @@ class RustMatrixTimeline(
|
||||
}
|
||||
}.onSuccess {
|
||||
Timber.v("Success back paginating for room ${matrixRoom.roomId}")
|
||||
}
|
||||
}.map { }
|
||||
}
|
||||
|
||||
private fun canBackPaginate(): Boolean {
|
||||
|
||||
@@ -22,13 +22,20 @@ import io.element.android.libraries.matrix.test.AN_EVENT_ID
|
||||
import io.element.android.services.analytics.test.FakeAnalyticsService
|
||||
import org.junit.Test
|
||||
import org.matrix.rustcomponents.sdk.UnableToDecryptInfo
|
||||
import uniffi.matrix_sdk_crypto.UtdCause
|
||||
|
||||
class UtdTrackerTest {
|
||||
@Test
|
||||
fun `when onUtd is called with null timeToDecryptMs, the expected analytics Event is sent`() {
|
||||
val fakeAnalyticsService = FakeAnalyticsService()
|
||||
val sut = UtdTracker(fakeAnalyticsService)
|
||||
sut.onUtd(UnableToDecryptInfo(eventId = AN_EVENT_ID.value, timeToDecryptMs = null))
|
||||
sut.onUtd(
|
||||
UnableToDecryptInfo(
|
||||
eventId = AN_EVENT_ID.value,
|
||||
timeToDecryptMs = null,
|
||||
cause = UtdCause.UNKNOWN,
|
||||
)
|
||||
)
|
||||
assertThat(fakeAnalyticsService.capturedEvents).containsExactly(
|
||||
Error(
|
||||
context = null,
|
||||
@@ -47,7 +54,13 @@ class UtdTrackerTest {
|
||||
fun `when onUtd is called with timeToDecryptMs, the expected analytics Event is sent`() {
|
||||
val fakeAnalyticsService = FakeAnalyticsService()
|
||||
val sut = UtdTracker(fakeAnalyticsService)
|
||||
sut.onUtd(UnableToDecryptInfo(eventId = AN_EVENT_ID.value, timeToDecryptMs = 123.toULong()))
|
||||
sut.onUtd(
|
||||
UnableToDecryptInfo(
|
||||
eventId = AN_EVENT_ID.value,
|
||||
timeToDecryptMs = 123.toULong(),
|
||||
cause = UtdCause.UNKNOWN,
|
||||
)
|
||||
)
|
||||
assertThat(fakeAnalyticsService.capturedEvents).containsExactly(
|
||||
Error(
|
||||
context = null,
|
||||
|
||||
Reference in New Issue
Block a user