Telegram empty fields do not raise errors anymore if not using Telegram

This commit is contained in:
Nicolás Sánchez 2024-12-10 00:08:50 -03:00
parent cbb0f04ab0
commit ce6499a3d2
2 changed files with 26 additions and 1 deletions

View File

@ -4,6 +4,22 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-12-09T20:18:37.036237904Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=/home/nicolas/.android/avd/Pixel_6_Pro_API_34.avd" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection>
<targets>
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=/home/nicolas/.android/avd/Pixel_6_Pro_API_34.avd" />
</handle>
</Target>
</targets>
</DialogSelection>
</SelectionState>
</selectionStates>
</component>

View File

@ -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());