Made postingPermanentlyDisabled further idiot-proof
Additionally deleted annoying alert notifying me that I'm offline.
This commit is contained in:
parent
3e4e7a1a40
commit
78b560cddd
@ -204,7 +204,7 @@ public final class ChatScene {
|
|||||||
remainingChars
|
remainingChars
|
||||||
.setText(String.format("remaining chars: %d/%d", MAX_MESSAGE_LENGTH - messageTextArea.getText().length(), MAX_MESSAGE_LENGTH));
|
.setText(String.format("remaining chars: %d/%d", MAX_MESSAGE_LENGTH - messageTextArea.getText().length(), MAX_MESSAGE_LENGTH));
|
||||||
}
|
}
|
||||||
messageTextArea.setDisable(currentChat == null);
|
messageTextArea.setDisable(currentChat == null || postingPermanentlyDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -256,10 +256,13 @@ public final class ChatScene {
|
|||||||
|| !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown()))
|
|| !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown()))
|
||||||
postMessage();
|
postMessage();
|
||||||
postButton.setDisable(messageTextArea.getText().isBlank() || currentChat == null);
|
postButton.setDisable(messageTextArea.getText().isBlank() || currentChat == null);
|
||||||
} else if (!infoLabel.getText().equals("You need to go online to send more messages"))
|
} else {
|
||||||
// Informing the user that he is a f*cking moron and should use Envoy online
|
final var noMoreMessaging = "Go online to send messages";
|
||||||
// because he ran out of messageIDs to use
|
if (!infoLabel.getText().equals(noMoreMessaging))
|
||||||
updateInfoLabel("You need to go online to send more messages", Color.RED);
|
// Informing the user that he is a f*cking moron and should use Envoy online
|
||||||
|
// because he ran out of messageIDs to use
|
||||||
|
updateInfoLabel(noMoreMessaging, Color.RED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -301,6 +304,8 @@ public final class ChatScene {
|
|||||||
postingPermanentlyDisabled = !(client.isOnline() || localDB.getIDGenerator().hasNext());
|
postingPermanentlyDisabled = !(client.isOnline() || localDB.getIDGenerator().hasNext());
|
||||||
if (postingPermanentlyDisabled) {
|
if (postingPermanentlyDisabled) {
|
||||||
postButton.setDisable(true);
|
postButton.setDisable(true);
|
||||||
|
messageTextArea.setDisable(true);
|
||||||
|
messageTextArea.clear();
|
||||||
updateInfoLabel("You need to go online to send more messages", Color.RED);
|
updateInfoLabel("You need to go online to send more messages", Color.RED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,6 @@ public final class LoginScene {
|
|||||||
final User clientUser = (User) localDB.getUsers().get(credentials.getIdentifier());
|
final User clientUser = (User) localDB.getUsers().get(credentials.getIdentifier());
|
||||||
if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown");
|
if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown");
|
||||||
client.setSender(clientUser);
|
client.setSender(clientUser);
|
||||||
new Alert(AlertType.WARNING, "A connection to the server could not be established. Starting in offline mode.").showAndWait();
|
|
||||||
loadChatScene();
|
loadChatScene();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
new Alert(AlertType.ERROR, "Client error: " + e).showAndWait();
|
new Alert(AlertType.ERROR, "Client error: " + e).showAndWait();
|
||||||
|
Reference in New Issue
Block a user