TF-3178 Add verify name only contain spaces for rule filter name
This commit is contained in:
+5
-9
@@ -21,7 +21,7 @@ extension ValicatorFailureExtension on VerifyNameFailure {
|
|||||||
} else if (exception is SpecialCharacterException) {
|
} else if (exception is SpecialCharacterException) {
|
||||||
return AppLocalizations.of(context).folderNameCannotContainSpecialCharacters;
|
return AppLocalizations.of(context).folderNameCannotContainSpecialCharacters;
|
||||||
} else if (exception is NameWithSpaceOnlyException) {
|
} else if (exception is NameWithSpaceOnlyException) {
|
||||||
return AppLocalizations.of(context).this_field_cannot_be_blank;
|
return AppLocalizations.of(context).thisFieldCannotContainOnlySpaces;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -30,6 +30,8 @@ extension ValicatorFailureExtension on VerifyNameFailure {
|
|||||||
String getMessageIdentity(BuildContext context) {
|
String getMessageIdentity(BuildContext context) {
|
||||||
if (exception is EmptyNameException) {
|
if (exception is EmptyNameException) {
|
||||||
return AppLocalizations.of(context).this_field_cannot_be_blank;
|
return AppLocalizations.of(context).this_field_cannot_be_blank;
|
||||||
|
} else if (exception is NameWithSpaceOnlyException) {
|
||||||
|
return AppLocalizations.of(context).thisFieldCannotContainOnlySpaces;
|
||||||
} else if (exception is EmailAddressInvalidException) {
|
} else if (exception is EmailAddressInvalidException) {
|
||||||
return AppLocalizations.of(context).thisEmailAddressInvalid;
|
return AppLocalizations.of(context).thisEmailAddressInvalid;
|
||||||
} else {
|
} else {
|
||||||
@@ -40,14 +42,8 @@ extension ValicatorFailureExtension on VerifyNameFailure {
|
|||||||
String getMessageRulesFilter(BuildContext context) {
|
String getMessageRulesFilter(BuildContext context) {
|
||||||
if (exception is EmptyNameException) {
|
if (exception is EmptyNameException) {
|
||||||
return AppLocalizations.of(context).this_field_cannot_be_blank;
|
return AppLocalizations.of(context).this_field_cannot_be_blank;
|
||||||
} else {
|
} else if (exception is NameWithSpaceOnlyException) {
|
||||||
return '';
|
return AppLocalizations.of(context).thisFieldCannotContainOnlySpaces;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String getMessageVacation(BuildContext context) {
|
|
||||||
if (exception is EmptyNameException) {
|
|
||||||
return AppLocalizations.of(context).messageIsRequired;
|
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import 'package:tmail_ui_user/features/mailbox/presentation/extensions/presentat
|
|||||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_actions.dart';
|
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_actions.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree_builder.dart';
|
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree_builder.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/empty_name_validator.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/empty_name_validator.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/name_with_space_only_validator.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_view_state.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_view_state.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/usecases/verify_name_interactor.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/domain/usecases/verify_name_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/presentation/extensions/validator_failure_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/presentation/extensions/validator_failure_extension.dart';
|
||||||
@@ -311,7 +312,13 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String? _getErrorStringByInputValue(BuildContext context, String? inputValue) {
|
String? _getErrorStringByInputValue(BuildContext context, String? inputValue) {
|
||||||
return verifyNameInteractor.execute(inputValue, [EmptyNameValidator()]).fold(
|
return verifyNameInteractor.execute(
|
||||||
|
inputValue,
|
||||||
|
[
|
||||||
|
EmptyNameValidator(),
|
||||||
|
NameWithSpaceOnlyValidator(),
|
||||||
|
],
|
||||||
|
).fold(
|
||||||
(failure) {
|
(failure) {
|
||||||
if (failure is VerifyNameFailure) {
|
if (failure is VerifyNameFailure) {
|
||||||
return failure.getMessageRulesFilter(context);
|
return failure.getMessageRulesFilter(context);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2024-10-25T09:31:37.466558",
|
"@@last_modified": "2024-10-29T16:13:26.917296",
|
||||||
"initializing_data": "Initializing data...",
|
"initializing_data": "Initializing data...",
|
||||||
"@initializing_data": {
|
"@initializing_data": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -1566,6 +1566,12 @@
|
|||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"languageGerman": "German",
|
||||||
|
"@languageGerman": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
"languageVietnamese": "Vietnamese",
|
"languageVietnamese": "Vietnamese",
|
||||||
"@languageVietnamese": {
|
"@languageVietnamese": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -1596,12 +1602,6 @@
|
|||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"languageGerman": "German",
|
|
||||||
"@languageGerman": {
|
|
||||||
"type": "text",
|
|
||||||
"placeholders_order": [],
|
|
||||||
"placeholders": {}
|
|
||||||
},
|
|
||||||
"messageDialogSendEmailUploadingAttachment": "Your message could not be sent because it uploading attachment",
|
"messageDialogSendEmailUploadingAttachment": "Your message could not be sent because it uploading attachment",
|
||||||
"@messageDialogSendEmailUploadingAttachment": {
|
"@messageDialogSendEmailUploadingAttachment": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -4035,5 +4035,11 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"thisFieldCannotContainOnlySpaces": "This field cannot contain only spaces",
|
||||||
|
"@thisFieldCannotContainOnlySpaces": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4231,4 +4231,11 @@ class AppLocalizations {
|
|||||||
'Find emails',
|
'Find emails',
|
||||||
name: 'findEmails');
|
name: 'findEmails');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get thisFieldCannotContainOnlySpaces {
|
||||||
|
return Intl.message(
|
||||||
|
'This field cannot contain only spaces',
|
||||||
|
name: 'thisFieldCannotContainOnlySpaces',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user