code review

This commit is contained in:
Valere 2021-12-17 16:43:52 +01:00
parent aa89e721aa
commit de08afdfad
5 changed files with 15 additions and 17 deletions

View file

@ -22,12 +22,11 @@ import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.internal.crypto.actions.MessageEncrypter
import org.matrix.android.sdk.internal.crypto.model.MXUsersDevicesMap
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
import org.matrix.android.sdk.internal.crypto.tasks.DefaultSendToDeviceTask
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
import javax.inject.Inject
internal class DefaultToDeviceService @Inject constructor(
private val sendToDeviceTask: DefaultSendToDeviceTask,
private val sendToDeviceTask: SendToDeviceTask,
private val messageEncrypter: MessageEncrypter,
private val cryptoStore: IMXCryptoStore
) : ToDeviceService {

View file

@ -376,6 +376,12 @@ internal abstract class SessionModule {
@Binds
abstract fun bindOpenIdTokenService(service: DefaultOpenIdService): OpenIdService
@Binds
abstract fun bindToDeviceService(service: DefaultToDeviceService): ToDeviceService
@Binds
abstract fun bindEventStreamService(service: DefaultEventStreamService): EventStreamService
@Binds
abstract fun bindTypingUsersTracker(tracker: DefaultTypingUsersTracker): TypingUsersTracker
@ -384,10 +390,4 @@ internal abstract class SessionModule {
@Binds
abstract fun bindEventSenderProcessor(processor: EventSenderProcessorCoroutine): EventSenderProcessor
@Binds
abstract fun bindToDeviceService(deviceService: DefaultToDeviceService): ToDeviceService
@Binds
abstract fun bindEventStreamService(deviceService: DefaultEventStreamService): EventStreamService
}

View file

@ -35,17 +35,15 @@ internal class StreamEventsManager @Inject constructor() {
private val listeners = mutableListOf<LiveEventListener>()
fun addLiveEventListener(listener: LiveEventListener) {
Timber.v("## VALR: addLiveEventListener")
listeners.add(listener)
}
fun removeLiveEventListener(listener: LiveEventListener) {
Timber.v("## VALR: removeLiveEventListener")
listeners.remove(listener)
}
fun dispatchLiveEventReceived(event: Event, roomId: String, initialSync: Boolean) {
Timber.v("## VALR: dispatchLiveEventReceived ${event.eventId}")
Timber.v("## dispatchLiveEventReceived ${event.eventId}")
coroutineScope.launch {
if (!initialSync) {
listeners.forEach {
@ -58,7 +56,7 @@ internal class StreamEventsManager @Inject constructor() {
}
fun dispatchPaginatedEventReceived(event: Event, roomId: String) {
Timber.v("## VALR: dispatchPaginatedEventReceived ${event.eventId}")
Timber.v("## dispatchPaginatedEventReceived ${event.eventId}")
coroutineScope.launch {
listeners.forEach {
tryOrNull {
@ -69,7 +67,7 @@ internal class StreamEventsManager @Inject constructor() {
}
fun dispatchLiveEventDecrypted(event: Event, result: MXEventDecryptionResult) {
Timber.v("## VALR: dispatchLiveEventDecrypted ${event.eventId}")
Timber.v("## dispatchLiveEventDecrypted ${event.eventId}")
coroutineScope.launch {
listeners.forEach {
tryOrNull {
@ -80,7 +78,7 @@ internal class StreamEventsManager @Inject constructor() {
}
fun dispatchLiveEventDecryptionFailed(event: Event, error: Throwable) {
Timber.v("## VALR: dispatchLiveEventDecryptionFailed ${event.eventId}")
Timber.v("## dispatchLiveEventDecryptionFailed ${event.eventId}")
coroutineScope.launch {
listeners.forEach {
tryOrNull {
@ -91,7 +89,7 @@ internal class StreamEventsManager @Inject constructor() {
}
fun dispatchOnLiveToDevice(event: Event) {
Timber.v("## VALR: dispatchOnLiveToDevice ${event.eventId}")
Timber.v("## dispatchOnLiveToDevice ${event.eventId}")
coroutineScope.launch {
listeners.forEach {
tryOrNull {

View file

@ -23,6 +23,7 @@ import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.api.session.events.model.toModel
import org.matrix.android.sdk.api.session.room.model.RoomMemberContent
import org.matrix.android.sdk.api.session.room.send.SendState
import org.matrix.android.sdk.internal.database.helper.addIfNecessary
import org.matrix.android.sdk.internal.database.helper.addStateEvent
import org.matrix.android.sdk.internal.database.helper.addTimelineEvent
import org.matrix.android.sdk.internal.database.mapper.toEntity
@ -36,6 +37,7 @@ import org.matrix.android.sdk.internal.database.query.find
import org.matrix.android.sdk.internal.database.query.where
import org.matrix.android.sdk.internal.di.SessionDatabase
import org.matrix.android.sdk.internal.session.StreamEventsManager
import org.matrix.android.sdk.internal.util.awaitTransaction
import timber.log.Timber
import javax.inject.Inject

View file

@ -170,7 +170,6 @@ class AutoRageShaker @Inject constructor(
}
override fun onUploadSucceed(reportUrl: String?) {
Timber.w("## VALR Report URL is $reportUrl")
// we need to send the toDevice message to the sender
coroutineScope.launch {
@ -190,7 +189,7 @@ class AutoRageShaker @Inject constructor(
).toContent()
)
} catch (failure: Throwable) {
Timber.w("## VALR : failed to send auto-uisi to device")
Timber.w("failed to send auto-uisi to device")
}
}
}