TF-3601 Fix email view gone blank with large html content in iOS
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -190,6 +190,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
final attachmentsViewState = RxMap<Id, Either<Failure, Success>>();
|
||||
final isEmailContentHidden = RxBool(false);
|
||||
final currentEmailLoaded = Rxn<EmailLoaded>();
|
||||
final isEmailContentClipped = RxBool(false);
|
||||
|
||||
EmailId? _currentEmailId;
|
||||
Identity? _identitySelected;
|
||||
@@ -750,6 +751,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
blobCalendarEvent.value = null;
|
||||
emailUnsubscribe.value = null;
|
||||
_identitySelected = null;
|
||||
isEmailContentClipped.value = false;
|
||||
if (isEmailClosing) {
|
||||
emailLoadedViewState.value = Right(UIState.idle);
|
||||
viewState.value = Right(UIState.idle);
|
||||
@@ -2520,4 +2522,9 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
void onHtmlContentClippedAction(bool isClipped) {
|
||||
log('SingleEmailController::onHtmlContentClippedAction:isClipped = $isClipped');
|
||||
isEmailContentClipped.value = isClipped;
|
||||
}
|
||||
}
|
||||
@@ -390,7 +390,7 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
else if (presentationEmail.id == controller.currentEmail?.id)
|
||||
Obx(() {
|
||||
if (controller.emailContents.value != null) {
|
||||
final allEmailContents = controller.emailContents.value ?? '';
|
||||
String allEmailContents = controller.emailContents.value ?? '';
|
||||
|
||||
if (PlatformInfo.isWeb) {
|
||||
return Expanded(
|
||||
@@ -429,29 +429,68 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
}),
|
||||
),
|
||||
);
|
||||
} else if (PlatformInfo.isIOS
|
||||
&& !controller.responsiveUtils.isScreenWithShortestSide(context)) {
|
||||
} else if (PlatformInfo.isIOS) {
|
||||
return Obx(() {
|
||||
if (controller.isEmailContentHidden.isTrue) {
|
||||
if (controller.isEmailContentHidden.isTrue && !controller.responsiveUtils.isScreenWithShortestSide(context)) {
|
||||
return const SizedBox.shrink();
|
||||
} else {
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.symmetric(
|
||||
vertical: EmailViewStyles.mobileContentVerticalMargin,
|
||||
horizontal: EmailViewStyles.mobileContentHorizontalMargin
|
||||
),
|
||||
child: LayoutBuilder(builder: (context, constraints) {
|
||||
return HtmlContentViewer(
|
||||
contentHtml: allEmailContents,
|
||||
initialWidth: constraints.maxWidth,
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
contentPadding: 0,
|
||||
useDefaultFont: true,
|
||||
onMailtoDelegateAction: controller.openMailToLink,
|
||||
onScrollHorizontalEnd: controller.toggleScrollPhysicsPagerView,
|
||||
onLoadWidthHtmlViewer: controller.emailSupervisorController.updateScrollPhysicPageView,
|
||||
);
|
||||
})
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.symmetric(
|
||||
vertical: EmailViewStyles.mobileContentVerticalMargin,
|
||||
horizontal: EmailViewStyles.mobileContentHorizontalMargin,
|
||||
),
|
||||
child: LayoutBuilder(builder: (context, constraints) {
|
||||
return HtmlContentViewer(
|
||||
contentHtml: allEmailContents,
|
||||
initialWidth: constraints.maxWidth,
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
contentPadding: 0,
|
||||
useDefaultFont: true,
|
||||
onMailtoDelegateAction: controller.openMailToLink,
|
||||
onScrollHorizontalEnd: controller.toggleScrollPhysicsPagerView,
|
||||
onLoadWidthHtmlViewer: controller.emailSupervisorController.updateScrollPhysicPageView,
|
||||
onHtmlContentClippedAction: controller.onHtmlContentClippedAction,
|
||||
);
|
||||
}),
|
||||
),
|
||||
Obx(() {
|
||||
if (controller.isEmailContentClipped.isTrue) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).messageClipped,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: AppColor.steelGray400,
|
||||
),
|
||||
),
|
||||
),
|
||||
TMailButtonWidget.fromText(
|
||||
text: AppLocalizations.of(context).viewEntireMessage.toUpperCase(),
|
||||
textStyle: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: AppColor.primaryColor,
|
||||
fontSize: 14,
|
||||
),
|
||||
margin: const EdgeInsetsDirectional.only(
|
||||
start: 8,
|
||||
end: 8,
|
||||
bottom: 24,
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
onTapActionCallback: () {},
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -471,6 +510,7 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
onMailtoDelegateAction: controller.openMailToLink,
|
||||
onScrollHorizontalEnd: controller.toggleScrollPhysicsPagerView,
|
||||
onLoadWidthHtmlViewer: controller.emailSupervisorController.updateScrollPhysicPageView,
|
||||
onHtmlContentClippedAction: controller.onHtmlContentClippedAction,
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"@@last_modified": "2025-02-20T19:41:05.121752",
|
||||
"@@last_modified": "2025-03-31T03:40:41.454034",
|
||||
"initializing_data": "Initializing data...",
|
||||
"@initializing_data": {
|
||||
"type": "text",
|
||||
@@ -2962,6 +2962,12 @@
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"errorWhileFetchingSubaddress": "Error while fetching the subaddress",
|
||||
"@errorWhileFetchingSubaddress": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"connectedToTheInternet": "Connected to the internet",
|
||||
"@connectedToTheInternet": {
|
||||
"type": "text",
|
||||
@@ -4238,12 +4244,6 @@
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"messageWarningDialogWhenExpiredOIDCTokenAndReconnection": "Your session expired. We need to take you back to the login page in order to refresh it. You might want to save the email you are currently editing before we do so.",
|
||||
"@messageWarningDialogWhenExpiredOIDCTokenAndReconnection": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"replyToList": "Reply to list",
|
||||
"@replyToList": {
|
||||
"type": "text",
|
||||
@@ -4375,5 +4375,17 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"messageClipped": "[Message clipped]",
|
||||
"@messageClipped": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"viewEntireMessage": "View entire message",
|
||||
"@viewEntireMessage": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
@@ -4597,4 +4597,18 @@ class AppLocalizations {
|
||||
name: 'exitFullscreen',
|
||||
);
|
||||
}
|
||||
|
||||
String get messageClipped {
|
||||
return Intl.message(
|
||||
'[Message clipped]',
|
||||
name: 'messageClipped',
|
||||
);
|
||||
}
|
||||
|
||||
String get viewEntireMessage {
|
||||
return Intl.message(
|
||||
'View entire message',
|
||||
name: 'viewEntireMessage',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user