From cdc7d711f55cd8c85d56bd130611d747b1b616b6 Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 12 Mar 2026 11:15:03 +0700 Subject: [PATCH] TF-4368 Add log to tracing refresh change emails on Sentry --- .../repository/thread_repository_impl.dart | 19 +++++++++++++++- .../presentation/thread_controller.dart | 22 +++++++++++++++---- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/lib/features/thread/data/repository/thread_repository_impl.dart b/lib/features/thread/data/repository/thread_repository_impl.dart index 4acbb93d2..196768fc5 100644 --- a/lib/features/thread/data/repository/thread_repository_impl.dart +++ b/lib/features/thread/data/repository/thread_repository_impl.dart @@ -375,9 +375,26 @@ class ThreadRepositoryImpl extends ThreadRepository { mailboxId: emailFilter?.mailboxId, propertiesCreated: propertiesCreated, ); - + logTrace( + 'ThreadRepositoryImpl::refreshChanges():' + 'CountEmailCached = ${newEmailResponse.emailList?.length}, ' + 'EmailStateCache = ${newEmailResponse.state?.value}, ' + 'InMailboxId = ${emailFilter?.mailboxId?.asString}, ' + 'Limit = ${limit?.value.toInt()}, ' + 'DefaultLimit = ${ThreadConstants.defaultLimit.value.toInt()}, ' + 'CountEmailNetwork = ${networkEmailResponse.emailList?.length}, ' + 'EmailStateNetwork = ${networkEmailResponse.state?.value}, ', + ); yield networkEmailResponse.copyWith(emailChangeResponse: emailChangeResponse); } else { + logTrace( + 'ThreadRepositoryImpl::refreshChanges():' + 'CountEmailCached = ${newEmailResponse.emailList?.length}, ' + 'EmailStateCache = ${newEmailResponse.state?.value}, ' + 'InMailboxId = ${emailFilter?.mailboxId?.asString}, ' + 'Limit = ${limit?.value.toInt()}, ' + 'DefaultLimit = ${ThreadConstants.defaultLimit.value.toInt()}, ', + ); yield newEmailResponse.copyWith(emailChangeResponse: emailChangeResponse); } } diff --git a/lib/features/thread/presentation/thread_controller.dart b/lib/features/thread/presentation/thread_controller.dart index 10c4eaa2f..678aa0ffb 100644 --- a/lib/features/thread/presentation/thread_controller.dart +++ b/lib/features/thread/presentation/thread_controller.dart @@ -477,8 +477,20 @@ class ThreadController extends BaseController with EmailActionController { final totalHeightListEmails = currentListEmails.isEmpty ? 0 : currentListEmails.length * ThreadConstants.defaultMaxHeightEmailItemOnBrowser; - if (browserInnerHeight >= ThreadConstants.defaultMaxHeightBrowser && - totalHeightListEmails <= browserInnerHeight) { + final isAutoLoadMore = + browserInnerHeight >= ThreadConstants.defaultMaxHeightBrowser && + totalHeightListEmails <= browserInnerHeight; + logTrace( + 'ThreadController::_validateBrowserHeight():' + 'BrowserInnerHeight = $browserInnerHeight, ' + 'TotalHeightListEmails = $totalHeightListEmails, ' + 'ThreadConstants.defaultMaxHeightBrowser = ${ThreadConstants.defaultMaxHeightBrowser}, ' + 'ThreadConstants.defaultMaxHeightEmailItemOnBrowser = ${ThreadConstants.defaultMaxHeightEmailItemOnBrowser}, ' + 'CanLoadMore = $canLoadMore, ' + 'isAutoLoadMore = $isAutoLoadMore, ' + 'CountCurrentListEmails = ${currentListEmails.length}', + ); + if (isAutoLoadMore) { _performAutomaticallyLoadMoreEmails(); } } @@ -557,7 +569,9 @@ class ThreadController extends BaseController with EmailActionController { } void _handleOnDoneGetAllEmailFailure() { - canLoadMore = false; + if (PlatformInfo.isWeb) { + _validateBrowserHeight(); + } if (PlatformInfo.isWeb && mailboxDashBoardController.isEmailListDisplayed) { refocusMailShortcutFocus(); } @@ -630,7 +644,7 @@ class ThreadController extends BaseController with EmailActionController { consumeState(Stream.value(Right(GetAllEmailLoading()))); } - canLoadMore = false; + canLoadMore = true; loadingMoreStatus.value = LoadingMoreStatus.idle; cancelSelectEmail();