fix:activity center view is empty

Updated all available message properties
from the new backend

Closes #4408
This commit is contained in:
Alexandra Betouni 2022-01-13 23:41:43 +02:00 committed by Sale Djenic
parent 6f8f9b6f76
commit a0b40590ab
8 changed files with 65 additions and 91 deletions

View File

@ -30,6 +30,10 @@ QtObject:
QtProperty[string] senderId: QtProperty[string] senderId:
read = 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 proc senderDisplayName*(self: MessageItem): string {.slot.} = result = ?.self.messageItem.senderDisplayName
QtProperty[string] senderDisplayName: QtProperty[string] senderDisplayName:
read = senderDisplayName read = senderDisplayName

View File

@ -46,7 +46,7 @@ proc toActivityCenterNotificationDto*(jsonObj: JsonNode): ActivityCenterNotifica
result.notificationType = ActivityCenterNotificationType.Unknown result.notificationType = ActivityCenterNotificationType.Unknown
var notificationTypeInt: int var notificationTypeInt: int
if (jsonObj.getProp("notificationType", notificationTypeInt) and if (jsonObj.getProp("type", notificationTypeInt) and
(notificationTypeInt >= ord(low(ActivityCenterNotificationType)) or (notificationTypeInt >= ord(low(ActivityCenterNotificationType)) or
notificationTypeInt <= ord(high(ActivityCenterNotificationType)))): notificationTypeInt <= ord(high(ActivityCenterNotificationType)))):
result.notificationType = ActivityCenterNotificationType(notificationTypeInt) result.notificationType = ActivityCenterNotificationType(notificationTypeInt)

View File

@ -31,9 +31,7 @@ StatusAppThreePanelLayout {
// Not Refactored // Not Refactored
property var messageStore property var messageStore
property RootStore rootStore: RootStore { property RootStore rootStore: RootStore { }
messageStore: root.messageStore
}
property Component pinnedMessagesListPopupComponent property Component pinnedMessagesListPopupComponent
property bool stickersLoaded: false property bool stickersLoaded: false
@ -65,6 +63,7 @@ StatusAppThreePanelLayout {
parentModule: root.rootStore.chatCommunitySectionModule parentModule: root.rootStore.chatCommunitySectionModule
rootStore: root.rootStore rootStore: root.rootStore
contactsStore: root.contactsStore contactsStore: root.contactsStore
chatSectionModule: root.rootStore.chatCommunitySectionModule
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
stickersLoaded: root.stickersLoaded stickersLoaded: root.stickersLoaded
//chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount //chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount

View File

@ -25,6 +25,7 @@ Popup {
property bool hideReadNotifications: false property bool hideReadNotifications: false
property var store property var store
property var chatSectionModule
id: activityCenter id: activityCenter
modal: false modal: false
@ -194,6 +195,13 @@ Popup {
default: return null 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 { Component {
@ -201,6 +209,7 @@ Popup {
ActivityCenterMessageComponentView { ActivityCenterMessageComponentView {
store: activityCenter.store store: activityCenter.store
chatSectionModule: activityCenter.chatSectionModule
} }
} }

View File

@ -47,7 +47,8 @@ QtObject {
} }
property var messageStore property var messageStore: MessageStore { }
property var emojiReactionsModel property var emojiReactionsModel
// Not Refactored Yet // Not Refactored Yet

View File

@ -19,10 +19,13 @@ Item {
width: parent.width width: parent.width
height: childrenRect.height + dateGroupLbl.anchors.topMargin height: childrenRect.height + dateGroupLbl.anchors.topMargin
property var store property var store
property int previousNotificationIndex
property string previousNotificationTimestamp
DateGroup { DateGroup {
id: dateGroupLbl id: dateGroupLbl
previousMessageIndex: previousNotificationIndex previousMessageIndex: root.previousNotificationIndex
previousMessageTimestamp: previousNotificationTimestamp previousMessageTimestamp: root.previousNotificationTimestamp
messageTimestamp: model.timestamp messageTimestamp: model.timestamp
isActivityCenterMessage: true isActivityCenterMessage: true
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0

View File

@ -31,6 +31,9 @@ Item {
} }
property var store property var store
property var chatSectionModule
property int previousNotificationIndex
property string previousNotificationTimestamp
// Not Refactored Yet // Not Refactored Yet
property int communityIndex: -1 //root.store.chatsModelInst.communities.joinedCommunities.getCommunityIndex(model.message.communityId) property int communityIndex: -1 //root.store.chatsModelInst.communities.joinedCommunities.getCommunityIndex(model.message.communityId)
function openProfile() { function openProfile() {
@ -56,7 +59,7 @@ Item {
tooltip.y: markReadBtn.height / 2 - height / 2 + 4 tooltip.y: markReadBtn.height / 2 - height / 2 + 4
onClicked: { onClicked: {
if (!model.read) { 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) return root.store.activityCenterModuleInst.markActivityCenterNotificationUnread(model.id, model.message.communityId, model.message.chatId, model.notificationType)
} }
@ -104,93 +107,47 @@ Item {
id: messageNotificationContent id: messageNotificationContent
width: parent.width width: parent.width
height: childrenRect.height height: childrenRect.height
MessageView { MessageView {
id: notificationMessage id: notificationMessage
anchors.right: undefined anchors.right: undefined
// rootStore: root.store messageStore: root.store.messageStore
// messageStore: root.store.messageStore messageId: model.id
//TODO Remove senderDisplayName: model.message.senderDisplayName
// fromAuthor: model.message.fromAuthor message: model.message.messageText
// chatId: model.message.chatId responseToMessageWithId: model.message.responseToMessageWithId
// userName: model.message.userName senderId: model.message.senderId
// alias: model.message.alias senderLocalName: model.message.senderLocalName
// localName: model.message.localName senderIcon: model.message.senderIcon
// message: model.message.message isSenderIconIdenticon: model.message.isSenderIconIdenticon
// plainText: model.message.plainText amISender: model.message.amISender
// identicon: model.message.identicon messageImage: model.message.messageImage
// isCurrentUser: model.message.isCurrentUser messageTimestamp: model.timestamp
// timestamp: model.message.timestamp //timestamp: model.message.timestamp
// sticker: model.message.sticker messageOutgoingStatus: model.message.outgoingStatus
// contentType: model.message.contentType messageContentType: model.message.contentType
// outgoingStatus: model.message.outgoingStatus //pinnedMessage: model.message.pinned
// responseTo: model.message.responseTo //messagePinnedBy: model.message.pinnedBy
// messageId: model.message.messageId //reactionsModel: model.message.reactions
// linkUrls: model.message.linkUrls activityCenterMessage: true
// communityId: model.message.communityId read: model.read
// hasMention: model.message.hasMention onImageClick: { Global.openImagePopup(image); }
// stickerPackId: model.message.stickerPackId scrollToBottom: null
// pinnedBy: model.message.pinnedBy clickMessage: function (isProfileClick) {
// pinnedMessage: model.message.isPinned if (isProfileClick) {
// activityCenterMessage: true return Global.openProfilePopup(model.message.senderId);
// read: model.read }
// onImageClick: { Global.openImagePopup(image); }
// clickMessage: function (isProfileClick) {
// if (isProfileClick) {
// return openProfilePopup(model.message.fromAuthor)
// }
// activityCenter.close() activityCenter.close()
// if (model.message.communityId) { // 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) // root.chatSectionModule.setActiveChannel(model.chatId);
// positionAtMessage(model.message.messageId) positionAtMessage(model.id);
// } }
// prevMessageIndex: previousNotificationIndex prevMessageIndex: root.previousNotificationIndex
// prevMsgTimestamp: previousNotificationTimestamp prevMsgTimestamp: root.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)
// }
// }
} }
Rectangle { Rectangle {
@ -225,16 +182,15 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 61 // TODO find a way to align with the text of the message anchors.leftMargin: 61 // TODO find a way to align with the text of the message
visible: model.notificationType !== Constants.activityCenterNotificationTypeOneToOne visible: model.notificationType !== Constants.activityCenterNotificationTypeOneToOne
name: model.name name: model.name
chatId: model.chatId chatId: model.chatId
notificationType: model.notificationType notificationType: model.notificationType
communityId: model.message.communityId // communityId: model.message.communityId
// Not Refactored Yet // Not Refactored Yet
// replyMessageIndex: root.store.chatsModelInst.messageView.getMessageIndex(model.chatId, model.responseTo) // replyMessageIndex: root.store.chatsModelInst.messageView.getMessageIndex(model.chatId, model.responseTo)
// Not Refactored Yet // Not Refactored Yet
// repliedMessageContent: replyMessageIndex > -1 ? root.store.chatsModelInst.messageView.getMessageData(chatId, replyMessageIndex, "message") : "" // repliedMessageContent: replyMessageIndex > -1 ? root.store.chatsModelInst.messageView.getMessageData(chatId, replyMessageIndex, "message") : ""
realChatType: { // realChatType: {
// Not Refactored Yet // Not Refactored Yet
// var chatType = root.store.chatsModelInst.channelView.chats.getChannelType(model.chatId) // var chatType = root.store.chatsModelInst.channelView.chats.getChannelType(model.chatId)
// if (chatType === Constants.chatType.communityChat) { // if (chatType === Constants.chatType.communityChat) {
@ -242,7 +198,7 @@ Item {
// return Constants.chatType.publicChat // return Constants.chatType.publicChat
// } // }
// return chatType // return chatType
} // }
profileImage: realChatType === Constants.chatType.oneToOne ? Global.getProfileImage(chatId) || "" : "" profileImage: realChatType === Constants.chatType.oneToOne ? Global.getProfileImage(chatId) || "" : ""
// Not Refactored Yet // Not Refactored Yet
// channelName: root.store.chatsModelInst.getChannelNameById(badge.chatId) // channelName: root.store.chatsModelInst.getChannelNameById(badge.chatId)

View File

@ -32,6 +32,7 @@ Item {
property var rootStore property var rootStore
property var contactsStore property var contactsStore
property var chatSectionModule
property Component pinnedMessagesPopupComponent property Component pinnedMessagesPopupComponent
// Not Refactored Yet // 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 height: root.height - 56 * 2 // TODO get screen size // Taken from old code top bar height was fixed there to 56
y: 56 y: 56
store: root.rootStore store: root.rootStore
chatSectionModule: root.chatSectionModule
} }
// Not Refactored Yet // Not Refactored Yet