TF-4069 Automatically reply should be deactivated vacation after end date
This commit is contained in:
+9
-5
@@ -2015,12 +2015,16 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
downloadController.deleteDownloadTask(taskId);
|
downloadController.deleteDownloadTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void disableVacationResponder() {
|
void disableVacationResponder(VacationResponse vacationResponse) {
|
||||||
if (accountId.value != null && _updateVacationInteractor != null) {
|
if (accountId.value != null && _updateVacationInteractor != null) {
|
||||||
final vacationDisabled = vacationResponse.value != null
|
consumeState(_updateVacationInteractor!.execute(
|
||||||
? vacationResponse.value!.copyWith(isEnabled: false)
|
accountId.value!,
|
||||||
: VacationResponse(isEnabled: false);
|
vacationResponse.clearAllExceptHtmlBody(),
|
||||||
consumeState(_updateVacationInteractor!.execute(accountId.value!, vacationDisabled));
|
));
|
||||||
|
} else {
|
||||||
|
consumeState(
|
||||||
|
Stream.value(Left(UpdateVacationFailure(ParametersIsNullException()))),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -617,12 +617,14 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
|
|
||||||
Widget _buildVacationNotificationMessage(BuildContext context) {
|
Widget _buildVacationNotificationMessage(BuildContext context) {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
if (controller.vacationResponse.value?.vacationResponderIsValid == true) {
|
final vacation = controller.vacationResponse.value;
|
||||||
|
if (vacation?.vacationResponderIsValid == true) {
|
||||||
return VacationNotificationMessageWidget(
|
return VacationNotificationMessageWidget(
|
||||||
margin: VacationNotificationMessageWidgetStyle.bannerMargin,
|
margin: VacationNotificationMessageWidgetStyle.bannerMargin,
|
||||||
vacationResponse: controller.vacationResponse.value!,
|
vacationResponse: vacation!,
|
||||||
actionGotoVacationSetting: controller.goToVacationSetting,
|
actionGotoVacationSetting: controller.goToVacationSetting,
|
||||||
actionEndNow: controller.disableVacationResponder);
|
actionEndNow: controller.disableVacationResponder,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
import 'package:jmap_dart_client/jmap/mail/vacation/vacation_response.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||||
|
|
||||||
|
extension HandleVacationResponseExtension on ManageAccountDashBoardController {
|
||||||
|
void syncVacationResponse(VacationResponse? newVacation) {
|
||||||
|
if (newVacation?.vacationResponderIsStopped == true) {
|
||||||
|
automaticallyDeactivateVacation(newVacation!);
|
||||||
|
} else {
|
||||||
|
setUpVacation(newVacation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setUpVacation(VacationResponse? newVacation) {
|
||||||
|
vacationResponse.value = newVacation;
|
||||||
|
}
|
||||||
|
|
||||||
|
void automaticallyDeactivateVacation(VacationResponse vacationResponse) {
|
||||||
|
disableVacationResponder(vacationResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -87,6 +87,10 @@ extension VacationResponseExtension on VacationResponse {
|
|||||||
htmlBody: htmlBody ?? this.htmlBody
|
htmlBody: htmlBody ?? this.htmlBody
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VacationResponse clearAllExceptHtmlBody() {
|
||||||
|
return VacationResponse(isEnabled: false, htmlBody: htmlBody);
|
||||||
|
}
|
||||||
|
|
||||||
String getNotificationMessage(BuildContext context) {
|
String getNotificationMessage(BuildContext context) {
|
||||||
if (vacationResponderIsValid) {
|
if (vacationResponderIsValid) {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:back_button_interceptor/back_button_interceptor.dart';
|
import 'package:back_button_interceptor/back_button_interceptor.dart';
|
||||||
import 'package:core/core.dart';
|
import 'package:core/core.dart';
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
||||||
@@ -18,6 +17,7 @@ import 'package:tmail_ui_user/features/base/mixin/own_email_address_mixin.dart';
|
|||||||
import 'package:tmail_ui_user/features/base/reloadable/reloadable_controller.dart';
|
import 'package:tmail_ui_user/features/base/reloadable/reloadable_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/base/widget/dialog_picker/color_dialog_picker.dart';
|
import 'package:tmail_ui_user/features/base/widget/dialog_picker/color_dialog_picker.dart';
|
||||||
import 'package:tmail_ui_user/features/base/widget/dialog_picker/date_time_dialog_picker.dart';
|
import 'package:tmail_ui_user/features/base/widget/dialog_picker/date_time_dialog_picker.dart';
|
||||||
|
import 'package:tmail_ui_user/features/home/data/exceptions/session_exceptions.dart';
|
||||||
import 'package:tmail_ui_user/features/home/domain/extensions/session_extensions.dart';
|
import 'package:tmail_ui_user/features/home/domain/extensions/session_extensions.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/domain/state/export_trace_log_state.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/state/export_trace_log_state.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/state/get_all_vacation_state.dart';
|
||||||
@@ -27,6 +27,7 @@ import 'package:tmail_ui_user/features/manage_account/domain/usecases/update_vac
|
|||||||
import 'package:tmail_ui_user/features/manage_account/presentation/action/dashboard_setting_action.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/action/dashboard_setting_action.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/bindings/email_rules_bindings.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/bindings/email_rules_bindings.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/export_trace_log_extension.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/export_trace_log_extension.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/handle_vacation_response_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/bindings/forward_bindings.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/forward/bindings/forward_bindings.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/identities/identity_bindings.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/identities/identity_bindings.dart';
|
||||||
@@ -80,9 +81,7 @@ class ManageAccountDashBoardController extends ReloadableController
|
|||||||
@override
|
@override
|
||||||
void handleSuccessViewState(Success success) {
|
void handleSuccessViewState(Success success) {
|
||||||
if (success is GetAllVacationSuccess) {
|
if (success is GetAllVacationSuccess) {
|
||||||
if (success.listVacationResponse.isNotEmpty) {
|
syncVacationResponse(success.listVacationResponse.firstOrNull);
|
||||||
vacationResponse.value = success.listVacationResponse.first;
|
|
||||||
}
|
|
||||||
} else if (success is UpdateVacationSuccess) {
|
} else if (success is UpdateVacationSuccess) {
|
||||||
_handleUpdateVacationSuccess(success);
|
_handleUpdateVacationSuccess(success);
|
||||||
} else if (success is ExportTraceLogSuccess) {
|
} else if (success is ExportTraceLogSuccess) {
|
||||||
@@ -96,6 +95,8 @@ class ManageAccountDashBoardController extends ReloadableController
|
|||||||
void handleFailureViewState(Failure failure) {
|
void handleFailureViewState(Failure failure) {
|
||||||
if (failure is ExportTraceLogFailure) {
|
if (failure is ExportTraceLogFailure) {
|
||||||
handleExportTraceLogFailure(failure);
|
handleExportTraceLogFailure(failure);
|
||||||
|
} else if (failure is UpdateVacationFailure) {
|
||||||
|
setUpVacation(null);
|
||||||
} else {
|
} else {
|
||||||
super.handleFailureViewState(failure);
|
super.handleFailureViewState(failure);
|
||||||
}
|
}
|
||||||
@@ -178,10 +179,6 @@ class ManageAccountDashBoardController extends ReloadableController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateVacationResponse(VacationResponse? newVacation) {
|
|
||||||
vacationResponse.value = newVacation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectAccountMenuItem(AccountMenuItem newAccountMenuItem) {
|
void selectAccountMenuItem(AccountMenuItem newAccountMenuItem) {
|
||||||
settingsPageLevel.value = newAccountMenuItem == AccountMenuItem.none
|
settingsPageLevel.value = newAccountMenuItem == AccountMenuItem.none
|
||||||
? SettingsPageLevel.universal
|
? SettingsPageLevel.universal
|
||||||
@@ -292,25 +289,28 @@ class ManageAccountDashBoardController extends ReloadableController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void disableVacationResponder() {
|
void disableVacationResponder(VacationResponse vacation) {
|
||||||
if (accountId.value != null && _updateVacationInteractor != null) {
|
if (accountId.value != null && _updateVacationInteractor != null) {
|
||||||
final vacationDisabled = vacationResponse.value != null
|
consumeState(_updateVacationInteractor!.execute(
|
||||||
? vacationResponse.value!.copyWith(isEnabled: false)
|
accountId.value!,
|
||||||
: VacationResponse(isEnabled: false);
|
vacation.clearAllExceptHtmlBody(),
|
||||||
consumeState(_updateVacationInteractor!.execute(accountId.value!, vacationDisabled));
|
));
|
||||||
|
} else {
|
||||||
|
consumeState(
|
||||||
|
Stream.value(Left(UpdateVacationFailure(ParametersIsNullException()))),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
||||||
if (success.listVacationResponse.isNotEmpty) {
|
if (success.listVacationResponse.isNotEmpty &&
|
||||||
if (currentContext != null && currentOverlayContext != null) {
|
currentContext != null &&
|
||||||
appToast.showToastSuccessMessage(
|
currentOverlayContext != null) {
|
||||||
currentOverlayContext!,
|
appToast.showToastSuccessMessage(
|
||||||
AppLocalizations.of(currentContext!).yourVacationResponderIsDisabledSuccessfully);
|
currentOverlayContext!,
|
||||||
}
|
AppLocalizations.of(currentContext!).yourVacationResponderIsDisabledSuccessfully);
|
||||||
vacationResponse.value = success.listVacationResponse.first;
|
|
||||||
log('ManageAccountDashBoardController::_handleUpdateVacationSuccess(): $vacationResponse');
|
|
||||||
}
|
}
|
||||||
|
setUpVacation(success.listVacationResponse.firstOrNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool inVacationSettings() {
|
bool inVacationSettings() {
|
||||||
|
|||||||
@@ -29,9 +29,10 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final isWebDesktop = controller.responsiveUtils.isWebDesktop(context);
|
||||||
return Portal(
|
return Portal(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: controller.responsiveUtils.isWebDesktop(context)
|
backgroundColor: isWebDesktop
|
||||||
? AppColor.colorBgDesktop
|
? AppColor.colorBgDesktop
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
drawerEnableOpenDragGesture: false,
|
drawerEnableOpenDragGesture: false,
|
||||||
@@ -82,32 +83,34 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
|||||||
color: AppColor.colorBgDesktop,
|
color: AppColor.colorBgDesktop,
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
Obx(() {
|
Obx(() {
|
||||||
if (controller.vacationResponse.value?.vacationResponderIsValid == true) {
|
final vacation = controller.vacationResponse.value;
|
||||||
|
|
||||||
|
if (vacation?.vacationResponderIsValid == true) {
|
||||||
return VacationNotificationMessageWidget(
|
return VacationNotificationMessageWidget(
|
||||||
margin: EdgeInsetsDirectional.only(
|
margin: EdgeInsetsDirectional.only(
|
||||||
start: controller.responsiveUtils.isWebDesktop(context) ? 0 : 16,
|
start: isWebDesktop ? 0 : 16,
|
||||||
end: 16,
|
end: 16,
|
||||||
top: controller.responsiveUtils.isWebDesktop(context) ? 16 : 0,
|
top: isWebDesktop ? 16 : 0,
|
||||||
bottom: controller.responsiveUtils.isWebDesktop(context) ? 0 : 16,
|
bottom: isWebDesktop ? 0 : 16,
|
||||||
),
|
),
|
||||||
fromAccountDashBoard: true,
|
fromAccountDashBoard: true,
|
||||||
vacationResponse: controller.vacationResponse.value!,
|
vacationResponse: vacation!,
|
||||||
actionGotoVacationSetting: !controller.inVacationSettings()
|
actionGotoVacationSetting: !controller.inVacationSettings()
|
||||||
? () => controller.selectAccountMenuItem(AccountMenuItem.vacation)
|
? () => controller.selectAccountMenuItem(AccountMenuItem.vacation)
|
||||||
: null,
|
: null,
|
||||||
actionEndNow: controller.disableVacationResponder);
|
actionEndNow: controller.disableVacationResponder,
|
||||||
} else if ((controller.vacationResponse.value?.vacationResponderIsWaiting == true
|
);
|
||||||
|| controller.vacationResponse.value?.vacationResponderIsStopped == true)
|
} else if (vacation?.vacationResponderIsWaiting == true &&
|
||||||
&& controller.accountMenuItemSelected.value == AccountMenuItem.vacation) {
|
controller.inVacationSettings()) {
|
||||||
return VacationNotificationMessageWidget(
|
return VacationNotificationMessageWidget(
|
||||||
margin: EdgeInsetsDirectional.only(
|
margin: EdgeInsetsDirectional.only(
|
||||||
start: controller.responsiveUtils.isWebDesktop(context) ? 0 : 16,
|
start: isWebDesktop ? 0 : 16,
|
||||||
end: 16,
|
end: 16,
|
||||||
top: controller.responsiveUtils.isWebDesktop(context) ? 16 : 0,
|
top: isWebDesktop ? 16 : 0,
|
||||||
bottom: controller.responsiveUtils.isWebDesktop(context) ? 0 : 16,
|
bottom: isWebDesktop ? 0 : 16,
|
||||||
),
|
),
|
||||||
fromAccountDashBoard: true,
|
fromAccountDashBoard: true,
|
||||||
vacationResponse: controller.vacationResponse.value!,
|
vacationResponse: vacation!,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||||
leadingIcon: const Padding(
|
leadingIcon: const Padding(
|
||||||
padding: EdgeInsetsDirectional.only(end: 12),
|
padding: EdgeInsetsDirectional.only(end: 12),
|
||||||
|
|||||||
@@ -40,33 +40,36 @@ class SettingsView extends GetWidget<SettingsController> {
|
|||||||
controller.showExportTraceLogConfirmDialog(context),
|
controller.showExportTraceLogConfirmDialog(context),
|
||||||
)),
|
)),
|
||||||
Obx(() {
|
Obx(() {
|
||||||
if (controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsValid == true) {
|
final dashboard = controller.manageAccountDashboardController;
|
||||||
|
final vacation = dashboard.vacationResponse.value;
|
||||||
|
final isWebDesktop = controller.responsiveUtils.isWebDesktop(context);
|
||||||
|
|
||||||
|
if (vacation?.vacationResponderIsValid == true) {
|
||||||
return VacationNotificationMessageWidget(
|
return VacationNotificationMessageWidget(
|
||||||
margin: EdgeInsetsDirectional.only(
|
margin: EdgeInsetsDirectional.only(
|
||||||
start: 12,
|
start: 12,
|
||||||
end: 12,
|
end: 12,
|
||||||
top: controller.responsiveUtils.isWebDesktop(context) ? 8 : 0,
|
top: isWebDesktop ? 8 : 0,
|
||||||
bottom: controller.responsiveUtils.isWebDesktop(context) ? 0 : 16,
|
bottom: isWebDesktop ? 0 : 16,
|
||||||
),
|
),
|
||||||
fromAccountDashBoard: true,
|
fromAccountDashBoard: true,
|
||||||
vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!,
|
vacationResponse: vacation!,
|
||||||
actionGotoVacationSetting: !controller.manageAccountDashboardController.inVacationSettings()
|
actionGotoVacationSetting: !dashboard.inVacationSettings()
|
||||||
? () => controller.manageAccountDashboardController.selectAccountMenuItem(AccountMenuItem.vacation)
|
? () => dashboard.selectAccountMenuItem(AccountMenuItem.vacation)
|
||||||
: null,
|
: null,
|
||||||
actionEndNow: controller.manageAccountDashboardController.disableVacationResponder
|
actionEndNow: dashboard.disableVacationResponder
|
||||||
);
|
);
|
||||||
} else if ((controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsWaiting == true
|
} else if (vacation?.vacationResponderIsWaiting == true &&
|
||||||
|| controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsStopped == true)
|
dashboard.inVacationSettings()) {
|
||||||
&& controller.manageAccountDashboardController.inVacationSettings()) {
|
|
||||||
return VacationNotificationMessageWidget(
|
return VacationNotificationMessageWidget(
|
||||||
margin: EdgeInsetsDirectional.only(
|
margin: EdgeInsetsDirectional.only(
|
||||||
start: 12,
|
start: 12,
|
||||||
end: 12,
|
end: 12,
|
||||||
top: controller.responsiveUtils.isWebDesktop(context) ? 8 : 0,
|
top: isWebDesktop ? 8 : 0,
|
||||||
bottom: controller.responsiveUtils.isWebDesktop(context) ? 0 : 16,
|
bottom: isWebDesktop ? 0 : 16,
|
||||||
),
|
),
|
||||||
fromAccountDashBoard: true,
|
fromAccountDashBoard: true,
|
||||||
vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!,
|
vacationResponse: vacation!,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||||
leadingIcon: const Padding(
|
leadingIcon: const Padding(
|
||||||
padding: EdgeInsetsDirectional.only(end: 12),
|
padding: EdgeInsetsDirectional.only(end: 12),
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ import 'package:rich_text_composer/views/commons/constants.dart';
|
|||||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/base/widget/dialog_picker/date_time_dialog_picker.dart';
|
import 'package:tmail_ui_user/features/base/widget/dialog_picker/date_time_dialog_picker.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/presentation/controller/rich_text_web_controller.dart';
|
import 'package:tmail_ui_user/features/composer/presentation/controller/rich_text_web_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/domain/exceptions/null_session_or_accountid_exception.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/domain/state/update_vacation_state.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/state/update_vacation_state.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/update_vacation_interactor.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/usecases/update_vacation_interactor.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/handle_vacation_response_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings/settings_controller.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings/settings_controller.dart';
|
||||||
@@ -223,7 +225,7 @@ class VacationController extends BaseController {
|
|||||||
_updateVacationAction(newVacationResponse);
|
_updateVacationAction(newVacationResponse);
|
||||||
} else {
|
} else {
|
||||||
final vacationDisabled = currentVacation != null
|
final vacationDisabled = currentVacation != null
|
||||||
? currentVacation!.copyWith(isEnabled: false)
|
? currentVacation!.clearAllExceptHtmlBody()
|
||||||
: VacationResponse(isEnabled: false);
|
: VacationResponse(isEnabled: false);
|
||||||
log('VacationController::saveVacation(): vacationDisabled: $vacationDisabled');
|
log('VacationController::saveVacation(): vacationDisabled: $vacationDisabled');
|
||||||
_updateVacationAction(vacationDisabled);
|
_updateVacationAction(vacationDisabled);
|
||||||
@@ -234,26 +236,28 @@ class VacationController extends BaseController {
|
|||||||
final accountId = _accountDashBoardController.accountId.value;
|
final accountId = _accountDashBoardController.accountId.value;
|
||||||
if (accountId != null) {
|
if (accountId != null) {
|
||||||
consumeState(_updateVacationInteractor.execute(accountId, vacationResponse));
|
consumeState(_updateVacationInteractor.execute(accountId, vacationResponse));
|
||||||
|
} else {
|
||||||
|
consumeState(
|
||||||
|
Stream.value(Left(UpdateVacationFailure(NullSessionOrAccountIdException()))),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
||||||
if (success.listVacationResponse.isNotEmpty) {
|
if (success.listVacationResponse.isNotEmpty &&
|
||||||
if (currentOverlayContext != null && currentContext != null) {
|
currentOverlayContext != null &&
|
||||||
appToast.showToastSuccessMessage(
|
currentContext != null) {
|
||||||
currentOverlayContext!,
|
appToast.showToastSuccessMessage(
|
||||||
AppLocalizations.of(currentContext!).vacationSettingSaved);
|
currentOverlayContext!,
|
||||||
}
|
AppLocalizations.of(currentContext!).vacationSettingSaved);
|
||||||
currentVacation = success.listVacationResponse.first;
|
|
||||||
log('VacationController::_handleUpdateVacationSuccess(): $currentVacation');
|
|
||||||
|
|
||||||
if (currentVacation != null) {
|
|
||||||
final newVacationPresentation = currentVacation!.toVacationPresentation();
|
|
||||||
_initializeValueForVacation(newVacationPresentation);
|
|
||||||
}
|
|
||||||
|
|
||||||
_accountDashBoardController.updateVacationResponse(currentVacation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentVacation = success.listVacationResponse.firstOrNull;
|
||||||
|
if (currentVacation != null) {
|
||||||
|
final newVacationPresentation = currentVacation!.toVacationPresentation();
|
||||||
|
_initializeValueForVacation(newVacationPresentation);
|
||||||
|
}
|
||||||
|
_accountDashBoardController.setUpVacation(currentVacation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateMessageHtmlText(String? text) => _vacationMessageHtmlText = text;
|
void updateMessageHtmlText(String? text) => _vacationMessageHtmlText = text;
|
||||||
|
|||||||
+4
-3
@@ -6,7 +6,7 @@ import 'package:jmap_dart_client/jmap/mail/vacation/vacation_response.dart';
|
|||||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
typedef EndNowVacationSettingAction = Function();
|
typedef EndNowVacationSettingAction = Function(VacationResponse vacation);
|
||||||
typedef GoToVacationSettingAction = Function();
|
typedef GoToVacationSettingAction = Function();
|
||||||
|
|
||||||
class VacationNotificationMessageWidget extends StatelessWidget {
|
class VacationNotificationMessageWidget extends StatelessWidget {
|
||||||
@@ -93,7 +93,8 @@ class VacationNotificationMessageWidget extends StatelessWidget {
|
|||||||
maxWidth: 180,
|
maxWidth: 180,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
tooltipMessage: AppLocalizations.of(context).endNow,
|
tooltipMessage: AppLocalizations.of(context).endNow,
|
||||||
onTapActionCallback: actionEndNow),
|
onTapActionCallback: () => actionEndNow?.call(vacationResponse),
|
||||||
|
),
|
||||||
if (actionGotoVacationSetting != null)
|
if (actionGotoVacationSetting != null)
|
||||||
TMailButtonWidget.fromText(
|
TMailButtonWidget.fromText(
|
||||||
text: AppLocalizations.of(context).vacationSetting,
|
text: AppLocalizations.of(context).vacationSetting,
|
||||||
@@ -148,7 +149,7 @@ class VacationNotificationMessageWidget extends StatelessWidget {
|
|||||||
maxWidth: 180,
|
maxWidth: 180,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
tooltipMessage: AppLocalizations.of(context).endNow,
|
tooltipMessage: AppLocalizations.of(context).endNow,
|
||||||
onTapActionCallback: actionEndNow
|
onTapActionCallback: () => actionEndNow?.call(vacationResponse),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (actionGotoVacationSetting != null)
|
if (actionGotoVacationSetting != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user