This commit is contained in:
marlon-erler
2024-07-22 02:23:21 +02:00
parent a776b977f8
commit 839e6e6b2a
5 changed files with 106 additions and 105 deletions
+16 -15
View File
@@ -25,19 +25,7 @@ export default class ConnectionModel {
channelsToSubscribe: Set<string> = new Set();
// connection
connect = (address: string): void => {
this.udn.connect(address);
};
disconnect = (): void => {
this.udn.disconnect();
// do not reconnect
const reconnectAddressPath: string[] = storageKeys.reconnectAddress;
this.storageModel.remove(reconnectAddressPath);
};
// handlers
handleMessage = (data: Message): void => {
this.messageHandler(data);
};
@@ -55,6 +43,19 @@ export default class ConnectionModel {
this.sendMessagesInOutbox();
};
// connection
connect = (address: string): void => {
this.udn.connect(address);
};
disconnect = (): void => {
this.udn.disconnect();
// do not reconnect
const reconnectAddressPath: string[] = storageKeys.reconnectAddress;
this.storageModel.remove(reconnectAddressPath);
};
// mailbox
requestNewMailbox = (): void => {
console.trace("requesting mailbox");
@@ -178,7 +179,7 @@ export default class ConnectionModel {
return this.storageModel.list(dirPath);
}
// handlers
// other
setConnectionChangeHandler = (handler: () => void): void => {
this.connectionChangeHandler = handler;
};
@@ -193,7 +194,7 @@ export default class ConnectionModel {
this.messageSentHandler = handler;
};
// setup
// init
constructor(storageModel: StorageModel) {
// create frontend
this.udn = new UDNFrontend();
+1
View File
@@ -5,6 +5,7 @@ import StorageModel, { storageKeys } from "./storageModel";
export default class SettingsModel {
storageModel: StorageModel;
// data
username: string;
firstDayOfWeek: string;
+1 -1
View File
@@ -1,4 +1,4 @@
// this file is responsible for reading and writing persistent data; all storage shall be handled by this file.
// this file is responsible for reading and writing persistent data.
import {
DATA_VERSION,