From 321fddf5f66f55a3fa794fd1811fbaf4898d4233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Tue, 4 Oct 2022 13:24:41 +0200 Subject: [PATCH] Remove TODO --- .../composer/MessageComposerFragment.kt | 23 ++++++++----------- .../composer/voice/VoiceRecorderFragment.kt | 4 ++-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt index 8ec5f0d313..369f8c2d74 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt @@ -437,8 +437,6 @@ class MessageComposerFragment : VectorBaseFragment(), A private fun renderVoiceMessageMode(content: String) { ContentAttachmentData.fromJsonString(content)?.let { audioAttachmentData -> - // TODO: review this behaviour -// views.voiceMessageRecorderView.isVisible = true messageComposerViewModel.handle(MessageComposerAction.InitializeVoiceRecorder(audioAttachmentData)) } } @@ -595,17 +593,6 @@ class MessageComposerFragment : VectorBaseFragment(), 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 override fun onContentAttachmentsReady(attachments: List) { val grouped = attachments.toGroupedContentAttachmentData() @@ -787,6 +774,16 @@ class MessageComposerFragment : VectorBaseFragment(), A 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. */ @RequiresApi(Build.VERSION_CODES.O) private fun EditText.setUseIncognitoKeyboard(useIncognitoKeyboard: Boolean) { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/voice/VoiceRecorderFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/voice/VoiceRecorderFragment.kt index c2c2af675c..c5bb204ddb 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/voice/VoiceRecorderFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/voice/VoiceRecorderFragment.kt @@ -88,8 +88,9 @@ class VoiceRecorderFragment : VectorBaseFragment() override fun invalidate() = withState(timelineViewModel, messageComposerViewModel) { mainState, messageComposerState -> if (mainState.tombstoneEvent != null) return@withState + val hasVoiceDraft = messageComposerState.voiceRecordingUiState is VoiceMessageRecorderView.RecordingUiState.Draft with(views.root) { - isVisible = messageComposerState.isVoiceMessageRecorderVisible + isVisible = messageComposerState.isVoiceMessageRecorderVisible || hasVoiceDraft render(messageComposerState.voiceRecordingUiState) } } @@ -188,5 +189,4 @@ class VoiceRecorderFragment : VectorBaseFragment() * Returns the root thread event if we are in a thread room, otherwise returns null. */ fun getRootThreadEventId(): String? = withState(timelineViewModel) { it.rootThreadEventId } - }