diff --git a/assets/images/ic_expand_arrows.svg b/assets/images/ic_expand_arrows.svg
new file mode 100644
index 000000000..b9ac554f7
--- /dev/null
+++ b/assets/images/ic_expand_arrows.svg
@@ -0,0 +1,4 @@
+
diff --git a/core/lib/presentation/extensions/color_extension.dart b/core/lib/presentation/extensions/color_extension.dart
index 7f5ef0877..272a1e5b5 100644
--- a/core/lib/presentation/extensions/color_extension.dart
+++ b/core/lib/presentation/extensions/color_extension.dart
@@ -245,6 +245,7 @@ extension AppColor on Color {
static const blue400 = Color(0xFF80BDFF);
static const blue900 = Color(0xFF0F76E7);
static const m3Tertiary = Color(0xFF8C9CAF);
+ static const lightIconTertiary = Color(0xFFB8C1CC);
static const m3Neutral70 = Color(0xFFAEAAAE);
static const m3Neutral90 = Color(0xFFE6E1E5);
static const grayBackgroundColor = Color(0xFFF3F6F9);
diff --git a/core/lib/presentation/extensions/list_extensions.dart b/core/lib/presentation/extensions/list_extensions.dart
index beb45f971..57d37bf91 100644
--- a/core/lib/presentation/extensions/list_extensions.dart
+++ b/core/lib/presentation/extensions/list_extensions.dart
@@ -20,4 +20,21 @@ extension ListExtensions on List {
int countOccurrences(T value) {
return where((element) => element == value).length;
}
+
+ List> chunks(int chunkSize) {
+ if (chunkSize <= 0) {
+ throw ArgumentError('Chunk size must be greater than 0', 'chunkSize');
+ }
+ if (isEmpty) {
+ return [];
+ }
+ final result = >[];
+ final totalChunks = (length / chunkSize).ceil();
+ for (var i = 0; i < totalChunks; i++) {
+ final start = i * chunkSize;
+ final end = (start + chunkSize).clamp(0, length);
+ result.add(sublist(start, end));
+ }
+ return result;
+ }
}
\ No newline at end of file
diff --git a/core/lib/presentation/resources/image_paths.dart b/core/lib/presentation/resources/image_paths.dart
index 379370f16..3bf6f4e14 100644
--- a/core/lib/presentation/resources/image_paths.dart
+++ b/core/lib/presentation/resources/image_paths.dart
@@ -236,6 +236,7 @@ class ImagePaths {
String get icTwakeWorkplace => _getIconPath('icon_twp.png');
String get animLottieTmail => _getAnimationPath('lottie-tmail.json');
+ String get icExpandArrows => _getImagePath('ic_expand_arrows.svg');
String _getImagePath(String imageName) {
return AssetsPaths.images + imageName;
diff --git a/core/lib/presentation/views/html_viewer/html_content_viewer_on_web_widget.dart b/core/lib/presentation/views/html_viewer/html_content_viewer_on_web_widget.dart
index 7b4ab27cf..4a7b6246f 100644
--- a/core/lib/presentation/views/html_viewer/html_content_viewer_on_web_widget.dart
+++ b/core/lib/presentation/views/html_viewer/html_content_viewer_on_web_widget.dart
@@ -193,6 +193,11 @@ class _HtmlContentViewerOnWebState extends State {
}
}
}
+
+ const resizeObserver = new ResizeObserver((entries) => {
+ var height = document.body.scrollHeight;
+ window.parent.postMessage(JSON.stringify({"view": "$_createdViewId", "type": "toDart: htmlHeight", "height": height}), "*");
+ });
${widget.mailtoDelegate != null
? '''
@@ -238,6 +243,8 @@ class _HtmlContentViewerOnWebState extends State {
}
'''
: ''}
+
+ resizeObserver.observe(document.body);
}
''';
@@ -303,7 +310,7 @@ class _HtmlContentViewerOnWebState extends State {
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraint) {
- minHeight = math.max(constraint.maxHeight, minHeight);
+ minHeight = math.min(constraint.maxHeight, minHeight);
final child = Stack(
children: [
if (_htmlData?.isNotEmpty == false)
@@ -317,7 +324,7 @@ class _HtmlContentViewerOnWebState extends State {
height: _actualHeight,
width: _actualWidth,
child: HtmlElementView(
- key: ValueKey(_htmlData),
+ key: ValueKey('$_htmlData-${widget.key}'),
viewType: _createdViewId,
),
);
diff --git a/core/lib/presentation/views/html_viewer/html_content_viewer_widget.dart b/core/lib/presentation/views/html_viewer/html_content_viewer_widget.dart
index be1565850..a3fe9fcdd 100644
--- a/core/lib/presentation/views/html_viewer/html_content_viewer_widget.dart
+++ b/core/lib/presentation/views/html_viewer/html_content_viewer_widget.dart
@@ -32,6 +32,7 @@ class HtmlContentViewer extends StatefulWidget {
final double? maxHtmlContentHeight;
final double minHtmlContentHeight;
final double offsetHtmlContentHeight;
+ final bool keepAlive;
final OnLoadWidthHtmlViewerAction? onLoadWidthHtmlViewer;
final OnMailtoDelegateAction? onMailtoDelegateAction;
@@ -47,6 +48,7 @@ class HtmlContentViewer extends StatefulWidget {
this.direction,
this.minHtmlContentHeight = ConstantsUI.htmlContentMinHeight,
this.offsetHtmlContentHeight = ConstantsUI.htmlContentOffsetHeight,
+ this.keepAlive = false,
this.keepWidthWhileLoading = false,
this.contentPadding,
this.useDefaultFont = false,
@@ -63,7 +65,7 @@ class HtmlContentViewer extends StatefulWidget {
State createState() => HtmlContentViewState();
}
-class HtmlContentViewState extends State {
+class HtmlContentViewState extends State with AutomaticKeepAliveClientMixin {
late InAppWebViewController _webViewController;
late double _actualHeight;
@@ -130,6 +132,7 @@ class HtmlContentViewState extends State {
@override
Widget build(BuildContext context) {
+ super.build(context);
final child = Stack(children: [
if (_htmlData == null)
const SizedBox.shrink()
@@ -352,4 +355,7 @@ class HtmlContentViewState extends State {
_htmlData = null;
super.dispose();
}
+
+ @override
+ bool get wantKeepAlive => widget.keepAlive;
}
\ No newline at end of file
diff --git a/core/test/presentation/extensions/list_extensions_test.dart b/core/test/presentation/extensions/list_extensions_test.dart
new file mode 100644
index 000000000..4dd8e7cac
--- /dev/null
+++ b/core/test/presentation/extensions/list_extensions_test.dart
@@ -0,0 +1,137 @@
+import 'package:core/presentation/extensions/list_extensions.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+void main() {
+ group('list extensions test:', () {
+ group('chunks test:', () {
+ test('should return evenly sized chunks when length is divisible by chunkSize', () {
+ // Arrange
+ final sourceList = [1, 2, 3, 4, 5, 6];
+ const chunkSize = 3;
+ final expectedOutput = [
+ [1, 2, 3],
+ [4, 5, 6]
+ ];
+
+ // Act
+ final result = sourceList.chunks(chunkSize);
+
+ // Assert
+ expect(result, equals(expectedOutput));
+ });
+
+ test('should return chunks with the last chunk smaller when length is not divisible', () {
+ // Arrange
+ final sourceList = [1, 2, 3, 4, 5];
+ const chunkSize = 3;
+ final expectedOutput = [
+ [1, 2, 3],
+ [4, 5]
+ ];
+
+ // Act
+ final result = sourceList.chunks(chunkSize);
+
+ // Assert
+ expect(result, equals(expectedOutput));
+ });
+
+ test('should return chunks of size 1 when chunkSize is 1', () {
+ // Arrange
+ final sourceList = [1, 2, 3];
+ const chunkSize = 1;
+ final expectedOutput = [
+ [1],
+ [2],
+ [3]
+ ];
+
+ // Act
+ final result = sourceList.chunks(chunkSize);
+
+ // Assert
+ expect(result, equals(expectedOutput));
+ });
+
+ test('should return a single chunk when chunkSize equals list length', () {
+ // Arrange
+ final sourceList = [1, 2, 3, 4];
+ const chunkSize = 4;
+ final expectedOutput = [
+ [1, 2, 3, 4]
+ ];
+
+ // Act
+ final result = sourceList.chunks(chunkSize);
+
+ // Assert
+ expect(result, equals(expectedOutput));
+ });
+
+ test('should return a single chunk when chunkSize is greater than list length', () {
+ // Arrange
+ final sourceList = [1, 2, 3];
+ const chunkSize = 5;
+ final expectedOutput = [
+ [1, 2, 3]
+ ];
+
+ // Act
+ final result = sourceList.chunks(chunkSize);
+
+ // Assert
+ expect(result, equals(expectedOutput));
+ });
+
+ test('should return an empty list when the source list is empty', () {
+ // Arrange
+ final sourceList = []; // Explicitly typed empty list
+ const chunkSize = 3;
+ final expectedOutput = >[]; // Expected empty list of lists
+
+ // Act
+ final result = sourceList.chunks(chunkSize);
+
+ // Assert
+ expect(result, isEmpty); // Check if it's empty
+ expect(result, equals(expectedOutput)); // Also check for structural equality
+ });
+
+ test('should work with different list types (e.g., String)', () {
+ // Arrange
+ final sourceList = ['a', 'b', 'c', 'd', 'e'];
+ const chunkSize = 2;
+ final expectedOutput = [
+ ['a', 'b'],
+ ['c', 'd'],
+ ['e']
+ ];
+
+ // Act
+ final result = sourceList.chunks(chunkSize);
+
+ // Assert
+ expect(result, equals(expectedOutput));
+ });
+
+ test('should throw ArgumentError when chunkSize is 0', () {
+ // Arrange
+ final sourceList = [1, 2, 3];
+ const chunkSize = 0;
+
+ // Act & Assert
+ // We wrap the call that is expected to throw in a zero-argument function.
+ expect(() => sourceList.chunks(chunkSize), throwsArgumentError);
+ });
+
+ test('should throw ArgumentError when chunkSize is negative', () {
+ // Arrange
+ final sourceList = [1, 2, 3];
+ const chunkSize = -1;
+
+ // Act & Assert
+ expect(() => sourceList.chunks(chunkSize), throwsArgumentError);
+ });
+ });
+ });
+}
\ No newline at end of file
diff --git a/lib/features/base/upgradeable/upgrade_hive_database_steps_v18.dart b/lib/features/base/upgradeable/upgrade_hive_database_steps_v18.dart
new file mode 100644
index 000000000..ebcf9fe43
--- /dev/null
+++ b/lib/features/base/upgradeable/upgrade_hive_database_steps_v18.dart
@@ -0,0 +1,17 @@
+
+import 'package:tmail_ui_user/features/base/upgradeable/upgrade_database_steps.dart';
+import 'package:tmail_ui_user/features/caching/caching_manager.dart';
+
+class UpgradeHiveDatabaseStepsV18 extends UpgradeDatabaseSteps {
+
+ final CachingManager _cachingManager;
+
+ UpgradeHiveDatabaseStepsV18(this._cachingManager);
+
+ @override
+ Future onUpgrade(int oldVersion, int newVersion) async {
+ if (oldVersion > 0 && oldVersion < newVersion && newVersion == 18) {
+ await _cachingManager.clearAllEmailAndStateCache();
+ }
+ }
+}
\ No newline at end of file
diff --git a/lib/features/base/widget/email_avatar_builder.dart b/lib/features/base/widget/email_avatar_builder.dart
index cddbfc6ed..67612181f 100644
--- a/lib/features/base/widget/email_avatar_builder.dart
+++ b/lib/features/base/widget/email_avatar_builder.dart
@@ -9,10 +9,12 @@ import 'package:model/extensions/presentation_email_extension.dart';
class EmailAvatarBuilder extends StatelessWidget {
final PresentationEmail emailSelected;
+ final OnTapAvatarActionClick? onTapAvatarActionClick;
const EmailAvatarBuilder({
Key? key,
- required this.emailSelected
+ required this.emailSelected,
+ this.onTapAvatarActionClick,
}) : super(key: key);
@override
@@ -22,6 +24,7 @@ class EmailAvatarBuilder extends StatelessWidget {
..size(50)
..addTextStyle(ThemeUtils.textStyleHeadingH4(color: Colors.white))
..backgroundColor(AppColor.colorAvatar)
+ ..addOnTapActionClick(onTapAvatarActionClick ?? () {})
..avatarColor(emailSelected.avatarColors))
.build();
}
diff --git a/lib/features/base/widget/optional_expanded.dart b/lib/features/base/widget/optional_expanded.dart
new file mode 100644
index 000000000..211992421
--- /dev/null
+++ b/lib/features/base/widget/optional_expanded.dart
@@ -0,0 +1,17 @@
+import 'package:flutter/material.dart';
+
+class OptionalExpanded extends StatelessWidget {
+ const OptionalExpanded({
+ super.key,
+ required this.expandedEnabled,
+ required this.child,
+ });
+
+ final bool expandedEnabled;
+ final Widget child;
+
+ @override
+ Widget build(BuildContext context) {
+ return expandedEnabled ? Expanded(child: child) : child;
+ }
+}
\ No newline at end of file
diff --git a/lib/features/base/widget/optional_scroll.dart b/lib/features/base/widget/optional_scroll.dart
new file mode 100644
index 000000000..a57aa0533
--- /dev/null
+++ b/lib/features/base/widget/optional_scroll.dart
@@ -0,0 +1,24 @@
+import 'package:flutter/material.dart';
+
+class OptionalScroll extends StatelessWidget {
+ const OptionalScroll({
+ super.key,
+ required this.scrollEnabled,
+ required this.child,
+ this.scrollPhysics = const ClampingScrollPhysics(),
+ });
+
+ final bool scrollEnabled;
+ final Widget child;
+ final ScrollPhysics scrollPhysics;
+
+ @override
+ Widget build(BuildContext context) {
+ return scrollEnabled
+ ? SingleChildScrollView(
+ physics : scrollPhysics,
+ child: child,
+ )
+ : child;
+ }
+}
\ No newline at end of file
diff --git a/lib/features/caching/config/cache_version.dart b/lib/features/caching/config/cache_version.dart
index c79ad831a..394cff579 100644
--- a/lib/features/caching/config/cache_version.dart
+++ b/lib/features/caching/config/cache_version.dart
@@ -1,4 +1,4 @@
class CacheVersion {
- static const int hiveDBVersion = 17;
+ static const int hiveDBVersion = 18;
}
\ No newline at end of file
diff --git a/lib/features/caching/config/hive_cache_config.dart b/lib/features/caching/config/hive_cache_config.dart
index ce988a31d..4b990bc1d 100644
--- a/lib/features/caching/config/hive_cache_config.dart
+++ b/lib/features/caching/config/hive_cache_config.dart
@@ -14,6 +14,7 @@ import 'package:tmail_ui_user/features/base/upgradeable/upgrade_hive_database_st
import 'package:tmail_ui_user/features/base/upgradeable/upgrade_hive_database_steps_v15.dart';
import 'package:tmail_ui_user/features/base/upgradeable/upgrade_hive_database_steps_v16.dart';
import 'package:tmail_ui_user/features/base/upgradeable/upgrade_hive_database_steps_v17.dart';
+import 'package:tmail_ui_user/features/base/upgradeable/upgrade_hive_database_steps_v18.dart';
import 'package:tmail_ui_user/features/base/upgradeable/upgrade_hive_database_steps_v7.dart';
import 'package:tmail_ui_user/features/caching/caching_manager.dart';
import 'package:tmail_ui_user/features/caching/config/cache_version.dart';
@@ -91,6 +92,7 @@ class HiveCacheConfig {
await UpgradeHiveDatabaseStepsV15(cachingManager).onUpgrade(oldVersion, newVersion);
await UpgradeHiveDatabaseStepsV16(cachingManager).onUpgrade(oldVersion, newVersion);
await UpgradeHiveDatabaseStepsV17(cachingManager).onUpgrade(oldVersion, newVersion);
+ await UpgradeHiveDatabaseStepsV18(cachingManager).onUpgrade(oldVersion, newVersion);
if (oldVersion != newVersion) {
await cachingManager.storeCacheVersion(newVersion);
diff --git a/lib/features/composer/presentation/extensions/email_action_type_extension.dart b/lib/features/composer/presentation/extensions/email_action_type_extension.dart
index f52162778..55c79e95f 100644
--- a/lib/features/composer/presentation/extensions/email_action_type_extension.dart
+++ b/lib/features/composer/presentation/extensions/email_action_type_extension.dart
@@ -153,6 +153,23 @@ extension EmailActionTypeExtension on EmailActionType {
return imagePaths.icEdit;
case EmailActionType.openInNewTab:
return imagePaths.icOpenInNewTab;
+ case EmailActionType.printAll:
+ return imagePaths.icPrinter;
+ case EmailActionType.forward:
+ return imagePaths.icForward;
+ case EmailActionType.replyAll:
+ return imagePaths.icReplyAll;
+ case EmailActionType.replyToList:
+ return imagePaths.icReply;
+ case EmailActionType.moveToMailbox:
+ return imagePaths.icMoveEmail;
+ case EmailActionType.markAsStarred:
+ return imagePaths.icStar;
+ case EmailActionType.unMarkAsStarred:
+ return imagePaths.icUnStar;
+ case EmailActionType.moveToTrash:
+ case EmailActionType.deletePermanently:
+ return imagePaths.icDeleteComposer;
default:
return '';
}
@@ -178,6 +195,24 @@ extension EmailActionTypeExtension on EmailActionType {
return appLocalizations.editAsNewEmail;
case EmailActionType.openInNewTab:
return appLocalizations.openInNewTab;
+ case EmailActionType.printAll:
+ return appLocalizations.printAll;
+ case EmailActionType.forward:
+ return appLocalizations.forward;
+ case EmailActionType.replyAll:
+ return appLocalizations.reply_all;
+ case EmailActionType.replyToList:
+ return appLocalizations.replyToList;
+ case EmailActionType.moveToMailbox:
+ return appLocalizations.move_message;
+ case EmailActionType.markAsStarred:
+ return appLocalizations.mark_as_starred;
+ case EmailActionType.unMarkAsStarred:
+ return appLocalizations.not_starred;
+ case EmailActionType.moveToTrash:
+ return appLocalizations.move_to_trash;
+ case EmailActionType.deletePermanently:
+ return appLocalizations.delete_permanently;
default:
return '';
}
diff --git a/lib/features/email/presentation/action/email_ui_action.dart b/lib/features/email/presentation/action/email_ui_action.dart
index ab063f13e..4aee77e06 100644
--- a/lib/features/email/presentation/action/email_ui_action.dart
+++ b/lib/features/email/presentation/action/email_ui_action.dart
@@ -1,5 +1,8 @@
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
+import 'package:jmap_dart_client/jmap/mail/email/email.dart';
+import 'package:model/email/email_action_type.dart';
+import 'package:model/email/presentation_email.dart';
import 'package:tmail_ui_user/features/base/action/ui_action.dart';
class EmailUIAction extends UIAction {
@@ -28,4 +31,28 @@ class HideEmailContentViewAction extends EmailUIAction {}
class ShowEmailContentViewAction extends EmailUIAction {}
-class RefreshAllEmailAction extends EmailUIAction {}
\ No newline at end of file
+class RefreshAllEmailAction extends EmailUIAction {}
+
+class CloseEmailInThreadDetailAction extends EmailUIAction {
+ final EmailId emailId;
+
+ CloseEmailInThreadDetailAction(this.emailId);
+
+ @override
+ List