TF-4243 Implement delete a label in presentation layer
This commit is contained in:
@@ -13,9 +13,11 @@ 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/labels/domain/state/create_new_label_state.dart';
|
||||
import 'package:tmail_ui_user/features/labels/domain/state/edit_label_state.dart';
|
||||
import 'package:tmail_ui_user/features/labels/domain/state/delete_a_label_state.dart';
|
||||
import 'package:tmail_ui_user/features/labels/domain/state/get_all_label_state.dart';
|
||||
import 'package:tmail_ui_user/features/labels/domain/usecases/create_new_label_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/labels/domain/usecases/edit_label_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/labels/domain/usecases/delete_a_label_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/labels/domain/usecases/get_all_label_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/labels/presentation/extensions/handle_label_action_type_extension.dart';
|
||||
import 'package:tmail_ui_user/features/labels/presentation/label_interactor_bindings.dart';
|
||||
@@ -37,6 +39,7 @@ class LabelController extends BaseController with LabelContextMenuMixin {
|
||||
CreateNewLabelInteractor? _createNewLabelInteractor;
|
||||
GetLabelSettingStateInteractor? _getLabelSettingStateInteractor;
|
||||
EditLabelInteractor? _editLabelInteractor;
|
||||
DeleteALabelInteractor? _deleteALabelInteractor;
|
||||
|
||||
bool isLabelCapabilitySupported(Session session, AccountId accountId) {
|
||||
return LabelsConstants.labelsCapability.isSupported(session, accountId);
|
||||
@@ -62,10 +65,13 @@ class LabelController extends BaseController with LabelContextMenuMixin {
|
||||
_getAllLabelInteractor = getBinding<GetAllLabelInteractor>();
|
||||
_createNewLabelInteractor = getBinding<CreateNewLabelInteractor>();
|
||||
_editLabelInteractor = getBinding<EditLabelInteractor>();
|
||||
_deleteALabelInteractor = getBinding<DeleteALabelInteractor>();
|
||||
}
|
||||
|
||||
EditLabelInteractor? get editLabelInteractor => _editLabelInteractor;
|
||||
|
||||
DeleteALabelInteractor? get deleteALabelInteractor => _deleteALabelInteractor;
|
||||
|
||||
void getAllLabels(AccountId accountId) {
|
||||
if (_getAllLabelInteractor == null) return;
|
||||
|
||||
@@ -139,6 +145,8 @@ class LabelController extends BaseController with LabelContextMenuMixin {
|
||||
_handleGetLabelSettingStateSuccess(success.isEnabled, success.accountId);
|
||||
} else if (success is EditLabelSuccess) {
|
||||
handleEditLabelSuccess(success);
|
||||
} else if (success is DeleteALabelSuccess) {
|
||||
handleDeleteLabelSuccess(success);
|
||||
} else {
|
||||
super.handleSuccessViewState(success);
|
||||
}
|
||||
@@ -155,6 +163,8 @@ class LabelController extends BaseController with LabelContextMenuMixin {
|
||||
_clearLabelData();
|
||||
} else if (failure is EditLabelFailure) {
|
||||
handleEditLabelFailure(failure);
|
||||
} else if (failure is DeleteALabelFailure) {
|
||||
handleDeleteLabelFailure(failure);
|
||||
} else {
|
||||
super.handleFailureViewState(failure);
|
||||
}
|
||||
@@ -165,6 +175,7 @@ class LabelController extends BaseController with LabelContextMenuMixin {
|
||||
_getAllLabelInteractor = null;
|
||||
_createNewLabelInteractor = null;
|
||||
_editLabelInteractor = null;
|
||||
_deleteALabelInteractor = null;
|
||||
_getLabelSettingStateInteractor = null;
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user