Fix incorrect ChatScene size on startup
Additionally fixes error on message receival. Fixes #68
This commit is contained in:
parent
8c0add517a
commit
8383bed10b
@ -223,16 +223,16 @@ public final class ChatScene implements EventListener, Restorable {
|
|||||||
final var recipientID = message instanceof GroupMessage || ownMessage ? message.getRecipientID() : message.getSenderID();
|
final var recipientID = message instanceof GroupMessage || ownMessage ? message.getRecipientID() : message.getSenderID();
|
||||||
|
|
||||||
localDB.getChat(recipientID).ifPresent(chat -> {
|
localDB.getChat(recipientID).ifPresent(chat -> {
|
||||||
|
Platform.runLater(() -> {
|
||||||
chat.insert(message);
|
chat.insert(message);
|
||||||
|
|
||||||
// Read current chat or increment unread amount
|
// Read current chat or increment unread amount
|
||||||
if (chat.equals(currentChat)) {
|
if (chat.equals(currentChat)) {
|
||||||
currentChat.read(writeProxy);
|
currentChat.read(writeProxy);
|
||||||
Platform.runLater(this::scrollToMessageListEnd);
|
scrollToMessageListEnd();
|
||||||
} else if (!ownMessage && message.getStatus() != MessageStatus.READ) chat.incrementUnreadAmount();
|
} else if (!ownMessage && message.getStatus() != MessageStatus.READ) chat.incrementUnreadAmount();
|
||||||
|
|
||||||
// Move chat with most recent unread messages to the top
|
// Move chat with most recent unread messages to the top
|
||||||
Platform.runLater(() -> {
|
|
||||||
chats.getSource().remove(chat);
|
chats.getSource().remove(chat);
|
||||||
((ObservableList<Chat>) chats.getSource()).add(0, chat);
|
((ObservableList<Chat>) chats.getSource()).add(0, chat);
|
||||||
|
|
||||||
|
@ -20,13 +20,17 @@
|
|||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
<?import javafx.stage.Screen?>
|
||||||
|
|
||||||
<GridPane fx:id="scene" maxHeight="-Infinity"
|
<GridPane fx:id="scene" maxHeight="-Infinity"
|
||||||
maxWidth="-Infinity" minHeight="400.0" minWidth="500.0"
|
maxWidth="-Infinity" minHeight="400.0" minWidth="500.0"
|
||||||
prefHeight="1152.0" prefWidth="2042.0"
|
prefHeight="${screen.visualBounds.height}" prefWidth="${screen.visualBounds.width}"
|
||||||
xmlns="http://javafx.com/javafx/11.0.1"
|
xmlns="http://javafx.com/javafx/11.0.1"
|
||||||
xmlns:fx="http://javafx.com/fxml/1"
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
fx:controller="envoy.client.ui.controller.ChatScene">
|
fx:controller="envoy.client.ui.controller.ChatScene">
|
||||||
|
<fx:define>
|
||||||
|
<Screen fx:factory="getPrimary" fx:id="screen" />
|
||||||
|
</fx:define>
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="NEVER"
|
<ColumnConstraints hgrow="NEVER"
|
||||||
maxWidth="327.99997965494794" minWidth="-Infinity" prefWidth="317.0" />
|
maxWidth="327.99997965494794" minWidth="-Infinity" prefWidth="317.0" />
|
||||||
|
Reference in New Issue
Block a user