mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 11:26:01 +03:00
Timeline: some clean up
This commit is contained in:
parent
bf1be4f20d
commit
b53433e61b
3 changed files with 18 additions and 26 deletions
|
@ -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
|
||||
)
|
||||
|
||||
|
|
|
@ -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<Realm>,
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue