feat: Separate in method: _syncLabelForOpenedEmail & add const for LabelKeywordIsNull

This commit is contained in:
dab246
2026-03-27 13:45:37 +07:00
committed by Dat H. Pham
parent 2a58247b2b
commit cee2dd9d14
2 changed files with 17 additions and 9 deletions
@@ -87,7 +87,7 @@ mixin AddLabelToEmailMixin on EmitStateMixin {
emitFailure( emitFailure(
controller: currentController, controller: currentController,
failure: AddALabelToAnEmailFailure( failure: AddALabelToAnEmailFailure(
exception: LabelKeywordIsNull(), exception: const LabelKeywordIsNull(),
labelDisplay: labelDisplay, labelDisplay: labelDisplay,
), ),
); );
@@ -151,7 +151,7 @@ mixin AddLabelToEmailMixin on EmitStateMixin {
emitFailure( emitFailure(
controller: currentController, controller: currentController,
failure: RemoveALabelFromAnEmailFailure( failure: RemoveALabelFromAnEmailFailure(
exception: LabelKeywordIsNull(), exception: const LabelKeywordIsNull(),
labelDisplay: labelDisplay, labelDisplay: labelDisplay,
), ),
); );
@@ -49,16 +49,24 @@ extension HandleLogicLabelExtension on MailboxDashBoardController {
_refreshLabelSettingEnabled(); _refreshLabelSettingEnabled();
if (isEmailOpened) { if (isEmailOpened) {
dispatchEmailUIAction( _syncLabelForOpenedEmail(emailId, labelKeyword, shouldRemove);
SyncUpdateLabelForEmailOnMemory(
emailId: emailId,
labelKeyword: labelKeyword,
shouldRemove: shouldRemove,
),
);
} }
} }
void _syncLabelForOpenedEmail(
EmailId emailId,
KeyWordIdentifier labelKeyword,
bool shouldRemove,
) {
dispatchEmailUIAction(
SyncUpdateLabelForEmailOnMemory(
emailId: emailId,
labelKeyword: labelKeyword,
shouldRemove: shouldRemove,
),
);
}
void _syncLabelForEmailList( void _syncLabelForEmailList(
EmailId emailId, EmailId emailId,
KeyWordIdentifier labelKeyword, KeyWordIdentifier labelKeyword,