TF-3449 Setup Sender-set important flag in Setting View
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
|
Before Width: | Height: | Size: 758 B After Width: | Height: | Size: 758 B |
@@ -212,7 +212,7 @@ class ImagePaths {
|
|||||||
String get icUnsubscribe => _getImagePath('ic_unsubscribe.svg');
|
String get icUnsubscribe => _getImagePath('ic_unsubscribe.svg');
|
||||||
String get icRecoverDeletedMessages => _getImagePath('ic_recover_deleted_messages.svg');
|
String get icRecoverDeletedMessages => _getImagePath('ic_recover_deleted_messages.svg');
|
||||||
String get icPrinter => _getImagePath('ic_printer.svg');
|
String get icPrinter => _getImagePath('ic_printer.svg');
|
||||||
String get icAlwaysReadReceipt => _getImagePath('ic_always_read_receipt.svg');
|
String get icPreferences => _getImagePath('ic_preferences.svg');
|
||||||
String get icNotification => _getImagePath('ic_notification.svg');
|
String get icNotification => _getImagePath('ic_notification.svg');
|
||||||
String get icRemoveRule => _getImagePath('ic_remove_rule.svg');
|
String get icRemoveRule => _getImagePath('ic_remove_rule.svg');
|
||||||
String get icCheckboxUnselected => _getImagePath('ic_checkbox_unselected.svg');
|
String get icCheckboxUnselected => _getImagePath('ic_checkbox_unselected.svg');
|
||||||
|
|||||||
@@ -50,18 +50,14 @@ import 'package:tmail_ui_user/features/mailbox/domain/repository/mailbox_reposit
|
|||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/repository/composer_cache_repository.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/repository/composer_cache_repository.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/usecases/remove_composer_cache_on_web_interactor.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/usecases/remove_composer_cache_on_web_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_identities_interactor.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_identities_interactor.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/preferences/bindings/preferences_interactors_bindings.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/identities/identity_interactors_bindings.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/identities/identity_interactors_bindings.dart';
|
||||||
import 'package:tmail_ui_user/features/offline_mode/manager/new_email_cache_manager.dart';
|
import 'package:tmail_ui_user/features/offline_mode/manager/new_email_cache_manager.dart';
|
||||||
import 'package:tmail_ui_user/features/offline_mode/manager/new_email_cache_worker_queue.dart';
|
import 'package:tmail_ui_user/features/offline_mode/manager/new_email_cache_worker_queue.dart';
|
||||||
import 'package:tmail_ui_user/features/offline_mode/manager/opened_email_cache_manager.dart';
|
import 'package:tmail_ui_user/features/offline_mode/manager/opened_email_cache_manager.dart';
|
||||||
import 'package:tmail_ui_user/features/offline_mode/manager/opened_email_cache_worker_queue.dart';
|
import 'package:tmail_ui_user/features/offline_mode/manager/opened_email_cache_worker_queue.dart';
|
||||||
import 'package:tmail_ui_user/features/offline_mode/manager/sending_email_cache_manager.dart';
|
import 'package:tmail_ui_user/features/offline_mode/manager/sending_email_cache_manager.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/data/datasource/server_settings_data_source.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_server_setting_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/data/datasource_impl/remote_server_settings_data_source_impl.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/data/network/server_settings_api.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/data/repository/server_settings_repository_impl.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/repository/server_settings_repository.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_always_read_receipt_setting_interactor.dart';
|
|
||||||
import 'package:tmail_ui_user/features/thread/data/local/email_cache_manager.dart';
|
import 'package:tmail_ui_user/features/thread/data/local/email_cache_manager.dart';
|
||||||
import 'package:tmail_ui_user/features/upload/data/datasource/attachment_upload_datasource.dart';
|
import 'package:tmail_ui_user/features/upload/data/datasource/attachment_upload_datasource.dart';
|
||||||
import 'package:tmail_ui_user/features/upload/data/datasource_impl/attachment_upload_datasource_impl.dart';
|
import 'package:tmail_ui_user/features/upload/data/datasource_impl/attachment_upload_datasource_impl.dart';
|
||||||
@@ -141,9 +137,6 @@ class ComposerBindings extends BaseBindings {
|
|||||||
Get.lazyPut(() => EmailSessionStorageDatasourceImpl(
|
Get.lazyPut(() => EmailSessionStorageDatasourceImpl(
|
||||||
Get.find<SessionStorageManager>(),
|
Get.find<SessionStorageManager>(),
|
||||||
Get.find<CacheExceptionThrower>()));
|
Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => RemoteServerSettingsDataSourceImpl(
|
|
||||||
Get.find<ServerSettingsAPI>(),
|
|
||||||
Get.find<RemoteExceptionThrower>()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -156,8 +149,6 @@ class ComposerBindings extends BaseBindings {
|
|||||||
Get.lazyPut<HtmlDataSource>(() => Get.find<HtmlDataSourceImpl>());
|
Get.lazyPut<HtmlDataSource>(() => Get.find<HtmlDataSourceImpl>());
|
||||||
Get.lazyPut<StateDataSource>(() => Get.find<StateDataSourceImpl>());
|
Get.lazyPut<StateDataSource>(() => Get.find<StateDataSourceImpl>());
|
||||||
Get.lazyPut<PrintFileDataSource>(() => Get.find<PrintFileDataSourceImpl>());
|
Get.lazyPut<PrintFileDataSource>(() => Get.find<PrintFileDataSourceImpl>());
|
||||||
Get.lazyPut<ServerSettingsDataSource>(
|
|
||||||
() => Get.find<RemoteServerSettingsDataSourceImpl>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -188,9 +179,6 @@ class ComposerBindings extends BaseBindings {
|
|||||||
Get.find<StateDataSource>(),
|
Get.find<StateDataSource>(),
|
||||||
Get.find<PrintFileDataSource>(),
|
Get.find<PrintFileDataSource>(),
|
||||||
));
|
));
|
||||||
Get.lazyPut(() => ServerSettingsRepositoryImpl(
|
|
||||||
Get.find<ServerSettingsDataSource>(),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -199,7 +187,6 @@ class ComposerBindings extends BaseBindings {
|
|||||||
Get.lazyPut<ContactRepository>(() => Get.find<ContactRepositoryImpl>());
|
Get.lazyPut<ContactRepository>(() => Get.find<ContactRepositoryImpl>());
|
||||||
Get.lazyPut<MailboxRepository>(() => Get.find<MailboxRepositoryImpl>());
|
Get.lazyPut<MailboxRepository>(() => Get.find<MailboxRepositoryImpl>());
|
||||||
Get.lazyPut<EmailRepository>(() => Get.find<EmailRepositoryImpl>());
|
Get.lazyPut<EmailRepository>(() => Get.find<EmailRepositoryImpl>());
|
||||||
Get.lazyPut<ServerSettingsRepository>(() => Get.find<ServerSettingsRepositoryImpl>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -215,7 +202,6 @@ class ComposerBindings extends BaseBindings {
|
|||||||
));
|
));
|
||||||
Get.lazyPut(() => DownloadImageAsBase64Interactor(Get.find<ComposerRepository>()));
|
Get.lazyPut(() => DownloadImageAsBase64Interactor(Get.find<ComposerRepository>()));
|
||||||
Get.lazyPut(() => TransformHtmlEmailContentInteractor(Get.find<EmailRepository>()));
|
Get.lazyPut(() => TransformHtmlEmailContentInteractor(Get.find<EmailRepository>()));
|
||||||
Get.lazyPut(() => GetAlwaysReadReceiptSettingInteractor(Get.find<ServerSettingsRepository>()));
|
|
||||||
Get.lazyPut(() => CreateNewAndSendEmailInteractor(
|
Get.lazyPut(() => CreateNewAndSendEmailInteractor(
|
||||||
Get.find<EmailRepository>(),
|
Get.find<EmailRepository>(),
|
||||||
Get.find<ComposerRepository>(),
|
Get.find<ComposerRepository>(),
|
||||||
@@ -230,6 +216,7 @@ class ComposerBindings extends BaseBindings {
|
|||||||
Get.find<EmailRepository>()));
|
Get.find<EmailRepository>()));
|
||||||
|
|
||||||
IdentityInteractorsBindings().dependencies();
|
IdentityInteractorsBindings().dependencies();
|
||||||
|
PreferencesInteractorsBindings().dependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -250,7 +237,7 @@ class ComposerBindings extends BaseBindings {
|
|||||||
Get.find<SaveComposerCacheOnWebInteractor>(),
|
Get.find<SaveComposerCacheOnWebInteractor>(),
|
||||||
Get.find<DownloadImageAsBase64Interactor>(),
|
Get.find<DownloadImageAsBase64Interactor>(),
|
||||||
Get.find<TransformHtmlEmailContentInteractor>(),
|
Get.find<TransformHtmlEmailContentInteractor>(),
|
||||||
Get.find<GetAlwaysReadReceiptSettingInteractor>(),
|
Get.find<GetServerSettingInteractor>(),
|
||||||
Get.find<CreateNewAndSendEmailInteractor>(),
|
Get.find<CreateNewAndSendEmailInteractor>(),
|
||||||
Get.find<CreateNewAndSaveEmailToDraftsInteractor>(),
|
Get.find<CreateNewAndSaveEmailToDraftsInteractor>(),
|
||||||
Get.find<PrintEmailInteractor>(),
|
Get.find<PrintEmailInteractor>(),
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import 'package:permission_handler/permission_handler.dart';
|
|||||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||||
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
|
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
|
||||||
import 'package:rich_text_composer/rich_text_composer.dart';
|
import 'package:rich_text_composer/rich_text_composer.dart';
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings_extension.dart';
|
||||||
import 'package:super_tag_editor/tag_editor.dart';
|
import 'package:super_tag_editor/tag_editor.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/before_reconnect_handler.dart';
|
import 'package:tmail_ui_user/features/base/before_reconnect_handler.dart';
|
||||||
@@ -93,8 +94,8 @@ import 'package:tmail_ui_user/features/manage_account/presentation/extensions/id
|
|||||||
import 'package:tmail_ui_user/features/network_connection/presentation/network_connection_controller.dart'
|
import 'package:tmail_ui_user/features/network_connection/presentation/network_connection_controller.dart'
|
||||||
if (dart.library.html) 'package:tmail_ui_user/features/network_connection/presentation/web_network_connection_controller.dart';
|
if (dart.library.html) 'package:tmail_ui_user/features/network_connection/presentation/web_network_connection_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/sending_queue/domain/model/sending_email.dart';
|
import 'package:tmail_ui_user/features/sending_queue/domain/model/sending_email.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/state/get_always_read_receipt_setting_state.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/state/get_server_setting_state.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_always_read_receipt_setting_interactor.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_server_setting_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/upload/domain/exceptions/pick_file_exception.dart';
|
import 'package:tmail_ui_user/features/upload/domain/exceptions/pick_file_exception.dart';
|
||||||
import 'package:tmail_ui_user/features/upload/domain/extensions/list_file_info_extension.dart';
|
import 'package:tmail_ui_user/features/upload/domain/extensions/list_file_info_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/upload/domain/extensions/file_info_extension.dart';
|
import 'package:tmail_ui_user/features/upload/domain/extensions/file_info_extension.dart';
|
||||||
@@ -148,7 +149,7 @@ class ComposerController extends BaseController
|
|||||||
final SaveComposerCacheOnWebInteractor _saveComposerCacheOnWebInteractor;
|
final SaveComposerCacheOnWebInteractor _saveComposerCacheOnWebInteractor;
|
||||||
final DownloadImageAsBase64Interactor _downloadImageAsBase64Interactor;
|
final DownloadImageAsBase64Interactor _downloadImageAsBase64Interactor;
|
||||||
final TransformHtmlEmailContentInteractor _transformHtmlEmailContentInteractor;
|
final TransformHtmlEmailContentInteractor _transformHtmlEmailContentInteractor;
|
||||||
final GetAlwaysReadReceiptSettingInteractor _getAlwaysReadReceiptSettingInteractor;
|
final GetServerSettingInteractor _getServerSettingInteractor;
|
||||||
final CreateNewAndSendEmailInteractor _createNewAndSendEmailInteractor;
|
final CreateNewAndSendEmailInteractor _createNewAndSendEmailInteractor;
|
||||||
final CreateNewAndSaveEmailToDraftsInteractor _createNewAndSaveEmailToDraftsInteractor;
|
final CreateNewAndSaveEmailToDraftsInteractor _createNewAndSaveEmailToDraftsInteractor;
|
||||||
final PrintEmailInteractor printEmailInteractor;
|
final PrintEmailInteractor printEmailInteractor;
|
||||||
@@ -240,7 +241,7 @@ class ComposerController extends BaseController
|
|||||||
this._saveComposerCacheOnWebInteractor,
|
this._saveComposerCacheOnWebInteractor,
|
||||||
this._downloadImageAsBase64Interactor,
|
this._downloadImageAsBase64Interactor,
|
||||||
this._transformHtmlEmailContentInteractor,
|
this._transformHtmlEmailContentInteractor,
|
||||||
this._getAlwaysReadReceiptSettingInteractor,
|
this._getServerSettingInteractor,
|
||||||
this._createNewAndSendEmailInteractor,
|
this._createNewAndSendEmailInteractor,
|
||||||
this._createNewAndSaveEmailToDraftsInteractor,
|
this._createNewAndSaveEmailToDraftsInteractor,
|
||||||
this.printEmailInteractor,
|
this.printEmailInteractor,
|
||||||
@@ -367,8 +368,8 @@ class ComposerController extends BaseController
|
|||||||
richTextMobileTabletController?.insertImage(inlineImage);
|
richTextMobileTabletController?.insertImage(inlineImage);
|
||||||
}
|
}
|
||||||
maxWithEditor = null;
|
maxWithEditor = null;
|
||||||
} else if (success is GetAlwaysReadReceiptSettingSuccess) {
|
} else if (success is GetServerSettingSuccess) {
|
||||||
hasRequestReadReceipt.value = success.alwaysReadReceiptEnabled;
|
hasRequestReadReceipt.value = success.settingOption.isAlwaysReadReceipts;
|
||||||
_initEmailDraftHash();
|
_initEmailDraftHash();
|
||||||
} else if (success is RestoreEmailInlineImagesSuccess) {
|
} else if (success is RestoreEmailInlineImagesSuccess) {
|
||||||
_updateEditorContent(success);
|
_updateEditorContent(success);
|
||||||
@@ -396,7 +397,7 @@ class ComposerController extends BaseController
|
|||||||
if (identitySelected.value == null) {
|
if (identitySelected.value == null) {
|
||||||
_autoFocusFieldWhenLauncher();
|
_autoFocusFieldWhenLauncher();
|
||||||
}
|
}
|
||||||
} else if (failure is GetAlwaysReadReceiptSettingFailure) {
|
} else if (failure is GetServerSettingFailure) {
|
||||||
hasRequestReadReceipt.value = false;
|
hasRequestReadReceipt.value = false;
|
||||||
_initEmailDraftHash();
|
_initEmailDraftHash();
|
||||||
}
|
}
|
||||||
@@ -772,7 +773,7 @@ class ComposerController extends BaseController
|
|||||||
log('ComposerController::_initEmail: hasRequestReadReceipt = ${arguments.hasRequestReadReceipt}');
|
log('ComposerController::_initEmail: hasRequestReadReceipt = ${arguments.hasRequestReadReceipt}');
|
||||||
hasRequestReadReceipt.value = arguments.hasRequestReadReceipt ?? false;
|
hasRequestReadReceipt.value = arguments.hasRequestReadReceipt ?? false;
|
||||||
} else if (composerArguments.value?.emailActionType != EmailActionType.editDraft) {
|
} else if (composerArguments.value?.emailActionType != EmailActionType.editDraft) {
|
||||||
_getAlwaysReadReceiptSetting();
|
_getServerSetting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2242,11 +2243,10 @@ class ComposerController extends BaseController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _getAlwaysReadReceiptSetting() {
|
void _getServerSetting() {
|
||||||
log('ComposerController::_getAlwaysReadReceiptSetting:');
|
|
||||||
final accountId = mailboxDashBoardController.accountId.value;
|
final accountId = mailboxDashBoardController.accountId.value;
|
||||||
if (accountId != null) {
|
if (accountId != null) {
|
||||||
consumeState(_getAlwaysReadReceiptSettingInteractor.execute(accountId));
|
consumeState(_getServerSettingInteractor.execute(accountId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2447,7 +2447,7 @@ class ComposerController extends BaseController
|
|||||||
void _handleGetEmailContentFailure(GetEmailContentFailure failure) {
|
void _handleGetEmailContentFailure(GetEmailContentFailure failure) {
|
||||||
emailContentsViewState.value = Left(failure);
|
emailContentsViewState.value = Left(failure);
|
||||||
if (composerArguments.value?.emailActionType == EmailActionType.editDraft) {
|
if (composerArguments.value?.emailActionType == EmailActionType.editDraft) {
|
||||||
_getAlwaysReadReceiptSetting();
|
_getServerSetting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2456,7 +2456,7 @@ class ComposerController extends BaseController
|
|||||||
hasRequestReadReceipt.value = true;
|
hasRequestReadReceipt.value = true;
|
||||||
_initEmailDraftHash();
|
_initEmailDraftHash();
|
||||||
} else {
|
} else {
|
||||||
_getAlwaysReadReceiptSetting();
|
_getServerSetting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
@@ -102,6 +102,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller
|
|||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/search_controller.dart' as search;
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/search_controller.dart' as search;
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/spam_report_controller.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/spam_report_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/delete_emails_in_mailbox_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/delete_emails_in_mailbox_extension.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_preferences_setting_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/set_error_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/set_error_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/update_current_emails_flags_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/update_current_emails_flags_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart';
|
||||||
@@ -144,6 +145,8 @@ import 'package:tmail_ui_user/features/sending_queue/domain/usecases/get_all_sen
|
|||||||
import 'package:tmail_ui_user/features/sending_queue/domain/usecases/store_sending_email_interactor.dart';
|
import 'package:tmail_ui_user/features/sending_queue/domain/usecases/store_sending_email_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/sending_queue/domain/usecases/update_sending_email_interactor.dart';
|
import 'package:tmail_ui_user/features/sending_queue/domain/usecases/update_sending_email_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/sending_queue/presentation/model/sending_email_arguments.dart';
|
import 'package:tmail_ui_user/features/sending_queue/presentation/model/sending_email_arguments.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/state/get_server_setting_state.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_server_setting_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/thread/domain/model/filter_message_option.dart';
|
import 'package:tmail_ui_user/features/thread/domain/model/filter_message_option.dart';
|
||||||
import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart';
|
import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart';
|
||||||
import 'package:tmail_ui_user/features/thread/domain/state/empty_spam_folder_state.dart';
|
import 'package:tmail_ui_user/features/thread/domain/state/empty_spam_folder_state.dart';
|
||||||
@@ -174,6 +177,7 @@ import 'package:tmail_ui_user/main/universal_import/html_stub.dart' as html;
|
|||||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||||
import 'package:tmail_ui_user/main/utils/email_receive_manager.dart';
|
import 'package:tmail_ui_user/main/utils/email_receive_manager.dart';
|
||||||
import 'package:tmail_ui_user/main/utils/ios_notification_manager.dart';
|
import 'package:tmail_ui_user/main/utils/ios_notification_manager.dart';
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings_extension.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
class MailboxDashBoardController extends ReloadableController
|
class MailboxDashBoardController extends ReloadableController
|
||||||
@@ -221,6 +225,7 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
DeleteMailboxStateToRefreshInteractor? _deleteMailboxStateToRefreshInteractor;
|
DeleteMailboxStateToRefreshInteractor? _deleteMailboxStateToRefreshInteractor;
|
||||||
GetAutoCompleteInteractor? _getAutoCompleteInteractor;
|
GetAutoCompleteInteractor? _getAutoCompleteInteractor;
|
||||||
IOSNotificationManager? _iosNotificationManager;
|
IOSNotificationManager? _iosNotificationManager;
|
||||||
|
GetServerSettingInteractor? getServerSettingInteractor;
|
||||||
|
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
final selectedMailbox = Rxn<PresentationMailbox>();
|
final selectedMailbox = Rxn<PresentationMailbox>();
|
||||||
@@ -245,6 +250,7 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
final attachmentDraggableAppState = Rxn<DraggableAppState>();
|
final attachmentDraggableAppState = Rxn<DraggableAppState>();
|
||||||
final isRecoveringDeletedMessage = RxBool(false);
|
final isRecoveringDeletedMessage = RxBool(false);
|
||||||
final localFileDraggableAppState = Rxn<DraggableAppState>();
|
final localFileDraggableAppState = Rxn<DraggableAppState>();
|
||||||
|
final isSenderImportantFlagEnabled = RxBool(true);
|
||||||
|
|
||||||
Session? sessionCurrent;
|
Session? sessionCurrent;
|
||||||
Map<Role, MailboxId> mapDefaultMailboxIdByRole = {};
|
Map<Role, MailboxId> mapDefaultMailboxIdByRole = {};
|
||||||
@@ -439,6 +445,8 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
[success.emailId],
|
[success.emailId],
|
||||||
markStarAction: success.markStarAction,
|
markStarAction: success.markStarAction,
|
||||||
);
|
);
|
||||||
|
} else if (success is GetServerSettingSuccess) {
|
||||||
|
isSenderImportantFlagEnabled.value = success.settingOption.isDisplaySenderPriority;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,6 +479,8 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
toastManager.showMessageFailure(failure);
|
toastManager.showMessageFailure(failure);
|
||||||
} else if (failure is GetComposerCacheFailure) {
|
} else if (failure is GetComposerCacheFailure) {
|
||||||
_handleIdentityCache();
|
_handleIdentityCache();
|
||||||
|
} else if (failure is GetServerSettingFailure) {
|
||||||
|
isSenderImportantFlagEnabled.value = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,6 +744,7 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
injectRuleFilterBindings(session, currentAccountId);
|
injectRuleFilterBindings(session, currentAccountId);
|
||||||
injectVacationBindings(session, currentAccountId);
|
injectVacationBindings(session, currentAccountId);
|
||||||
injectWebSocket(session, currentAccountId);
|
injectWebSocket(session, currentAccountId);
|
||||||
|
injectPreferencesBindings();
|
||||||
if (PlatformInfo.isMobile) {
|
if (PlatformInfo.isMobile) {
|
||||||
injectFCMBindings(session, currentAccountId);
|
injectFCMBindings(session, currentAccountId);
|
||||||
}
|
}
|
||||||
@@ -741,6 +752,7 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
_getVacationResponse();
|
_getVacationResponse();
|
||||||
spamReportController.getSpamReportStateAction();
|
spamReportController.getSpamReportStateAction();
|
||||||
_getAllIdentities();
|
_getAllIdentities();
|
||||||
|
getServerSetting();
|
||||||
|
|
||||||
if (PlatformInfo.isMobile) {
|
if (PlatformInfo.isMobile) {
|
||||||
getAllSendingEmails();
|
getAllSendingEmails();
|
||||||
@@ -1900,6 +1912,7 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getAllIdentities();
|
_getAllIdentities();
|
||||||
|
getServerSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<PresentationEmail>> quickSearchEmails(String query) async {
|
Future<List<PresentationEmail>> quickSearchEmails(String query) async {
|
||||||
@@ -1965,6 +1978,7 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getAllIdentities();
|
_getAllIdentities();
|
||||||
|
getServerSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
||||||
|
|||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
import 'package:server_settings/server_settings/capability_server_settings.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/preferences/bindings/preferences_interactors_bindings.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_server_setting_interactor.dart';
|
||||||
|
import 'package:tmail_ui_user/main/error/capability_validator.dart';
|
||||||
|
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||||
|
|
||||||
|
extension HandlePreferencesSettingExtension on MailboxDashBoardController {
|
||||||
|
|
||||||
|
bool get isServerSettingsCapabilitySupported {
|
||||||
|
if (accountId.value == null || sessionCurrent == null) return false;
|
||||||
|
|
||||||
|
return capabilityServerSettings.isSupported(
|
||||||
|
sessionCurrent!,
|
||||||
|
accountId.value!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void injectPreferencesBindings() {
|
||||||
|
if (isServerSettingsCapabilitySupported) {
|
||||||
|
PreferencesInteractorsBindings().dependencies();
|
||||||
|
getServerSettingInteractor = getBinding<GetServerSettingInteractor>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void getServerSetting() {
|
||||||
|
if (accountId.value == null || getServerSettingInteractor == null) return;
|
||||||
|
|
||||||
|
consumeState(getServerSettingInteractor!.execute(accountId.value!));
|
||||||
|
}
|
||||||
|
}
|
||||||
-99
@@ -1,99 +0,0 @@
|
|||||||
import 'package:core/presentation/state/failure.dart';
|
|
||||||
import 'package:core/presentation/state/success.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/state/get_always_read_receipt_setting_state.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/state/update_always_read_receipt_setting_state.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_always_read_receipt_setting_interactor.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/usecases/update_always_read_receipt_setting_interactor.dart';
|
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
|
||||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
|
||||||
|
|
||||||
class AlwaysReadReceiptController extends BaseController {
|
|
||||||
AlwaysReadReceiptController(
|
|
||||||
this._getAlwaysReadReceiptSettingInteractor,
|
|
||||||
this._updateAlwaysReadReceiptSettingInteractor,
|
|
||||||
);
|
|
||||||
|
|
||||||
final GetAlwaysReadReceiptSettingInteractor _getAlwaysReadReceiptSettingInteractor;
|
|
||||||
final UpdateAlwaysReadReceiptSettingInteractor _updateAlwaysReadReceiptSettingInteractor;
|
|
||||||
|
|
||||||
final alwaysReadReceipt = Rxn<bool>();
|
|
||||||
bool get isLoading => viewState.value.fold(
|
|
||||||
(failure) => false,
|
|
||||||
(success) => success is GettingAlwaysReadReceiptSetting || success is UpdatingAlwaysReadReceiptSetting);
|
|
||||||
final _manageAccountDashBoardController = Get.find<ManageAccountDashBoardController>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
|
|
||||||
_getCurrentAlwaysReadReceiptSetting();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void handleSuccessViewState(Success success) {
|
|
||||||
super.handleSuccessViewState(success);
|
|
||||||
if (success is GetAlwaysReadReceiptSettingSuccess) {
|
|
||||||
_getAlwaysReadReceiptSettingSuccess(success);
|
|
||||||
} else if (success is UpdateAlwaysReadReceiptSettingSuccess) {
|
|
||||||
_updateAlwaysReadReceiptSettingSuccess(success);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void handleFailureViewState(Failure failure) {
|
|
||||||
super.handleFailureViewState(failure);
|
|
||||||
if (failure is GetAlwaysReadReceiptSettingFailure) {
|
|
||||||
_getAlwaysReadReceiptSettingFailure();
|
|
||||||
} else if (failure is UpdateAlwaysReadReceiptSettingFailure) {
|
|
||||||
_updateAlwaysReadReceiptSettingFailure();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _updateAlwaysReadReceiptValue(bool value) {
|
|
||||||
alwaysReadReceipt.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _updateAlwaysReadReceiptSettingFailure() {
|
|
||||||
if (currentOverlayContext != null && currentContext != null) {
|
|
||||||
appToast.showToastErrorMessage(
|
|
||||||
currentOverlayContext!,
|
|
||||||
AppLocalizations.of(currentContext!).an_error_occurred);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _updateAlwaysReadReceiptSettingSuccess(
|
|
||||||
UpdateAlwaysReadReceiptSettingSuccess success
|
|
||||||
) {
|
|
||||||
_updateAlwaysReadReceiptValue(success.alwaysReadReceiptIsEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleAlwaysReadReceipt() {
|
|
||||||
if (isLoading || alwaysReadReceipt.value == null) return;
|
|
||||||
final accountId = _manageAccountDashBoardController.accountId.value;
|
|
||||||
if (accountId != null) {
|
|
||||||
consumeState(_updateAlwaysReadReceiptSettingInteractor.execute(
|
|
||||||
accountId,
|
|
||||||
!alwaysReadReceipt.value!));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _getAlwaysReadReceiptSettingFailure() {
|
|
||||||
alwaysReadReceipt.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _getAlwaysReadReceiptSettingSuccess(
|
|
||||||
GetAlwaysReadReceiptSettingSuccess success
|
|
||||||
) {
|
|
||||||
_updateAlwaysReadReceiptValue(success.alwaysReadReceiptEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _getCurrentAlwaysReadReceiptSetting() {
|
|
||||||
final accountId = _manageAccountDashBoardController.accountId.value;
|
|
||||||
if (accountId != null) {
|
|
||||||
consumeState(_getAlwaysReadReceiptSettingInteractor.execute(accountId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-95
@@ -1,95 +0,0 @@
|
|||||||
import 'package:core/presentation/extensions/color_extension.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:tmail_ui_user/features/base/mixin/app_loader_mixin.dart';
|
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/always_read_receipt/always_read_receipt_controller.dart';
|
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
|
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
|
||||||
|
|
||||||
class AlwaysReadReceiptView extends GetWidget<AlwaysReadReceiptController> with AppLoaderMixin {
|
|
||||||
const AlwaysReadReceiptView({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: SettingsUtils.getBackgroundColor(context, controller.responsiveUtils),
|
|
||||||
body: Padding(
|
|
||||||
padding: SettingsUtils.getMarginViewForSettingDetails(context, controller.responsiveUtils),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Obx(() {
|
|
||||||
if (!controller.isLoading) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 8),
|
|
||||||
child: horizontalLoadingWidget,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
color: SettingsUtils.getContentBackgroundColor(context, controller.responsiveUtils),
|
|
||||||
decoration: SettingsUtils.getBoxDecorationForContent(context, controller.responsiveUtils),
|
|
||||||
padding: SettingsUtils.getPaddingAlwaysReadReceiptSetting(context, controller.responsiveUtils),
|
|
||||||
child: ListView(
|
|
||||||
physics: const ClampingScrollPhysics(),
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context).emailReadReceipts,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 17,
|
|
||||||
height: 24 / 17,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black)),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context).emailReadReceiptsSettingExplanation,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
height: 20 / 16,
|
|
||||||
color: AppColor.colorTextSettingDescriptions)),
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
Obx(() {
|
|
||||||
if (controller.alwaysReadReceipt.value == null) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
InkWell(
|
|
||||||
onTap: controller.toggleAlwaysReadReceipt,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(4),
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
controller.alwaysReadReceipt.value!
|
|
||||||
? controller.imagePaths.icSwitchOn
|
|
||||||
: controller.imagePaths.icSwitchOff,
|
|
||||||
fit: BoxFit.fill,
|
|
||||||
width: 32,
|
|
||||||
height: 20),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
AppLocalizations.of(context).emailReadReceiptsToggleDescription,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
height: 20 / 16,
|
|
||||||
color: Colors.black),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -22,7 +22,6 @@ import 'package:tmail_ui_user/features/manage_account/domain/state/update_vacati
|
|||||||
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/get_all_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/domain/usecases/update_vacation_interactor.dart';
|
||||||
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/always_read_receipt/bindings/always_read_receipt_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/email_rules/bindings/email_rules_bindings.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';
|
||||||
@@ -32,6 +31,7 @@ import 'package:tmail_ui_user/features/manage_account/presentation/model/account
|
|||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/manage_account_arguments.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/manage_account_arguments.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/settings_page_level.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/settings_page_level.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/notification/bindings/notification_binding.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/notification/bindings/notification_binding.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/preferences/bindings/preferences_bindings.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/profiles_bindings.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/profiles_bindings.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/vacation_controller_bindings.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/vacation_controller_bindings.dart';
|
||||||
import 'package:tmail_ui_user/main/error/capability_validator.dart';
|
import 'package:tmail_ui_user/main/error/capability_validator.dart';
|
||||||
@@ -184,8 +184,8 @@ class ManageAccountDashBoardController extends ReloadableController with UserSet
|
|||||||
case AccountMenuItem.emailRules:
|
case AccountMenuItem.emailRules:
|
||||||
EmailRulesBindings().dependencies();
|
EmailRulesBindings().dependencies();
|
||||||
break;
|
break;
|
||||||
case AccountMenuItem.alwaysReadReceipt:
|
case AccountMenuItem.preferences:
|
||||||
AlwaysReadReceiptBindings().dependencies();
|
PreferencesBindings().dependencies();
|
||||||
break;
|
break;
|
||||||
case AccountMenuItem.forward:
|
case AccountMenuItem.forward:
|
||||||
ForwardBindings().dependencies();
|
ForwardBindings().dependencies();
|
||||||
@@ -224,7 +224,7 @@ class ManageAccountDashBoardController extends ReloadableController with UserSet
|
|||||||
|
|
||||||
bool get isVacationCapabilitySupported {
|
bool get isVacationCapabilitySupported {
|
||||||
if (accountId.value != null && sessionCurrent != null) {
|
if (accountId.value != null && sessionCurrent != null) {
|
||||||
return [CapabilityIdentifier.jmapVacationResponse].isSupported(sessionCurrent!, accountId.value!);
|
return CapabilityIdentifier.jmapVacationResponse.isSupported(sessionCurrent!, accountId.value!);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -240,7 +240,7 @@ class ManageAccountDashBoardController extends ReloadableController with UserSet
|
|||||||
|
|
||||||
bool get isServerSettingsCapabilitySupported {
|
bool get isServerSettingsCapabilitySupported {
|
||||||
if (accountId.value != null && sessionCurrent != null) {
|
if (accountId.value != null && sessionCurrent != null) {
|
||||||
return [capabilityServerSettings].isSupported(sessionCurrent!, accountId.value!);
|
return capabilityServerSettings.isSupported(sessionCurrent!, accountId.value!);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ class ManageAccountDashBoardController extends ReloadableController with UserSet
|
|||||||
|
|
||||||
bool get isRuleFilterCapabilitySupported {
|
bool get isRuleFilterCapabilitySupported {
|
||||||
if (accountId.value != null && sessionCurrent != null) {
|
if (accountId.value != null && sessionCurrent != null) {
|
||||||
return [capabilityRuleFilter].isSupported(sessionCurrent!, accountId.value!);
|
return capabilityRuleFilter.isSupported(sessionCurrent!, accountId.value!);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ class ManageAccountDashBoardController extends ReloadableController with UserSet
|
|||||||
|
|
||||||
bool get isForwardCapabilitySupported {
|
bool get isForwardCapabilitySupported {
|
||||||
if (accountId.value != null && sessionCurrent != null) {
|
if (accountId.value != null && sessionCurrent != null) {
|
||||||
return [capabilityForward].isSupported(sessionCurrent!, accountId.value!);
|
return capabilityForward.isSupported(sessionCurrent!, accountId.value!);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:get/get.dart';
|
|||||||
import 'package:model/model.dart';
|
import 'package:model/model.dart';
|
||||||
import 'package:tmail_ui_user/features/base/state/banner_state.dart';
|
import 'package:tmail_ui_user/features/base/state/banner_state.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/navigation_bar/navigation_bar_widget.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/navigation_bar/navigation_bar_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/always_read_receipt/always_read_receipt_view.dart';
|
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_view.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/forward_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/forward/forward_view.dart';
|
||||||
@@ -17,6 +16,7 @@ import 'package:tmail_ui_user/features/manage_account/presentation/manage_accoun
|
|||||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/manage_account_menu_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/menu/manage_account_menu_view.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings/settings_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings/settings_view.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/preferences/preferences_view.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/profiles_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/profiles_view.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/vacation_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/vacation_view.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart';
|
||||||
@@ -117,19 +117,19 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
|||||||
case AccountMenuItem.languageAndRegion:
|
case AccountMenuItem.languageAndRegion:
|
||||||
return const LanguageAndRegionView();
|
return const LanguageAndRegionView();
|
||||||
case AccountMenuItem.emailRules:
|
case AccountMenuItem.emailRules:
|
||||||
if(controller.isRuleFilterCapabilitySupported){
|
if (controller.isRuleFilterCapabilitySupported){
|
||||||
return EmailRulesView();
|
return EmailRulesView();
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
case AccountMenuItem.alwaysReadReceipt:
|
case AccountMenuItem.preferences:
|
||||||
if(controller.isServerSettingsCapabilitySupported){
|
if (controller.isServerSettingsCapabilitySupported){
|
||||||
return const AlwaysReadReceiptView();
|
return const PreferencesView();
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
case AccountMenuItem.forward:
|
case AccountMenuItem.forward:
|
||||||
if(controller.isForwardCapabilitySupported){
|
if (controller.isForwardCapabilitySupported){
|
||||||
return ForwardView();
|
return ForwardView();
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class ManageAccountMenuController extends GetxController with ContactSupportMixi
|
|||||||
if (dashBoardController.isRuleFilterCapabilitySupported)
|
if (dashBoardController.isRuleFilterCapabilitySupported)
|
||||||
AccountMenuItem.emailRules,
|
AccountMenuItem.emailRules,
|
||||||
if (dashBoardController.isServerSettingsCapabilitySupported)
|
if (dashBoardController.isServerSettingsCapabilitySupported)
|
||||||
AccountMenuItem.alwaysReadReceipt,
|
AccountMenuItem.preferences,
|
||||||
if (dashBoardController.isForwardCapabilitySupported)
|
if (dashBoardController.isForwardCapabilitySupported)
|
||||||
AccountMenuItem.forward,
|
AccountMenuItem.forward,
|
||||||
if (dashBoardController.isVacationCapabilitySupported)
|
if (dashBoardController.isVacationCapabilitySupported)
|
||||||
|
|||||||
+3
-3
@@ -68,10 +68,10 @@ class SettingsFirstLevelView extends GetWidget<SettingsController> {
|
|||||||
if (controller.manageAccountDashboardController.isServerSettingsCapabilitySupported) {
|
if (controller.manageAccountDashboardController.isServerSettingsCapabilitySupported) {
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
SettingFirstLevelTileBuilder(
|
SettingFirstLevelTileBuilder(
|
||||||
AccountMenuItem.alwaysReadReceipt.getName(context),
|
AccountMenuItem.preferences.getName(context),
|
||||||
AccountMenuItem.alwaysReadReceipt.getIcon(controller.imagePaths),
|
AccountMenuItem.preferences.getIcon(controller.imagePaths),
|
||||||
subtitle: AppLocalizations.of(context).emailReadReceiptsSettingExplanation,
|
subtitle: AppLocalizations.of(context).emailReadReceiptsSettingExplanation,
|
||||||
() => controller.selectSettings(AccountMenuItem.alwaysReadReceipt)
|
() => controller.selectSettings(AccountMenuItem.preferences)
|
||||||
),
|
),
|
||||||
Divider(
|
Divider(
|
||||||
color: AppColor.colorDividerHorizontal,
|
color: AppColor.colorDividerHorizontal,
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ 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:tmail_ui_user/features/base/state/banner_state.dart';
|
import 'package:tmail_ui_user/features/base/state/banner_state.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/always_read_receipt/always_read_receipt_view.dart';
|
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_view.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/forward_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/forward/forward_view.dart';
|
||||||
@@ -19,6 +18,7 @@ import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings
|
|||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/settings_page_level.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/settings_page_level.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/notification/notification_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/notification/notification_view.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/preferences/preferences_view.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/profiles_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/profiles_view.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/vacation_view.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/vacation_view.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart';
|
||||||
@@ -198,9 +198,9 @@ class SettingsView extends GetWidget<SettingsController> {
|
|||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
case AccountMenuItem.alwaysReadReceipt:
|
case AccountMenuItem.preferences:
|
||||||
if (controller.manageAccountDashboardController.isServerSettingsCapabilitySupported) {
|
if (controller.manageAccountDashboardController.isServerSettingsCapabilitySupported) {
|
||||||
return const AlwaysReadReceiptView();
|
return const PreferencesView();
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
import 'package:core/core.dart';
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
enum AccountMenuItem {
|
enum AccountMenuItem {
|
||||||
profiles,
|
profiles,
|
||||||
languageAndRegion,
|
languageAndRegion,
|
||||||
alwaysReadReceipt,
|
preferences,
|
||||||
emailRules,
|
emailRules,
|
||||||
forward,
|
forward,
|
||||||
vacation,
|
vacation,
|
||||||
@@ -22,8 +22,8 @@ enum AccountMenuItem {
|
|||||||
return imagePaths.icProfiles;
|
return imagePaths.icProfiles;
|
||||||
case AccountMenuItem.languageAndRegion:
|
case AccountMenuItem.languageAndRegion:
|
||||||
return imagePaths.icLanguage;
|
return imagePaths.icLanguage;
|
||||||
case AccountMenuItem.alwaysReadReceipt:
|
case AccountMenuItem.preferences:
|
||||||
return imagePaths.icAlwaysReadReceipt;
|
return imagePaths.icPreferences;
|
||||||
case AccountMenuItem.emailRules:
|
case AccountMenuItem.emailRules:
|
||||||
return imagePaths.icEmailRules;
|
return imagePaths.icEmailRules;
|
||||||
case AccountMenuItem.forward:
|
case AccountMenuItem.forward:
|
||||||
@@ -51,8 +51,8 @@ enum AccountMenuItem {
|
|||||||
return AppLocalizations.of(context).language;
|
return AppLocalizations.of(context).language;
|
||||||
case AccountMenuItem.emailRules:
|
case AccountMenuItem.emailRules:
|
||||||
return AppLocalizations.of(context).emailRules;
|
return AppLocalizations.of(context).emailRules;
|
||||||
case AccountMenuItem.alwaysReadReceipt:
|
case AccountMenuItem.preferences:
|
||||||
return AppLocalizations.of(context).emailReadReceipts;
|
return AppLocalizations.of(context).preferences;
|
||||||
case AccountMenuItem.forward:
|
case AccountMenuItem.forward:
|
||||||
return AppLocalizations.of(context).forwarding;
|
return AppLocalizations.of(context).forwarding;
|
||||||
case AccountMenuItem.vacation:
|
case AccountMenuItem.vacation:
|
||||||
@@ -78,8 +78,8 @@ enum AccountMenuItem {
|
|||||||
return 'language-region';
|
return 'language-region';
|
||||||
case AccountMenuItem.emailRules:
|
case AccountMenuItem.emailRules:
|
||||||
return 'email-rules';
|
return 'email-rules';
|
||||||
case AccountMenuItem.alwaysReadReceipt:
|
case AccountMenuItem.preferences:
|
||||||
return 'email-read-receipts';
|
return 'preferences';
|
||||||
case AccountMenuItem.forward:
|
case AccountMenuItem.forward:
|
||||||
return 'forwarding';
|
return 'forwarding';
|
||||||
case AccountMenuItem.vacation:
|
case AccountMenuItem.vacation:
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings_extension.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
enum SettingOptionType {
|
||||||
|
readReceipt,
|
||||||
|
senderPriority;
|
||||||
|
|
||||||
|
String getTitle(AppLocalizations appLocalizations) {
|
||||||
|
switch(this) {
|
||||||
|
case SettingOptionType.readReceipt:
|
||||||
|
return appLocalizations.emailReadReceipts;
|
||||||
|
case SettingOptionType.senderPriority:
|
||||||
|
return appLocalizations.senderSetImportantFlag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getExplanation(AppLocalizations appLocalizations) {
|
||||||
|
switch(this) {
|
||||||
|
case SettingOptionType.readReceipt:
|
||||||
|
return appLocalizations.emailReadReceiptsSettingExplanation;
|
||||||
|
case SettingOptionType.senderPriority:
|
||||||
|
return appLocalizations.senderImportantSettingExplanation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getToggleDescription(AppLocalizations appLocalizations) {
|
||||||
|
switch(this) {
|
||||||
|
case SettingOptionType.readReceipt:
|
||||||
|
return appLocalizations.emailReadReceiptsToggleDescription;
|
||||||
|
case SettingOptionType.senderPriority:
|
||||||
|
return appLocalizations.senderImportantSettingToggleDescription;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEnabled(TMailServerSettingOptions settingOption) {
|
||||||
|
switch(this) {
|
||||||
|
case SettingOptionType.readReceipt:
|
||||||
|
return settingOption.isAlwaysReadReceipts;
|
||||||
|
case SettingOptionType.senderPriority:
|
||||||
|
return settingOption.isDisplaySenderPriority;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/preferences/bindings/preferences_interactors_bindings.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/preferences/preferences_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_server_setting_interactor.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/update_server_setting_interactor.dart';
|
||||||
|
|
||||||
|
class PreferencesBindings extends Bindings {
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
PreferencesInteractorsBindings().dependencies();
|
||||||
|
|
||||||
|
Get.lazyPut(() => PreferencesController(
|
||||||
|
Get.find<GetServerSettingInteractor>(),
|
||||||
|
Get.find<UpdateServerSettingInteractor>(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
-14
@@ -1,22 +1,15 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:tmail_ui_user/features/base/base_bindings.dart';
|
import 'package:tmail_ui_user/features/base/interactors_bindings.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/always_read_receipt/always_read_receipt_controller.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/data/datasource/server_settings_data_source.dart';
|
import 'package:tmail_ui_user/features/server_settings/data/datasource/server_settings_data_source.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/data/datasource_impl/remote_server_settings_data_source_impl.dart';
|
import 'package:tmail_ui_user/features/server_settings/data/datasource_impl/remote_server_settings_data_source_impl.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/data/network/server_settings_api.dart';
|
import 'package:tmail_ui_user/features/server_settings/data/network/server_settings_api.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/data/repository/server_settings_repository_impl.dart';
|
import 'package:tmail_ui_user/features/server_settings/data/repository/server_settings_repository_impl.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/repository/server_settings_repository.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/repository/server_settings_repository.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_always_read_receipt_setting_interactor.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_server_setting_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/usecases/update_always_read_receipt_setting_interactor.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/update_server_setting_interactor.dart';
|
||||||
import 'package:tmail_ui_user/main/exceptions/remote_exception_thrower.dart';
|
import 'package:tmail_ui_user/main/exceptions/remote_exception_thrower.dart';
|
||||||
|
|
||||||
class AlwaysReadReceiptBindings extends BaseBindings {
|
class PreferencesInteractorsBindings extends InteractorsBindings {
|
||||||
@override
|
|
||||||
void bindingsController() {
|
|
||||||
Get.put(AlwaysReadReceiptController(
|
|
||||||
Get.find<GetAlwaysReadReceiptSettingInteractor>(),
|
|
||||||
Get.find<UpdateAlwaysReadReceiptSettingInteractor>()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void bindingsDataSource() {
|
void bindingsDataSource() {
|
||||||
@@ -27,13 +20,14 @@ class AlwaysReadReceiptBindings extends BaseBindings {
|
|||||||
void bindingsDataSourceImpl() {
|
void bindingsDataSourceImpl() {
|
||||||
Get.lazyPut(() => RemoteServerSettingsDataSourceImpl(
|
Get.lazyPut(() => RemoteServerSettingsDataSourceImpl(
|
||||||
Get.find<ServerSettingsAPI>(),
|
Get.find<ServerSettingsAPI>(),
|
||||||
Get.find<RemoteExceptionThrower>()));
|
Get.find<RemoteExceptionThrower>(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void bindingsInteractor() {
|
void bindingsInteractor() {
|
||||||
Get.lazyPut(() => GetAlwaysReadReceiptSettingInteractor(Get.find<ServerSettingsRepository>()));
|
Get.lazyPut(() => GetServerSettingInteractor(Get.find<ServerSettingsRepository>()));
|
||||||
Get.lazyPut(() => UpdateAlwaysReadReceiptSettingInteractor(Get.find<ServerSettingsRepository>()));
|
Get.lazyPut(() => UpdateServerSettingInteractor(Get.find<ServerSettingsRepository>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
import 'package:core/presentation/state/failure.dart';
|
||||||
|
import 'package:core/presentation/state/success.dart';
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||||
|
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/home/data/exceptions/session_exceptions.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/setting_option_type.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/state/get_server_setting_state.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/state/update_server_setting_state.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_server_setting_interactor.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/update_server_setting_interactor.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||||
|
|
||||||
|
class PreferencesController extends BaseController {
|
||||||
|
PreferencesController(
|
||||||
|
this._getServerSettingInteractor,
|
||||||
|
this._updateServerSettingInteractor,
|
||||||
|
);
|
||||||
|
|
||||||
|
final GetServerSettingInteractor _getServerSettingInteractor;
|
||||||
|
final UpdateServerSettingInteractor _updateServerSettingInteractor;
|
||||||
|
|
||||||
|
final settingOption = Rxn<TMailServerSettingOptions>();
|
||||||
|
|
||||||
|
bool get isLoading => viewState.value.fold(
|
||||||
|
(failure) => false,
|
||||||
|
(success) => success is GettingServerSetting || success is UpdatingServerSetting);
|
||||||
|
|
||||||
|
final _manageAccountDashBoardController = Get.find<ManageAccountDashBoardController>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
_getSettingOption();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void handleSuccessViewState(Success success) {
|
||||||
|
if (success is GetServerSettingSuccess) {
|
||||||
|
_updateSettingOptionValue(newSettingOption: success.settingOption);
|
||||||
|
} else if (success is UpdateServerSettingSuccess) {
|
||||||
|
_updateSettingOptionValue(newSettingOption: success.settingOption);
|
||||||
|
} else {
|
||||||
|
super.handleSuccessViewState(success);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void handleFailureViewState(Failure failure) {
|
||||||
|
if (failure is GetServerSettingFailure) {
|
||||||
|
_updateSettingOptionValue(newSettingOption: null);
|
||||||
|
} else if (failure is UpdateServerSettingFailure) {
|
||||||
|
_handleUpdateServerSettingFailure();
|
||||||
|
} else {
|
||||||
|
super.handleFailureViewState(failure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _handleUpdateServerSettingFailure() {
|
||||||
|
if (currentOverlayContext != null && currentContext != null) {
|
||||||
|
appToast.showToastErrorMessage(
|
||||||
|
currentOverlayContext!,
|
||||||
|
AppLocalizations.of(currentContext!).an_error_occurred);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _updateSettingOptionValue({required TMailServerSettingOptions? newSettingOption}) {
|
||||||
|
settingOption.value = newSettingOption;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _getSettingOption() {
|
||||||
|
final accountId = _manageAccountDashBoardController.accountId.value;
|
||||||
|
if (accountId != null) {
|
||||||
|
consumeState(_getServerSettingInteractor.execute(accountId));
|
||||||
|
} else {
|
||||||
|
consumeState(Stream.value(Left(GetServerSettingFailure(NotFoundAccountIdException()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateStateSettingOption(SettingOptionType optionType, bool isEnabled) {
|
||||||
|
TMailServerSettingOptions? newSettingOption;
|
||||||
|
switch(optionType) {
|
||||||
|
case SettingOptionType.readReceipt:
|
||||||
|
newSettingOption = settingOption.value?.copyWith(
|
||||||
|
alwaysReadReceipts: !isEnabled,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case SettingOptionType.senderPriority:
|
||||||
|
newSettingOption = settingOption.value?.copyWith(
|
||||||
|
displaySenderPriority: !isEnabled,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
final accountId = _manageAccountDashBoardController.accountId.value;
|
||||||
|
if (accountId != null && newSettingOption != null) {
|
||||||
|
consumeState(_updateServerSettingInteractor.execute(
|
||||||
|
accountId,
|
||||||
|
newSettingOption,
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
consumeState(Stream.value(Left(UpdateServerSettingFailure(NotFoundAccountIdException()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:tmail_ui_user/features/base/mixin/app_loader_mixin.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/setting_option_type.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/preferences/preferences_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/preferences/widgets/setting_option_item.dart';
|
||||||
|
|
||||||
|
class PreferencesView extends GetWidget<PreferencesController> with AppLoaderMixin {
|
||||||
|
const PreferencesView({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: SettingsUtils.getBackgroundColor(context, controller.responsiveUtils),
|
||||||
|
body: Padding(
|
||||||
|
padding: SettingsUtils.getMarginViewForSettingDetails(context, controller.responsiveUtils),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Obx(() {
|
||||||
|
if (!controller.isLoading) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 8),
|
||||||
|
child: horizontalLoadingWidget,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
color: SettingsUtils.getContentBackgroundColor(
|
||||||
|
context, controller.responsiveUtils,
|
||||||
|
),
|
||||||
|
decoration: SettingsUtils.getBoxDecorationForContent(
|
||||||
|
context,
|
||||||
|
controller.responsiveUtils,
|
||||||
|
),
|
||||||
|
width: double.infinity,
|
||||||
|
padding: SettingsUtils.getPaddingAlwaysReadReceiptSetting(
|
||||||
|
context,
|
||||||
|
controller.responsiveUtils,
|
||||||
|
),
|
||||||
|
child: Obx(() {
|
||||||
|
final settingOption = controller.settingOption.value;
|
||||||
|
|
||||||
|
if (settingOption == null) return const SizedBox.shrink();
|
||||||
|
|
||||||
|
final settingOptionList = SettingOptionType.values.toList();
|
||||||
|
|
||||||
|
return ListView.separated(
|
||||||
|
itemCount: settingOptionList.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return SettingOptionItem(
|
||||||
|
imagePaths: controller.imagePaths,
|
||||||
|
settingOption: settingOption,
|
||||||
|
optionType: settingOptionList[index],
|
||||||
|
onTapSettingOptionAction: controller.updateStateSettingOption,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (_, __) => const SizedBox(height: 60),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
|
||||||
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/setting_option_type.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
typedef OnTapSettingOptionAction = Function(SettingOptionType optionType, bool isEnabled);
|
||||||
|
|
||||||
|
class SettingOptionItem extends StatelessWidget {
|
||||||
|
|
||||||
|
final ImagePaths imagePaths;
|
||||||
|
final TMailServerSettingOptions settingOption;
|
||||||
|
final SettingOptionType optionType;
|
||||||
|
final OnTapSettingOptionAction onTapSettingOptionAction;
|
||||||
|
|
||||||
|
const SettingOptionItem({
|
||||||
|
super.key,
|
||||||
|
required this.imagePaths,
|
||||||
|
required this.settingOption,
|
||||||
|
required this.optionType,
|
||||||
|
required this.onTapSettingOptionAction,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final appLocalizations = AppLocalizations.of(context);
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
optionType.getTitle(appLocalizations),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
height: 20 / 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||||
|
child: Text(
|
||||||
|
optionType.getExplanation(appLocalizations),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
height: 16 / 13,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () => onTapSettingOptionAction(
|
||||||
|
optionType,
|
||||||
|
optionType.isEnabled(settingOption),
|
||||||
|
),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
optionType.isEnabled(settingOption)
|
||||||
|
? imagePaths.icSwitchOn
|
||||||
|
: imagePaths.icSwitchOff,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
width: 44,
|
||||||
|
height: 28,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
optionType.getToggleDescription(appLocalizations),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
height: 16 / 13,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -648,6 +648,7 @@ class SearchEmailView extends GetWidget<SearchEmailController>
|
|||||||
selectAllMode: controller.selectionMode.value,
|
selectAllMode: controller.selectionMode.value,
|
||||||
searchQuery: controller.searchQuery,
|
searchQuery: controller.searchQuery,
|
||||||
isShowingEmailContent: controller.mailboxDashBoardController.selectedEmail.value?.id == currentPresentationEmail.id,
|
isShowingEmailContent: controller.mailboxDashBoardController.selectedEmail.value?.id == currentPresentationEmail.id,
|
||||||
|
isSenderImportantFlagEnabled: controller.mailboxDashBoardController.isSenderImportantFlagEnabled.value,
|
||||||
isSearchEmailRunning: true,
|
isSearchEmailRunning: true,
|
||||||
padding: SearchEmailViewStyle.getPaddingSearchResultList(context, controller.responsiveUtils),
|
padding: SearchEmailViewStyle.getPaddingSearchResultList(context, controller.responsiveUtils),
|
||||||
mailboxContain: currentPresentationEmail.mailboxContain,
|
mailboxContain: currentPresentationEmail.mailboxContain,
|
||||||
@@ -697,6 +698,7 @@ class SearchEmailView extends GetWidget<SearchEmailController>
|
|||||||
selectAllMode: controller.selectionMode.value,
|
selectAllMode: controller.selectionMode.value,
|
||||||
searchQuery: controller.searchQuery,
|
searchQuery: controller.searchQuery,
|
||||||
isShowingEmailContent: controller.mailboxDashBoardController.selectedEmail.value?.id == currentPresentationEmail.id,
|
isShowingEmailContent: controller.mailboxDashBoardController.selectedEmail.value?.id == currentPresentationEmail.id,
|
||||||
|
isSenderImportantFlagEnabled: controller.mailboxDashBoardController.isSenderImportantFlagEnabled.value,
|
||||||
isSearchEmailRunning: true,
|
isSearchEmailRunning: true,
|
||||||
padding: SearchEmailViewStyle.getPaddingSearchResultList(
|
padding: SearchEmailViewStyle.getPaddingSearchResultList(
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
class NotFoundServerSettingsException implements Exception {}
|
class NotFoundServerSettingsException implements Exception {}
|
||||||
|
|
||||||
|
class NotFoundSettingOptionException implements Exception {}
|
||||||
|
|
||||||
class CanNotUpdateServerSettingsException implements Exception {}
|
class CanNotUpdateServerSettingsException implements Exception {}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import 'package:core/presentation/state/failure.dart';
|
|
||||||
import 'package:core/presentation/state/success.dart';
|
|
||||||
|
|
||||||
class GettingAlwaysReadReceiptSetting extends LoadingState {}
|
|
||||||
|
|
||||||
class GetAlwaysReadReceiptSettingSuccess extends UIState {
|
|
||||||
final bool alwaysReadReceiptEnabled;
|
|
||||||
|
|
||||||
GetAlwaysReadReceiptSettingSuccess({required this.alwaysReadReceiptEnabled});
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object?> get props => [alwaysReadReceiptEnabled];
|
|
||||||
}
|
|
||||||
|
|
||||||
class GetAlwaysReadReceiptSettingFailure extends FeatureFailure {
|
|
||||||
GetAlwaysReadReceiptSettingFailure(dynamic exception)
|
|
||||||
: super(exception: exception);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import 'package:core/presentation/state/failure.dart';
|
||||||
|
import 'package:core/presentation/state/success.dart';
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||||
|
|
||||||
|
class GettingServerSetting extends LoadingState {}
|
||||||
|
|
||||||
|
class GetServerSettingSuccess extends UIState {
|
||||||
|
final TMailServerSettingOptions settingOption;
|
||||||
|
|
||||||
|
GetServerSettingSuccess(this.settingOption);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [settingOption];
|
||||||
|
}
|
||||||
|
|
||||||
|
class GetServerSettingFailure extends FeatureFailure {
|
||||||
|
GetServerSettingFailure(dynamic exception)
|
||||||
|
: super(exception: exception);
|
||||||
|
}
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
import 'package:core/core.dart';
|
|
||||||
|
|
||||||
class UpdatingAlwaysReadReceiptSetting extends LoadingState {}
|
|
||||||
|
|
||||||
class UpdateAlwaysReadReceiptSettingSuccess extends UIState {
|
|
||||||
final bool alwaysReadReceiptIsEnabled;
|
|
||||||
|
|
||||||
UpdateAlwaysReadReceiptSettingSuccess({required this.alwaysReadReceiptIsEnabled});
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object?> get props => [alwaysReadReceiptIsEnabled];
|
|
||||||
}
|
|
||||||
|
|
||||||
class UpdateAlwaysReadReceiptSettingFailure extends FeatureFailure {
|
|
||||||
UpdateAlwaysReadReceiptSettingFailure(dynamic exception)
|
|
||||||
: super(exception: exception);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import 'package:core/presentation/state/failure.dart';
|
||||||
|
import 'package:core/presentation/state/success.dart';
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||||
|
|
||||||
|
class UpdatingServerSetting extends LoadingState {}
|
||||||
|
|
||||||
|
class UpdateServerSettingSuccess extends UIState {
|
||||||
|
final TMailServerSettingOptions settingOption;
|
||||||
|
|
||||||
|
UpdateServerSettingSuccess(this.settingOption);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [settingOption];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateServerSettingFailure extends FeatureFailure {
|
||||||
|
UpdateServerSettingFailure(dynamic exception)
|
||||||
|
: super(exception: exception);
|
||||||
|
}
|
||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
import 'package:core/presentation/state/failure.dart';
|
|
||||||
import 'package:core/presentation/state/success.dart';
|
|
||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/repository/server_settings_repository.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/state/get_always_read_receipt_setting_state.dart';
|
|
||||||
|
|
||||||
class GetAlwaysReadReceiptSettingInteractor {
|
|
||||||
final ServerSettingsRepository _serverSettingsRepository;
|
|
||||||
|
|
||||||
GetAlwaysReadReceiptSettingInteractor(this._serverSettingsRepository);
|
|
||||||
|
|
||||||
Stream<Either<Failure, Success>> execute(AccountId accountId) async* {
|
|
||||||
try {
|
|
||||||
yield Right(GettingAlwaysReadReceiptSetting());
|
|
||||||
final result = await _serverSettingsRepository.getServerSettings(accountId);
|
|
||||||
yield Right(GetAlwaysReadReceiptSettingSuccess(
|
|
||||||
alwaysReadReceiptEnabled: result.settings?.alwaysReadReceipts ?? false));
|
|
||||||
} catch (e) {
|
|
||||||
yield Left(GetAlwaysReadReceiptSettingFailure(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import 'package:core/presentation/state/failure.dart';
|
||||||
|
import 'package:core/presentation/state/success.dart';
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/exceptions/server_settings_exception.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/repository/server_settings_repository.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/state/get_server_setting_state.dart';
|
||||||
|
|
||||||
|
class GetServerSettingInteractor {
|
||||||
|
final ServerSettingsRepository _serverSettingsRepository;
|
||||||
|
|
||||||
|
GetServerSettingInteractor(this._serverSettingsRepository);
|
||||||
|
|
||||||
|
Stream<Either<Failure, Success>> execute(AccountId accountId) async* {
|
||||||
|
try {
|
||||||
|
yield Right(GettingServerSetting());
|
||||||
|
final serverSetting = await _serverSettingsRepository.getServerSettings(accountId);
|
||||||
|
final settingOption = serverSetting.settings;
|
||||||
|
if (settingOption == null) {
|
||||||
|
yield Left(GetServerSettingFailure(NotFoundSettingOptionException()));
|
||||||
|
} else {
|
||||||
|
yield Right(GetServerSettingSuccess(settingOption));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
yield Left(GetServerSettingFailure(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
import 'package:core/core.dart';
|
|
||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
|
||||||
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/repository/server_settings_repository.dart';
|
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/state/update_always_read_receipt_setting_state.dart';
|
|
||||||
|
|
||||||
class UpdateAlwaysReadReceiptSettingInteractor {
|
|
||||||
final ServerSettingsRepository _serverSettingsRepository;
|
|
||||||
|
|
||||||
UpdateAlwaysReadReceiptSettingInteractor(this._serverSettingsRepository);
|
|
||||||
|
|
||||||
Stream<Either<Failure, Success>> execute(
|
|
||||||
AccountId accountId,
|
|
||||||
bool isEnabled
|
|
||||||
) async* {
|
|
||||||
yield Right(UpdatingAlwaysReadReceiptSetting());
|
|
||||||
try {
|
|
||||||
final result = await _serverSettingsRepository.updateServerSettings(
|
|
||||||
accountId,
|
|
||||||
TMailServerSettings(
|
|
||||||
settings: TMailServerSettingOptions(alwaysReadReceipts: isEnabled)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
yield Right(UpdateAlwaysReadReceiptSettingSuccess(
|
|
||||||
alwaysReadReceiptIsEnabled: result.settings?.alwaysReadReceipts ?? true));
|
|
||||||
} catch (e) {
|
|
||||||
yield Left(UpdateAlwaysReadReceiptSettingFailure(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import 'package:core/presentation/state/failure.dart';
|
||||||
|
import 'package:core/presentation/state/success.dart';
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/exceptions/server_settings_exception.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/repository/server_settings_repository.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/state/update_server_setting_state.dart';
|
||||||
|
|
||||||
|
class UpdateServerSettingInteractor {
|
||||||
|
final ServerSettingsRepository _serverSettingsRepository;
|
||||||
|
|
||||||
|
UpdateServerSettingInteractor(this._serverSettingsRepository);
|
||||||
|
|
||||||
|
Stream<Either<Failure, Success>> execute(
|
||||||
|
AccountId accountId,
|
||||||
|
TMailServerSettingOptions newSettingOption,
|
||||||
|
) async* {
|
||||||
|
yield Right(UpdatingServerSetting());
|
||||||
|
try {
|
||||||
|
final serverSetting = await _serverSettingsRepository.updateServerSettings(
|
||||||
|
accountId,
|
||||||
|
TMailServerSettings(settings: newSettingOption),
|
||||||
|
);
|
||||||
|
final settingOption = serverSetting.settings;
|
||||||
|
if (settingOption == null) {
|
||||||
|
yield Left(UpdateServerSettingFailure(NotFoundServerSettingsException()));
|
||||||
|
} else {
|
||||||
|
yield Right(UpdateServerSettingSuccess(settingOption));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
yield Left(UpdateServerSettingFailure(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -497,6 +497,8 @@ class ThreadView extends GetWidget<ThreadController>
|
|||||||
Widget _buildEmailItemWhenDragging(BuildContext context, PresentationEmail presentationEmail) {
|
Widget _buildEmailItemWhenDragging(BuildContext context, PresentationEmail presentationEmail) {
|
||||||
final isShowingEmailContent = controller.mailboxDashBoardController.selectedEmail.value?.id == presentationEmail.id;
|
final isShowingEmailContent = controller.mailboxDashBoardController.selectedEmail.value?.id == presentationEmail.id;
|
||||||
final selectModeAll = controller.mailboxDashBoardController.currentSelectMode.value;
|
final selectModeAll = controller.mailboxDashBoardController.currentSelectMode.value;
|
||||||
|
final isSenderImportantFlagEnabled =
|
||||||
|
controller.mailboxDashBoardController.isSenderImportantFlagEnabled.value;
|
||||||
|
|
||||||
return EmailTileBuilder(
|
return EmailTileBuilder(
|
||||||
key: Key('email_tile_builder_${presentationEmail.id?.asString}'),
|
key: Key('email_tile_builder_${presentationEmail.id?.asString}'),
|
||||||
@@ -506,13 +508,16 @@ class ThreadView extends GetWidget<ThreadController>
|
|||||||
searchQuery: controller.searchQuery,
|
searchQuery: controller.searchQuery,
|
||||||
mailboxContain: presentationEmail.mailboxContain,
|
mailboxContain: presentationEmail.mailboxContain,
|
||||||
isSearchEmailRunning: controller.searchController.isSearchEmailRunning,
|
isSearchEmailRunning: controller.searchController.isSearchEmailRunning,
|
||||||
isDrag: true
|
isDrag: true,
|
||||||
|
isSenderImportantFlagEnabled: isSenderImportantFlagEnabled,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEmailItemNotDraggable(BuildContext context, PresentationEmail presentationEmail) {
|
Widget _buildEmailItemNotDraggable(BuildContext context, PresentationEmail presentationEmail) {
|
||||||
final isShowingEmailContent = controller.mailboxDashBoardController.selectedEmail.value?.id == presentationEmail.id;
|
final isShowingEmailContent = controller.mailboxDashBoardController.selectedEmail.value?.id == presentationEmail.id;
|
||||||
final selectModeAll = controller.mailboxDashBoardController.currentSelectMode.value;
|
final selectModeAll = controller.mailboxDashBoardController.currentSelectMode.value;
|
||||||
|
final isSenderImportantFlagEnabled =
|
||||||
|
controller.mailboxDashBoardController.isSenderImportantFlagEnabled.value;
|
||||||
|
|
||||||
return Dismissible(
|
return Dismissible(
|
||||||
key: ValueKey<EmailId?>(presentationEmail.id),
|
key: ValueKey<EmailId?>(presentationEmail.id),
|
||||||
@@ -588,6 +593,7 @@ class ThreadView extends GetWidget<ThreadController>
|
|||||||
presentationEmail: presentationEmail,
|
presentationEmail: presentationEmail,
|
||||||
selectAllMode: selectModeAll,
|
selectAllMode: selectModeAll,
|
||||||
isShowingEmailContent: isShowingEmailContent,
|
isShowingEmailContent: isShowingEmailContent,
|
||||||
|
isSenderImportantFlagEnabled: isSenderImportantFlagEnabled,
|
||||||
searchQuery: controller.searchQuery,
|
searchQuery: controller.searchQuery,
|
||||||
mailboxContain: presentationEmail.mailboxContain,
|
mailboxContain: presentationEmail.mailboxContain,
|
||||||
isSearchEmailRunning: controller.searchController.isSearchEmailRunning,
|
isSearchEmailRunning: controller.searchController.isSearchEmailRunning,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class EmailTileBuilder extends StatelessWidget with BaseEmailItemTile {
|
|||||||
final EdgeInsetsGeometry? padding;
|
final EdgeInsetsGeometry? padding;
|
||||||
final bool isDrag;
|
final bool isDrag;
|
||||||
final bool isShowingEmailContent;
|
final bool isShowingEmailContent;
|
||||||
|
final bool isSenderImportantFlagEnabled;
|
||||||
final OnPressEmailActionClick? emailActionClick;
|
final OnPressEmailActionClick? emailActionClick;
|
||||||
final OnMoreActionClick? onMoreActionClick;
|
final OnMoreActionClick? onMoreActionClick;
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ class EmailTileBuilder extends StatelessWidget with BaseEmailItemTile {
|
|||||||
required this.isShowingEmailContent,
|
required this.isShowingEmailContent,
|
||||||
this.searchQuery,
|
this.searchQuery,
|
||||||
this.isSearchEmailRunning = false,
|
this.isSearchEmailRunning = false,
|
||||||
|
this.isSenderImportantFlagEnabled = true,
|
||||||
this.mailboxContain,
|
this.mailboxContain,
|
||||||
this.padding,
|
this.padding,
|
||||||
this.isDrag = false,
|
this.isDrag = false,
|
||||||
@@ -104,7 +106,7 @@ class EmailTileBuilder extends StatelessWidget with BaseEmailItemTile {
|
|||||||
children: [
|
children: [
|
||||||
if (presentationEmail.hasCalendarEvent)
|
if (presentationEmail.hasCalendarEvent)
|
||||||
buildCalendarEventIcon(context: context, presentationEmail: presentationEmail),
|
buildCalendarEventIcon(context: context, presentationEmail: presentationEmail),
|
||||||
if (presentationEmail.isMarkAsImportant)
|
if (presentationEmail.isMarkAsImportant && isSenderImportantFlagEnabled)
|
||||||
buildMarkAsImportantIcon(context),
|
buildMarkAsImportantIcon(context),
|
||||||
Expanded(child: buildEmailTitle(
|
Expanded(child: buildEmailTitle(
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class EmailTileBuilder extends StatefulWidget {
|
|||||||
final EdgeInsetsGeometry? padding;
|
final EdgeInsetsGeometry? padding;
|
||||||
final bool isDrag;
|
final bool isDrag;
|
||||||
final bool isShowingEmailContent;
|
final bool isShowingEmailContent;
|
||||||
|
final bool isSenderImportantFlagEnabled;
|
||||||
final OnPressEmailActionClick? emailActionClick;
|
final OnPressEmailActionClick? emailActionClick;
|
||||||
final OnMoreActionClick? onMoreActionClick;
|
final OnMoreActionClick? onMoreActionClick;
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ class EmailTileBuilder extends StatefulWidget {
|
|||||||
required this.isShowingEmailContent,
|
required this.isShowingEmailContent,
|
||||||
this.searchQuery,
|
this.searchQuery,
|
||||||
this.isSearchEmailRunning = false,
|
this.isSearchEmailRunning = false,
|
||||||
|
this.isSenderImportantFlagEnabled = true,
|
||||||
this.mailboxContain,
|
this.mailboxContain,
|
||||||
this.padding,
|
this.padding,
|
||||||
this.isDrag = false,
|
this.isDrag = false,
|
||||||
@@ -140,7 +142,7 @@ class _EmailTileBuilderState extends State<EmailTileBuilder> with BaseEmailItem
|
|||||||
context: context,
|
context: context,
|
||||||
presentationEmail: widget.presentationEmail
|
presentationEmail: widget.presentationEmail
|
||||||
),
|
),
|
||||||
if (widget.presentationEmail.isMarkAsImportant)
|
if (widget.presentationEmail.isMarkAsImportant && widget.isSenderImportantFlagEnabled)
|
||||||
buildMarkAsImportantIcon(context),
|
buildMarkAsImportantIcon(context),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: buildEmailTitle(
|
child: buildEmailTitle(
|
||||||
@@ -259,7 +261,7 @@ class _EmailTileBuilderState extends State<EmailTileBuilder> with BaseEmailItem
|
|||||||
context: context,
|
context: context,
|
||||||
presentationEmail: widget.presentationEmail
|
presentationEmail: widget.presentationEmail
|
||||||
),
|
),
|
||||||
if (widget.presentationEmail.isMarkAsImportant)
|
if (widget.presentationEmail.isMarkAsImportant && widget.isSenderImportantFlagEnabled)
|
||||||
buildMarkAsImportantIcon(context),
|
buildMarkAsImportantIcon(context),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: buildEmailTitle(
|
child: buildEmailTitle(
|
||||||
@@ -615,7 +617,7 @@ class _EmailTileBuilderState extends State<EmailTileBuilder> with BaseEmailItem
|
|||||||
return Row(children: [
|
return Row(children: [
|
||||||
if (widget.presentationEmail.hasCalendarEvent)
|
if (widget.presentationEmail.hasCalendarEvent)
|
||||||
buildCalendarEventIcon(context: context, presentationEmail: widget.presentationEmail),
|
buildCalendarEventIcon(context: context, presentationEmail: widget.presentationEmail),
|
||||||
if (widget.presentationEmail.isMarkAsImportant)
|
if (widget.presentationEmail.isMarkAsImportant && widget.isSenderImportantFlagEnabled)
|
||||||
buildMarkAsImportantIcon(context),
|
buildMarkAsImportantIcon(context),
|
||||||
if (widget.presentationEmail.getEmailTitle().isNotEmpty)
|
if (widget.presentationEmail.getEmailTitle().isNotEmpty)
|
||||||
Container(
|
Container(
|
||||||
|
|||||||
@@ -4339,5 +4339,29 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"preferences": "Preferences",
|
||||||
|
"@preferences": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"senderSetImportantFlag": "Sender-set important flag",
|
||||||
|
"@senderSetImportantFlag": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"senderImportantSettingExplanation": "Enables display of important emails flag in your inbox. This feature is controlled by the sender and thus could result in abuses.",
|
||||||
|
"@senderImportantSettingExplanation": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"senderImportantSettingToggleDescription": "Display sender-set important flag",
|
||||||
|
"@senderImportantSettingToggleDescription": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4555,4 +4555,32 @@ class AppLocalizations {
|
|||||||
name: 'turnOffMarkAsImportant',
|
name: 'turnOffMarkAsImportant',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get preferences {
|
||||||
|
return Intl.message(
|
||||||
|
'Preferences',
|
||||||
|
name: 'preferences',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get senderSetImportantFlag {
|
||||||
|
return Intl.message(
|
||||||
|
'Sender-set important flag',
|
||||||
|
name: 'senderSetImportantFlag',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get senderImportantSettingExplanation {
|
||||||
|
return Intl.message(
|
||||||
|
'Enables display of important emails flag in your inbox. This feature is controlled by the sender and thus could result in abuses.',
|
||||||
|
name: 'senderImportantSettingExplanation',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get senderImportantSettingToggleDescription {
|
||||||
|
return Intl.message(
|
||||||
|
'Display sender-set important flag',
|
||||||
|
name: 'senderImportantSettingToggleDescription',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,13 +1,13 @@
|
|||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
class AlwaysReadReceiptNullableConverter implements JsonConverter<bool?, String?> {
|
class BooleanNullableConverter implements JsonConverter<bool?, String?> {
|
||||||
const AlwaysReadReceiptNullableConverter();
|
const BooleanNullableConverter();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool? fromJson(String? json) {
|
bool? fromJson(String? json) {
|
||||||
if (json == null) {
|
if (json == null) {
|
||||||
return null;
|
return null;
|
||||||
} else if (json == 'true') {
|
} else if (json.trim().toLowerCase() == 'true') {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
import 'package:server_settings/server_settings/converter/always_read_receipt_nullable_converter.dart';
|
import 'package:server_settings/server_settings/converter/boolean_nullable_converter.dart';
|
||||||
import 'package:server_settings/server_settings/converter/server_settings_id_nullable_converter.dart';
|
import 'package:server_settings/server_settings/converter/server_settings_id_nullable_converter.dart';
|
||||||
import 'package:server_settings/server_settings/server_settings.dart';
|
import 'package:server_settings/server_settings/server_settings.dart';
|
||||||
import 'package:server_settings/server_settings/server_settings_id.dart';
|
import 'package:server_settings/server_settings/server_settings_id.dart';
|
||||||
@@ -28,23 +28,38 @@ class TMailServerSettings extends ServerSettings {
|
|||||||
@JsonSerializable(
|
@JsonSerializable(
|
||||||
explicitToJson: true,
|
explicitToJson: true,
|
||||||
includeIfNull: false,
|
includeIfNull: false,
|
||||||
converters: [AlwaysReadReceiptNullableConverter()])
|
converters: [BooleanNullableConverter()]
|
||||||
|
)
|
||||||
class TMailServerSettingOptions with EquatableMixin {
|
class TMailServerSettingOptions with EquatableMixin {
|
||||||
@JsonKey(name: 'read.receipts.always')
|
@JsonKey(name: 'read.receipts.always')
|
||||||
final bool? alwaysReadReceipts;
|
final bool? alwaysReadReceipts;
|
||||||
TMailServerSettingOptions({this.alwaysReadReceipts});
|
|
||||||
|
@JsonKey(name: 'display.sender.priority')
|
||||||
|
final bool? displaySenderPriority;
|
||||||
|
|
||||||
|
TMailServerSettingOptions({
|
||||||
|
this.alwaysReadReceipts,
|
||||||
|
this.displaySenderPriority,
|
||||||
|
});
|
||||||
|
|
||||||
factory TMailServerSettingOptions.fromJson(Map<String, dynamic> json) =>
|
factory TMailServerSettingOptions.fromJson(Map<String, dynamic> json) =>
|
||||||
_$TMailServerSettingOptionsFromJson(json);
|
_$TMailServerSettingOptionsFromJson(json);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$TMailServerSettingOptionsToJson(this);
|
Map<String, dynamic> toJson() => _$TMailServerSettingOptionsToJson(this);
|
||||||
|
|
||||||
TMailServerSettingOptions copyWith({bool? alwaysReadReceipts}) {
|
TMailServerSettingOptions copyWith({
|
||||||
|
bool? alwaysReadReceipts,
|
||||||
|
bool? displaySenderPriority,
|
||||||
|
}) {
|
||||||
return TMailServerSettingOptions(
|
return TMailServerSettingOptions(
|
||||||
alwaysReadReceipts: alwaysReadReceipts ?? this.alwaysReadReceipts,
|
alwaysReadReceipts: alwaysReadReceipts ?? this.alwaysReadReceipts,
|
||||||
|
displaySenderPriority: displaySenderPriority ?? this.displaySenderPriority,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object?> get props => [alwaysReadReceipts];
|
List<Object?> get props => [
|
||||||
|
alwaysReadReceipts,
|
||||||
|
displaySenderPriority,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||||
|
|
||||||
|
extension TmailServerSettingsExtension on TMailServerSettingOptions {
|
||||||
|
bool get isDisplaySenderPriority => displaySenderPriority ?? true;
|
||||||
|
|
||||||
|
bool get isAlwaysReadReceipts => alwaysReadReceipts ?? false;
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ import 'package:model/email/email_property.dart';
|
|||||||
import 'package:model/email/presentation_email.dart';
|
import 'package:model/email/presentation_email.dart';
|
||||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||||
import 'package:rich_text_composer/rich_text_composer.dart';
|
import 'package:rich_text_composer/rich_text_composer.dart';
|
||||||
|
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||||
import 'package:tmail_ui_user/features/base/before_reconnect_manager.dart';
|
import 'package:tmail_ui_user/features/base/before_reconnect_manager.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/caching_manager.dart';
|
import 'package:tmail_ui_user/features/caching/caching_manager.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/domain/state/save_email_as_drafts_state.dart';
|
import 'package:tmail_ui_user/features/composer/domain/state/save_email_as_drafts_state.dart';
|
||||||
@@ -58,8 +59,8 @@ import 'package:tmail_ui_user/features/manage_account/domain/state/get_all_ident
|
|||||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_identities_interactor.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_identities_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/domain/usecases/log_out_oidc_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/network_connection/presentation/network_connection_controller.dart';
|
import 'package:tmail_ui_user/features/network_connection/presentation/network_connection_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/state/get_always_read_receipt_setting_state.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/state/get_server_setting_state.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_always_read_receipt_setting_interactor.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_server_setting_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/upload/domain/usecases/local_file_picker_interactor.dart';
|
import 'package:tmail_ui_user/features/upload/domain/usecases/local_file_picker_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/upload/domain/usecases/local_image_picker_interactor.dart';
|
import 'package:tmail_ui_user/features/upload/domain/usecases/local_image_picker_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/upload/presentation/controller/upload_controller.dart';
|
import 'package:tmail_ui_user/features/upload/presentation/controller/upload_controller.dart';
|
||||||
@@ -159,7 +160,7 @@ class MockMailboxDashBoardController extends Mock implements MailboxDashBoardCon
|
|||||||
MockSpec<SaveComposerCacheOnWebInteractor>(),
|
MockSpec<SaveComposerCacheOnWebInteractor>(),
|
||||||
MockSpec<DownloadImageAsBase64Interactor>(),
|
MockSpec<DownloadImageAsBase64Interactor>(),
|
||||||
MockSpec<TransformHtmlEmailContentInteractor>(),
|
MockSpec<TransformHtmlEmailContentInteractor>(),
|
||||||
MockSpec<GetAlwaysReadReceiptSettingInteractor>(),
|
MockSpec<GetServerSettingInteractor>(),
|
||||||
MockSpec<CreateNewAndSendEmailInteractor>(),
|
MockSpec<CreateNewAndSendEmailInteractor>(),
|
||||||
MockSpec<CreateNewAndSaveEmailToDraftsInteractor>(),
|
MockSpec<CreateNewAndSaveEmailToDraftsInteractor>(),
|
||||||
MockSpec<PrintEmailInteractor>(),
|
MockSpec<PrintEmailInteractor>(),
|
||||||
@@ -202,7 +203,7 @@ void main() {
|
|||||||
late MockSaveComposerCacheOnWebInteractor mockSaveComposerCacheOnWebInteractor;
|
late MockSaveComposerCacheOnWebInteractor mockSaveComposerCacheOnWebInteractor;
|
||||||
late MockDownloadImageAsBase64Interactor mockDownloadImageAsBase64Interactor;
|
late MockDownloadImageAsBase64Interactor mockDownloadImageAsBase64Interactor;
|
||||||
late MockTransformHtmlEmailContentInteractor mockTransformHtmlEmailContentInteractor;
|
late MockTransformHtmlEmailContentInteractor mockTransformHtmlEmailContentInteractor;
|
||||||
late MockGetAlwaysReadReceiptSettingInteractor mockGetAlwaysReadReceiptSettingInteractor;
|
late MockGetServerSettingInteractor mockGetServerSettingInteractor;
|
||||||
late MockCreateNewAndSendEmailInteractor mockCreateNewAndSendEmailInteractor;
|
late MockCreateNewAndSendEmailInteractor mockCreateNewAndSendEmailInteractor;
|
||||||
late MockCreateNewAndSaveEmailToDraftsInteractor mockCreateNewAndSaveEmailToDraftsInteractor;
|
late MockCreateNewAndSaveEmailToDraftsInteractor mockCreateNewAndSaveEmailToDraftsInteractor;
|
||||||
late MockPrintEmailInteractor mockPrintEmailInteractor;
|
late MockPrintEmailInteractor mockPrintEmailInteractor;
|
||||||
@@ -270,7 +271,7 @@ void main() {
|
|||||||
mockSaveComposerCacheOnWebInteractor = MockSaveComposerCacheOnWebInteractor();
|
mockSaveComposerCacheOnWebInteractor = MockSaveComposerCacheOnWebInteractor();
|
||||||
mockDownloadImageAsBase64Interactor = MockDownloadImageAsBase64Interactor();
|
mockDownloadImageAsBase64Interactor = MockDownloadImageAsBase64Interactor();
|
||||||
mockTransformHtmlEmailContentInteractor = MockTransformHtmlEmailContentInteractor();
|
mockTransformHtmlEmailContentInteractor = MockTransformHtmlEmailContentInteractor();
|
||||||
mockGetAlwaysReadReceiptSettingInteractor = MockGetAlwaysReadReceiptSettingInteractor();
|
mockGetServerSettingInteractor = MockGetServerSettingInteractor();
|
||||||
mockCreateNewAndSendEmailInteractor = MockCreateNewAndSendEmailInteractor();
|
mockCreateNewAndSendEmailInteractor = MockCreateNewAndSendEmailInteractor();
|
||||||
mockCreateNewAndSaveEmailToDraftsInteractor = MockCreateNewAndSaveEmailToDraftsInteractor();
|
mockCreateNewAndSaveEmailToDraftsInteractor = MockCreateNewAndSaveEmailToDraftsInteractor();
|
||||||
mockPrintEmailInteractor = MockPrintEmailInteractor();
|
mockPrintEmailInteractor = MockPrintEmailInteractor();
|
||||||
@@ -285,7 +286,7 @@ void main() {
|
|||||||
mockSaveComposerCacheOnWebInteractor,
|
mockSaveComposerCacheOnWebInteractor,
|
||||||
mockDownloadImageAsBase64Interactor,
|
mockDownloadImageAsBase64Interactor,
|
||||||
mockTransformHtmlEmailContentInteractor,
|
mockTransformHtmlEmailContentInteractor,
|
||||||
mockGetAlwaysReadReceiptSettingInteractor,
|
mockGetServerSettingInteractor,
|
||||||
mockCreateNewAndSendEmailInteractor,
|
mockCreateNewAndSendEmailInteractor,
|
||||||
mockCreateNewAndSaveEmailToDraftsInteractor,
|
mockCreateNewAndSaveEmailToDraftsInteractor,
|
||||||
mockPrintEmailInteractor,
|
mockPrintEmailInteractor,
|
||||||
@@ -335,8 +336,7 @@ void main() {
|
|||||||
composerController?.listReplyToEmailAddress = [replyToRecipient];
|
composerController?.listReplyToEmailAddress = [replyToRecipient];
|
||||||
composerController?.identitySelected.value = identity;
|
composerController?.identitySelected.value = identity;
|
||||||
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
|
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
|
||||||
final state = GetAlwaysReadReceiptSettingSuccess(
|
final state = GetServerSettingSuccess(TMailServerSettingOptions(alwaysReadReceipts: alwaysReadReceiptEnabled));
|
||||||
alwaysReadReceiptEnabled: alwaysReadReceiptEnabled);
|
|
||||||
|
|
||||||
final savedEmailDraft = SavedEmailDraft(
|
final savedEmailDraft = SavedEmailDraft(
|
||||||
content: emailContent,
|
content: emailContent,
|
||||||
@@ -376,7 +376,7 @@ void main() {
|
|||||||
composerController?.listReplyToEmailAddress = [replyToRecipient];
|
composerController?.listReplyToEmailAddress = [replyToRecipient];
|
||||||
composerController?.identitySelected.value = identity;
|
composerController?.identitySelected.value = identity;
|
||||||
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
|
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
|
||||||
final state = GetAlwaysReadReceiptSettingFailure(Exception());
|
final state = GetServerSettingFailure(Exception());
|
||||||
|
|
||||||
final savedEmailDraft = SavedEmailDraft(
|
final savedEmailDraft = SavedEmailDraft(
|
||||||
content: emailContent,
|
content: emailContent,
|
||||||
@@ -757,8 +757,7 @@ void main() {
|
|||||||
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
|
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
|
||||||
|
|
||||||
const alwaysReadReceiptEnabled = true;
|
const alwaysReadReceiptEnabled = true;
|
||||||
final state = GetAlwaysReadReceiptSettingSuccess(
|
final state = GetServerSettingSuccess(TMailServerSettingOptions(alwaysReadReceipts: alwaysReadReceiptEnabled));
|
||||||
alwaysReadReceiptEnabled: alwaysReadReceiptEnabled);
|
|
||||||
|
|
||||||
final savedEmailDraft = SavedEmailDraft(
|
final savedEmailDraft = SavedEmailDraft(
|
||||||
content: emailContent,
|
content: emailContent,
|
||||||
@@ -799,7 +798,7 @@ void main() {
|
|||||||
composerController?.identitySelected.value = identity;
|
composerController?.identitySelected.value = identity;
|
||||||
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
|
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
|
||||||
|
|
||||||
final state = GetAlwaysReadReceiptSettingFailure(Exception());
|
final state = GetServerSettingFailure(Exception());
|
||||||
|
|
||||||
final savedEmailDraft = SavedEmailDraft(
|
final savedEmailDraft = SavedEmailDraft(
|
||||||
content: emailContent,
|
content: emailContent,
|
||||||
@@ -1310,8 +1309,7 @@ void main() {
|
|||||||
when(mockRichTextMobileTabletController.htmlEditorApi).thenReturn(
|
when(mockRichTextMobileTabletController.htmlEditorApi).thenReturn(
|
||||||
mockHtmlEditorApi);
|
mockHtmlEditorApi);
|
||||||
|
|
||||||
final state = GetAlwaysReadReceiptSettingSuccess(
|
final state = GetServerSettingSuccess(TMailServerSettingOptions(alwaysReadReceipts: true));
|
||||||
alwaysReadReceiptEnabled: true);
|
|
||||||
|
|
||||||
// act
|
// act
|
||||||
composerController?.handleSuccessViewState(state);
|
composerController?.handleSuccessViewState(state);
|
||||||
@@ -1330,7 +1328,7 @@ void main() {
|
|||||||
when(mockRichTextMobileTabletController.htmlEditorApi).thenReturn(
|
when(mockRichTextMobileTabletController.htmlEditorApi).thenReturn(
|
||||||
mockHtmlEditorApi);
|
mockHtmlEditorApi);
|
||||||
|
|
||||||
final state = GetAlwaysReadReceiptSettingFailure(Exception());
|
final state = GetServerSettingFailure(Exception());
|
||||||
|
|
||||||
// act
|
// act
|
||||||
composerController?.handleFailureViewState(state);
|
composerController?.handleFailureViewState(state);
|
||||||
|
|||||||
+11
-11
@@ -7,17 +7,17 @@ import 'package:mockito/mockito.dart';
|
|||||||
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/exceptions/server_settings_exception.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/exceptions/server_settings_exception.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/repository/server_settings_repository.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/repository/server_settings_repository.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/state/get_always_read_receipt_setting_state.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/state/get_server_setting_state.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_always_read_receipt_setting_interactor.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/get_server_setting_interactor.dart';
|
||||||
|
|
||||||
import 'get_always_read_receipt_setting_interactor_test.mocks.dart';
|
import 'get_server_setting_interactor_test.mocks.dart';
|
||||||
|
|
||||||
@GenerateNiceMocks([MockSpec<ServerSettingsRepository>()])
|
@GenerateNiceMocks([MockSpec<ServerSettingsRepository>()])
|
||||||
void main() {
|
void main() {
|
||||||
final accountId = AccountId(Id('123'));
|
final accountId = AccountId(Id('123'));
|
||||||
final serverSettingsRepository = MockServerSettingsRepository();
|
final serverSettingsRepository = MockServerSettingsRepository();
|
||||||
final getAlwaysReadReceiptSettingInteractor =
|
final getServerSettingInteractor =
|
||||||
GetAlwaysReadReceiptSettingInteractor(serverSettingsRepository);
|
GetServerSettingInteractor(serverSettingsRepository);
|
||||||
|
|
||||||
group('get always read receipt setting interactor', () {
|
group('get always read receipt setting interactor', () {
|
||||||
test('should return right with value returned from repository', () {
|
test('should return right with value returned from repository', () {
|
||||||
@@ -29,10 +29,10 @@ void main() {
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
expect(
|
expect(
|
||||||
getAlwaysReadReceiptSettingInteractor.execute(accountId),
|
getServerSettingInteractor.execute(accountId),
|
||||||
emitsInOrder([
|
emitsInOrder([
|
||||||
Right(GettingAlwaysReadReceiptSetting()),
|
Right(GettingServerSetting()),
|
||||||
Right(GetAlwaysReadReceiptSettingSuccess(alwaysReadReceiptEnabled: false)),
|
Right(GetServerSettingSuccess(TMailServerSettingOptions(alwaysReadReceipts: false))),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -44,10 +44,10 @@ void main() {
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
expect(
|
expect(
|
||||||
getAlwaysReadReceiptSettingInteractor.execute(accountId),
|
getServerSettingInteractor.execute(accountId),
|
||||||
emitsInOrder([
|
emitsInOrder([
|
||||||
Right(GettingAlwaysReadReceiptSetting()),
|
Right(GettingServerSetting()),
|
||||||
Left(GetAlwaysReadReceiptSettingFailure(exception)),
|
Left(GetServerSettingFailure(exception)),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
+19
-12
@@ -2,14 +2,17 @@ import 'package:dartz/dartz.dart';
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||||
import 'package:jmap_dart_client/jmap/core/id.dart';
|
import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||||
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/exceptions/server_settings_exception.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/exceptions/server_settings_exception.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/state/update_always_read_receipt_setting_state.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/repository/server_settings_repository.dart';
|
||||||
import 'package:tmail_ui_user/features/server_settings/domain/usecases/update_always_read_receipt_setting_interactor.dart';
|
import 'package:tmail_ui_user/features/server_settings/domain/state/update_server_setting_state.dart';
|
||||||
|
import 'package:tmail_ui_user/features/server_settings/domain/usecases/update_server_setting_interactor.dart';
|
||||||
|
|
||||||
import 'get_always_read_receipt_setting_interactor_test.mocks.dart';
|
import 'update_server_setting_interactor_test.mocks.dart';
|
||||||
|
|
||||||
|
@GenerateNiceMocks([MockSpec<ServerSettingsRepository>()])
|
||||||
void main() {
|
void main() {
|
||||||
final accountId = AccountId(Id('123'));
|
final accountId = AccountId(Id('123'));
|
||||||
const alwaysReadReceipts = false;
|
const alwaysReadReceipts = false;
|
||||||
@@ -17,8 +20,7 @@ void main() {
|
|||||||
settings: TMailServerSettingOptions(alwaysReadReceipts: alwaysReadReceipts)
|
settings: TMailServerSettingOptions(alwaysReadReceipts: alwaysReadReceipts)
|
||||||
);
|
);
|
||||||
final serverSettingsRepository = MockServerSettingsRepository();
|
final serverSettingsRepository = MockServerSettingsRepository();
|
||||||
final updateAlwaysReadReceiptSettingInteractor =
|
final updateServerSettingInteractor = UpdateServerSettingInteractor(serverSettingsRepository);
|
||||||
UpdateAlwaysReadReceiptSettingInteractor(serverSettingsRepository);
|
|
||||||
group('update always read receipt setting interactor', () {
|
group('update always read receipt setting interactor', () {
|
||||||
test('should return right with value returned from repository', () {
|
test('should return right with value returned from repository', () {
|
||||||
// arrange
|
// arrange
|
||||||
@@ -27,11 +29,13 @@ void main() {
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
expect(
|
expect(
|
||||||
updateAlwaysReadReceiptSettingInteractor
|
updateServerSettingInteractor.execute(
|
||||||
.execute(accountId, alwaysReadReceipts),
|
accountId,
|
||||||
|
TMailServerSettingOptions(alwaysReadReceipts: alwaysReadReceipts),
|
||||||
|
),
|
||||||
emitsInOrder([
|
emitsInOrder([
|
||||||
Right(UpdatingAlwaysReadReceiptSetting()),
|
Right(UpdatingServerSetting()),
|
||||||
Right(UpdateAlwaysReadReceiptSettingSuccess(alwaysReadReceiptIsEnabled: alwaysReadReceipts)),
|
Right(UpdateServerSettingSuccess(TMailServerSettingOptions(alwaysReadReceipts: alwaysReadReceipts))),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -44,10 +48,13 @@ void main() {
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
expect(
|
expect(
|
||||||
updateAlwaysReadReceiptSettingInteractor.execute(accountId, alwaysReadReceipts),
|
updateServerSettingInteractor.execute(
|
||||||
|
accountId,
|
||||||
|
TMailServerSettingOptions(alwaysReadReceipts: alwaysReadReceipts),
|
||||||
|
),
|
||||||
emitsInOrder([
|
emitsInOrder([
|
||||||
Right(UpdatingAlwaysReadReceiptSetting()),
|
Right(UpdatingServerSetting()),
|
||||||
Left(UpdateAlwaysReadReceiptSettingFailure(exception)),
|
Left(UpdateServerSettingFailure(exception)),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user