TF-1715 Auto refresh list emails in Favorite folder when message incoming or message changed
This commit is contained in:
@@ -278,6 +278,8 @@ class MailboxController extends BaseMailboxController
|
||||
if (PlatformInfo.isIOS) {
|
||||
_updateMailboxIdsBlockNotificationToKeychain(success.mailboxList);
|
||||
}
|
||||
} else if (success is CreateDefaultMailboxAllSuccess) {
|
||||
addFavoriteFolderToMailboxList();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -599,6 +601,7 @@ class MailboxController extends BaseMailboxController
|
||||
if (currentContext != null) {
|
||||
syncAllMailboxWithDisplayName(currentContext!);
|
||||
}
|
||||
addFavoriteFolderToMailboxList();
|
||||
_setMapMailbox();
|
||||
_setOutboxMailbox();
|
||||
_selectSelectedMailboxDefault();
|
||||
|
||||
@@ -711,6 +711,8 @@ class ThreadController extends BaseController with EmailActionController {
|
||||
try {
|
||||
if (searchController.isSearchEmailRunning && PlatformInfo.isWeb) {
|
||||
await _refreshChangeSearchEmail();
|
||||
} else if (selectedMailboxId?.isFavoriteMailboxId == true) {
|
||||
await _refreshChangeListEmailsInFavoriteFolder();
|
||||
} else {
|
||||
await _refreshChangeListEmail();
|
||||
}
|
||||
@@ -815,6 +817,40 @@ class ThreadController extends BaseController with EmailActionController {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _refreshChangeListEmailsInFavoriteFolder() async {
|
||||
log('ThreadController::_refreshChangeListEmailsInFavoriteFolder:');
|
||||
|
||||
await _refreshChangeListEmailCache();
|
||||
|
||||
final viewState = await _getEmailsInMailboxInteractor
|
||||
.execute(
|
||||
_session!,
|
||||
_accountId!,
|
||||
limit: limitEmailFetched,
|
||||
sort: EmailSortOrderType.mostRecent.getSortOrder().toNullable(),
|
||||
emailFilter: getEmailFilterForLoadMailbox(),
|
||||
propertiesCreated: EmailUtils.getPropertiesForEmailGetMethod(
|
||||
_session!,
|
||||
_accountId!,
|
||||
),
|
||||
propertiesUpdated: EmailUtils.getPropertiesForEmailChangeMethod(
|
||||
_session!,
|
||||
_accountId!,
|
||||
),
|
||||
useCache: false,
|
||||
)
|
||||
.last;
|
||||
|
||||
final emailSuccessState = viewState
|
||||
.foldSuccessWithResult<GetAllEmailSuccess>();
|
||||
|
||||
if (emailSuccessState is GetAllEmailSuccess) {
|
||||
_getAllEmailSuccess(emailSuccessState);
|
||||
} else {
|
||||
onDataFailureViewState(emailSuccessState);
|
||||
}
|
||||
}
|
||||
|
||||
void _loadMoreEmails() {
|
||||
log('ThreadController::_loadMoreEmails()::canLoadMore = $canLoadMore');
|
||||
if (canLoadMore && _session != null && _accountId != null) {
|
||||
|
||||
Reference in New Issue
Block a user