Message queuing : exposes enableSendingQueue method

This commit is contained in:
ganfra
2024-06-05 16:44:06 +02:00
parent 102cd5769e
commit ba4abe3de7
3 changed files with 24 additions and 0 deletions

View File

@@ -105,4 +105,14 @@ interface MatrixClient : Closeable {
suspend fun getRecentlyVisitedRooms(): Result<List<RoomId>>
suspend fun resolveRoomAlias(roomAlias: RoomAlias): Result<ResolvedRoomAlias>
suspend fun getRoomPreviewFromRoomId(roomId: RoomId, serverNames: List<String>): Result<RoomPreview>
/**
* Enables or disables the sending queue, according to the given parameter.
*
* The sending queue automatically disables itself whenever sending an
* event with it failed (e.g., sending an event via the Timeline,
* so it's required to manually re-enable it as soon as
* connectivity is back on the device.
*/
suspend fun enableSendingQueue(enable: Boolean)
}

View File

@@ -551,6 +551,10 @@ class RustMatrixClient(
}.distinctUntilChanged()
}
override suspend fun enableSendingQueue(enable: Boolean) = withContext(sessionDispatcher){
client.enableSendingQueue(enable)
}
private suspend fun File.getCacheSize(
includeCryptoDb: Boolean = false,
): Long = withContext(sessionDispatcher) {
@@ -590,6 +594,9 @@ class RustMatrixClient(
true
}
}
}
private val defaultRoomCreationPowerLevels = PowerLevels(

View File

@@ -48,6 +48,7 @@ import io.element.android.libraries.matrix.test.roomdirectory.FakeRoomDirectoryS
import io.element.android.libraries.matrix.test.roomlist.FakeRoomListService
import io.element.android.libraries.matrix.test.sync.FakeSyncService
import io.element.android.libraries.matrix.test.verification.FakeSessionVerificationService
import io.element.android.tests.testutils.lambda.lambdaRecorder
import io.element.android.tests.testutils.simulateLongTask
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
@@ -298,4 +299,10 @@ class FakeMatrixClient(
}
override fun getRoomInfoFlow(roomId: RoomId) = getRoomInfoFlowLambda(roomId)
var enableSendingQueueLambda = lambdaRecorder(ensureNeverCalled = true) { enable: Boolean ->
// no-op
}
override suspend fun enableSendingQueue(enable: Boolean) = enableSendingQueueLambda(enable)
}