Timeline: remove useless methods

This commit is contained in:
ganfra 2021-11-03 11:44:20 +01:00
parent d42a2e69ae
commit ce5ccd4dab
3 changed files with 1 additions and 56 deletions

View file

@ -70,31 +70,11 @@ interface Timeline {
*/
fun paginate(direction: Direction, count: Int)
/**
* Returns the number of sending events
*/
fun pendingEventCount(): Int
/**
* Returns the number of failed sending events.
*/
fun failedToDeliverEventCount(): Int
/**
* Returns the index of a built event or null.
*/
fun getIndexOfEvent(eventId: String?): Int?
/**
* Returns the built [TimelineEvent] at index or null
*/
fun getTimelineEventAtIndex(index: Int): TimelineEvent?
/**
* Returns the built [TimelineEvent] with eventId or null
*/
fun getTimelineEventWithId(eventId: String?): TimelineEvent?
fun getPaginationState(direction: Direction): PaginationState
interface Listener {

View file

@ -54,7 +54,7 @@ internal class DefaultTimeline internal constructor(private val roomId: String,
eventDecryptor: TimelineEventDecryptor) : Timeline {
companion object {
val BACKGROUND_HANDLER = createBackgroundHandler("SimpleTimeline_Thread")
val BACKGROUND_HANDLER = createBackgroundHandler("DefaultTimeline_Thread")
}
override val timelineID = UUID.randomUUID().toString()
@ -144,28 +144,11 @@ internal class DefaultTimeline internal constructor(private val roomId: String,
}
}
override fun pendingEventCount(): Int {
return 0
}
override fun failedToDeliverEventCount(): Int {
return 0
}
override fun getIndexOfEvent(eventId: String?): Int? {
if (eventId == null) return null
return strategy.getBuiltEventIndex(eventId)
}
override fun getTimelineEventAtIndex(index: Int): TimelineEvent? {
return null
}
override fun getTimelineEventWithId(eventId: String?): TimelineEvent? {
if (eventId == null) return null
return strategy.getBuiltEvent(eventId)
}
override fun getPaginationState(direction: Timeline.Direction): Timeline.PaginationState {
return if (direction == Timeline.Direction.BACKWARDS) {
backwardState

View file

@ -133,28 +133,10 @@ class MergedTimelines(
secondaryTimeline.paginate(direction, count)
}
override fun pendingEventCount(): Int {
return mainTimeline.pendingEventCount() + secondaryTimeline.pendingEventCount()
}
override fun failedToDeliverEventCount(): Int {
return mainTimeline.pendingEventCount() + secondaryTimeline.pendingEventCount()
}
override fun getTimelineEventAtIndex(index: Int): TimelineEvent? {
return mergedEvents.getOrNull(index)
}
override fun getIndexOfEvent(eventId: String?): Int? {
return positionsMapping[eventId]
}
override fun getTimelineEventWithId(eventId: String?): TimelineEvent? {
return positionsMapping[eventId]?.let {
getTimelineEventAtIndex(it)
}
}
private fun processTimelineUpdates(isInit: KMutableProperty0<Boolean>, eventsRef: MutableList<TimelineEvent>, newData: List<TimelineEvent>) {
coroutineScope.launch(Dispatchers.Default) {
processingSemaphore.withPermit {