TF-3911 Support mail keyboard shortcut actions in email detailed view on web

This commit is contained in:
dab246
2025-07-29 02:00:32 +07:00
committed by Dat H. Pham
parent 1c7778d6cc
commit b2989521d9
36 changed files with 763 additions and 270 deletions
@@ -121,6 +121,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_clear_mailbox_extension.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_create_new_rule_filter.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_preferences_setting_extension.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_reactive_obx_variable_extension.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_save_email_as_draft_extension.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_store_email_sort_order_extension.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/initialize_app_language.dart';
@@ -310,6 +311,8 @@ class MailboxDashBoardController extends ReloadableController
int minInputLengthAutocomplete = AppConfig.defaultMinInputLengthAutocomplete;
EmailSortOrderType currentSortOrder = SearchEmailFilter.defaultSortOrder;
PaywallController? paywallController;
Worker? advancedSearchVisibleWorker;
Worker? searchInputFocusWorker;
final StreamController<Either<Failure, Success>> _progressStateController =
StreamController<Either<Failure, Success>>.broadcast();
@@ -376,6 +379,7 @@ class MailboxDashBoardController extends ReloadableController
if (PlatformInfo.isWeb) {
listSearchFilterScrollController = ScrollController();
twakeAppManager.setExecutingBeforeReconnect(false);
registerReactiveObxVariableListener();
}
if (PlatformInfo.isIOS) {
_registerPendingCurrentEmailIdInNotification();
@@ -3039,18 +3043,17 @@ class MailboxDashBoardController extends ReloadableController
return false;
}
void archiveMessage(BuildContext context, PresentationEmail email) {
void archiveMessage(PresentationEmail email) {
final mailboxContain = email.findMailboxContain(mapMailboxById);
if (mailboxContain != null) {
final archiveMailboxId = getMailboxIdByRole(PresentationMailbox.roleArchive);
final archiveMailboxPath = mapMailboxById[archiveMailboxId]?.getDisplayName(context);
if (archiveMailboxId != null) {
final moveToArchiveMailboxRequest = MoveToMailboxRequest(
{mailboxContain.id: [email.id!]},
archiveMailboxId,
MoveAction.moving,
EmailActionType.moveToMailbox,
destinationPath: archiveMailboxPath
destinationPath: getMailboxNameById(archiveMailboxId),
);
moveToMailbox(
sessionCurrent!,
@@ -3062,6 +3065,15 @@ class MailboxDashBoardController extends ReloadableController
}
}
String getMailboxNameById(MailboxId mailboxId) {
final mailbox = mapMailboxById[mailboxId];
if (currentContext != null) {
return mailbox?.getDisplayName(currentContext!) ?? '';
} else {
return mailbox?.name?.name ?? '';
}
}
void _handleRestoreDeletedMessageSuccess(EmailRecoveryActionId emailRecoveryActionId) async {
log('MailboxDashBoardController::_handleRestoreDeletedMessageSuccess():emailRecoveryActionId: $emailRecoveryActionId');
_getRestoredDeletedMessage(emailRecoveryActionId);
@@ -3271,10 +3283,14 @@ class MailboxDashBoardController extends ReloadableController
}
}
bool get isEmailOpened =>
dashboardRoute.value == DashboardRoutes.threadDetailed;
@override
void onClose() {
if (PlatformInfo.isWeb) {
listSearchFilterScrollController?.dispose();
disposeReactiveObxVariableListener();
}
if (PlatformInfo.isIOS) {
_iosNotificationManager?.dispose();
@@ -47,6 +47,7 @@ class SearchController extends BaseController with DateRangePickerMixin {
final listFilterOnSuggestionForm = RxList<QuickSearchFilter>();
final simpleSearchIsActivated = RxBool(false);
final advancedSearchIsActivated = RxBool(false);
final isSearchInputFocused = RxBool(false);
SearchQuery? get searchQuery => searchEmailFilter.value.text;
@@ -59,6 +60,17 @@ class SearchController extends BaseController with DateRangePickerMixin {
this._getAllRecentSearchLatestInteractor,
);
@override
void onInit() {
super.onInit();
searchFocus.addListener(_onSearchFocusChanged);
}
void _onSearchFocusChanged() {
log('SearchController::_onSearchFocusChanged: ${searchFocus.hasFocus}');
isSearchInputFocused.value = searchFocus.hasFocus;
}
void openAdvanceSearch() {
isAdvancedSearchViewOpen.value = true;
}
@@ -322,6 +334,7 @@ class SearchController extends BaseController with DateRangePickerMixin {
@override
void onClose() {
searchInputController.dispose();
searchFocus.removeListener(_onSearchFocusChanged);
searchFocus.dispose();
super.onClose();
}