TF-802 Disable vacation responder in notification message

This commit is contained in:
dab246
2022-08-18 16:16:59 +07:00
committed by Dat H. Pham
parent 610d5771b4
commit 20a2e94b8e
11 changed files with 111 additions and 7 deletions
@@ -35,6 +35,7 @@ class VacationController extends BaseController {
final TextEditingController messageBodyEditorController = TextEditingController();
VacationResponse? currentVacation;
late Worker vacationWorker;
VacationController(
this._getAllVacationInteractor,
@@ -42,6 +43,12 @@ class VacationController extends BaseController {
this._verifyNameInteractor
);
@override
void onInit() {
_initWorker();
super.onInit();
}
@override
void onReady() {
_getAllVacation();
@@ -65,6 +72,17 @@ class VacationController extends BaseController {
@override
void onError(error) {}
void _initWorker() {
vacationWorker = ever(_accountDashBoardController.vacationResponse, (vacation) {
if (vacation is VacationResponse) {
currentVacation = vacation;
final newVacationPresentation = currentVacation?.toVacationPresentation();
vacationPresentation.value = newVacationPresentation ?? VacationPresentation.initialize();
messageBodyEditorController.text = newVacationPresentation?.messageBody ?? '';
}
});
}
void _getAllVacation() {
final accountId = _accountDashBoardController.accountId.value;
if (accountId != null) {
@@ -273,6 +291,7 @@ class VacationController extends BaseController {
@override
void onClose() {
messageBodyEditorController.dispose();
vacationWorker.dispose();
super.onClose();
}
}