From ce6499a3d22e1e44ff7b8577aaf1d7be04442b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20S=C3=A1nchez?= Date: Tue, 10 Dec 2024 00:08:50 -0300 Subject: [PATCH] Telegram empty fields do not raise errors anymore if not using Telegram --- .idea/deploymentTargetSelector.xml | 16 ++++++++++++++++ .../dcav2gui/ui/settings/SettingsFragment.java | 11 ++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml index b268ef3..52e3742 100644 --- a/.idea/deploymentTargetSelector.xml +++ b/.idea/deploymentTargetSelector.xml @@ -4,6 +4,22 @@ diff --git a/app/src/main/java/com/example/dcav2gui/ui/settings/SettingsFragment.java b/app/src/main/java/com/example/dcav2gui/ui/settings/SettingsFragment.java index e4625d8..be399a5 100644 --- a/app/src/main/java/com/example/dcav2gui/ui/settings/SettingsFragment.java +++ b/app/src/main/java/com/example/dcav2gui/ui/settings/SettingsFragment.java @@ -66,11 +66,20 @@ public class SettingsFragment extends Fragment { int amountOfLastTrades = 0; //Check if the user entered valid strings - if (profileName.isEmpty() || apiUrl.isEmpty() || apiKey.isEmpty() || botToken.isEmpty() || chatId.isEmpty()) { + if (profileName.isEmpty() || apiUrl.isEmpty() || apiKey.isEmpty()) { Toast.makeText(getContext(), "Invalid input, please enter valid strings", Toast.LENGTH_SHORT).show(); return; } + if (useTelegram && botToken.isEmpty()) { + Toast.makeText(getContext(), "Please enter a valid Telegram bot token", Toast.LENGTH_SHORT).show(); + return; + } + if (useTelegram && chatId.isEmpty()) { + Toast.makeText(getContext(), "Please enter a valid Telegram chat ID", Toast.LENGTH_SHORT).show(); + return; + } + //Check if the user entered valid numbers try { timeBetweenQueries = Float.parseFloat(editTimeBetweenQueries.getText().toString());