Replaced MessageCache by Cache<T>

This class will be used to implement the offline cache for both messages
and events.
This commit is contained in:
2020-02-06 18:35:05 +01:00
parent 768b637ce8
commit cdef310a69
4 changed files with 65 additions and 62 deletions

View File

@ -13,13 +13,11 @@ import javax.swing.SwingUtilities;
import envoy.client.Config;
import envoy.client.Settings;
import envoy.client.data.LocalDb;
import envoy.client.data.PersistentLocalDb;
import envoy.client.data.TransientLocalDb;
import envoy.client.data.*;
import envoy.client.net.Client;
import envoy.client.net.MessageCache;
import envoy.client.util.EnvoyLog;
import envoy.data.LoginCredentials;
import envoy.data.Message;
import envoy.data.User;
import envoy.exception.EnvoyException;
@ -108,7 +106,7 @@ public class Startup {
// Acquire the client user (with ID) either from the server or from the local
// database, which triggers offline mode
Client client = new Client();
MessageCache cache = null;
Cache<Message> cache = null;
try {
// Try entering online mode first
localDb.loadIdGenerator();
@ -178,7 +176,7 @@ public class Startup {
});
// Relay unread messages from cache
if (cache != null) cache.relayMessages();
if (cache != null) cache.relay();
// Save Settings and PersistentLocalDb on shutdown
Runtime.getRuntime().addShutdownHook(new Thread(() -> {