move name to settings modal
This commit is contained in:
Vendored
+192
-123
@@ -351,9 +351,6 @@
|
||||
connectAudioLabel: "connect to server",
|
||||
disconnectAudioLabel: "disconnect from server",
|
||||
manageConnectionsAudioLabel: "manage connections",
|
||||
yourNameLabel: "Your name",
|
||||
yourNamePlaceholder: "Jane Doe",
|
||||
setNameButtonAudioLabel: "set name",
|
||||
settingsButton: "Settings",
|
||||
manageStorageButton: "Manage storage",
|
||||
transferDataButton: "Transfer or export data",
|
||||
@@ -369,6 +366,7 @@
|
||||
settings: {
|
||||
pages: {
|
||||
appearance: "Appearance",
|
||||
account: "Account",
|
||||
regional: "Language & Region",
|
||||
info: "About CT"
|
||||
},
|
||||
@@ -379,10 +377,19 @@
|
||||
system: "Device theme",
|
||||
black: "Black"
|
||||
},
|
||||
version: "Version",
|
||||
account: {
|
||||
yourNameLabel: "Your name",
|
||||
yourNamePlaceholder: "Jane Doe",
|
||||
setNameButtonAudioLabel: "set name"
|
||||
},
|
||||
regional: {
|
||||
language: "Language",
|
||||
firstDayOfWeekLabel: "First day of week",
|
||||
firstDayOfWeekLabel: "First day of week"
|
||||
},
|
||||
about: {
|
||||
version: "Version",
|
||||
checkUpdatesButton: "Check for updates"
|
||||
}
|
||||
},
|
||||
connectionModal: {
|
||||
connectionModalHeadline: "Manage Connections",
|
||||
@@ -600,9 +607,6 @@
|
||||
connectAudioLabel: "mit Server verbinden",
|
||||
disconnectAudioLabel: "vom Server trennen",
|
||||
manageConnectionsAudioLabel: "Verbindungen verwalten",
|
||||
yourNameLabel: "Dein Name",
|
||||
yourNamePlaceholder: "Max Mustermann",
|
||||
setNameButtonAudioLabel: "Name speichern",
|
||||
settingsButton: "Einstellungen",
|
||||
manageStorageButton: "Daten verwalten",
|
||||
transferDataButton: "Daten \xFCbertragen",
|
||||
@@ -617,6 +621,7 @@
|
||||
settings: {
|
||||
pages: {
|
||||
appearance: "Erscheinungsbild",
|
||||
account: "Konto",
|
||||
regional: "Sprache & Region",
|
||||
info: "\xDCber CT"
|
||||
},
|
||||
@@ -627,10 +632,19 @@
|
||||
system: "Ger\xE4teeinstellung",
|
||||
black: "Schwarz"
|
||||
},
|
||||
version: "Version",
|
||||
account: {
|
||||
yourNameLabel: "Dein Name",
|
||||
yourNamePlaceholder: "Max Mustermann",
|
||||
setNameButtonAudioLabel: "Namen festlegen"
|
||||
},
|
||||
regional: {
|
||||
language: "Sprache",
|
||||
firstDayOfWeekLabel: "Erster Wochentag",
|
||||
checkUpdatesButton: "Nach updates suchen"
|
||||
firstDayOfWeekLabel: "Erster Wochentag"
|
||||
},
|
||||
about: {
|
||||
version: "Version",
|
||||
checkUpdatesButton: "Nach Updates suchen"
|
||||
}
|
||||
},
|
||||
connectionModal: {
|
||||
connectionModalHeadline: "Verbindungen verwalten",
|
||||
@@ -829,9 +843,6 @@
|
||||
connectAudioLabel: "conectar al servidor",
|
||||
disconnectAudioLabel: "desconectar del servidor",
|
||||
manageConnectionsAudioLabel: "gestionar conexiones",
|
||||
yourNameLabel: "Tu nombre",
|
||||
yourNamePlaceholder: "Juan P\xE9rez",
|
||||
setNameButtonAudioLabel: "establecer nombre",
|
||||
settingsButton: "Ajustes",
|
||||
manageStorageButton: "Gestionar almacenamiento",
|
||||
transferDataButton: "Enviar o exportar archivos",
|
||||
@@ -846,6 +857,7 @@
|
||||
settings: {
|
||||
pages: {
|
||||
appearance: "Aspecto",
|
||||
account: "Cuenta",
|
||||
regional: "Idioma y Regi\xF3n",
|
||||
info: "Sobre CT"
|
||||
},
|
||||
@@ -856,10 +868,19 @@
|
||||
system: "Seg\xFAn dispositivo",
|
||||
black: "Negro"
|
||||
},
|
||||
version: "Versi\xF3n",
|
||||
account: {
|
||||
yourNameLabel: "Tu nombre",
|
||||
yourNamePlaceholder: "Juan P\xE9rez",
|
||||
setNameButtonAudioLabel: "establecer nombre"
|
||||
},
|
||||
regional: {
|
||||
language: "Idioma",
|
||||
firstDayOfWeekLabel: "Primer d\xEDa de la semana",
|
||||
checkUpdatesButton: "Buscar actualizaciones"
|
||||
firstDayOfWeekLabel: "Primer d\xEDa de la semana"
|
||||
},
|
||||
about: {
|
||||
version: "Versi\xF3n",
|
||||
checkUpdatesButton: "Buscar actualisaciones"
|
||||
}
|
||||
},
|
||||
connectionModal: {
|
||||
connectionModalHeadline: "Gestionar Conexiones",
|
||||
@@ -1862,9 +1883,8 @@
|
||||
// src/Model/Global/settingsModel.ts
|
||||
var SettingsModel = class _SettingsModel {
|
||||
// init
|
||||
constructor(storageModel2, contactListModel2) {
|
||||
constructor(storageModel2) {
|
||||
this.storageModel = storageModel2;
|
||||
this.contactListModel = contactListModel2;
|
||||
// data
|
||||
this.username = "";
|
||||
this.userid = "";
|
||||
@@ -1886,7 +1906,6 @@
|
||||
this.setName = (newValue) => {
|
||||
this.username = newValue;
|
||||
this.storeSetting("username", newValue);
|
||||
this.contactListModel.storeContact(this.userid, newValue);
|
||||
};
|
||||
this.setFirstDayOfWeek = (newValue) => {
|
||||
this.firstDayOfWeek = newValue;
|
||||
@@ -1976,7 +1995,10 @@
|
||||
() => this.usernameInput.value == "" || this.usernameInput.value == this.coreViewModel.settingsModel.username
|
||||
);
|
||||
// methods
|
||||
this.setName = () => {
|
||||
this.setName = (name) => {
|
||||
if (typeof name == "string") {
|
||||
this.usernameInput.value = name;
|
||||
}
|
||||
this.coreViewModel.settingsModel.setName(this.usernameInput.value);
|
||||
this.username.value = this.coreViewModel.settingsModel.username;
|
||||
this.usernameInput.callSubscriptions();
|
||||
@@ -2362,6 +2384,58 @@
|
||||
}
|
||||
};
|
||||
|
||||
// src/ViewModel/Global/contactViewModel.ts
|
||||
var ContactListViewModel = class {
|
||||
// init
|
||||
constructor(contactListModel2, settingsViewModel2) {
|
||||
this.contactListModel = contactListModel2;
|
||||
this.settingsViewModel = settingsViewModel2;
|
||||
// state
|
||||
this.contacts = /* @__PURE__ */ new Map();
|
||||
// main
|
||||
this.updateContact = (id, name) => {
|
||||
if (id == this.settingsViewModel.settingsModel.userid) {
|
||||
this.settingsViewModel.setName(name);
|
||||
}
|
||||
const match = this.contacts.get(id);
|
||||
if (match) {
|
||||
match.name.value = name;
|
||||
return match;
|
||||
}
|
||||
const vm = new ContactViewModel(id, name);
|
||||
this.contacts.set(id, vm);
|
||||
return vm;
|
||||
};
|
||||
this.handleContact = (contact) => {
|
||||
this.updateContact(...contact);
|
||||
};
|
||||
this.unwrapContact = (id, knownName) => {
|
||||
if (this.contacts.has(id))
|
||||
return this.contacts.get(id);
|
||||
return this.updateContact(id, knownName);
|
||||
};
|
||||
// load
|
||||
this.loadData = () => {
|
||||
const contacts = this.contactListModel.loadContacts();
|
||||
for (const contact of contacts) {
|
||||
const vm = new ContactViewModel(...contact);
|
||||
this.contacts.set(vm.id, vm);
|
||||
}
|
||||
};
|
||||
this.loadData();
|
||||
this.contactListModel.contactHandlerManager.setHandler("contact-list-view-model", this.handleContact);
|
||||
}
|
||||
};
|
||||
var ContactViewModel = class {
|
||||
// init
|
||||
constructor(id, name) {
|
||||
this.id = id;
|
||||
// state
|
||||
this.name = new State("");
|
||||
this.name.value = name;
|
||||
}
|
||||
};
|
||||
|
||||
// src/ViewModel/Global/connectionViewModel.ts
|
||||
var ConnectionViewModel = class {
|
||||
// init
|
||||
@@ -2952,9 +3026,14 @@
|
||||
// messaging
|
||||
this.addMessage = async (chatMessage) => {
|
||||
await this.decryptMessage(chatMessage);
|
||||
this.contactListModel.storeContact(chatMessage.senderId, chatMessage.senderName);
|
||||
this.contactListModel.storeContact(
|
||||
chatMessage.senderId,
|
||||
chatMessage.senderName
|
||||
);
|
||||
if (chatMessage.body != "") {
|
||||
const messagePath = this.getMessagePath(chatMessage.fileId);
|
||||
const messagePath = this.getMessagePath(
|
||||
chatMessage.fileId
|
||||
);
|
||||
this.storageModel.writeStringifiable(messagePath, chatMessage);
|
||||
this.chatMessageHandlerManager.trigger(chatMessage);
|
||||
}
|
||||
@@ -5196,23 +5275,6 @@
|
||||
"toggle:disabled": connectionViewModel2.cannotConnect
|
||||
},
|
||||
/* @__PURE__ */ createElement("span", { class: "icon" }, "link")
|
||||
)), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("label", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "account_circle"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, coreViewModel2.translations.homePage.yourNameLabel), /* @__PURE__ */ createElement(
|
||||
"input",
|
||||
{
|
||||
placeholder: coreViewModel2.translations.homePage.yourNamePlaceholder,
|
||||
"bind:value": settingsViewModel2.usernameInput,
|
||||
"on:enter": settingsViewModel2.setName
|
||||
}
|
||||
))), /* @__PURE__ */ createElement("div", { class: "flex-row justify-end" }, /* @__PURE__ */ createElement(
|
||||
"button",
|
||||
{
|
||||
class: "width-50",
|
||||
"on:click": settingsViewModel2.setName,
|
||||
"toggle:disabled": settingsViewModel2.cannotSetName,
|
||||
"aria-label": coreViewModel2.translations.homePage.setNameButtonAudioLabel
|
||||
},
|
||||
coreViewModel2.translations.general.setButton,
|
||||
/* @__PURE__ */ createElement("span", { class: "icon" }, "check")
|
||||
)), /* @__PURE__ */ createElement("hr", null), HomePageButton(
|
||||
settingsViewModel2.showSettingsModal,
|
||||
coreViewModel2.translations.homePage.settingsButton,
|
||||
@@ -6476,7 +6538,13 @@
|
||||
|
||||
// src/View/Components/replyPreview.tsx
|
||||
function ReplyPreview(coreViewModel2, chatMessageViewModel) {
|
||||
return /* @__PURE__ */ createElement("div", { class: "reply-preview" }, /* @__PURE__ */ createElement("div", { class: "surface blur" }, /* @__PURE__ */ createElement("span", { class: "secondary", "subscribe:innerText": chatMessageViewModel.contact.name }), /* @__PURE__ */ createElement(
|
||||
return /* @__PURE__ */ createElement("div", { class: "reply-preview" }, /* @__PURE__ */ createElement("div", { class: "surface blur" }, /* @__PURE__ */ createElement(
|
||||
"span",
|
||||
{
|
||||
class: "secondary",
|
||||
"subscribe:innerText": chatMessageViewModel.contact.name
|
||||
}
|
||||
), /* @__PURE__ */ createElement(
|
||||
"b",
|
||||
{
|
||||
class: "ellipsis",
|
||||
@@ -7430,12 +7498,17 @@
|
||||
coreViewModel2,
|
||||
settingsViewModel2
|
||||
);
|
||||
case 1 /* Regional */:
|
||||
case 1 /* Account */:
|
||||
return SettingsAccountPane(
|
||||
coreViewModel2,
|
||||
settingsViewModel2
|
||||
);
|
||||
case 2 /* Regional */:
|
||||
return SettingsRegionalPane(
|
||||
coreViewModel2,
|
||||
settingsViewModel2
|
||||
);
|
||||
case 2 /* Info */:
|
||||
case 3 /* Info */:
|
||||
return SettingsInfoPane(coreViewModel2, settingsViewModel2);
|
||||
}
|
||||
}
|
||||
@@ -7466,12 +7539,17 @@
|
||||
), SettingsPaneButton(
|
||||
coreViewModel2,
|
||||
settingsViewModel2,
|
||||
1 /* Regional */,
|
||||
1 /* Account */,
|
||||
coreViewModel2.translations.settings.pages.account
|
||||
), SettingsPaneButton(
|
||||
coreViewModel2,
|
||||
settingsViewModel2,
|
||||
2 /* Regional */,
|
||||
coreViewModel2.translations.settings.pages.regional
|
||||
), SettingsPaneButton(
|
||||
coreViewModel2,
|
||||
settingsViewModel2,
|
||||
2 /* Info */,
|
||||
3 /* Info */,
|
||||
coreViewModel2.translations.settings.pages.info
|
||||
));
|
||||
}
|
||||
@@ -7487,7 +7565,7 @@
|
||||
function SettingsInfoPane(coreViewModel2, settingsViewModel2) {
|
||||
return /* @__PURE__ */ createElement("div", { class: "slide-up" }, /* @__PURE__ */ createElement("h2", null, coreViewModel2.translations.homePage.appName), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("div", { class: "flex-column gap" }, InfoTile(
|
||||
"build",
|
||||
coreViewModel2.translations.settings.version,
|
||||
coreViewModel2.translations.settings.about.version,
|
||||
settingsViewModel2.coreViewModel.version
|
||||
), /* @__PURE__ */ createElement(
|
||||
"button",
|
||||
@@ -7498,15 +7576,15 @@
|
||||
},
|
||||
/* @__PURE__ */ createElement("span", { "subscribe:innerText": coreViewModel2.updateText }),
|
||||
/* @__PURE__ */ createElement("span", { class: "icon" }, "update")
|
||||
), /* @__PURE__ */ createElement("button", { class: "standard", "on:click": coreViewModel2.checkUpdates }, coreViewModel2.translations.settings.checkUpdatesButton)));
|
||||
), /* @__PURE__ */ createElement("button", { class: "standard", "on:click": coreViewModel2.checkUpdates }, coreViewModel2.translations.settings.about.checkUpdatesButton)));
|
||||
}
|
||||
function SettingsRegionalPane(coreViewModel2, settingsViewModel2) {
|
||||
return /* @__PURE__ */ createElement("div", { class: "slide-up" }, /* @__PURE__ */ createElement("h2", null, coreViewModel2.translations.settings.pages.regional), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("h3", null, coreViewModel2.translations.settings.language), OptionButtonList(
|
||||
return /* @__PURE__ */ createElement("div", { class: "slide-up" }, /* @__PURE__ */ createElement("h2", null, coreViewModel2.translations.settings.pages.regional), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("h3", null, coreViewModel2.translations.settings.regional.language), OptionButtonList(
|
||||
new ListState(
|
||||
Object.values(Languages).map((x) => [languageNames[x], x])
|
||||
),
|
||||
settingsViewModel2.language
|
||||
), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("h3", null, coreViewModel2.translations.settings.firstDayOfWeekLabel), OptionButtonList(
|
||||
), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("h3", null, coreViewModel2.translations.settings.regional.firstDayOfWeekLabel), OptionButtonList(
|
||||
new ListState(
|
||||
coreViewModel2.translations.regional.weekdays.full.map(
|
||||
(x, i) => [x, i.toString()]
|
||||
@@ -7515,6 +7593,26 @@
|
||||
settingsViewModel2.firstDayOfWeek
|
||||
));
|
||||
}
|
||||
function SettingsAccountPane(coreViewModel2, settingsViewModel2) {
|
||||
return /* @__PURE__ */ createElement("div", { class: "slide-up" }, /* @__PURE__ */ createElement("h2", null, coreViewModel2.translations.settings.pages.account), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("label", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "account_circle"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, coreViewModel2.translations.settings.account.yourNameLabel), /* @__PURE__ */ createElement(
|
||||
"input",
|
||||
{
|
||||
placeholder: coreViewModel2.translations.settings.account.yourNamePlaceholder,
|
||||
"bind:value": settingsViewModel2.usernameInput,
|
||||
"on:enter": settingsViewModel2.setName
|
||||
}
|
||||
))), /* @__PURE__ */ createElement("div", { class: "flex-row justify-end width-input" }, /* @__PURE__ */ createElement(
|
||||
"button",
|
||||
{
|
||||
class: "width-50",
|
||||
"on:click": settingsViewModel2.setName,
|
||||
"toggle:disabled": settingsViewModel2.cannotSetName,
|
||||
"aria-label": coreViewModel2.translations.settings.account.setNameButtonAudioLabel
|
||||
},
|
||||
coreViewModel2.translations.general.setButton,
|
||||
/* @__PURE__ */ createElement("span", { class: "icon" }, "check")
|
||||
)));
|
||||
}
|
||||
function SettingsAppearancePane(coreViewModel2, settingsViewModel2) {
|
||||
return /* @__PURE__ */ createElement("div", { class: "slide-up" }, /* @__PURE__ */ createElement("h2", null, coreViewModel2.translations.settings.pages.appearance), /* @__PURE__ */ createElement("hr", null), OptionButtonList(
|
||||
new ListState([
|
||||
@@ -8150,6 +8248,37 @@
|
||||
body: ""
|
||||
};
|
||||
|
||||
// src/Model/Global/contactListModel.ts
|
||||
var ContactListModel = class {
|
||||
constructor(storageModel2, settingsModel2) {
|
||||
this.storageModel = storageModel2;
|
||||
this.settingsModel = settingsModel2;
|
||||
this.contactHandlerManager = new HandlerManager();
|
||||
this.getContactPath = (contactId) => {
|
||||
return StorageModel.getPath("contacts" /* ContactsModel */, [
|
||||
contactId
|
||||
]);
|
||||
};
|
||||
this.loadContacts = () => {
|
||||
const contactIds = this.storageModel.list([
|
||||
"contacts" /* ContactsModel */
|
||||
]);
|
||||
const contacts = contactIds.map((id) => [
|
||||
id,
|
||||
this.storageModel.read(this.getContactPath(id)) ?? "?"
|
||||
]);
|
||||
contacts.push([this.settingsModel.userid, this.settingsModel.username]);
|
||||
return contacts;
|
||||
};
|
||||
this.storeContact = (id, name) => {
|
||||
this.contactHandlerManager.trigger([id, name]);
|
||||
if (id == this.settingsModel.userid) return;
|
||||
const path = this.getContactPath(id);
|
||||
this.storageModel.write(path, name);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// node_modules/udn-frontend/index.ts
|
||||
var UDNFrontend = class {
|
||||
ws;
|
||||
@@ -8370,11 +8499,17 @@
|
||||
return chatMessages;
|
||||
};
|
||||
this.addToOutbox = (chatMessage) => {
|
||||
const messagePath = [...this.getOutboxPath(), chatMessage.fileId];
|
||||
const messagePath = [
|
||||
...this.getOutboxPath(),
|
||||
chatMessage.fileId
|
||||
];
|
||||
this.storageModel.writeStringifiable(messagePath, chatMessage);
|
||||
};
|
||||
this.removeFromOutbox = (chatMessage) => {
|
||||
const messagePath = [...this.getOutboxPath(), chatMessage.fileId];
|
||||
const messagePath = [
|
||||
...this.getOutboxPath(),
|
||||
chatMessage.fileId
|
||||
];
|
||||
this.storageModel.remove(messagePath);
|
||||
};
|
||||
this.sendMessagesInOutbox = () => {
|
||||
@@ -8564,79 +8699,10 @@
|
||||
}
|
||||
};
|
||||
|
||||
// src/Model/Global/contactListModel.ts
|
||||
var ContactListModel = class {
|
||||
constructor(storageModel2) {
|
||||
this.storageModel = storageModel2;
|
||||
this.contactHandlerManager = new HandlerManager();
|
||||
this.getContactPath = (contactId) => {
|
||||
return StorageModel.getPath("contacts" /* ContactsModel */, [contactId]);
|
||||
};
|
||||
this.loadContacts = () => {
|
||||
const contactIds = this.storageModel.list(["contacts" /* ContactsModel */]);
|
||||
const contacts = contactIds.map((id) => [id, this.storageModel.read(this.getContactPath(id)) ?? "?"]);
|
||||
return contacts;
|
||||
};
|
||||
this.storeContact = (id, name) => {
|
||||
const path = this.getContactPath(id);
|
||||
this.storageModel.write(path, name);
|
||||
this.contactHandlerManager.trigger([id, name]);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// src/ViewModel/Global/contactViewModel.ts
|
||||
var ContactListViewModel = class {
|
||||
// init
|
||||
constructor(contactListModel2) {
|
||||
this.contactListModel = contactListModel2;
|
||||
// state
|
||||
this.contacts = /* @__PURE__ */ new Map();
|
||||
// main
|
||||
this.updateContact = (id, name) => {
|
||||
const match = this.contacts.get(id);
|
||||
if (match) {
|
||||
match.name.value = name;
|
||||
return match;
|
||||
}
|
||||
const vm = new ContactViewModel(id, name);
|
||||
this.contacts.set(id, vm);
|
||||
return vm;
|
||||
};
|
||||
this.handleContact = (contact) => {
|
||||
this.updateContact(...contact);
|
||||
};
|
||||
this.unwrapContact = (id, knownName) => {
|
||||
if (this.contacts.has(id))
|
||||
return this.contacts.get(id);
|
||||
return this.updateContact(id, knownName);
|
||||
};
|
||||
// load
|
||||
this.loadData = () => {
|
||||
const contacts = this.contactListModel.loadContacts();
|
||||
for (const contact of contacts) {
|
||||
const vm = new ContactViewModel(...contact);
|
||||
this.contacts.set(vm.id, vm);
|
||||
}
|
||||
};
|
||||
this.loadData();
|
||||
this.contactListModel.contactHandlerManager.setHandler("contact-list-view-model", this.handleContact);
|
||||
}
|
||||
};
|
||||
var ContactViewModel = class {
|
||||
// init
|
||||
constructor(id, name) {
|
||||
this.id = id;
|
||||
// state
|
||||
this.name = new State("");
|
||||
this.name.value = name;
|
||||
}
|
||||
};
|
||||
|
||||
// src/index.tsx
|
||||
var storageModel = new StorageModel();
|
||||
var contactListModel = new ContactListModel(storageModel);
|
||||
var settingsModel = new SettingsModel(storageModel, contactListModel);
|
||||
var settingsModel = new SettingsModel(storageModel);
|
||||
var contactListModel = new ContactListModel(storageModel, settingsModel);
|
||||
var connectionModel = new ConnectionModel(storageModel);
|
||||
var chatListModel = new ChatListModel(
|
||||
storageModel,
|
||||
@@ -8653,8 +8719,11 @@
|
||||
fileTransferModel
|
||||
);
|
||||
var storageViewModel = new StorageViewModel(coreViewModel);
|
||||
var contactListViewModel = new ContactListViewModel(contactListModel);
|
||||
var settingsViewModel = new SettingsViewModel(coreViewModel, settingsModel);
|
||||
var contactListViewModel = new ContactListViewModel(
|
||||
contactListModel,
|
||||
settingsViewModel
|
||||
);
|
||||
var connectionViewModel = new ConnectionViewModel(coreViewModel);
|
||||
var chatListViewModel = new ChatListViewModel(
|
||||
coreViewModel,
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
const VERSION = "2610 Beta 14"
|
||||
const VERSION = "2610 Beta 16"
|
||||
|
||||
function processUrl(event) {
|
||||
const url = event.request.url;
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
2610 Beta 14
|
||||
2610 Beta 16
|
||||
|
||||
@@ -8,8 +8,8 @@ import StorageModel, {
|
||||
filePaths,
|
||||
} from "../Global/storageModel";
|
||||
import SettingsModel from "../Global/settingsModel";
|
||||
import ConnectionModel from "../Global/connectionModel";
|
||||
import ContactListModel from "../Global/contactListModel";
|
||||
import ConnectionModel from "../Global/connectionModel";
|
||||
|
||||
export default class ChatListModel {
|
||||
// data
|
||||
@@ -102,7 +102,7 @@ export default class ChatListModel {
|
||||
public storageModel: StorageModel,
|
||||
public settingsModel: SettingsModel,
|
||||
public connectionModel: ConnectionModel,
|
||||
public contactListModel: ContactListModel
|
||||
public contactListModel: ContactListModel,
|
||||
) {
|
||||
this.loadChats();
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ import StorageModel, {
|
||||
filePaths,
|
||||
} from "../Global/storageModel";
|
||||
import SettingsModel from "../Global/settingsModel";
|
||||
import ContactListModel from "../Global/contactListModel";
|
||||
import ConnectionModel from "../Global/connectionModel";
|
||||
import FileModel, { FileContent } from "../Files/fileModel";
|
||||
import { Colors } from "../../colors";
|
||||
import ContactListModel from "../Global/contactListModel";
|
||||
|
||||
export default class ChatModel {
|
||||
// models
|
||||
@@ -162,11 +162,16 @@ export default class ChatModel {
|
||||
readonly addMessage = async (chatMessage: ChatMessage): Promise<void> => {
|
||||
await this.decryptMessage(chatMessage);
|
||||
|
||||
this.contactListModel.storeContact(chatMessage.senderId, chatMessage.senderName);
|
||||
this.contactListModel.storeContact(
|
||||
chatMessage.senderId,
|
||||
chatMessage.senderName,
|
||||
);
|
||||
|
||||
// message
|
||||
if (chatMessage.body != "") {
|
||||
const messagePath: string[] = this.getMessagePath(chatMessage.fileId);
|
||||
const messagePath: string[] = this.getMessagePath(
|
||||
chatMessage.fileId,
|
||||
);
|
||||
this.storageModel.writeStringifiable(messagePath, chatMessage);
|
||||
this.chatMessageHandlerManager.trigger(chatMessage);
|
||||
}
|
||||
@@ -501,8 +506,7 @@ export interface ChatMessage extends FileContent<"message"> {
|
||||
stringifiedFile: string;
|
||||
}
|
||||
|
||||
export interface ChatMessageReaction
|
||||
extends FileContent<"reaction"> {
|
||||
export interface ChatMessageReaction extends FileContent<"reaction"> {
|
||||
readonly messageId: string;
|
||||
readonly senderId: string;
|
||||
readonly senderName: string;
|
||||
|
||||
@@ -149,12 +149,18 @@ export default class ConnectionModel {
|
||||
};
|
||||
|
||||
readonly addToOutbox = (chatMessage: ChatMessage): void => {
|
||||
const messagePath: string[] = [...this.getOutboxPath(), chatMessage.fileId];
|
||||
const messagePath: string[] = [
|
||||
...this.getOutboxPath(),
|
||||
chatMessage.fileId,
|
||||
];
|
||||
this.storageModel.writeStringifiable(messagePath, chatMessage);
|
||||
};
|
||||
|
||||
readonly removeFromOutbox = (chatMessage: ChatMessage): void => {
|
||||
const messagePath: string[] = [...this.getOutboxPath(), chatMessage.fileId];
|
||||
const messagePath: string[] = [
|
||||
...this.getOutboxPath(),
|
||||
chatMessage.fileId,
|
||||
];
|
||||
this.storageModel.remove(messagePath);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,28 +1,38 @@
|
||||
import {HandlerManager} from "../Utility/utility";
|
||||
import SettingsModel from "./settingsModel";
|
||||
import StorageModel, { StorageModelSubPaths } from "./storageModel";
|
||||
import SettingsModel from "./settingsModel";
|
||||
import { HandlerManager } from "../Utility/utility";
|
||||
|
||||
export default class ContactListModel {
|
||||
contactHandlerManager = new HandlerManager<[string, string]>();
|
||||
|
||||
private getContactPath = (contactId: string): string[] => {
|
||||
return StorageModel.getPath(StorageModelSubPaths.ContactsModel, [contactId]);
|
||||
}
|
||||
return StorageModel.getPath(StorageModelSubPaths.ContactsModel, [
|
||||
contactId,
|
||||
]);
|
||||
};
|
||||
|
||||
loadContacts = (): [string, string][] => {
|
||||
const contactIds: string[] = this.storageModel.list([StorageModelSubPaths.ContactsModel]);
|
||||
const contacts: [string, string][] = contactIds.map(id => [id, this.storageModel.read(this.getContactPath(id)) ?? "?"]);
|
||||
const contactIds: string[] = this.storageModel.list([
|
||||
StorageModelSubPaths.ContactsModel,
|
||||
]);
|
||||
const contacts: [string, string][] = contactIds.map((id) => [
|
||||
id,
|
||||
this.storageModel.read(this.getContactPath(id)) ?? "?",
|
||||
]);
|
||||
contacts.push([this.settingsModel.userid, this.settingsModel.username]);
|
||||
return contacts;
|
||||
}
|
||||
};
|
||||
|
||||
storeContact = (id: string, name: string) => {
|
||||
this.contactHandlerManager.trigger([id, name]);
|
||||
|
||||
if (id == this.settingsModel.userid) return;
|
||||
const path = this.getContactPath(id);
|
||||
this.storageModel.write(path, name)
|
||||
}
|
||||
this.storageModel.write(path, name);
|
||||
};
|
||||
|
||||
constructor(public storageModel: StorageModel, public settingsModel: SettingsModel) {}
|
||||
constructor(
|
||||
public storageModel: StorageModel,
|
||||
public settingsModel: SettingsModel,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ export default class StorageModel {
|
||||
// upgrade
|
||||
readonly upgrade = (): void => {
|
||||
// function used to upgrade data versions
|
||||
}
|
||||
};
|
||||
|
||||
// init
|
||||
constructor() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ViewController } from "../viewController";
|
||||
import * as React from "../../react";
|
||||
import ChatMessageViewModel from "../../ViewModel/Chat/chatMessageViewModel";
|
||||
import { ContactViewModel } from "../../ViewModel/Global/contactViewModel";
|
||||
import ChatMessageViewModel from "../../ViewModel/Chat/chatMessageViewModel";
|
||||
|
||||
export function InlineReply(chatMessageViewModel: ChatMessageViewModel) {
|
||||
const reply = chatMessageViewModel.inlineReply;
|
||||
|
||||
@@ -9,7 +9,10 @@ export function ReplyPreview(
|
||||
return (
|
||||
<div class="reply-preview">
|
||||
<div class="surface blur">
|
||||
<span class="secondary" subscribe:innerText={chatMessageViewModel.contact.name}></span>
|
||||
<span
|
||||
class="secondary"
|
||||
subscribe:innerText={chatMessageViewModel.contact.name}
|
||||
></span>
|
||||
<b
|
||||
class="ellipsis"
|
||||
subscribe:innerText={chatMessageViewModel.body}
|
||||
|
||||
@@ -29,6 +29,11 @@ export function SettingsModal(
|
||||
coreViewModel,
|
||||
settingsViewModel,
|
||||
);
|
||||
case SettingsModalPages.Account:
|
||||
return SettingsAccountPane(
|
||||
coreViewModel,
|
||||
settingsViewModel,
|
||||
);
|
||||
case SettingsModalPages.Regional:
|
||||
return SettingsRegionalPane(
|
||||
coreViewModel,
|
||||
@@ -79,6 +84,12 @@ function SettingsLeftPane(
|
||||
SettingsModalPages.Appearance,
|
||||
coreViewModel.translations.settings.pages.appearance,
|
||||
)}
|
||||
{SettingsPaneButton(
|
||||
coreViewModel,
|
||||
settingsViewModel,
|
||||
SettingsModalPages.Account,
|
||||
coreViewModel.translations.settings.pages.account,
|
||||
)}
|
||||
{SettingsPaneButton(
|
||||
coreViewModel,
|
||||
settingsViewModel,
|
||||
@@ -121,7 +132,7 @@ function SettingsInfoPane(
|
||||
<div class="flex-column gap">
|
||||
{InfoTile(
|
||||
"build",
|
||||
coreViewModel.translations.settings.version,
|
||||
coreViewModel.translations.settings.about.version,
|
||||
settingsViewModel.coreViewModel.version,
|
||||
)}
|
||||
|
||||
@@ -135,7 +146,10 @@ function SettingsInfoPane(
|
||||
</button>
|
||||
|
||||
<button class="standard" on:click={coreViewModel.checkUpdates}>
|
||||
{coreViewModel.translations.settings.checkUpdatesButton}
|
||||
{
|
||||
coreViewModel.translations.settings.about
|
||||
.checkUpdatesButton
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -151,7 +165,7 @@ function SettingsRegionalPane(
|
||||
<h2>{coreViewModel.translations.settings.pages.regional}</h2>
|
||||
|
||||
<hr></hr>
|
||||
<h3>{coreViewModel.translations.settings.language}</h3>
|
||||
<h3>{coreViewModel.translations.settings.regional.language}</h3>
|
||||
{OptionButtonList(
|
||||
new React.ListState<[string, string]>(
|
||||
Object.values(Languages).map((x) => [languageNames[x], x]),
|
||||
@@ -160,7 +174,12 @@ function SettingsRegionalPane(
|
||||
)}
|
||||
|
||||
<hr></hr>
|
||||
<h3>{coreViewModel.translations.settings.firstDayOfWeekLabel}</h3>
|
||||
<h3>
|
||||
{
|
||||
coreViewModel.translations.settings.regional
|
||||
.firstDayOfWeekLabel
|
||||
}
|
||||
</h3>
|
||||
{OptionButtonList(
|
||||
new React.ListState<[string, string]>(
|
||||
coreViewModel.translations.regional.weekdays.full.map(
|
||||
@@ -173,6 +192,51 @@ function SettingsRegionalPane(
|
||||
);
|
||||
}
|
||||
|
||||
function SettingsAccountPane(
|
||||
coreViewModel: CoreViewModel,
|
||||
settingsViewModel: SettingsViewModel,
|
||||
) {
|
||||
return (
|
||||
<div class="slide-up">
|
||||
<h2>{coreViewModel.translations.settings.pages.account}</h2>
|
||||
<hr></hr>
|
||||
<label class="tile flex-no">
|
||||
<span class="icon">account_circle</span>
|
||||
<div>
|
||||
<span>
|
||||
{
|
||||
coreViewModel.translations.settings.account
|
||||
.yourNameLabel
|
||||
}
|
||||
</span>
|
||||
<input
|
||||
placeholder={
|
||||
coreViewModel.translations.settings.account
|
||||
.yourNamePlaceholder
|
||||
}
|
||||
bind:value={settingsViewModel.usernameInput}
|
||||
on:enter={settingsViewModel.setName}
|
||||
></input>
|
||||
</div>
|
||||
</label>
|
||||
<div class="flex-row justify-end width-input">
|
||||
<button
|
||||
class="width-50"
|
||||
on:click={settingsViewModel.setName}
|
||||
toggle:disabled={settingsViewModel.cannotSetName}
|
||||
aria-label={
|
||||
coreViewModel.translations.settings.account
|
||||
.setNameButtonAudioLabel
|
||||
}
|
||||
>
|
||||
{coreViewModel.translations.general.setButton}
|
||||
<span class="icon">check</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SettingsAppearancePane(
|
||||
coreViewModel: CoreViewModel,
|
||||
settingsViewModel: SettingsViewModel,
|
||||
|
||||
@@ -87,39 +87,6 @@ export function HomePage(
|
||||
|
||||
<hr></hr>
|
||||
|
||||
<label class="tile flex-no">
|
||||
<span class="icon">account_circle</span>
|
||||
<div>
|
||||
<span>
|
||||
{coreViewModel.translations.homePage.yourNameLabel}
|
||||
</span>
|
||||
<input
|
||||
placeholder={
|
||||
coreViewModel.translations.homePage
|
||||
.yourNamePlaceholder
|
||||
}
|
||||
bind:value={settingsViewModel.usernameInput}
|
||||
on:enter={settingsViewModel.setName}
|
||||
></input>
|
||||
</div>
|
||||
</label>
|
||||
<div class="flex-row justify-end">
|
||||
<button
|
||||
class="width-50"
|
||||
on:click={settingsViewModel.setName}
|
||||
toggle:disabled={settingsViewModel.cannotSetName}
|
||||
aria-label={
|
||||
coreViewModel.translations.homePage
|
||||
.setNameButtonAudioLabel
|
||||
}
|
||||
>
|
||||
{coreViewModel.translations.general.setButton}
|
||||
<span class="icon">check</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<hr></hr>
|
||||
|
||||
{HomePageButton(
|
||||
settingsViewModel.showSettingsModal,
|
||||
coreViewModel.translations.homePage.settingsButton,
|
||||
|
||||
+35
-26
@@ -65,10 +65,6 @@ const englishTranslations = {
|
||||
disconnectAudioLabel: "disconnect from server",
|
||||
manageConnectionsAudioLabel: "manage connections",
|
||||
|
||||
yourNameLabel: "Your name",
|
||||
yourNamePlaceholder: "Jane Doe",
|
||||
setNameButtonAudioLabel: "set name",
|
||||
|
||||
settingsButton: "Settings",
|
||||
manageStorageButton: "Manage storage",
|
||||
transferDataButton: "Transfer or export data",
|
||||
@@ -90,6 +86,7 @@ const englishTranslations = {
|
||||
settings: {
|
||||
pages: {
|
||||
appearance: "Appearance",
|
||||
account: "Account",
|
||||
regional: "Language & Region",
|
||||
info: "About CT",
|
||||
},
|
||||
@@ -100,14 +97,20 @@ const englishTranslations = {
|
||||
system: "Device theme",
|
||||
black: "Black",
|
||||
},
|
||||
|
||||
version: "Version",
|
||||
account: {
|
||||
yourNameLabel: "Your name",
|
||||
yourNamePlaceholder: "Jane Doe",
|
||||
setNameButtonAudioLabel: "set name",
|
||||
},
|
||||
regional: {
|
||||
language: "Language",
|
||||
|
||||
firstDayOfWeekLabel: "First day of week",
|
||||
|
||||
},
|
||||
about: {
|
||||
version: "Version",
|
||||
checkUpdatesButton: "Check for updates",
|
||||
},
|
||||
},
|
||||
|
||||
connectionModal: {
|
||||
connectionModalHeadline: "Manage Connections",
|
||||
@@ -414,10 +417,6 @@ export const allTranslations: {
|
||||
disconnectAudioLabel: "vom Server trennen",
|
||||
manageConnectionsAudioLabel: "Verbindungen verwalten",
|
||||
|
||||
yourNameLabel: "Dein Name",
|
||||
yourNamePlaceholder: "Max Mustermann",
|
||||
setNameButtonAudioLabel: "Name speichern",
|
||||
|
||||
settingsButton: "Einstellungen",
|
||||
manageStorageButton: "Daten verwalten",
|
||||
transferDataButton: "Daten übertragen",
|
||||
@@ -437,6 +436,7 @@ export const allTranslations: {
|
||||
settings: {
|
||||
pages: {
|
||||
appearance: "Erscheinungsbild",
|
||||
account: "Konto",
|
||||
regional: "Sprache & Region",
|
||||
info: "Über CT",
|
||||
},
|
||||
@@ -447,13 +447,19 @@ export const allTranslations: {
|
||||
system: "Geräteeinstellung",
|
||||
black: "Schwarz",
|
||||
},
|
||||
|
||||
version: "Version",
|
||||
account: {
|
||||
yourNameLabel: "Dein Name",
|
||||
yourNamePlaceholder: "Max Mustermann",
|
||||
setNameButtonAudioLabel: "Namen festlegen",
|
||||
},
|
||||
regional: {
|
||||
language: "Sprache",
|
||||
|
||||
firstDayOfWeekLabel: "Erster Wochentag",
|
||||
|
||||
checkUpdatesButton: "Nach updates suchen",
|
||||
},
|
||||
about: {
|
||||
version: "Version",
|
||||
checkUpdatesButton: "Nach Updates suchen",
|
||||
},
|
||||
},
|
||||
|
||||
connectionModal: {
|
||||
@@ -729,10 +735,6 @@ export const allTranslations: {
|
||||
disconnectAudioLabel: "desconectar del servidor",
|
||||
manageConnectionsAudioLabel: "gestionar conexiones",
|
||||
|
||||
yourNameLabel: "Tu nombre",
|
||||
yourNamePlaceholder: "Juan Pérez",
|
||||
setNameButtonAudioLabel: "establecer nombre",
|
||||
|
||||
settingsButton: "Ajustes",
|
||||
manageStorageButton: "Gestionar almacenamiento",
|
||||
transferDataButton: "Enviar o exportar archivos",
|
||||
@@ -752,6 +754,7 @@ export const allTranslations: {
|
||||
settings: {
|
||||
pages: {
|
||||
appearance: "Aspecto",
|
||||
account: "Cuenta",
|
||||
regional: "Idioma y Región",
|
||||
info: "Sobre CT",
|
||||
},
|
||||
@@ -762,13 +765,19 @@ export const allTranslations: {
|
||||
system: "Según dispositivo",
|
||||
black: "Negro",
|
||||
},
|
||||
|
||||
version: "Versión",
|
||||
account: {
|
||||
yourNameLabel: "Tu nombre",
|
||||
yourNamePlaceholder: "Juan Pérez",
|
||||
setNameButtonAudioLabel: "establecer nombre",
|
||||
},
|
||||
regional: {
|
||||
language: "Idioma",
|
||||
|
||||
firstDayOfWeekLabel: "Primer día de la semana",
|
||||
|
||||
checkUpdatesButton: "Buscar actualizaciones",
|
||||
},
|
||||
about: {
|
||||
version: "Versión",
|
||||
checkUpdatesButton: "Buscar actualisaciones",
|
||||
},
|
||||
},
|
||||
connectionModal: {
|
||||
connectionModalHeadline: "Gestionar Conexiones",
|
||||
|
||||
@@ -2,11 +2,11 @@ import ChatViewModel from "./chatViewModel";
|
||||
import SettingsViewModel from "../Global/settingsViewModel";
|
||||
import NotificationViewModel from "../Global/notificationViewModel";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
import ContactListViewModel from "../Global/contactViewModel";
|
||||
import ConnectionViewModel from "../Global/connectionViewModel";
|
||||
import * as React from "../../react";
|
||||
import { IndexManager } from "../../Model/Utility/utility";
|
||||
import ChatModel from "../../Model/Chat/chatModel";
|
||||
import ContactListViewModel from "../Global/contactViewModel";
|
||||
|
||||
export default class ChatListViewModel {
|
||||
notificationViewModel: NotificationViewModel;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import MessagePageViewModel from "../Pages/messagePageViewModel";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
import { ContactViewModel } from "../Global/contactViewModel";
|
||||
import * as React from "../../react";
|
||||
import {
|
||||
ChatMessage,
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
ChatMessageStatuses,
|
||||
ReactionSymbols,
|
||||
} from "../../Model/Chat/chatModel";
|
||||
import {ContactViewModel} from "../Global/contactViewModel";
|
||||
|
||||
export default class ChatMessageViewModel {
|
||||
// data
|
||||
|
||||
@@ -8,6 +8,7 @@ import CalendarPageViewModel, {
|
||||
import SettingsViewModel from "../Global/settingsViewModel";
|
||||
import NotificationViewModel from "../Global/notificationViewModel";
|
||||
import CoreViewModel, { Context, ContextHost } from "../Global/coreViewModel";
|
||||
import ContactListViewModel from "../Global/contactViewModel";
|
||||
import ConnectionViewModel from "../Global/connectionViewModel";
|
||||
import * as React from "../../react";
|
||||
import { Colors } from "../../colors";
|
||||
@@ -21,7 +22,6 @@ import ChatModel, {
|
||||
ChatMessage,
|
||||
ChatMessageReaction,
|
||||
} from "../../Model/Chat/chatModel";
|
||||
import ContactListViewModel from "../Global/contactViewModel";
|
||||
|
||||
export default class ChatViewModel extends ContextHost<ChatPageTypes> {
|
||||
calendarViewModel: CalendarPageViewModel;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ContactListModel from "../../Model/Global/contactListModel";
|
||||
import * as React from "../../react";
|
||||
import SettingsViewModel from "./settingsViewModel";
|
||||
import * as React from "../../react";
|
||||
import ContactListModel from "../../Model/Global/contactListModel";
|
||||
|
||||
export default class ContactListViewModel {
|
||||
// state
|
||||
@@ -20,31 +20,37 @@ export default class ContactListViewModel {
|
||||
const vm = new ContactViewModel(id, name);
|
||||
this.contacts.set(id, vm);
|
||||
return vm;
|
||||
}
|
||||
};
|
||||
|
||||
handleContact = (contact: [string, string]): void => {
|
||||
this.updateContact(...contact);
|
||||
}
|
||||
};
|
||||
|
||||
unwrapContact = (id: string, knownName: string): ContactViewModel => {
|
||||
if (this.contacts.has(id))
|
||||
return this.contacts.get(id)!
|
||||
if (this.contacts.has(id)) return this.contacts.get(id)!;
|
||||
return this.updateContact(id, knownName);
|
||||
}
|
||||
};
|
||||
|
||||
// load
|
||||
loadData = (): void => {
|
||||
const contacts: [string, string][] = this.contactListModel.loadContacts();
|
||||
const contacts: [string, string][] =
|
||||
this.contactListModel.loadContacts();
|
||||
for (const contact of contacts) {
|
||||
const vm = new ContactViewModel(...contact);
|
||||
this.contacts.set(vm.id, vm);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// init
|
||||
constructor(public contactListModel: ContactListModel, public settingsViewModel: SettingsViewModel) {
|
||||
constructor(
|
||||
public contactListModel: ContactListModel,
|
||||
public settingsViewModel: SettingsViewModel,
|
||||
) {
|
||||
this.loadData();
|
||||
this.contactListModel.contactHandlerManager.setHandler("contact-list-view-model", this.handleContact);
|
||||
this.contactListModel.contactHandlerManager.setHandler(
|
||||
"contact-list-view-model",
|
||||
this.handleContact,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +59,10 @@ export class ContactViewModel {
|
||||
name: React.State<string> = new React.State("");
|
||||
|
||||
// init
|
||||
constructor(public id: string, name: string) {
|
||||
constructor(
|
||||
public id: string,
|
||||
name: string,
|
||||
) {
|
||||
this.name.value = name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import CoreViewModel, { Context } from "./coreViewModel";
|
||||
import * as React from "../../react";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import SettingsModel, { Languages, ThemeSettings } from "../../Model/Global/settingsModel";
|
||||
import SettingsModel, {
|
||||
Languages,
|
||||
ThemeSettings,
|
||||
} from "../../Model/Global/settingsModel";
|
||||
|
||||
export default class SettingsViewModel extends Context {
|
||||
// state
|
||||
@@ -129,7 +132,10 @@ export default class SettingsViewModel extends Context {
|
||||
};
|
||||
|
||||
// init
|
||||
constructor(public readonly coreViewModel: CoreViewModel, public readonly settingsModel: SettingsModel) {
|
||||
constructor(
|
||||
public readonly coreViewModel: CoreViewModel,
|
||||
public readonly settingsModel: SettingsModel,
|
||||
) {
|
||||
super("settings");
|
||||
|
||||
this.username.value = coreViewModel.settingsModel.username;
|
||||
@@ -177,6 +183,7 @@ export default class SettingsViewModel extends Context {
|
||||
|
||||
export enum SettingsModalPages {
|
||||
Appearance,
|
||||
Account,
|
||||
Regional,
|
||||
Info,
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import SearchViewModel from "../Utility/searchViewModel";
|
||||
import CoreViewModel, { Context } from "../Global/coreViewModel";
|
||||
import ContactListViewModel from "../Global/contactViewModel";
|
||||
import ChatViewModel, { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
import ChatMessageViewModel from "../Chat/chatMessageViewModel";
|
||||
import * as React from "../../react";
|
||||
@@ -9,7 +10,6 @@ import {
|
||||
ChatMessageReaction,
|
||||
ReactionSymbols,
|
||||
} from "../../Model/Chat/chatModel";
|
||||
import ContactListViewModel from "../Global/contactViewModel";
|
||||
|
||||
export default class MessagePageViewModel extends Context {
|
||||
// state
|
||||
@@ -107,14 +107,17 @@ export default class MessagePageViewModel extends Context {
|
||||
|
||||
// view
|
||||
showChatMessage = (chatMessage: ChatMessage): void => {
|
||||
const contact = this.contactListViewModel.unwrapContact(chatMessage.senderId, chatMessage.senderName);
|
||||
const contact = this.contactListViewModel.unwrapContact(
|
||||
chatMessage.senderId,
|
||||
chatMessage.senderName,
|
||||
);
|
||||
const chatMessageViewModel = new ChatMessageViewModel(
|
||||
this.coreViewModel,
|
||||
this,
|
||||
chatMessage,
|
||||
contact,
|
||||
chatMessage.senderId ==
|
||||
this.chatViewModel.settingsViewModel.settingsModel.userid
|
||||
this.chatViewModel.settingsViewModel.settingsModel.userid,
|
||||
);
|
||||
|
||||
const existingChatMessageViewModel: ChatMessageViewModel | undefined =
|
||||
|
||||
+6
-3
@@ -7,6 +7,7 @@ import StorageViewModel from "./ViewModel/Global/storageViewModel";
|
||||
import SettingsViewModel from "./ViewModel/Global/settingsViewModel";
|
||||
import FileTransferViewModel from "./ViewModel/Global/fileTransferViewModel";
|
||||
import CoreViewModel from "./ViewModel/Global/coreViewModel";
|
||||
import ContactListViewModel from "./ViewModel/Global/contactViewModel";
|
||||
import ConnectionViewModel from "./ViewModel/Global/connectionViewModel";
|
||||
import ChatListViewModel from "./ViewModel/Chat/chatListViewModel";
|
||||
import { HomePage } from "./View/homePage";
|
||||
@@ -18,10 +19,9 @@ import { ConnectionModal } from "./View/Modals/connectionModal";
|
||||
import StorageModel from "./Model/Global/storageModel";
|
||||
import SettingsModel from "./Model/Global/settingsModel";
|
||||
import FileTransferModel from "./Model/Global/fileTransferModel";
|
||||
import ContactListModel from "./Model/Global/contactListModel";
|
||||
import ConnectionModel from "./Model/Global/connectionModel";
|
||||
import ChatListModel from "./Model/Chat/chatListModel";
|
||||
import ContactListModel from "./Model/Global/contactListModel";
|
||||
import ContactListViewModel from "./ViewModel/Global/contactViewModel";
|
||||
|
||||
// models
|
||||
const storageModel = new StorageModel();
|
||||
@@ -47,7 +47,10 @@ const coreViewModel = new CoreViewModel(
|
||||
|
||||
const storageViewModel = new StorageViewModel(coreViewModel);
|
||||
const settingsViewModel = new SettingsViewModel(coreViewModel, settingsModel);
|
||||
const contactListViewModel = new ContactListViewModel(contactListModel, settingsViewModel);
|
||||
const contactListViewModel = new ContactListViewModel(
|
||||
contactListModel,
|
||||
settingsViewModel,
|
||||
);
|
||||
const connectionViewModel = new ConnectionViewModel(coreViewModel);
|
||||
const chatListViewModel = new ChatListViewModel(
|
||||
coreViewModel,
|
||||
|
||||
Reference in New Issue
Block a user