Remove TODO

This commit is contained in:
Jorge Martín 2022-10-04 13:24:41 +02:00
parent 3c2e2552ec
commit 321fddf5f6
2 changed files with 12 additions and 15 deletions

View File

@ -437,8 +437,6 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
private fun renderVoiceMessageMode(content: String) { private fun renderVoiceMessageMode(content: String) {
ContentAttachmentData.fromJsonString(content)?.let { audioAttachmentData -> ContentAttachmentData.fromJsonString(content)?.let { audioAttachmentData ->
// TODO: review this behaviour
// views.voiceMessageRecorderView.isVisible = true
messageComposerViewModel.handle(MessageComposerAction.InitializeVoiceRecorder(audioAttachmentData)) messageComposerViewModel.handle(MessageComposerAction.InitializeVoiceRecorder(audioAttachmentData))
} }
} }
@ -595,17 +593,6 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
} }
} }
/**
* Returns the root thread event if we are in a thread room, otherwise returns null.
*/
fun getRootThreadEventId(): String? = withState(timelineViewModel) { it.rootThreadEventId }
/**
* Returns true if the current room is a Thread room, false otherwise.
*/
private fun isThreadTimeLine(): Boolean = withState(timelineViewModel) { it.isThreadTimeline() }
// AttachmentsHelper.Callback // AttachmentsHelper.Callback
override fun onContentAttachmentsReady(attachments: List<ContentAttachmentData>) { override fun onContentAttachmentsReady(attachments: List<ContentAttachmentData>) {
val grouped = attachments.toGroupedContentAttachmentData() val grouped = attachments.toGroupedContentAttachmentData()
@ -787,6 +774,16 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
return displayName return displayName
} }
/**
* Returns the root thread event if we are in a thread room, otherwise returns null.
*/
fun getRootThreadEventId(): String? = withState(timelineViewModel) { it.rootThreadEventId }
/**
* Returns true if the current room is a Thread room, false otherwise.
*/
private fun isThreadTimeLine(): Boolean = withState(timelineViewModel) { it.isThreadTimeline() }
/** Set whether the keyboard should disable personalized learning. */ /** Set whether the keyboard should disable personalized learning. */
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
private fun EditText.setUseIncognitoKeyboard(useIncognitoKeyboard: Boolean) { private fun EditText.setUseIncognitoKeyboard(useIncognitoKeyboard: Boolean) {

View File

@ -88,8 +88,9 @@ class VoiceRecorderFragment : VectorBaseFragment<FragmentVoiceRecorderBinding>()
override fun invalidate() = withState(timelineViewModel, messageComposerViewModel) { mainState, messageComposerState -> override fun invalidate() = withState(timelineViewModel, messageComposerViewModel) { mainState, messageComposerState ->
if (mainState.tombstoneEvent != null) return@withState if (mainState.tombstoneEvent != null) return@withState
val hasVoiceDraft = messageComposerState.voiceRecordingUiState is VoiceMessageRecorderView.RecordingUiState.Draft
with(views.root) { with(views.root) {
isVisible = messageComposerState.isVoiceMessageRecorderVisible isVisible = messageComposerState.isVoiceMessageRecorderVisible || hasVoiceDraft
render(messageComposerState.voiceRecordingUiState) render(messageComposerState.voiceRecordingUiState)
} }
} }
@ -188,5 +189,4 @@ class VoiceRecorderFragment : VectorBaseFragment<FragmentVoiceRecorderBinding>()
* Returns the root thread event if we are in a thread room, otherwise returns null. * Returns the root thread event if we are in a thread room, otherwise returns null.
*/ */
fun getRootThreadEventId(): String? = withState(timelineViewModel) { it.rootThreadEventId } fun getRootThreadEventId(): String? = withState(timelineViewModel) { it.rootThreadEventId }
} }