diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 2d550c3..b5f9772 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -93,5 +93,7 @@ "ipAddress": "IP address", "ipNotValid": "IP address not valid", "clientAddedSuccessfully": "Client added to the list successfully", - "addingClient": "Adding client..." + "addingClient": "Adding client...", + "clientNotAdded": "Client could not be added to the list", + "clientAnotherList": "This client is yet in another list" } \ No newline at end of file diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index 3d7d6cc..c5cbb1c 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -93,5 +93,7 @@ "ipAddress": "Dirección IP", "ipNotValid": "Dirección IP no válida", "clientAddedSuccessfully": "Cliente añadido a la lista satisfactoriamente", - "addingClient": "Añadiendo cliente..." + "addingClient": "Añadiendo cliente...", + "clientNotAdded": "El cliente no se pudo añadir a la lista", + "clientAnotherList": "El cliente ya está en otra lista" } \ No newline at end of file diff --git a/lib/screens/clients/blocked_allowed_list.dart b/lib/screens/clients/blocked_allowed_list.dart index 23857bb..a933af4 100644 --- a/lib/screens/clients/blocked_allowed_list.dart +++ b/lib/screens/clients/blocked_allowed_list.dart @@ -59,6 +59,14 @@ class BlockedAllowedList extends StatelessWidget { ) ); } + else if (result['result'] == 'error' && result['message'] == 'client_another_list') { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(AppLocalizations.of(context)!.clientAnotherList), + backgroundColor: Colors.red, + ) + ); + } else { ScaffoldMessenger.of(context).showSnackBar( SnackBar( diff --git a/lib/screens/clients/fab.dart b/lib/screens/clients/fab.dart index e5b9d98..05412e1 100644 --- a/lib/screens/clients/fab.dart +++ b/lib/screens/clients/fab.dart @@ -62,10 +62,18 @@ class ClientsFab extends StatelessWidget { ) ); } + else if (result['result'] == 'error' && result['message'] == 'client_another_list') { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(AppLocalizations.of(context)!.clientAnotherList), + backgroundColor: Colors.red, + ) + ); + } else { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text(AppLocalizations.of(context)!.clientNotRemoved), + content: Text(AppLocalizations.of(context)!.clientNotAdded), backgroundColor: Colors.red, ) ); diff --git a/lib/services/http_requests.dart b/lib/services/http_requests.dart index fe251be..87cb29a 100644 --- a/lib/services/http_requests.dart +++ b/lib/services/http_requests.dart @@ -285,6 +285,12 @@ Future requestAllowedBlockedClientsHosts(Server server, Map if (result.statusCode == 200) { return {'result': 'success'}; } + else if (result.statusCode == 400) { + return { + 'result': 'error', + 'message': 'client_another_list' + }; + } else { return {'result': 'error'}; }