TF-801 Show notification message when vacation enabled
This commit is contained in:
@@ -66,6 +66,13 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/download/download_controller.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/search_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/data/datasource/manage_account_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/data/datasource_impl/manage_account_datasource_impl.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/data/local/language_cache_manager.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/data/network/manage_account_api.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/data/repository/manage_account_repository_impl.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/repository/manage_account_repository.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_vacation_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/log_out_oidc_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/thread/data/datasource/thread_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/thread/data/datasource_impl/local_thread_datasource_impl.dart';
|
||||
@@ -102,6 +109,7 @@ class MailboxDashBoardBindings extends BaseBindings {
|
||||
Get.find<DeleteEmailPermanentlyInteractor>(),
|
||||
Get.find<MarkAsMailboxReadInteractor>(),
|
||||
Get.find<GetComposerCacheOnWebInteractor>(),
|
||||
Get.find<GetAllVacationInteractor>(),
|
||||
));
|
||||
Get.put(AdvancedFilterController());
|
||||
}
|
||||
@@ -117,6 +125,7 @@ class MailboxDashBoardBindings extends BaseBindings {
|
||||
Get.lazyPut<AccountDatasource>(() => Get.find<HiveAccountDatasourceImpl>());
|
||||
Get.lazyPut<AuthenticationOIDCDataSource>(() => Get.find<AuthenticationOIDCDataSourceImpl>());
|
||||
Get.lazyPut<SessionStorageComposerDatasource>(() => Get.find<SessionStorageComposerDatasourceImpl>());
|
||||
Get.lazyPut<ManageAccountDataSource>(() => Get.find<ManageAccountDataSourceImpl>());
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -140,6 +149,9 @@ class MailboxDashBoardBindings extends BaseBindings {
|
||||
Get.find<OidcConfigurationCacheManager>()
|
||||
));
|
||||
Get.lazyPut(() => SessionStorageComposerDatasourceImpl());
|
||||
Get.lazyPut(() => ManageAccountDataSourceImpl(
|
||||
Get.find<ManageAccountAPI>(),
|
||||
Get.find<LanguageCacheManager>()));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -179,6 +191,7 @@ class MailboxDashBoardBindings extends BaseBindings {
|
||||
Get.lazyPut(() => GetComposerCacheOnWebInteractor(Get.find<ComposerCacheRepository>()));
|
||||
Get.lazyPut(() => SaveComposerCacheOnWebInteractor(Get.find<ComposerCacheRepository>()));
|
||||
Get.lazyPut(() => RemoveComposerCacheOnWebInteractor(Get.find<ComposerCacheRepository>()));
|
||||
Get.lazyPut(() => GetAllVacationInteractor(Get.find<ManageAccountRepository>()));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -191,6 +204,7 @@ class MailboxDashBoardBindings extends BaseBindings {
|
||||
Get.lazyPut<AccountRepository>(() => Get.find<AccountRepositoryImpl>());
|
||||
Get.lazyPut<AuthenticationOIDCRepository>(() => Get.find<AuthenticationOIDCRepositoryImpl>());
|
||||
Get.lazyPut<ComposerCacheRepository>(() => Get.find<ComposerCacheRepositoryImpl>());
|
||||
Get.lazyPut<ManageAccountRepository>(() => Get.find<ManageAccountRepositoryImpl>());
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -219,5 +233,6 @@ class MailboxDashBoardBindings extends BaseBindings {
|
||||
Get.lazyPut(() => AccountRepositoryImpl(Get.find<AccountDatasource>()));
|
||||
Get.lazyPut(() => AuthenticationOIDCRepositoryImpl(Get.find<AuthenticationOIDCDataSource>()));
|
||||
Get.lazyPut(() => ComposerCacheRepositoryImpl(Get.find<SessionStorageComposerDatasource>()));
|
||||
Get.lazyPut(() => ManageAccountRepositoryImpl(Get.find<ManageAccountDataSource>()));
|
||||
}
|
||||
}
|
||||
+25
-4
@@ -13,6 +13,7 @@ import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/unsigned_int.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/vacation/vacation_response.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:tmail_ui_user/features/base/action/ui_action.dart';
|
||||
@@ -43,6 +44,8 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/composer_overlay_state.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/download/download_task_state.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/quick_search_filter.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_all_vacation_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_vacation_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/log_out_oidc_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/manage_account_arguments.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/filter_message_option.dart';
|
||||
@@ -71,6 +74,7 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
final DeleteEmailPermanentlyInteractor _deleteEmailPermanentlyInteractor;
|
||||
final MarkAsMailboxReadInteractor _markAsMailboxReadInteractor;
|
||||
final GetComposerCacheOnWebInteractor _getEmailCacheOnWebInteractor;
|
||||
final GetAllVacationInteractor _getAllVacationInteractor;
|
||||
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
final selectedMailbox = Rxn<PresentationMailbox>();
|
||||
@@ -85,6 +89,7 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
final listEmailSelected = <PresentationEmail>[].obs;
|
||||
final composerOverlayState = ComposerOverlayState.inActive.obs;
|
||||
final viewStateMarkAsReadMailbox = Rx<Either<Failure, Success>>(Right(UIState.idle));
|
||||
final vacationResponse = Rxn<VacationResponse>();
|
||||
|
||||
Session? sessionCurrent;
|
||||
Map<Role, MailboxId> mapDefaultMailboxId = {};
|
||||
@@ -106,6 +111,7 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
this._deleteEmailPermanentlyInteractor,
|
||||
this._markAsMailboxReadInteractor,
|
||||
this._getEmailCacheOnWebInteractor,
|
||||
this._getAllVacationInteractor,
|
||||
) : super(logoutOidcInteractor,
|
||||
deleteAuthorityOidcInteractor,
|
||||
getAuthenticatedAccountInteractor);
|
||||
@@ -125,6 +131,7 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
dispatchRoute(AppRoutes.THREAD);
|
||||
_setSessionCurrent();
|
||||
_getUserProfile();
|
||||
_getVacationResponse();
|
||||
_getAppVersion();
|
||||
super.onReady();
|
||||
}
|
||||
@@ -210,6 +217,10 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
} else if (success is MarkAsMailboxReadAllSuccess ||
|
||||
success is MarkAsMailboxReadHasSomeEmailFailure) {
|
||||
_markAsReadMailboxSuccess(success);
|
||||
} else if (success is GetAllVacationSuccess) {
|
||||
if (success.listVacationResponse.isNotEmpty) {
|
||||
vacationResponse.value = success.listVacationResponse.first;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -292,6 +303,12 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
appInformation.value = info;
|
||||
}
|
||||
|
||||
void _getVacationResponse() {
|
||||
if (accountId.value != null) {
|
||||
consumeState(_getAllVacationInteractor.execute(accountId.value!));
|
||||
}
|
||||
}
|
||||
|
||||
MailboxId? getMailboxIdByRole(Role role) {
|
||||
return mapDefaultMailboxId[role];
|
||||
}
|
||||
@@ -448,6 +465,7 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
sessionCurrent = session;
|
||||
accountId.value = sessionCurrent?.accounts.keys.first;
|
||||
_getUserProfile();
|
||||
_getVacationResponse();
|
||||
_handleComposerCache();
|
||||
injectAutoCompleteBindings();
|
||||
}
|
||||
@@ -544,13 +562,16 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
dashBoardAction.value = DashBoardAction.idle;
|
||||
}
|
||||
|
||||
void goToSettings() {
|
||||
if (currentContext != null && (_responsiveUtils.isMobile(currentContext!)
|
||||
|| _responsiveUtils.isTablet(currentContext!))) {
|
||||
void goToSettings() async {
|
||||
if (isDrawerOpen) {
|
||||
closeMailboxMenuDrawer();
|
||||
}
|
||||
push(AppRoutes.MANAGE_ACCOUNT,
|
||||
final result = await push(AppRoutes.MANAGE_ACCOUNT,
|
||||
arguments: ManageAccountArguments(sessionCurrent));
|
||||
|
||||
if (result is VacationResponse) {
|
||||
vacationResponse.value = result;
|
||||
}
|
||||
}
|
||||
|
||||
void selectQuickSearchFilter({
|
||||
|
||||
@@ -19,6 +19,8 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/ad
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/download/download_task_item_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/email_quick_search_item_tile_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/recent_search_item_tile_widget.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/filter_message_option.dart';
|
||||
import 'package:tmail_ui_user/features/thread/presentation/thread_view.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
@@ -93,6 +95,15 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
||||
children: [
|
||||
SizedBox(child: MailboxView(), width: responsiveUtils.defaultSizeMenu),
|
||||
Expanded(child: Column(children: [
|
||||
Obx(() {
|
||||
if (controller.vacationResponse.value?.vacationResponderIsReady == true) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsets.only(top: 16, right: 16),
|
||||
vacationResponse: controller.vacationResponse.value!);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
_buildMarkAsMailboxReadLoading(context),
|
||||
Expanded(child: Obx(() {
|
||||
switch(controller.routePath.value) {
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ mixin UserSettingPopupMenuMixin {
|
||||
Widget _settingAction(BuildContext context, Function? onCallBack) {
|
||||
return PopupMenuItemWidget(
|
||||
_imagePaths.icSetting,
|
||||
AppLocalizations.of(context).settings,
|
||||
AppLocalizations.of(context).manage_account,
|
||||
() => onCallBack?.call());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user