Prepare handshake synchronization

Common
* Replace LocalDateTime with Instant everywhere

Client
* Display message creation date with system time zone in MessageControl
* LocalDB#users now strictly contains Users
* lastSync time stamp in LocalDB (saved per user)
* isOnline parameter in save function (lastSync updated if true)
* lastSync time stamp in LoginCredentials
* No ClientConfig#getLoginCredentials because of missing information,
  moved to LoginScene
* Pass LocalDB#lastSync to LoginCredentials in LoginScene

Server
* Explicit lastSync parameter for
  PersistenceManager#getPending(Group)Messages

This sends the correct time stamp to the server, however the JPQL
queries have yet to be adjusted.
This commit is contained in:
2020-07-16 17:04:35 +02:00
parent abd0113588
commit 07c4ccf3c8
23 changed files with 189 additions and 159 deletions

View File

@ -1,6 +1,6 @@
package envoy.event;
import java.time.LocalDateTime;
import java.time.Instant;
import envoy.data.GroupMessage;
import envoy.data.Message.MessageStatus;
@ -27,9 +27,9 @@ public class GroupMessageStatusChange extends MessageStatusChange {
* @param date the date at which the MessageStatus change occurred for
* this specific member
* @param memberID the ID of the group member that caused the status change
* @since Envoy Common v0.1-beta
* @since Envoy Common v0.2-beta
*/
public GroupMessageStatusChange(long id, MessageStatus status, LocalDateTime date, long memberID) {
public GroupMessageStatusChange(long id, MessageStatus status, Instant date, long memberID) {
super(id, status, date);
this.memberID = memberID;
}

View File

@ -1,6 +1,6 @@
package envoy.event;
import java.time.LocalDateTime;
import java.time.Instant;
import envoy.data.Message;
@ -14,8 +14,8 @@ import envoy.data.Message;
*/
public class MessageStatusChange extends Event<Message.MessageStatus> {
private final long id;
private final LocalDateTime date;
private final long id;
private final Instant date;
private static final long serialVersionUID = 0L;
@ -26,9 +26,9 @@ public class MessageStatusChange extends Event<Message.MessageStatus> {
* @param status the status of the {@link Message} this event is related
* to
* @param date the date at which the MessageStatus change occurred
* @since Envoy Common v0.2-alpha
* @since Envoy Common v0.2-beta
*/
public MessageStatusChange(long id, Message.MessageStatus status, LocalDateTime date) {
public MessageStatusChange(long id, Message.MessageStatus status, Instant date) {
super(status);
this.id = id;
this.date = date;
@ -40,7 +40,7 @@ public class MessageStatusChange extends Event<Message.MessageStatus> {
* @param message the message from which to build the event
* @since Envoy Common v0.2-alpha
*/
public MessageStatusChange(Message message) { this(message.getID(), message.getStatus(), LocalDateTime.now()); }
public MessageStatusChange(Message message) { this(message.getID(), message.getStatus(), Instant.now()); }
/**
* @return the ID of the {@link Message} this event is related to
@ -50,9 +50,9 @@ public class MessageStatusChange extends Event<Message.MessageStatus> {
/**
* @return the date at which the status change occurred
* @since Envoy Common v0.2-alpha
* @since Envoy Common v0.2-beta
*/
public LocalDateTime getDate() { return date; }
public Instant getDate() { return date; }
@Override
public String toString() { return String.format("MessageStatusChange[id=%d,status=%s,date=%s]", id, value, date); }