mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Improve code clarity
This commit is contained in:
parent
c459c4f90c
commit
2495fa49f3
1 changed files with 12 additions and 10 deletions
|
@ -386,14 +386,14 @@ internal class DefaultTimeline(
|
||||||
|
|
||||||
private fun getState(direction: Timeline.Direction): TimelineState {
|
private fun getState(direction: Timeline.Direction): TimelineState {
|
||||||
return when (direction) {
|
return when (direction) {
|
||||||
Timeline.Direction.FORWARDS -> forwardsState.get()
|
Timeline.Direction.FORWARDS -> forwardsState.get()
|
||||||
Timeline.Direction.BACKWARDS -> backwardsState.get()
|
Timeline.Direction.BACKWARDS -> backwardsState.get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateState(direction: Timeline.Direction, update: (TimelineState) -> TimelineState) {
|
private fun updateState(direction: Timeline.Direction, update: (TimelineState) -> TimelineState) {
|
||||||
val stateReference = when (direction) {
|
val stateReference = when (direction) {
|
||||||
Timeline.Direction.FORWARDS -> forwardsState
|
Timeline.Direction.FORWARDS -> forwardsState
|
||||||
Timeline.Direction.BACKWARDS -> backwardsState
|
Timeline.Direction.BACKWARDS -> backwardsState
|
||||||
}
|
}
|
||||||
val currentValue = stateReference.get()
|
val currentValue = stateReference.get()
|
||||||
|
@ -604,12 +604,14 @@ internal class DefaultTimeline(
|
||||||
return offsetResults.size
|
return offsetResults.size
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildTimelineEvent(eventEntity: TimelineEventEntity) = timelineEventMapper.map(
|
private fun buildTimelineEvent(eventEntity: TimelineEventEntity): TimelineEvent {
|
||||||
timelineEventEntity = eventEntity,
|
return timelineEventMapper.map(
|
||||||
buildReadReceipts = settings.buildReadReceipts
|
timelineEventEntity = eventEntity,
|
||||||
).let {
|
buildReadReceipts = settings.buildReadReceipts
|
||||||
// eventually enhance with ui echo?
|
).let { timelineEvent ->
|
||||||
(uiEchoManager.decorateEventWithReactionUiEcho(it) ?: it)
|
// eventually enhance with ui echo?
|
||||||
|
uiEchoManager.decorateEventWithReactionUiEcho(timelineEvent) ?: timelineEvent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -702,10 +704,10 @@ internal class DefaultTimeline(
|
||||||
return object : MatrixCallback<TokenChunkEventPersistor.Result> {
|
return object : MatrixCallback<TokenChunkEventPersistor.Result> {
|
||||||
override fun onSuccess(data: TokenChunkEventPersistor.Result) {
|
override fun onSuccess(data: TokenChunkEventPersistor.Result) {
|
||||||
when (data) {
|
when (data) {
|
||||||
TokenChunkEventPersistor.Result.SUCCESS -> {
|
TokenChunkEventPersistor.Result.SUCCESS -> {
|
||||||
Timber.v("Success fetching $limit items $direction from pagination request")
|
Timber.v("Success fetching $limit items $direction from pagination request")
|
||||||
}
|
}
|
||||||
TokenChunkEventPersistor.Result.REACHED_END -> {
|
TokenChunkEventPersistor.Result.REACHED_END -> {
|
||||||
postSnapshot()
|
postSnapshot()
|
||||||
}
|
}
|
||||||
TokenChunkEventPersistor.Result.SHOULD_FETCH_MORE ->
|
TokenChunkEventPersistor.Result.SHOULD_FETCH_MORE ->
|
||||||
|
|
Loading…
Reference in a new issue