From b1da8c24ab69e1b657f5f5ac038888cee622b113 Mon Sep 17 00:00:00 2001 From: Serdar Ozturk Date: Fri, 8 May 2026 14:00:32 +0100 Subject: [PATCH] Disable body height restriction in EntireMessageBody flow - Prevent full-message screen from inheriting preview height caps, which blocks scrolling in EntireMessageBodyScreen - pass forceDisableHeightRestriction=true when mapping body UI model in EntireMessageBodyViewModel - keep preview restriction behavior unchanged for conversation detail flow ET-6187 --- .../mapper/MessageBodyUiModelMapper.kt | 7 +++++-- .../viewmodel/EntireMessageBodyViewModel.kt | 7 ++++++- .../EntireMessageBodyViewModelTest.kt | 21 ++++++++++++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/mail-detail/presentation/src/main/kotlin/ch/protonmail/android/maildetail/presentation/mapper/MessageBodyUiModelMapper.kt b/mail-detail/presentation/src/main/kotlin/ch/protonmail/android/maildetail/presentation/mapper/MessageBodyUiModelMapper.kt index 634bbbaa4b..4a9061f438 100644 --- a/mail-detail/presentation/src/main/kotlin/ch/protonmail/android/maildetail/presentation/mapper/MessageBodyUiModelMapper.kt +++ b/mail-detail/presentation/src/main/kotlin/ch/protonmail/android/maildetail/presentation/mapper/MessageBodyUiModelMapper.kt @@ -45,10 +45,13 @@ class MessageBodyUiModelMapper @Inject constructor( suspend fun toUiModel( decryptedMessageBody: DecryptedMessageBody, attachmentListExpandCollapseMode: AttachmentListExpandCollapseMode?, - existingMessageBodyUiModel: MessageBodyUiModel? = null + existingMessageBodyUiModel: MessageBodyUiModel? = null, + forceDisableHeightRestriction: Boolean = false ): MessageBodyUiModel { val shouldRestrictWebViewHeight = - hasMessageBodyWebViewCrashed() && restrictMessageWebViewHeightEnabled.get() + !forceDisableHeightRestriction && + hasMessageBodyWebViewCrashed() && + restrictMessageWebViewHeightEnabled.get() val decryptedMessageBodyWithType = MessageBodyWithType( decryptedMessageBody.value, diff --git a/mail-detail/presentation/src/main/kotlin/ch/protonmail/android/maildetail/presentation/viewmodel/EntireMessageBodyViewModel.kt b/mail-detail/presentation/src/main/kotlin/ch/protonmail/android/maildetail/presentation/viewmodel/EntireMessageBodyViewModel.kt index 8e307859b6..8fe6a2f819 100644 --- a/mail-detail/presentation/src/main/kotlin/ch/protonmail/android/maildetail/presentation/viewmodel/EntireMessageBodyViewModel.kt +++ b/mail-detail/presentation/src/main/kotlin/ch/protonmail/android/maildetail/presentation/viewmodel/EntireMessageBodyViewModel.kt @@ -167,7 +167,12 @@ class EntireMessageBodyViewModel @Inject constructor( ifRight = { mutableState.value = mutableState.value.copy( messageBodyState = MessageBodyState.Data( - messageBodyUiModel = messageBodyUiModelMapper.toUiModel(it, null) + messageBodyUiModel = messageBodyUiModelMapper.toUiModel( + decryptedMessageBody = it, + attachmentListExpandCollapseMode = null, + existingMessageBodyUiModel = null, + forceDisableHeightRestriction = true + ) ), requestPhishingLinkConfirmation = it.banners.contains(MessageBanner.PhishingAttempt) ) diff --git a/mail-detail/presentation/src/test/kotlin/ch/protonmail/android/maildetail/presentation/viewmodel/EntireMessageBodyViewModelTest.kt b/mail-detail/presentation/src/test/kotlin/ch/protonmail/android/maildetail/presentation/viewmodel/EntireMessageBodyViewModelTest.kt index 3f0fb07c06..955dac7e90 100644 --- a/mail-detail/presentation/src/test/kotlin/ch/protonmail/android/maildetail/presentation/viewmodel/EntireMessageBodyViewModelTest.kt +++ b/mail-detail/presentation/src/test/kotlin/ch/protonmail/android/maildetail/presentation/viewmodel/EntireMessageBodyViewModelTest.kt @@ -128,7 +128,12 @@ class EntireMessageBodyViewModelTest { getMessageBodyWithClickableLinks(UserIdTestData.userId, MessageId(MESSAGE_ID), any()) } returns decryptedMessageBody.right() coEvery { - messageBodyUiModelMapper.toUiModel(decryptedMessageBody, null) + messageBodyUiModelMapper.toUiModel( + decryptedMessageBody = decryptedMessageBody, + attachmentListExpandCollapseMode = null, + existingMessageBodyUiModel = null, + forceDisableHeightRestriction = true + ) } returns messageBodyUiModel // When @@ -224,7 +229,12 @@ class EntireMessageBodyViewModelTest { getMessageBodyWithClickableLinks(UserIdTestData.userId, MessageId(MESSAGE_ID), any()) } returns decryptedMessageBody.right() coEvery { - messageBodyUiModelMapper.toUiModel(decryptedMessageBody, null) + messageBodyUiModelMapper.toUiModel( + decryptedMessageBody = decryptedMessageBody, + attachmentListExpandCollapseMode = null, + existingMessageBodyUiModel = null, + forceDisableHeightRestriction = true + ) } returns messageBodyUiModel // When @@ -247,7 +257,12 @@ class EntireMessageBodyViewModelTest { getMessageBodyWithClickableLinks(UserIdTestData.userId, MessageId(MESSAGE_ID), any()) } returns decryptedMessageBody.right() coEvery { - messageBodyUiModelMapper.toUiModel(decryptedMessageBody, null) + messageBodyUiModelMapper.toUiModel( + decryptedMessageBody = decryptedMessageBody, + attachmentListExpandCollapseMode = null, + existingMessageBodyUiModel = null, + forceDisableHeightRestriction = true + ) } returns messageBodyUiModel // When