Skip to content

Commit cee2dd9

Browse files
dab246hoangdat
authored andcommitted
feat: Separate in method: _syncLabelForOpenedEmail & add const for LabelKeywordIsNull
1 parent 2a58247 commit cee2dd9

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

lib/features/labels/presentation/mixin/add_label_to_email_mixin.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ mixin AddLabelToEmailMixin on EmitStateMixin {
8787
emitFailure(
8888
controller: currentController,
8989
failure: AddALabelToAnEmailFailure(
90-
exception: LabelKeywordIsNull(),
90+
exception: const LabelKeywordIsNull(),
9191
labelDisplay: labelDisplay,
9292
),
9393
);
@@ -151,7 +151,7 @@ mixin AddLabelToEmailMixin on EmitStateMixin {
151151
emitFailure(
152152
controller: currentController,
153153
failure: RemoveALabelFromAnEmailFailure(
154-
exception: LabelKeywordIsNull(),
154+
exception: const LabelKeywordIsNull(),
155155
labelDisplay: labelDisplay,
156156
),
157157
);

lib/features/mailbox_dashboard/presentation/extensions/labels/handle_logic_label_extension.dart

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,24 @@ extension HandleLogicLabelExtension on MailboxDashBoardController {
4949
_refreshLabelSettingEnabled();
5050

5151
if (isEmailOpened) {
52-
dispatchEmailUIAction(
53-
SyncUpdateLabelForEmailOnMemory(
54-
emailId: emailId,
55-
labelKeyword: labelKeyword,
56-
shouldRemove: shouldRemove,
57-
),
58-
);
52+
_syncLabelForOpenedEmail(emailId, labelKeyword, shouldRemove);
5953
}
6054
}
6155

56+
void _syncLabelForOpenedEmail(
57+
EmailId emailId,
58+
KeyWordIdentifier labelKeyword,
59+
bool shouldRemove,
60+
) {
61+
dispatchEmailUIAction(
62+
SyncUpdateLabelForEmailOnMemory(
63+
emailId: emailId,
64+
labelKeyword: labelKeyword,
65+
shouldRemove: shouldRemove,
66+
),
67+
);
68+
}
69+
6270
void _syncLabelForEmailList(
6371
EmailId emailId,
6472
KeyWordIdentifier labelKeyword,

0 commit comments

Comments
 (0)