diff --git a/src/app/modules/shared_models/message_item_qobject.nim b/src/app/modules/shared_models/message_item_qobject.nim index e552e2bb21..dc99845246 100644 --- a/src/app/modules/shared_models/message_item_qobject.nim +++ b/src/app/modules/shared_models/message_item_qobject.nim @@ -30,6 +30,10 @@ QtObject: QtProperty[string] senderId: read = senderId + proc pinnedBy*(self: MessageItem): string {.slot.} = result = ?.self.messageItem.pinnedBy + QtProperty[string] pinnedBy: + read = pinnedBy + proc senderDisplayName*(self: MessageItem): string {.slot.} = result = ?.self.messageItem.senderDisplayName QtProperty[string] senderDisplayName: read = senderDisplayName diff --git a/src/app_service/service/activity_center/dto/notification.nim b/src/app_service/service/activity_center/dto/notification.nim index 01961b54a8..5003f59bcd 100644 --- a/src/app_service/service/activity_center/dto/notification.nim +++ b/src/app_service/service/activity_center/dto/notification.nim @@ -46,7 +46,7 @@ proc toActivityCenterNotificationDto*(jsonObj: JsonNode): ActivityCenterNotifica result.notificationType = ActivityCenterNotificationType.Unknown var notificationTypeInt: int - if (jsonObj.getProp("notificationType", notificationTypeInt) and + if (jsonObj.getProp("type", notificationTypeInt) and (notificationTypeInt >= ord(low(ActivityCenterNotificationType)) or notificationTypeInt <= ord(high(ActivityCenterNotificationType)))): result.notificationType = ActivityCenterNotificationType(notificationTypeInt) diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index 8399ae92e8..94352cb952 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -31,9 +31,7 @@ StatusAppThreePanelLayout { // Not Refactored property var messageStore - property RootStore rootStore: RootStore { - messageStore: root.messageStore - } + property RootStore rootStore: RootStore { } property Component pinnedMessagesListPopupComponent property bool stickersLoaded: false @@ -65,6 +63,7 @@ StatusAppThreePanelLayout { parentModule: root.rootStore.chatCommunitySectionModule rootStore: root.rootStore contactsStore: root.contactsStore + chatSectionModule: root.rootStore.chatCommunitySectionModule pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent stickersLoaded: root.stickersLoaded //chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount diff --git a/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml b/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml index 6c10e72173..a66ca19b69 100644 --- a/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml @@ -25,6 +25,7 @@ Popup { property bool hideReadNotifications: false property var store + property var chatSectionModule id: activityCenter modal: false @@ -194,6 +195,13 @@ Popup { default: return null } } + onLoaded: { + if (model.notificationType === Constants.activityCenterNotificationTypeReply || + model.notificationType === Constants.activityCenterNotificationTypeGroupRequest) { + item.previousNotificationIndex = Qt.binding(() => notifLoader.previousNotificationIndex); + item.previousNotificationTimestamp = Qt.binding(() => notifLoader.previousNotificationTimestamp); + } + } } Component { @@ -201,6 +209,7 @@ Popup { ActivityCenterMessageComponentView { store: activityCenter.store + chatSectionModule: activityCenter.chatSectionModule } } diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index 10a8594c83..b70be84d9d 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -47,7 +47,8 @@ QtObject { } - property var messageStore + property var messageStore: MessageStore { } + property var emojiReactionsModel // Not Refactored Yet diff --git a/ui/app/AppLayouts/Chat/views/ActivityCenterGroupRequest.qml b/ui/app/AppLayouts/Chat/views/ActivityCenterGroupRequest.qml index eb9f7b2d0d..600ce1e68b 100644 --- a/ui/app/AppLayouts/Chat/views/ActivityCenterGroupRequest.qml +++ b/ui/app/AppLayouts/Chat/views/ActivityCenterGroupRequest.qml @@ -19,10 +19,13 @@ Item { width: parent.width height: childrenRect.height + dateGroupLbl.anchors.topMargin property var store + property int previousNotificationIndex + property string previousNotificationTimestamp + DateGroup { id: dateGroupLbl - previousMessageIndex: previousNotificationIndex - previousMessageTimestamp: previousNotificationTimestamp + previousMessageIndex: root.previousNotificationIndex + previousMessageTimestamp: root.previousNotificationTimestamp messageTimestamp: model.timestamp isActivityCenterMessage: true height: visible ? implicitHeight : 0 diff --git a/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml b/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml index 5282fa4111..03d1cc8069 100644 --- a/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml +++ b/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml @@ -31,6 +31,9 @@ Item { } property var store + property var chatSectionModule + property int previousNotificationIndex + property string previousNotificationTimestamp // Not Refactored Yet property int communityIndex: -1 //root.store.chatsModelInst.communities.joinedCommunities.getCommunityIndex(model.message.communityId) function openProfile() { @@ -56,7 +59,7 @@ Item { tooltip.y: markReadBtn.height / 2 - height / 2 + 4 onClicked: { if (!model.read) { - return root.store.activityCenterModuleInst.markActivityCenterNotificationRead(model.id, model.message.communityId, model.message.chatId, model.notificationType) + return root.store.activityCenterModuleInst.markActivityCenterNotificationRead(model.id, model.message.communityId, model.chatId, model.notificationType) } return root.store.activityCenterModuleInst.markActivityCenterNotificationUnread(model.id, model.message.communityId, model.message.chatId, model.notificationType) } @@ -104,93 +107,47 @@ Item { id: messageNotificationContent width: parent.width height: childrenRect.height - MessageView { id: notificationMessage anchors.right: undefined -// rootStore: root.store -// messageStore: root.store.messageStore - //TODO Remove -// fromAuthor: model.message.fromAuthor -// chatId: model.message.chatId -// userName: model.message.userName -// alias: model.message.alias -// localName: model.message.localName -// message: model.message.message -// plainText: model.message.plainText -// identicon: model.message.identicon -// isCurrentUser: model.message.isCurrentUser -// timestamp: model.message.timestamp -// sticker: model.message.sticker -// contentType: model.message.contentType -// outgoingStatus: model.message.outgoingStatus -// responseTo: model.message.responseTo -// messageId: model.message.messageId -// linkUrls: model.message.linkUrls -// communityId: model.message.communityId -// hasMention: model.message.hasMention -// stickerPackId: model.message.stickerPackId -// pinnedBy: model.message.pinnedBy -// pinnedMessage: model.message.isPinned -// activityCenterMessage: true -// read: model.read -// onImageClick: { Global.openImagePopup(image); } -// clickMessage: function (isProfileClick) { -// if (isProfileClick) { -// return openProfilePopup(model.message.fromAuthor) -// } + messageStore: root.store.messageStore + messageId: model.id + senderDisplayName: model.message.senderDisplayName + message: model.message.messageText + responseToMessageWithId: model.message.responseToMessageWithId + senderId: model.message.senderId + senderLocalName: model.message.senderLocalName + senderIcon: model.message.senderIcon + isSenderIconIdenticon: model.message.isSenderIconIdenticon + amISender: model.message.amISender + messageImage: model.message.messageImage + messageTimestamp: model.timestamp + //timestamp: model.message.timestamp + messageOutgoingStatus: model.message.outgoingStatus + messageContentType: model.message.contentType + //pinnedMessage: model.message.pinned + //messagePinnedBy: model.message.pinnedBy + //reactionsModel: model.message.reactions + activityCenterMessage: true + read: model.read + onImageClick: { Global.openImagePopup(image); } + scrollToBottom: null + clickMessage: function (isProfileClick) { + if (isProfileClick) { + return Global.openProfilePopup(model.message.senderId); + } -// activityCenter.close() + activityCenter.close() // if (model.message.communityId) { -// root.store.chatsModelInst.communities.setActiveCommunity(model.message.communityId) +// root.chatSectionModule..communities.setActiveCommunity(model.message.communityId) // } -// root.store.chatsModelInst.channelView.setActiveChannel(model.message.chatId) -// positionAtMessage(model.message.messageId) -// } -// prevMessageIndex: previousNotificationIndex -// prevMsgTimestamp: previousNotificationTimestamp -// Component.onCompleted: { -// messageStore.activityCenterMessage = true; -// messageStore.fromAuthor = model.message.fromAuthor; -// messageStore.chatId = model.message.chatId; -// messageStore.userName = model.message.userName; -// messageStore.alias = model.message.alias; -// messageStore.localName = model.message.localName; -// messageStore.message = model.message.message; -// messageStore.plainText = model.message.plainText; -// messageStore.identicon = model.message.identicon; -// messageStore.isCurrentUser = model.message.isCurrentUser; -// messageStore.timestamp = model.message.timestamp; -// messageStore.sticker = model.message.sticker; -// messageStore.contentType = model.message.contentType; -// messageStore.outgoingStatus = model.message.outgoingStatus; -// messageStore.responseTo = model.message.responseTo; -// messageStore.messageId = model.message.messageId; -// messageStore.linkUrls = model.message.linkUrls; -// messageStore.communityId = model.message.communityId; -// messageStore.hasMention = model.message.hasMention; -// messageStore.stickerPackId = model.message.stickerPackId; -// messageStore.pinnedBy = model.message.pinnedBy; -// messageStore.pinnedMessage = model.message.isPinned; -// messageStore.read = model.read; -// messageStore.prevMessageIndex = previousNotificationIndex; -// messageStore.prevMsgTimestamp = previousNotificationTimestamp; -// messageStore.clickMessage = function (isProfileClick) { -// if (isProfileClick) { -// return openProfilePopup(model.message.fromAuthor) -// } -// activityCenter.close() - -// if (model.message.communityId) { -// root.store.chatsModelInst.communities.setActiveCommunity(model.message.communityId) -// } - -// root.store.chatsModelInst.channelView.setActiveChannel(model.message.chatId) -// positionAtMessage(model.message.messageId) -// } -// } +// root.chatSectionModule.setActiveChannel(model.chatId); + positionAtMessage(model.id); + } + prevMessageIndex: root.previousNotificationIndex + prevMsgTimestamp: root.previousNotificationTimestamp } Rectangle { @@ -225,16 +182,15 @@ Item { anchors.left: parent.left anchors.leftMargin: 61 // TODO find a way to align with the text of the message visible: model.notificationType !== Constants.activityCenterNotificationTypeOneToOne - name: model.name chatId: model.chatId notificationType: model.notificationType - communityId: model.message.communityId +// communityId: model.message.communityId // Not Refactored Yet // replyMessageIndex: root.store.chatsModelInst.messageView.getMessageIndex(model.chatId, model.responseTo) // Not Refactored Yet // repliedMessageContent: replyMessageIndex > -1 ? root.store.chatsModelInst.messageView.getMessageData(chatId, replyMessageIndex, "message") : "" - realChatType: { +// realChatType: { // Not Refactored Yet // var chatType = root.store.chatsModelInst.channelView.chats.getChannelType(model.chatId) // if (chatType === Constants.chatType.communityChat) { @@ -242,7 +198,7 @@ Item { // return Constants.chatType.publicChat // } // return chatType - } +// } profileImage: realChatType === Constants.chatType.oneToOne ? Global.getProfileImage(chatId) || "" : "" // Not Refactored Yet // channelName: root.store.chatsModelInst.getChannelNameById(badge.chatId) diff --git a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml index 2ae955fc2b..11b9582051 100644 --- a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml @@ -32,6 +32,7 @@ Item { property var rootStore property var contactsStore + property var chatSectionModule property Component pinnedMessagesPopupComponent // Not Refactored Yet @@ -347,6 +348,7 @@ Item { height: root.height - 56 * 2 // TODO get screen size // Taken from old code top bar height was fixed there to 56 y: 56 store: root.rootStore + chatSectionModule: root.chatSectionModule } // Not Refactored Yet