MessageDetail hides the bottom bar when showing a converation that only contains a draft
This is a workaround that we agreed on applying for a time tradeoff. Opening the composer directly with the draft message contained in the conversation had some technical challenges which are documented in MAILAND-2248 MAILAND-2224
This commit is contained in:
parent
072320a69f
commit
02a952fd6e
|
@ -74,6 +74,8 @@ import java.util.ArrayList
|
|||
private const val MESSAGE_CONTENT_FIXED_SIZE_DP = 200F
|
||||
private const val EXPAND_MESSAGE_ANIMATION_DELAY_MS = 200L
|
||||
|
||||
private const val ITEM_NOT_FOUND_INDEX = -1
|
||||
|
||||
internal class MessageDetailsAdapter(
|
||||
private val context: Context,
|
||||
private var messages: List<Message>,
|
||||
|
@ -438,6 +440,10 @@ internal class MessageDetailsAdapter(
|
|||
!it.message.isDraft() && it.itemType == TYPE_HEADER
|
||||
} ?: return
|
||||
|
||||
if (lastNonDraftHeaderIndex == ITEM_NOT_FOUND_INDEX) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!isExpanded(lastNonDraftHeaderIndex)) {
|
||||
toggleExpandedItems(lastNonDraftHeaderIndex, true)
|
||||
}
|
||||
|
|
|
@ -461,13 +461,18 @@ internal class MessageDetailsActivity : BaseStoragePermissionActivity() {
|
|||
private inner class ConversationUiModelObserver : Observer<ConversationUiModel> {
|
||||
|
||||
override fun onChanged(conversation: ConversationUiModel) {
|
||||
val lastNonDraftMessage = conversation.messages.last { it.isDraft().not() }
|
||||
try {
|
||||
val lastNonDraftMessage = conversation.messages.last { it.isDraft().not() }
|
||||
setupLastMessageActionsListener(lastNonDraftMessage)
|
||||
Timber.v("New decrypted message ${lastNonDraftMessage.messageId}")
|
||||
} catch (exception: NoSuchElementException) {
|
||||
Timber.d(exception, "Conversation contains only drafts, disabling the bottom action bar")
|
||||
messageDetailsActionsView.isVisible = false
|
||||
}
|
||||
|
||||
setupToolbarOffsetListener(conversation.messages.count())
|
||||
displayToolbarData(conversation)
|
||||
setupLastMessageActionsListener(lastNonDraftMessage)
|
||||
|
||||
Timber.v("New decrypted message ${lastNonDraftMessage.messageId}")
|
||||
viewModel.renderedFromCache = AtomicBoolean(true)
|
||||
|
||||
Timber.v("setMessage conversations size: ${conversation.messages.size}")
|
||||
|
|
Loading…
Reference in New Issue