mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Sending queue : code quality
This commit is contained in:
@@ -41,7 +41,6 @@ class SendingQueue @Inject constructor(
|
|||||||
private val matrixClient: MatrixClient,
|
private val matrixClient: MatrixClient,
|
||||||
private val networkMonitor: NetworkMonitor,
|
private val networkMonitor: NetworkMonitor,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private val retryCount = AtomicInteger(0)
|
private val retryCount = AtomicInteger(0)
|
||||||
|
|
||||||
fun launchIn(coroutineScope: CoroutineScope) {
|
fun launchIn(coroutineScope: CoroutineScope) {
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import kotlinx.coroutines.test.runTest
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class) class SendingQueueTest {
|
@OptIn(ExperimentalCoroutinesApi::class) class SendingQueueTest {
|
||||||
|
|
||||||
private val matrixClient = FakeMatrixClient()
|
private val matrixClient = FakeMatrixClient()
|
||||||
private val networkMonitor = FakeNetworkMonitor()
|
private val networkMonitor = FakeNetworkMonitor()
|
||||||
private val sut = SendingQueue(matrixClient, networkMonitor)
|
private val sut = SendingQueue(matrixClient, networkMonitor)
|
||||||
@@ -77,5 +76,4 @@ import org.junit.Test
|
|||||||
listOf(value(true)),
|
listOf(value(true)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -73,4 +73,3 @@ internal fun TimelineEventTimestampViewPreview(@PreviewParameter(TimelineItemEve
|
|||||||
object TimelineEventTimestampViewDefaults {
|
object TimelineEventTimestampViewDefaults {
|
||||||
val spacing = 16.dp
|
val spacing = 16.dp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -162,5 +162,4 @@ interface Timeline : AutoCloseable {
|
|||||||
waveform: List<Float>,
|
waveform: List<Float>,
|
||||||
progressCallback: ProgressCallback?
|
progressCallback: ProgressCallback?
|
||||||
): Result<MediaUploadHandler>
|
): Result<MediaUploadHandler>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -263,9 +263,8 @@ class RustTimeline(
|
|||||||
|
|
||||||
override suspend fun sendMessage(body: String, htmlBody: String?, mentions: List<Mention>): Result<Unit> = withContext(dispatcher) {
|
override suspend fun sendMessage(body: String, htmlBody: String?, mentions: List<Mention>): Result<Unit> = withContext(dispatcher) {
|
||||||
messageEventContentFromParts(body, htmlBody).withMentions(mentions.map()).use { content ->
|
messageEventContentFromParts(body, htmlBody).withMentions(mentions.map()).use { content ->
|
||||||
runCatching {
|
runCatching<Unit> {
|
||||||
inner.send(content)
|
inner.send(content)
|
||||||
Unit
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -298,7 +297,7 @@ class RustTimeline(
|
|||||||
mentions: List<Mention>,
|
mentions: List<Mention>,
|
||||||
): Result<Unit> =
|
): Result<Unit> =
|
||||||
withContext(dispatcher) {
|
withContext(dispatcher) {
|
||||||
runCatching {
|
runCatching<Unit> {
|
||||||
when {
|
when {
|
||||||
originalEventId != null -> {
|
originalEventId != null -> {
|
||||||
val editedEvent = specialModeEventTimelineItem ?: inner.getEventTimelineItemByEventId(originalEventId.value)
|
val editedEvent = specialModeEventTimelineItem ?: inner.getEventTimelineItemByEventId(originalEventId.value)
|
||||||
@@ -314,7 +313,6 @@ class RustTimeline(
|
|||||||
inner.getEventTimelineItemByTransactionId(transactionId.value).use {
|
inner.getEventTimelineItemByTransactionId(transactionId.value).use {
|
||||||
inner.redactEvent(item = it, reason = null)
|
inner.redactEvent(item = it, reason = null)
|
||||||
}
|
}
|
||||||
Unit
|
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
error("Either originalEventId or transactionId must be non null")
|
error("Either originalEventId or transactionId must be non null")
|
||||||
|
|||||||
Reference in New Issue
Block a user