TF-801 Show notification message when vacation enabled

This commit is contained in:
dab246
2022-08-17 22:10:11 +07:00
committed by Dat H. Pham
parent 04b3b49c23
commit f2a72ac883
32 changed files with 531 additions and 365 deletions
@@ -1,4 +1,5 @@
import 'package:core/utils/app_logger.dart';
import 'package:flutter/material.dart';
import 'package:jmap_dart_client/jmap/mail/vacation/vacation_response.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/model/vacation/vacation_presentation.dart';
@@ -23,4 +24,20 @@ extension VacationResponseExtension on VacationResponse {
vacationStopEnabled: toDate != null
);
}
bool get vacationResponderIsReady {
if (isEnabled == true) {
final currentDate = DateTime.now().toUtc();
log('VacationResponseExtension::vacationResponderEnabled(): currentDate: $currentDate');
final startDate = fromDate?.value.toUtc();
log('VacationResponseExtension::vacationResponderEnabled(): startDate: $startDate');
if (startDate?.isBefore(currentDate) == true ||
startDate?.isAtSameMomentAs(currentDate) == true) {
return true;
} else {
return false;
}
}
return false;
}
}