diff --git a/dist/index.js b/dist/index.js index 432757a0..b7f67f3e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2410,8 +2410,7 @@ this.updateContact(...contact); }; this.unwrapContact = (id, knownName) => { - 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 @@ -2423,7 +2422,10 @@ } }; this.loadData(); - this.contactListModel.contactHandlerManager.setHandler("contact-list-view-model", this.handleContact); + this.contactListModel.contactHandlerManager.setHandler( + "contact-list-view-model", + this.handleContact + ); } }; var ContactViewModel = class { @@ -2986,6 +2988,7 @@ chatMessage.status = "received" /* Received */; this.addMessage(chatMessage); if (chatMessage.stringifiedFile) return; + if (chatMessage.senderId == this.settingsModel.userid) return; this.setReadStatus(true); }; this.handleReaction = (reaction) => { @@ -4749,7 +4752,10 @@ }; // view this.showChatMessage = (chatMessage) => { - 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, @@ -5017,8 +5023,9 @@ // src/ViewModel/Global/notificationViewModel.ts var NotificationViewModel = class { // init - constructor(chatListViewModel2) { + constructor(chatListViewModel2, settingsViewModel2) { this.chatListViewModel = chatListViewModel2; + this.settingsViewModel = settingsViewModel2; // data this.seenMessageIds = /* @__PURE__ */ new Set(); this.messagesInMarquee = []; @@ -5029,6 +5036,7 @@ this.showNotification = (message) => { if (this.seenMessageIds.has(message.fileId)) return; if (this.chatListViewModel.selectedChat.value == void 0) return; + if (message.senderId == this.settingsViewModel.settingsModel.userid) return; const notification = this.createNotification(message); const currentChat = this.chatListViewModel.selectedChat.value.chatModel.id; const currentPage = this.chatListViewModel.selectedChat.value.selectedPage.value; @@ -5170,7 +5178,7 @@ } return fullChannel; }; - this.notificationViewModel = new NotificationViewModel(this); + this.notificationViewModel = new NotificationViewModel(this, this.settingsViewModel); this.loadChats(); } }; diff --git a/dist/sw.js b/dist/sw.js index 364f3e90..7e073e57 100644 --- a/dist/sw.js +++ b/dist/sw.js @@ -1,4 +1,4 @@ -const VERSION = "2610 Beta 16" +const VERSION = "2610 Beta 17" function processUrl(event) { const url = event.request.url; diff --git a/dist/version.txt b/dist/version.txt index 28920a99..53ca3363 100644 --- a/dist/version.txt +++ b/dist/version.txt @@ -1 +1 @@ -2610 Beta 16 +2610 Beta 17 diff --git a/src/Model/Chat/chatModel.ts b/src/Model/Chat/chatModel.ts index f04165fa..26bb653d 100644 --- a/src/Model/Chat/chatModel.ts +++ b/src/Model/Chat/chatModel.ts @@ -111,6 +111,7 @@ export default class ChatModel { this.addMessage(chatMessage); if (chatMessage.stringifiedFile) return; + if (chatMessage.senderId == this.settingsModel.userid) return; this.setReadStatus(true); }; diff --git a/src/ViewModel/Chat/chatListViewModel.ts b/src/ViewModel/Chat/chatListViewModel.ts index 9e2a7b5a..55b96d9b 100644 --- a/src/ViewModel/Chat/chatListViewModel.ts +++ b/src/ViewModel/Chat/chatListViewModel.ts @@ -101,7 +101,7 @@ export default class ChatListViewModel { public readonly connectionViewModel: ConnectionViewModel, public readonly contactListViewModel: ContactListViewModel, ) { - this.notificationViewModel = new NotificationViewModel(this); + this.notificationViewModel = new NotificationViewModel(this, this.settingsViewModel); this.loadChats(); } diff --git a/src/ViewModel/Global/notificationViewModel.ts b/src/ViewModel/Global/notificationViewModel.ts index 8bdb0ac7..adb4c0a1 100644 --- a/src/ViewModel/Global/notificationViewModel.ts +++ b/src/ViewModel/Global/notificationViewModel.ts @@ -2,6 +2,7 @@ import { ChatPageTypes } from "../Chat/chatViewModel"; import ChatListViewModel from "../Chat/chatListViewModel"; import * as React from "../../react"; import ChatModel, { ChatMessage } from "../../Model/Chat/chatModel"; +import SettingsViewModel from "./settingsViewModel"; export default class NotificationViewModel { // data @@ -15,6 +16,7 @@ export default class NotificationViewModel { showNotification = (message: ChatMessage): void => { if (this.seenMessageIds.has(message.fileId)) return; if (this.chatListViewModel.selectedChat.value == undefined) return; + if (message.senderId == this.settingsViewModel.settingsModel.userid) return; const notification: Notification = this.createNotification(message); const currentChat = @@ -77,7 +79,7 @@ export default class NotificationViewModel { }; // init - constructor(public chatListViewModel: ChatListViewModel) {} + constructor(public chatListViewModel: ChatListViewModel, public settingsViewModel: SettingsViewModel) {} // util createNotification(message: ChatMessage): Notification {