change own contact when name setting changes
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
|
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
|
||||||
import { UUID } from "../../react";
|
import { UUID } from "../../react";
|
||||||
|
import ContactListModel from "./contactListModel";
|
||||||
|
|
||||||
export default class SettingsModel {
|
export default class SettingsModel {
|
||||||
readonly storageModel: StorageModel;
|
|
||||||
|
|
||||||
// data
|
// data
|
||||||
username: string = "";
|
username: string = "";
|
||||||
userid: string = "";
|
userid: string = "";
|
||||||
@@ -31,6 +30,7 @@ export default class SettingsModel {
|
|||||||
readonly setName = (newValue: string): void => {
|
readonly setName = (newValue: string): void => {
|
||||||
this.username = newValue;
|
this.username = newValue;
|
||||||
this.storeSetting("username", newValue);
|
this.storeSetting("username", newValue);
|
||||||
|
this.contactListModel.storeContact(this.userid,newValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
readonly setFirstDayOfWeek = (newValue: string): void => {
|
readonly setFirstDayOfWeek = (newValue: string): void => {
|
||||||
@@ -87,9 +87,7 @@ export default class SettingsModel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// init
|
// init
|
||||||
constructor(storageModel: StorageModel) {
|
constructor(public storageModel: StorageModel, public contactListModel: ContactListModel) {
|
||||||
this.storageModel = storageModel;
|
|
||||||
|
|
||||||
this.loadId();
|
this.loadId();
|
||||||
this.loadUsername();
|
this.loadUsername();
|
||||||
this.loadFirstDayofWeek();
|
this.loadFirstDayofWeek();
|
||||||
|
|||||||
+2
-2
@@ -25,8 +25,8 @@ import ContactListViewModel from "./ViewModel/Global/contactViewModel";
|
|||||||
|
|
||||||
// models
|
// models
|
||||||
const storageModel = new StorageModel();
|
const storageModel = new StorageModel();
|
||||||
const settingsModel = new SettingsModel(storageModel);
|
|
||||||
const contactListModel = new ContactListModel(storageModel);
|
const contactListModel = new ContactListModel(storageModel);
|
||||||
|
const settingsModel = new SettingsModel(storageModel, contactListModel);
|
||||||
const connectionModel = new ConnectionModel(storageModel);
|
const connectionModel = new ConnectionModel(storageModel);
|
||||||
const chatListModel = new ChatListModel(
|
const chatListModel = new ChatListModel(
|
||||||
storageModel,
|
storageModel,
|
||||||
@@ -46,8 +46,8 @@ const coreViewModel = new CoreViewModel(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const storageViewModel = new StorageViewModel(coreViewModel);
|
const storageViewModel = new StorageViewModel(coreViewModel);
|
||||||
const settingsViewModel = new SettingsViewModel(coreViewModel, settingsModel);
|
|
||||||
const contactListViewModel = new ContactListViewModel(contactListModel);
|
const contactListViewModel = new ContactListViewModel(contactListModel);
|
||||||
|
const settingsViewModel = new SettingsViewModel(coreViewModel, settingsModel);
|
||||||
const connectionViewModel = new ConnectionViewModel(coreViewModel);
|
const connectionViewModel = new ConnectionViewModel(coreViewModel);
|
||||||
const chatListViewModel = new ChatListViewModel(
|
const chatListViewModel = new ChatListViewModel(
|
||||||
coreViewModel,
|
coreViewModel,
|
||||||
|
|||||||
Reference in New Issue
Block a user