Added key shortcuts and system commands for logout, exit and settings

Additionally added **buggy** logout mechanism: LocalDB is not reset
properly and IndexOutOfBoundsExceptions occur in the UI
This commit is contained in:
2020-09-23 23:11:32 +02:00
parent 2d9283551a
commit 05d4917bb2
8 changed files with 91 additions and 23 deletions

View File

@ -7,7 +7,7 @@ import java.time.Instant;
import java.util.*;
import java.util.logging.Level;
import envoy.client.event.EnvoyCloseEvent;
import envoy.client.event.*;
import envoy.data.*;
import envoy.event.*;
import envoy.exception.EnvoyException;
@ -213,11 +213,19 @@ public final class LocalDB implements EventListener {
private void onNewAuthToken(NewAuthToken evt) { authToken = evt.get(); }
/**
* Deletes the file that stores the "remember me" feature.
* Deletes all associations to the current user.
*
* @since Envoy Client v0.2-beta
*/
public void deleteLoginFile() { lastLoginFile.delete(); }
@Event(eventType = Logout.class, priority = 100)
public void onLogout() {
lastLoginFile.delete();
userFile = null;
user = null;
authToken = null;
chats.clear();
cacheMap = new CacheMap();
}
/**
* @return a {@code Map<String, User>} of all users stored locally with their