change own contact when name setting changes

This commit is contained in:
marlon-erler
2026-09-27 03:05:01 +02:00
parent a9fba4646d
commit fc5486a0f7
2 changed files with 49 additions and 51 deletions
+3 -5
View File
@@ -1,9 +1,8 @@
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
import { UUID } from "../../react";
import ContactListModel from "./contactListModel";
export default class SettingsModel {
readonly storageModel: StorageModel;
// data
username: string = "";
userid: string = "";
@@ -31,6 +30,7 @@ export default class SettingsModel {
readonly setName = (newValue: string): void => {
this.username = newValue;
this.storeSetting("username", newValue);
this.contactListModel.storeContact(this.userid,newValue);
};
readonly setFirstDayOfWeek = (newValue: string): void => {
@@ -87,9 +87,7 @@ export default class SettingsModel {
};
// init
constructor(storageModel: StorageModel) {
this.storageModel = storageModel;
constructor(public storageModel: StorageModel, public contactListModel: ContactListModel) {
this.loadId();
this.loadUsername();
this.loadFirstDayofWeek();
+2 -2
View File
@@ -25,8 +25,8 @@ import ContactListViewModel from "./ViewModel/Global/contactViewModel";
// models
const storageModel = new StorageModel();
const settingsModel = new SettingsModel(storageModel);
const contactListModel = new ContactListModel(storageModel);
const settingsModel = new SettingsModel(storageModel, contactListModel);
const connectionModel = new ConnectionModel(storageModel);
const chatListModel = new ChatListModel(
storageModel,
@@ -46,8 +46,8 @@ const coreViewModel = new CoreViewModel(
);
const storageViewModel = new StorageViewModel(coreViewModel);
const settingsViewModel = new SettingsViewModel(coreViewModel, settingsModel);
const contactListViewModel = new ContactListViewModel(contactListModel);
const settingsViewModel = new SettingsViewModel(coreViewModel, settingsModel);
const connectionViewModel = new ConnectionViewModel(coreViewModel);
const chatListViewModel = new ChatListViewModel(
coreViewModel,