Code review

This commit is contained in:
Valere 2020-10-12 12:25:59 +02:00 committed by Benoit Marty
parent d319a353d4
commit dc8a6cc745
4 changed files with 8 additions and 10 deletions

View file

@ -90,8 +90,6 @@ internal class DefaultSendService @AssistedInject constructor(
.let { sendEvent(it) }
}
// For test only
override fun sendFormattedTextMessage(text: String, formattedText: String, msgType: String): Cancelable {
return localEchoEventFactory.createFormattedTextEvent(roomId, TextContent(text, formattedText), msgType)
.also { createLocalEcho(it) }

View file

@ -46,7 +46,7 @@ import kotlin.concurrent.schedule
* Each send is retried 3 times, if there is no network (e.g if cannot ping home server) it will wait and
* periodically test reachability before resume (does not count as a retry)
*
* If the app is killed before all event were sent, on next wakeup the sheduled events will be re posted
* If the app is killed before all event were sent, on next wakeup the scheduled events will be re posted
*/
@SessionScope
internal class EventSenderProcessor @Inject constructor(

View file

@ -17,11 +17,11 @@
package org.matrix.android.sdk.internal.session.room.send.queue
import android.content.Context
import org.matrix.android.sdk.api.auth.data.SessionParams
import org.matrix.android.sdk.api.auth.data.sessionId
import org.matrix.android.sdk.api.extensions.tryOrNull
import org.matrix.android.sdk.api.session.crypto.CryptoService
import org.matrix.android.sdk.api.session.room.send.SendState
import org.matrix.android.sdk.internal.di.SessionId
import org.matrix.android.sdk.internal.session.room.send.LocalEchoRepository
import timber.log.Timber
import javax.inject.Inject
@ -34,12 +34,12 @@ import javax.inject.Inject
* reschedule them (and only them) on next restart
*/
internal class QueueMemento @Inject constructor(context: Context,
sessionParams: SessionParams,
@SessionId sessionId: String,
private val queuedTaskFactory: QueuedTaskFactory,
private val localEchoRepository: LocalEchoRepository,
private val cryptoService: CryptoService) {
private val storage = context.getSharedPreferences("QueueMemento_${sessionParams.credentials.sessionId()}", Context.MODE_PRIVATE)
private val storage = context.getSharedPreferences("QueueMemento_$sessionId", Context.MODE_PRIVATE)
private val managedTaskInfos = mutableListOf<QueuedTask>()
fun track(task: QueuedTask) {

View file

@ -27,7 +27,7 @@ import org.matrix.android.sdk.internal.network.parsing.RuntimeJsonAdapterFactory
* Info that need to be persisted by the sender thread
* With polymorphic moshi parsing
*/
interface TaskInfo {
internal interface TaskInfo {
val type: String
val order: Int
@ -55,7 +55,7 @@ interface TaskInfo {
}
@JsonClass(generateAdapter = true)
data class SendEventTaskInfo(
internal data class SendEventTaskInfo(
@Json(name = "type") override val type: String = TaskInfo.TYPE_SEND,
@Json(name = "localEchoId") val localEchoId: String,
@Json(name = "encrypt") val encrypt: Boolean?,
@ -63,14 +63,14 @@ data class SendEventTaskInfo(
) : TaskInfo
@JsonClass(generateAdapter = true)
data class RedactEventTaskInfo(
internal data class RedactEventTaskInfo(
@Json(name = "type") override val type: String = TaskInfo.TYPE_REDACT,
@Json(name = "redactionLocalEcho") val redactionLocalEcho: String?,
@Json(name = "order") override val order: Int
) : TaskInfo
@JsonClass(generateAdapter = true)
data class FallbackTaskInfo(
internal data class FallbackTaskInfo(
@Json(name = "type") override val type: String = TaskInfo.TYPE_REDACT,
@Json(name = "order") override val order: Int
) : TaskInfo