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:
commit
76cedafeb7
5 changed files with 33 additions and 15 deletions
|
|
@ -154,7 +154,7 @@ jsoup = "org.jsoup:jsoup:1.17.2"
|
||||||
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
|
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
|
||||||
molecule-runtime = "app.cash.molecule:molecule-runtime:1.4.2"
|
molecule-runtime = "app.cash.molecule:molecule-runtime:1.4.2"
|
||||||
timber = "com.jakewharton.timber:timber:5.0.1"
|
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 = { module = "io.element.android:wysiwyg", version.ref = "wysiwyg" }
|
||||||
matrix_richtexteditor_compose = { module = "io.element.android:wysiwyg-compose", 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" }
|
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]. */
|
/** Returns a `Room` with an initialized timeline using the given [filter]. */
|
||||||
suspend fun RoomListItem.fullRoomWithTimeline(filter: TimelineEventTypeFilter? = null): Room {
|
suspend fun RoomListItem.fullRoomWithTimeline(filter: TimelineEventTypeFilter? = null): Room {
|
||||||
if (!isTimelineInitialized()) {
|
if (!isTimelineInitialized()) {
|
||||||
initTimeline(filter)
|
initTimeline(filter, "live")
|
||||||
}
|
}
|
||||||
return fullRoom()
|
return fullRoom()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,13 +27,13 @@ import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.buffer
|
import kotlinx.coroutines.flow.buffer
|
||||||
import kotlinx.coroutines.flow.callbackFlow
|
import kotlinx.coroutines.flow.callbackFlow
|
||||||
import kotlinx.coroutines.flow.catch
|
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.Timeline
|
||||||
import org.matrix.rustcomponents.sdk.TimelineDiff
|
import org.matrix.rustcomponents.sdk.TimelineDiff
|
||||||
import org.matrix.rustcomponents.sdk.TimelineItem
|
import org.matrix.rustcomponents.sdk.TimelineItem
|
||||||
import org.matrix.rustcomponents.sdk.TimelineListener
|
import org.matrix.rustcomponents.sdk.TimelineListener
|
||||||
import timber.log.Timber
|
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>> =
|
internal fun Timeline.timelineDiffFlow(onInitialList: suspend (List<TimelineItem>) -> Unit): Flow<List<TimelineDiff>> =
|
||||||
callbackFlow {
|
callbackFlow {
|
||||||
|
|
@ -58,10 +58,10 @@ internal fun Timeline.timelineDiffFlow(onInitialList: suspend (List<TimelineItem
|
||||||
Timber.d(it, "timelineDiffFlow() failed")
|
Timber.d(it, "timelineDiffFlow() failed")
|
||||||
}.buffer(Channel.UNLIMITED)
|
}.buffer(Channel.UNLIMITED)
|
||||||
|
|
||||||
internal fun Timeline.backPaginationStatusFlow(): Flow<BackPaginationStatus> =
|
internal fun Timeline.backPaginationStatusFlow(): Flow<PaginationStatus> =
|
||||||
mxCallbackFlow {
|
mxCallbackFlow {
|
||||||
val listener = object : BackPaginationStatusListener {
|
val listener = object : PaginationStatusListener {
|
||||||
override fun onUpdate(status: BackPaginationStatus) {
|
override fun onUpdate(status: PaginationStatus) {
|
||||||
trySendBlocking(status)
|
trySendBlocking(status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ import org.matrix.rustcomponents.sdk.Timeline
|
||||||
import org.matrix.rustcomponents.sdk.TimelineDiff
|
import org.matrix.rustcomponents.sdk.TimelineDiff
|
||||||
import org.matrix.rustcomponents.sdk.TimelineItem
|
import org.matrix.rustcomponents.sdk.TimelineItem
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import uniffi.matrix_sdk_ui.BackPaginationStatus
|
|
||||||
import uniffi.matrix_sdk_ui.EventItemOrigin
|
import uniffi.matrix_sdk_ui.EventItemOrigin
|
||||||
|
import uniffi.matrix_sdk_ui.PaginationStatus
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
|
|
||||||
|
|
@ -152,21 +152,21 @@ class RustMatrixTimeline(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
when (paginationStatus) {
|
when (paginationStatus) {
|
||||||
BackPaginationStatus.IDLE -> {
|
PaginationStatus.IDLE -> {
|
||||||
MatrixTimeline.PaginationState(
|
MatrixTimeline.PaginationState(
|
||||||
isBackPaginating = false,
|
isBackPaginating = false,
|
||||||
hasMoreToLoadBackwards = true,
|
hasMoreToLoadBackwards = true,
|
||||||
beginningOfRoomReached = false,
|
beginningOfRoomReached = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
BackPaginationStatus.PAGINATING -> {
|
PaginationStatus.PAGINATING -> {
|
||||||
MatrixTimeline.PaginationState(
|
MatrixTimeline.PaginationState(
|
||||||
isBackPaginating = true,
|
isBackPaginating = true,
|
||||||
hasMoreToLoadBackwards = true,
|
hasMoreToLoadBackwards = true,
|
||||||
beginningOfRoomReached = false,
|
beginningOfRoomReached = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
BackPaginationStatus.TIMELINE_START_REACHED -> {
|
PaginationStatus.TIMELINE_END_REACHED -> {
|
||||||
MatrixTimeline.PaginationState(
|
MatrixTimeline.PaginationState(
|
||||||
isBackPaginating = false,
|
isBackPaginating = false,
|
||||||
hasMoreToLoadBackwards = false,
|
hasMoreToLoadBackwards = false,
|
||||||
|
|
@ -229,7 +229,12 @@ class RustMatrixTimeline(
|
||||||
runCatching {
|
runCatching {
|
||||||
if (!canBackPaginate()) throw TimelineException.CannotPaginate
|
if (!canBackPaginate()) throw TimelineException.CannotPaginate
|
||||||
Timber.v("Start back paginating for room ${matrixRoom.roomId} ")
|
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 ->
|
}.onFailure { error ->
|
||||||
if (error is TimelineException.CannotPaginate) {
|
if (error is TimelineException.CannotPaginate) {
|
||||||
Timber.d("Can't paginate backwards on room ${matrixRoom.roomId}, we're already at the start")
|
Timber.d("Can't paginate backwards on room ${matrixRoom.roomId}, we're already at the start")
|
||||||
|
|
@ -238,7 +243,7 @@ class RustMatrixTimeline(
|
||||||
}
|
}
|
||||||
}.onSuccess {
|
}.onSuccess {
|
||||||
Timber.v("Success back paginating for room ${matrixRoom.roomId}")
|
Timber.v("Success back paginating for room ${matrixRoom.roomId}")
|
||||||
}
|
}.map { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun canBackPaginate(): Boolean {
|
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 io.element.android.services.analytics.test.FakeAnalyticsService
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.matrix.rustcomponents.sdk.UnableToDecryptInfo
|
import org.matrix.rustcomponents.sdk.UnableToDecryptInfo
|
||||||
|
import uniffi.matrix_sdk_crypto.UtdCause
|
||||||
|
|
||||||
class UtdTrackerTest {
|
class UtdTrackerTest {
|
||||||
@Test
|
@Test
|
||||||
fun `when onUtd is called with null timeToDecryptMs, the expected analytics Event is sent`() {
|
fun `when onUtd is called with null timeToDecryptMs, the expected analytics Event is sent`() {
|
||||||
val fakeAnalyticsService = FakeAnalyticsService()
|
val fakeAnalyticsService = FakeAnalyticsService()
|
||||||
val sut = UtdTracker(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(
|
assertThat(fakeAnalyticsService.capturedEvents).containsExactly(
|
||||||
Error(
|
Error(
|
||||||
context = null,
|
context = null,
|
||||||
|
|
@ -47,7 +54,13 @@ class UtdTrackerTest {
|
||||||
fun `when onUtd is called with timeToDecryptMs, the expected analytics Event is sent`() {
|
fun `when onUtd is called with timeToDecryptMs, the expected analytics Event is sent`() {
|
||||||
val fakeAnalyticsService = FakeAnalyticsService()
|
val fakeAnalyticsService = FakeAnalyticsService()
|
||||||
val sut = UtdTracker(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(
|
assertThat(fakeAnalyticsService.capturedEvents).containsExactly(
|
||||||
Error(
|
Error(
|
||||||
context = null,
|
context = null,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue