use key instead of pathComponents

This commit is contained in:
marlon-erler
2024-07-19 20:07:14 +02:00
parent ab83a7de39
commit ba3d78d8d0
2 changed files with 34 additions and 11 deletions
+23
View File
@@ -1,7 +1,22 @@
// this file is responsible for managing chats and chat messages. objects are delegated to objectModel.ts.
import StorageModel, { storageKeys } from "./storageModel";
import { createTimestamp } from "../utility";
export class ChatModel {
info: ChatInfo;
messages: ChatMessage[];
objects: ChatObject[];
outbox: ChatMessage[];
constructor(storageModel: StorageModel, chatId: string) {
const infoPath = storageKeys.chatInfo(chatId)
const info = storageModel.restoreStringifiable(infoPath);
}
}
// creation methods
export function createChatMessage(channel: string, sender: string, body: string): ChatMessage {
return {
@@ -15,6 +30,14 @@ export function createChatMessage(channel: string, sender: string, body: string)
}
// types
export interface ChatInfo {
primaryChannel: string;
secondaryChannels: string[];
encryptionKey: string;
hasUnreadMessages: boolean;
}
export interface ChatMessage {
dataVersion: "v2";