Skip to content

Commit

Permalink
Fixed client being added to two lists
Browse files Browse the repository at this point in the history
  • Loading branch information
JGeek00 committed Sep 29, 2022
1 parent 4bb24b9 commit 6401dc5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 3 additions & 1 deletion lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
8 changes: 8 additions & 0 deletions lib/screens/clients/blocked_allowed_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 9 additions & 1 deletion lib/screens/clients/fab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
);
Expand Down
6 changes: 6 additions & 0 deletions lib/services/http_requests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ Future requestAllowedBlockedClientsHosts(Server server, Map<String, List<String>
if (result.statusCode == 200) {
return {'result': 'success'};
}
else if (result.statusCode == 400) {
return {
'result': 'error',
'message': 'client_another_list'
};
}
else {
return {'result': 'error'};
}
Expand Down

0 comments on commit 6401dc5

Please sign in to comment.