diff --git a/lib/features/rules_filter_creator/presentation/model/email_rule_filter_action.dart b/lib/features/rules_filter_creator/presentation/model/email_rule_filter_action.dart index ce95d41261..0cadce06eb 100644 --- a/lib/features/rules_filter_creator/presentation/model/email_rule_filter_action.dart +++ b/lib/features/rules_filter_creator/presentation/model/email_rule_filter_action.dart @@ -27,4 +27,17 @@ enum EmailRuleFilterAction { return AppLocalizations.of(context).forwardTo; } } + + bool getSupported() { + switch(this) { + case EmailRuleFilterAction.moveMessage: + case EmailRuleFilterAction.maskAsSeen: + case EmailRuleFilterAction.startIt: + case EmailRuleFilterAction.rejectIt: + case EmailRuleFilterAction.markAsSpam: + return true; + case EmailRuleFilterAction.forwardTo: + return false; + } + } } \ No newline at end of file diff --git a/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart b/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart index a33bbe7553..57b0978118 100644 --- a/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart +++ b/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart @@ -68,7 +68,7 @@ class RulesFilterCreatorController extends BaseMailboxController { final TextEditingController forwardEmailController = TextEditingController(); final FocusNode forwardEmailFocusNode = FocusNode(); final listEmailRuleFilterActionSelected = RxList(); - int maxCountAction = EmailRuleFilterAction.values.length - 1; + int maxCountAction = EmailRuleFilterAction.values.where((action) => action.getSupported() == true).length - 1; final isShowAddAction = Rxn(); String? _newRuleName; diff --git a/lib/features/rules_filter_creator/presentation/rules_filter_creator_view.dart b/lib/features/rules_filter_creator/presentation/rules_filter_creator_view.dart index a8af657fc5..bfdddbf6aa 100644 --- a/lib/features/rules_filter_creator/presentation/rules_filter_creator_view.dart +++ b/lib/features/rules_filter_creator/presentation/rules_filter_creator_view.dart @@ -775,7 +775,10 @@ class RuleFilterCreatorView extends GetWidget { EmailRuleFilterAction? ruleActionSelected, int ruleActionIndex, ) { - return EmailRuleFilterAction.values + final supportedAction = EmailRuleFilterAction.values + .where((ruleAction) => ruleAction.getSupported() == true) + .toList(); + return supportedAction .map((ruleAction) => _buildRuleActionWidget(context, ruleAction, ruleActionSelected, ruleActionIndex)) .toList(); diff --git a/lib/features/rules_filter_creator/presentation/widgets/rule_filter_action_row_builder.dart b/lib/features/rules_filter_creator/presentation/widgets/rule_filter_action_row_builder.dart index e4f13fbef9..15cf6ea3f6 100644 --- a/lib/features/rules_filter_creator/presentation/widgets/rule_filter_action_row_builder.dart +++ b/lib/features/rules_filter_creator/presentation/widgets/rule_filter_action_row_builder.dart @@ -40,11 +40,12 @@ class RuleFilterActionRow extends StatelessWidget { @override Widget build(BuildContext context) { + final supportedAction = actionList.where((action) => action.getSupported() == true).toList(); return Row( children: [ Expanded( child: DropDownButtonWidget( - items: actionList, + items: supportedAction, itemSelected: actionSelected, onChanged: (newAction) => onActionChanged!(newAction), supportSelectionIcon: true,