mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-22 23:58:47 +01:00
Fix code quality issues
This commit is contained in:
parent
9ef4e1e83f
commit
0e30f4e817
@ -342,13 +342,17 @@ internal class DefaultTimeline(
|
||||
updateState(Timeline.Direction.FORWARDS) { state ->
|
||||
state.copy(
|
||||
hasMoreInCache = !builtEventsIdMap.containsKey(firstCacheEvent?.eventId), // what is in DB
|
||||
hasReachedEnd = if (isFromThreadTimeline) true else chunkEntity?.isLastForward ?: false // if you neeed fetch more
|
||||
hasReachedEnd = if (isFromThreadTimeline) true else chunkEntity?.isLastForward ?: false // if you need fetch more
|
||||
)
|
||||
}
|
||||
updateState(Timeline.Direction.BACKWARDS) { state ->
|
||||
state.copy(
|
||||
hasMoreInCache = !builtEventsIdMap.containsKey(lastCacheEvent?.eventId),
|
||||
hasReachedEnd = if (isFromThreadTimeline && results.map { it.eventId }.contains(rootThreadEventId)) true else (chunkEntity?.isLastBackward ?: false || lastCacheEvent?.root?.type == EventType.STATE_ROOM_CREATE)
|
||||
hasReachedEnd = if (isFromThreadTimeline && results.map { it.eventId }.contains(rootThreadEventId)) {
|
||||
true
|
||||
} else {
|
||||
(chunkEntity?.isLastBackward ?: false || lastCacheEvent?.root?.type == EventType.STATE_ROOM_CREATE)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -734,27 +734,32 @@ class TimelineFragment @Inject constructor(
|
||||
}
|
||||
|
||||
override fun onSendVoiceMessage() {
|
||||
messageComposerViewModel.handle(MessageComposerAction.EndRecordingVoiceMessage(isCancelled = false, rootThreadEventId = getRootThreadEventId()))
|
||||
messageComposerViewModel.handle(
|
||||
MessageComposerAction.EndRecordingVoiceMessage(isCancelled = false, rootThreadEventId = getRootThreadEventId()))
|
||||
updateRecordingUiState(RecordingUiState.Idle)
|
||||
}
|
||||
|
||||
override fun onDeleteVoiceMessage() {
|
||||
messageComposerViewModel.handle(MessageComposerAction.EndRecordingVoiceMessage(isCancelled = true, rootThreadEventId = getRootThreadEventId()))
|
||||
messageComposerViewModel.handle(
|
||||
MessageComposerAction.EndRecordingVoiceMessage(isCancelled = true, rootThreadEventId = getRootThreadEventId()))
|
||||
updateRecordingUiState(RecordingUiState.Idle)
|
||||
}
|
||||
|
||||
override fun onRecordingLimitReached() {
|
||||
messageComposerViewModel.handle(MessageComposerAction.PauseRecordingVoiceMessage)
|
||||
messageComposerViewModel.handle(
|
||||
MessageComposerAction.PauseRecordingVoiceMessage)
|
||||
updateRecordingUiState(RecordingUiState.Draft)
|
||||
}
|
||||
|
||||
override fun onRecordingWaveformClicked() {
|
||||
messageComposerViewModel.handle(MessageComposerAction.PauseRecordingVoiceMessage)
|
||||
messageComposerViewModel.handle(
|
||||
MessageComposerAction.PauseRecordingVoiceMessage)
|
||||
updateRecordingUiState(RecordingUiState.Draft)
|
||||
}
|
||||
|
||||
private fun updateRecordingUiState(state: RecordingUiState) {
|
||||
messageComposerViewModel.handle(MessageComposerAction.OnVoiceRecordingUiStateChanged(state))
|
||||
messageComposerViewModel.handle(
|
||||
MessageComposerAction.OnVoiceRecordingUiStateChanged(state))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,13 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
||||
eventIdToHighlight: String?,
|
||||
requestModelBuild: () -> Unit,
|
||||
callback: TimelineEventController.Callback?): MergedMembershipEventsItem_? {
|
||||
val mergedEvents = timelineEventVisibilityHelper.prevSameTypeEvents(items, currentPosition, 2, eventIdToHighlight, partialState.rootThreadEventId, partialState.isFromThreadTimeline())
|
||||
val mergedEvents = timelineEventVisibilityHelper.prevSameTypeEvents(
|
||||
items,
|
||||
currentPosition,
|
||||
2,
|
||||
eventIdToHighlight,
|
||||
partialState.rootThreadEventId,
|
||||
partialState.isFromThreadTimeline())
|
||||
return if (mergedEvents.isEmpty()) {
|
||||
null
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user