TF-2302 Fix show folder

Signed-off-by: dab246 <tdvu@linagora.com>
(cherry picked from commit 221f26feefea1e42ecad72dc0eb2fe9471d683a9)
This commit is contained in:
dab246
2023-11-07 19:08:52 +07:00
committed by Dat Vu
parent 5cb611b649
commit 780751034a
3 changed files with 45 additions and 11 deletions
@@ -1117,7 +1117,10 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
} }
} }
_refreshMailboxChanges(currentMailboxState: success.currentMailboxState); _refreshMailboxChanges(
currentMailboxState: success.currentMailboxState,
properties: MailboxConstants.propertiesDefault
);
} }
void _handleUnsubscribeMultipleMailboxAllSuccess(SubscribeMultipleMailboxAllSuccess success) { void _handleUnsubscribeMultipleMailboxAllSuccess(SubscribeMultipleMailboxAllSuccess success) {
@@ -1133,7 +1136,10 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
} }
} }
_refreshMailboxChanges(currentMailboxState: success.currentMailboxState); _refreshMailboxChanges(
currentMailboxState: success.currentMailboxState,
properties: MailboxConstants.propertiesDefault
);
} }
void _handleUnsubscribeMultipleMailboxHasSomeSuccess(SubscribeMultipleMailboxHasSomeSuccess success) { void _handleUnsubscribeMultipleMailboxHasSomeSuccess(SubscribeMultipleMailboxHasSomeSuccess success) {
@@ -1149,7 +1155,10 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
} }
} }
_refreshMailboxChanges(currentMailboxState: success.currentMailboxState); _refreshMailboxChanges(
currentMailboxState: success.currentMailboxState,
properties: MailboxConstants.propertiesDefault
);
} }
void _closeEmailViewIfMailboxDisabledOrNotExist(List<MailboxId> mailboxIdsDisabled) { void _closeEmailViewIfMailboxDisabledOrNotExist(List<MailboxId> mailboxIdsDisabled) {
@@ -7,12 +7,14 @@ import 'package:dartz/dartz.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart'; import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
import 'package:model/extensions/presentation_mailbox_extension.dart'; import 'package:model/extensions/presentation_mailbox_extension.dart';
import 'package:model/mailbox/expand_mode.dart'; import 'package:model/mailbox/expand_mode.dart';
import 'package:model/mailbox/presentation_mailbox.dart'; import 'package:model/mailbox/presentation_mailbox.dart';
import 'package:tmail_ui_user/features/base/base_mailbox_controller.dart'; import 'package:tmail_ui_user/features/base/base_mailbox_controller.dart';
import 'package:tmail_ui_user/features/mailbox/domain/constants/mailbox_constants.dart';
import 'package:tmail_ui_user/features/mailbox/domain/model/mailbox_subscribe_action_state.dart'; import 'package:tmail_ui_user/features/mailbox/domain/model/mailbox_subscribe_action_state.dart';
import 'package:tmail_ui_user/features/mailbox/domain/model/mailbox_subscribe_state.dart'; import 'package:tmail_ui_user/features/mailbox/domain/model/mailbox_subscribe_state.dart';
import 'package:tmail_ui_user/features/mailbox/domain/model/subscribe_mailbox_request.dart'; import 'package:tmail_ui_user/features/mailbox/domain/model/subscribe_mailbox_request.dart';
@@ -166,7 +168,10 @@ class MailboxVisibilityController extends BaseMailboxController {
_showToastSubscribeMailboxSuccess(subscribeMailboxSuccess.mailboxId); _showToastSubscribeMailboxSuccess(subscribeMailboxSuccess.mailboxId);
} }
_refreshMailboxChanges(subscribeMailboxSuccess.currentMailboxState); _refreshMailboxChanges(
newMailboxState: subscribeMailboxSuccess.currentMailboxState,
properties: MailboxConstants.propertiesDefault
);
} }
void _handleUnsubscribeMultipleMailboxHasSomeSuccess(SubscribeMultipleMailboxHasSomeSuccess subscribeMailboxSuccess) { void _handleUnsubscribeMultipleMailboxHasSomeSuccess(SubscribeMultipleMailboxHasSomeSuccess subscribeMailboxSuccess) {
@@ -177,7 +182,10 @@ class MailboxVisibilityController extends BaseMailboxController {
); );
} }
_refreshMailboxChanges(subscribeMailboxSuccess.currentMailboxState); _refreshMailboxChanges(
newMailboxState: subscribeMailboxSuccess.currentMailboxState,
properties: MailboxConstants.propertiesDefault
);
} }
void _handleUnsubscribeMultipleMailboxAllSuccess(SubscribeMultipleMailboxAllSuccess subscribeMailboxSuccess) { void _handleUnsubscribeMultipleMailboxAllSuccess(SubscribeMultipleMailboxAllSuccess subscribeMailboxSuccess) {
@@ -188,15 +196,23 @@ class MailboxVisibilityController extends BaseMailboxController {
); );
} }
_refreshMailboxChanges(subscribeMailboxSuccess.currentMailboxState); _refreshMailboxChanges(
newMailboxState: subscribeMailboxSuccess.currentMailboxState,
properties: MailboxConstants.propertiesDefault
);
} }
void _refreshMailboxChanges(jmap.State? newMailboxState) { void _refreshMailboxChanges({jmap.State? newMailboxState, Properties? properties}) {
final session = _accountDashBoardController.sessionCurrent; final session = _accountDashBoardController.sessionCurrent;
final accountId = _accountDashBoardController.accountId.value; final accountId = _accountDashBoardController.accountId.value;
final mailboxState = newMailboxState ?? currentMailboxState; final mailboxState = newMailboxState ?? currentMailboxState;
if (session != null && accountId != null && mailboxState != null) { if (session != null && accountId != null && mailboxState != null) {
refreshMailboxChanges(session, accountId, mailboxState); refreshMailboxChanges(
session,
accountId,
mailboxState,
properties: properties
);
} }
} }
@@ -509,7 +509,10 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
} }
} }
_refreshMailboxChanges(mailboxState: success.currentMailboxState); _refreshMailboxChanges(
mailboxState: success.currentMailboxState,
properties: MailboxConstants.propertiesDefault
);
} }
void _handleSubscribeMultipleMailboxAllSuccess(SubscribeMultipleMailboxAllSuccess success) { void _handleSubscribeMultipleMailboxAllSuccess(SubscribeMultipleMailboxAllSuccess success) {
@@ -527,7 +530,10 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
} }
} }
_refreshMailboxChanges(mailboxState: success.currentMailboxState); _refreshMailboxChanges(
mailboxState: success.currentMailboxState,
properties: MailboxConstants.propertiesDefault
);
} }
void _handleSubscribeMultipleMailboxHasSomeSuccess(SubscribeMultipleMailboxHasSomeSuccess success) { void _handleSubscribeMultipleMailboxHasSomeSuccess(SubscribeMultipleMailboxHasSomeSuccess success) {
@@ -545,7 +551,10 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
} }
} }
_refreshMailboxChanges(mailboxState: success.currentMailboxState); _refreshMailboxChanges(
mailboxState: success.currentMailboxState,
properties: MailboxConstants.propertiesDefault
);
} }
void _showToastSubscribeMailboxSuccess( void _showToastSubscribeMailboxSuccess(