mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-23 12:08:53 +00:00
fix(desktop/chat) show the badge during receiving the mention in inactive section
This commit is contained in:
parent
db97fbf3eb
commit
0cc64774af
@ -286,8 +286,11 @@ method load*(
|
|||||||
# we do this only in case of chat section (not in case of communities)
|
# we do this only in case of chat section (not in case of communities)
|
||||||
self.initContactRequestsModel()
|
self.initContactRequestsModel()
|
||||||
|
|
||||||
for cModule in self.chatContentModules.values:
|
let activeChatId = self.controller.getActiveChatId()
|
||||||
|
for chatId, cModule in self.chatContentModules:
|
||||||
cModule.load()
|
cModule.load()
|
||||||
|
if chatId == activeChatId:
|
||||||
|
cModule.onMadeActive()
|
||||||
|
|
||||||
proc checkIfModuleDidLoad(self: Module) =
|
proc checkIfModuleDidLoad(self: Module) =
|
||||||
if self.moduleLoaded:
|
if self.moduleLoaded:
|
||||||
@ -357,15 +360,15 @@ method activeItemSubItemSet*(self: Module, itemId: string, subItemId: string) =
|
|||||||
self.view.chatsModel().setActiveItemSubItem(itemId, subItemId)
|
self.view.chatsModel().setActiveItemSubItem(itemId, subItemId)
|
||||||
self.view.activeItemSubItemSet(item, subItem)
|
self.view.activeItemSubItemSet(item, subItem)
|
||||||
|
|
||||||
# update child modules
|
let activeChatId = self.controller.getActiveChatId()
|
||||||
|
|
||||||
|
# # update child modules
|
||||||
for chatId, chatContentModule in self.chatContentModules:
|
for chatId, chatContentModule in self.chatContentModules:
|
||||||
if chatId == self.controller.getActiveChatId():
|
if chatId == activeChatId:
|
||||||
chatContentModule.onMadeActive()
|
chatContentModule.onMadeActive()
|
||||||
else:
|
else:
|
||||||
chatContentModule.onMadeInactive()
|
chatContentModule.onMadeInactive()
|
||||||
|
|
||||||
let activeChatId = self.controller.getActiveChatId()
|
|
||||||
|
|
||||||
# save last open chat in settings for restore on the next app launch
|
# save last open chat in settings for restore on the next app launch
|
||||||
singletonInstance.localAccountSensitiveSettings.setSectionLastOpenChat(mySectionId, activeChatId)
|
singletonInstance.localAccountSensitiveSettings.setSectionLastOpenChat(mySectionId, activeChatId)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ Item {
|
|||||||
readonly property var chatDetails: chatContentModule.chatDetails || null
|
readonly property var chatDetails: chatContentModule.chatDetails || null
|
||||||
|
|
||||||
function markAllMessagesReadIfMostRecentMessageIsInViewport() {
|
function markAllMessagesReadIfMostRecentMessageIsInViewport() {
|
||||||
if (!isMostRecentMessageInViewport) {
|
if (!isMostRecentMessageInViewport || !chatLogView.visible) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,8 +95,17 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onHasUnreadMessagesChanged() {
|
function onHasUnreadMessagesChanged() {
|
||||||
if (d.chatDetails.hasUnreadMessages && d.chatDetails.active && !d.isMostRecentMessageInViewport) {
|
if (!d.chatDetails.hasUnreadMessages) {
|
||||||
// HACK: we call it later because messages model may not be yet propagated with unread messages when this signal is emitted
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// HACK: we call `addNewMessagesMarker` later because messages model
|
||||||
|
// may not be yet propagated with unread messages when this signal is emitted
|
||||||
|
if (chatLogView.visible) {
|
||||||
|
if (!d.isMostRecentMessageInViewport) {
|
||||||
|
Qt.callLater(() => messageStore.addNewMessagesMarker())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Qt.callLater(() => messageStore.addNewMessagesMarker())
|
Qt.callLater(() => messageStore.addNewMessagesMarker())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,6 +163,8 @@ Item {
|
|||||||
|
|
||||||
onCountChanged: d.markAllMessagesReadIfMostRecentMessageIsInViewport()
|
onCountChanged: d.markAllMessagesReadIfMostRecentMessageIsInViewport()
|
||||||
|
|
||||||
|
onVisibleChanged: d.markAllMessagesReadIfMostRecentMessageIsInViewport()
|
||||||
|
|
||||||
ScrollBar.vertical: StatusScrollBar {
|
ScrollBar.vertical: StatusScrollBar {
|
||||||
visible: chatLogView.visibleArea.heightRatio < 1
|
visible: chatLogView.visibleArea.heightRatio < 1
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user