feat: Persist label state after get all labels

This commit is contained in:
dab246
2026-02-03 19:46:24 +07:00
committed by Dat H. Pham
parent 9c211c05ef
commit 4fea45d062
11 changed files with 187 additions and 152 deletions
@@ -179,6 +179,7 @@ class LabelController extends BaseController with LabelContextMenuMixin {
void handleSuccessViewState(Success success) {
if (success is GetAllLabelSuccess) {
labels.value = success.labels..sortByAlphabetically();
setCurrentLabelState(success.newState);
} else if (success is CreateNewLabelSuccess) {
_handleCreateNewLabelSuccess(success);
} else if (success is GetLabelSettingStateSuccess) {
@@ -10,6 +10,7 @@ import 'package:tmail_ui_user/features/labels/domain/usecases/create_new_label_i
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/domain/usecases/get_label_changes_interactor.dart';
import 'package:tmail_ui_user/features/mailbox_creator/domain/usecases/verify_name_interactor.dart';
import 'package:tmail_ui_user/main/exceptions/remote_exception_thrower.dart';
import 'package:uuid/uuid.dart';
@@ -37,6 +38,7 @@ class LabelInteractorBindings extends InteractorsBindings {
Get.lazyPut(() => CreateNewLabelInteractor(Get.find<LabelRepository>()));
Get.lazyPut(() => EditLabelInteractor(Get.find<LabelRepository>()));
Get.lazyPut(() => DeleteALabelInteractor(Get.find<LabelRepository>()));
Get.lazyPut(() => GetLabelChangesInteractor(Get.find<LabelRepository>()));
Get.lazyPut(() => VerifyNameInteractor());
}
@@ -252,6 +252,7 @@ class LabelUtils {
}) {
final idsToRemove = {
...destroyedIds,
...created.map((label) => label.id),
...updated.map((label) => label.id),
};