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:
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

View File

@ -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)

View File

@ -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

View File

@ -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
}
}

View File

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

View File

@ -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

View File

@ -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
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
// 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)
// }
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)

View File

@ -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