cleanup path management
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import ChatModel, { ChatMessage } from "./chatModel";
|
||||
import StorageModel, { filePaths } from "../Global/storageModel";
|
||||
import StorageModel, { StorageModelSubPath, filePaths } from "../Global/storageModel";
|
||||
|
||||
import ConnectionModel from "../Global/connectionModel";
|
||||
import { Message } from "udn-frontend";
|
||||
@@ -77,7 +77,7 @@ export default class ChatListModel {
|
||||
|
||||
// load
|
||||
loadChats = (): void => {
|
||||
const chatDir = StorageModel.getPath("chat", filePaths.chat.base);
|
||||
const chatDir = StorageModel.getPath(StorageModelSubPath.Chat, filePaths.chat.base);
|
||||
const chatIds = this.storageModel.list(chatDir);
|
||||
for (const chatId of chatIds) {
|
||||
const chatModel = new ChatModel(
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
parseValidObject,
|
||||
stringify,
|
||||
} from "../Utility/utility";
|
||||
import StorageModel, { filePaths } from "../Global/storageModel";
|
||||
import StorageModel, { StorageModelSubPath, filePaths } from "../Global/storageModel";
|
||||
import { decryptString, encryptString } from "../Utility/crypto";
|
||||
|
||||
import ChatListModel from "./chatListModel";
|
||||
@@ -39,19 +39,19 @@ export default class ChatModel {
|
||||
|
||||
// paths
|
||||
getBasePath = (): string[] => {
|
||||
return StorageModel.getPath("chat", filePaths.chat.chatBase(this.id));
|
||||
return StorageModel.getPath(StorageModelSubPath.Chat, filePaths.chat.chatBase(this.id));
|
||||
};
|
||||
|
||||
getInfoPath = (): string[] => {
|
||||
return StorageModel.getPath("chat", filePaths.chat.info(this.id));
|
||||
return StorageModel.getPath(StorageModelSubPath.Chat, filePaths.chat.info(this.id));
|
||||
};
|
||||
|
||||
getColorPath = (): string[] => {
|
||||
return StorageModel.getPath("chat", filePaths.chat.color(this.id));
|
||||
return StorageModel.getPath(StorageModelSubPath.Chat, filePaths.chat.color(this.id));
|
||||
};
|
||||
|
||||
getMessageDirPath = (): string[] => {
|
||||
return StorageModel.getPath("chat", filePaths.chat.messages(this.id));
|
||||
return StorageModel.getPath(StorageModelSubPath.Chat, filePaths.chat.messages(this.id));
|
||||
};
|
||||
|
||||
getMessagePath = (id: string): string[] => {
|
||||
|
||||
Reference in New Issue
Block a user