integrate FileModel with ChatModel
This commit is contained in:
@@ -7,6 +7,7 @@ import { decryptString, encryptString } from "./Utility/crypto";
|
||||
import ChatListModel from "./chatListModel";
|
||||
import { Color } from "../ViewModel/colors";
|
||||
import ConnectionModel from "./connectionModel";
|
||||
import FileModel from "./fileModel";
|
||||
import SettingsModel from "./settingsModel";
|
||||
import { checkIsValidObject } from "./Utility/typeSafety";
|
||||
import { v4 } from "uuid";
|
||||
@@ -17,6 +18,8 @@ export default class ChatModel {
|
||||
settingsModel: SettingsModel;
|
||||
chatListModel: ChatListModel;
|
||||
|
||||
fileModel: FileModel;
|
||||
|
||||
// data
|
||||
id: string;
|
||||
info: ChatInfo;
|
||||
@@ -210,6 +213,8 @@ export default class ChatModel {
|
||||
this.subscribe();
|
||||
|
||||
connectionModel.setMessageSentHandler(this.handleMessageSent);
|
||||
|
||||
this.fileModel = new FileModel(this);
|
||||
}
|
||||
|
||||
// utility
|
||||
@@ -280,4 +285,4 @@ export interface ChatMessage {
|
||||
status?: ChatMessageStatus;
|
||||
|
||||
stringifiedFile?: string;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-1
@@ -1,6 +1,15 @@
|
||||
// this file is responsible for managing files within chats.
|
||||
|
||||
export default class FileModel {}
|
||||
import ChatModel from "./chatModel";
|
||||
|
||||
export default class FileModel {
|
||||
chatModel: ChatModel;
|
||||
|
||||
// init
|
||||
constructor(chatModel: ChatModel) {
|
||||
this.chatModel = chatModel;
|
||||
}
|
||||
}
|
||||
|
||||
// types
|
||||
export interface File {
|
||||
|
||||
Reference in New Issue
Block a user