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