implement model methods for backup

This commit is contained in:
marlon-erler
2026-08-29 02:10:26 +02:00
parent 2c8b078b80
commit 2245fb5885
20 changed files with 11999 additions and 8945 deletions
@@ -20,8 +20,8 @@ export default class NotificationViewModel {
if (this.chatListViewModel.selectedChat.value == undefined) return;
const currentChat =
this.chatListViewModel.selectedChat.value.chatModel.
unwrappedPrimaryChannel
this.chatListViewModel.selectedChat.value.chatModel
.unwrappedPrimaryChannel;
const currentPage =
this.chatListViewModel.selectedChat.value.selectedPage.value;
if (
@@ -41,7 +41,8 @@ export default class NotificationViewModel {
const chat = [
...this.chatListViewModel.chatViewModels.value.values(),
].find(
(chat) => chat.chatModel.unwrappedPrimaryChannel == notification.chat,
(chat) =>
chat.chatModel.unwrappedPrimaryChannel == notification.chat,
);
chat.open();
chat.openPage(ChatPageTypes.Messages);
@@ -79,7 +80,7 @@ export default class NotificationViewModel {
};
// init
constructor(public readonly chatListViewModel: ChatListViewModel) { }
constructor(public readonly chatListViewModel: ChatListViewModel) {}
// util
static createNotification(message: ChatMessage): Notification {
+6 -13
View File
@@ -32,8 +32,7 @@ export default class SettingsPageViewModel extends Context {
);
cannotSetNamespace: React.State<boolean> = React.createProxyState(
[this.namespace, this.namespaceInput],
() =>
this.namespaceInput.value == this.namespace.value,
() => this.namespaceInput.value == this.namespace.value,
);
cannotAddSecondaryChannel: React.State<boolean> = React.createProxyState(
[this.newSecondaryChannelInput],
@@ -53,11 +52,8 @@ export default class SettingsPageViewModel extends Context {
};
setNamespace = (): void => {
this.chatViewModel.chatModel.setNamespace(
this.namespaceInput.value,
);
this.namespace.value =
this.chatViewModel.chatModel.info.namespace;
this.chatViewModel.chatModel.setNamespace(this.namespaceInput.value);
this.namespace.value = this.chatViewModel.chatModel.info.namespace;
};
addSecondaryChannel = (): void => {
@@ -101,17 +97,14 @@ export default class SettingsPageViewModel extends Context {
preloadData = (): void => {
this.primaryChannel.value =
this.chatViewModel.chatModel.info.primaryChannel;
this.namespace.value =
this.chatViewModel.chatModel.info.namespace;
this.namespace.value = this.chatViewModel.chatModel.info.namespace;
this.color.value = this.chatViewModel.chatModel.color;
};
loadData = (): void => {
this.primaryChannelInput.value =
this.primaryChannel.value;
this.namespaceInput.value =
this.namespace.value;
this.primaryChannelInput.value = this.primaryChannel.value;
this.namespaceInput.value = this.namespace.value;
this.loadSecondaryChannels();