rename all enums to plural
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { ChatMessage, ChatMessageReference } from "../Chat/chatModel";
|
||||
import { HandlerManager, stringify } from "../Utility/utility";
|
||||
import StorageModel, { StorageModelSubPath, filePaths } from "./storageModel";
|
||||
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
|
||||
import UDNFrontend, { Message } from "udn-frontend";
|
||||
|
||||
export default class ConnectionModel {
|
||||
@@ -55,7 +55,7 @@ export default class ConnectionModel {
|
||||
|
||||
// do not reconnect
|
||||
const reconnectAddressPath: string[] = StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.reconnectAddress,
|
||||
);
|
||||
this.storageModel.remove(reconnectAddressPath);
|
||||
@@ -74,7 +74,7 @@ export default class ConnectionModel {
|
||||
// mailbox
|
||||
getMailboxPath = (address: string): string[] => {
|
||||
const mailboxDirPath = StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.mailboxes,
|
||||
);
|
||||
const mailboxFilePath = [...mailboxDirPath, address];
|
||||
@@ -122,7 +122,7 @@ export default class ConnectionModel {
|
||||
// outbox
|
||||
getOutboxPath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.outbox,
|
||||
);
|
||||
};
|
||||
@@ -192,7 +192,7 @@ export default class ConnectionModel {
|
||||
// storage
|
||||
getPreviousAddressPath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.previousAddresses,
|
||||
);
|
||||
};
|
||||
@@ -204,7 +204,7 @@ export default class ConnectionModel {
|
||||
|
||||
getReconnectAddressPath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.reconnectAddress,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// this file is responsible for all settings.
|
||||
|
||||
import StorageModel, { StorageModelSubPath, filePaths } from "./storageModel";
|
||||
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
|
||||
|
||||
export default class SettingsModel {
|
||||
storageModel: StorageModel;
|
||||
@@ -13,7 +13,7 @@ export default class SettingsModel {
|
||||
setName(newValue: string): void {
|
||||
this.username = newValue;
|
||||
const path = StorageModel.getPath(
|
||||
StorageModelSubPath.SettingsModel,
|
||||
StorageModelSubPaths.SettingsModel,
|
||||
filePaths.settingsModel.username,
|
||||
);
|
||||
this.storageModel.write(path, newValue);
|
||||
@@ -22,7 +22,7 @@ export default class SettingsModel {
|
||||
setFirstDayOfWeek(newValue: string): void {
|
||||
this.firstDayOfWeek = newValue;
|
||||
const path = StorageModel.getPath(
|
||||
StorageModelSubPath.SettingsModel,
|
||||
StorageModelSubPaths.SettingsModel,
|
||||
filePaths.settingsModel.firstDayOfWeek,
|
||||
);
|
||||
this.storageModel.write(path, newValue);
|
||||
@@ -31,7 +31,7 @@ export default class SettingsModel {
|
||||
// load
|
||||
loadUsernam(): void {
|
||||
const path = StorageModel.getPath(
|
||||
StorageModelSubPath.SettingsModel,
|
||||
StorageModelSubPaths.SettingsModel,
|
||||
filePaths.settingsModel.username,
|
||||
);
|
||||
const content = this.storageModel.read(path);
|
||||
@@ -40,7 +40,7 @@ export default class SettingsModel {
|
||||
|
||||
loadFirstDayofWeek(): void {
|
||||
const path = StorageModel.getPath(
|
||||
StorageModelSubPath.SettingsModel,
|
||||
StorageModelSubPaths.SettingsModel,
|
||||
filePaths.settingsModel.firstDayOfWeek,
|
||||
);
|
||||
const content = this.storageModel.read(path);
|
||||
|
||||
@@ -212,7 +212,7 @@ export default class StorageModel {
|
||||
};
|
||||
|
||||
static getPath(
|
||||
locationName: StorageModelSubPath,
|
||||
locationName: StorageModelSubPaths,
|
||||
filePath: string[],
|
||||
): string[] {
|
||||
return [DATA_VERSION, locationName, ...filePath];
|
||||
@@ -223,7 +223,7 @@ export default class StorageModel {
|
||||
export type StorageEntry = { [key: string]: StorageEntry };
|
||||
|
||||
// locations
|
||||
export enum StorageModelSubPath {
|
||||
export enum StorageModelSubPaths {
|
||||
Chat = "chat",
|
||||
|
||||
ConnectionModel = "connection",
|
||||
|
||||
Reference in New Issue
Block a user