diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt index 5e9efecc67..a2398bd750 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt @@ -74,18 +74,17 @@ internal class DefaultTimeline internal constructor(private val roomId: String, private val sequencer = SemaphoreCoroutineSequencer() private val strategyDependencies = LoadTimelineStrategy.Dependencies( - timelineScope = timelineScope, - eventDecryptor = eventDecryptor, timelineSettings = settings, + realm = backgroundRealm, + eventDecryptor = eventDecryptor, paginationTask = paginationTask, fetchTokenAndPaginateTask = fetchTokenAndPaginateTask, + getContextOfEventTask = getEventTask, timelineInput = timelineInput, timelineEventMapper = timelineEventMapper, - realm = backgroundRealm, - getContextOfEventTask = getEventTask, threadsAwarenessHandler = threadsAwarenessHandler, - onLimitedTimeline = this::onLimitedTimeline, onEventsUpdated = this::postSnapshot, + onLimitedTimeline = this::onLimitedTimeline, onNewTimelineEvents = this::onNewTimelineEvents ) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LoadTimelineStrategy.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LoadTimelineStrategy.kt index fb0971ad47..d51c2c28cb 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LoadTimelineStrategy.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LoadTimelineStrategy.kt @@ -21,8 +21,6 @@ import io.realm.OrderedRealmCollectionChangeListener import io.realm.Realm import io.realm.RealmResults import kotlinx.coroutines.CompletableDeferred -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.session.room.send.SendState import org.matrix.android.sdk.api.session.room.timeline.Timeline @@ -65,7 +63,6 @@ internal class LoadTimelineStrategy( data class Dependencies( val timelineSettings: TimelineSettings, - val timelineScope: CoroutineScope, val realm: AtomicReference, val eventDecryptor: TimelineEventDecryptor, val paginationTask: PaginationTask, @@ -228,8 +225,7 @@ internal class LoadTimelineStrategy( uiEchoManager = uiEchoManager, threadsAwarenessHandler = dependencies.threadsAwarenessHandler, initialEventId = mode.originEventId(), - onBuiltEvents = dependencies.onEventsUpdated, - timelineScope = dependencies.timelineScope + onBuiltEvents = dependencies.onEventsUpdated ) } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt index 78bc02f9c7..9686e49987 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt @@ -23,7 +23,6 @@ import io.realm.RealmQuery import io.realm.RealmResults import io.realm.Sort import kotlinx.coroutines.CompletableDeferred -import kotlinx.coroutines.CoroutineScope import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.extensions.tryOrNull import org.matrix.android.sdk.api.session.events.model.EventType @@ -46,19 +45,18 @@ import java.util.concurrent.atomic.AtomicBoolean * It does mainly listen to the db timeline events. * It also triggers pagination to the server when needed, or dispatch to the prev or next chunk if any. */ -internal class TimelineChunk constructor(private val chunkEntity: ChunkEntity, - private val timelineScope: CoroutineScope, - private val timelineSettings: TimelineSettings, - private val roomId: String, - private val timelineId: String, - private val eventDecryptor: TimelineEventDecryptor, - private val paginationTask: PaginationTask, - private val fetchTokenAndPaginateTask: FetchTokenAndPaginateTask, - private val timelineEventMapper: TimelineEventMapper, - private val uiEchoManager: UIEchoManager? = null, - private val threadsAwarenessHandler: ThreadsAwarenessHandler, - private val initialEventId: String?, - private val onBuiltEvents: () -> Unit) { +internal class TimelineChunk(private val chunkEntity: ChunkEntity, + private val timelineSettings: TimelineSettings, + private val roomId: String, + private val timelineId: String, + private val eventDecryptor: TimelineEventDecryptor, + private val paginationTask: PaginationTask, + private val fetchTokenAndPaginateTask: FetchTokenAndPaginateTask, + private val timelineEventMapper: TimelineEventMapper, + private val uiEchoManager: UIEchoManager? = null, + private val threadsAwarenessHandler: ThreadsAwarenessHandler, + private val initialEventId: String?, + private val onBuiltEvents: () -> Unit) { private val isLastForward = AtomicBoolean(chunkEntity.isLastForward) private val isLastBackward = AtomicBoolean(chunkEntity.isLastBackward) @@ -442,11 +440,10 @@ internal class TimelineChunk constructor(private val chunkEntity: ChunkEntity, if (chunkEntity == null) return null return TimelineChunk( chunkEntity = chunkEntity, - timelineScope = timelineScope, timelineSettings = timelineSettings, + roomId = roomId, timelineId = timelineId, eventDecryptor = eventDecryptor, - roomId = roomId, paginationTask = paginationTask, fetchTokenAndPaginateTask = fetchTokenAndPaginateTask, timelineEventMapper = timelineEventMapper,