Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Oct 12, 2020
1 parent 301ff39 commit 27b1812
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -55,22 +55,22 @@ 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?,
@Json(name = "order") override val order: Int
) : 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

0 comments on commit 27b1812

Please sign in to comment.