2022-09-16 13:06:52 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
2022-11-16 17:17:38 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as CoreUtils
|
2022-09-16 13:06:52 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
2023-01-13 13:32:36 +00:00
|
|
|
import shared.views.chat 1.0
|
2022-09-16 13:06:52 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
ActivityNotificationBase {
|
|
|
|
id: root
|
|
|
|
|
2022-12-29 15:46:28 +00:00
|
|
|
readonly property bool isOutgoingRequest: notification && notification.message.amISender
|
|
|
|
readonly property string contactId: notification ? isOutgoingRequest ? notification.chatId : notification.author : ""
|
2022-09-20 16:11:29 +00:00
|
|
|
|
2022-12-30 09:08:25 +00:00
|
|
|
property var contactDetails: null
|
2022-11-16 17:17:38 +00:00
|
|
|
property int maximumLineCount: 2
|
2022-09-16 13:06:52 +00:00
|
|
|
|
2022-11-22 22:01:30 +00:00
|
|
|
signal messageClicked()
|
|
|
|
|
2022-11-16 17:17:38 +00:00
|
|
|
property StatusMessageDetails messageDetails: StatusMessageDetails {
|
2022-11-30 11:15:29 +00:00
|
|
|
messageText: notification ? notification.message.messageText : ""
|
2022-12-29 15:46:28 +00:00
|
|
|
amISender: false
|
|
|
|
sender.id: contactId
|
|
|
|
sender.displayName: contactDetails ? contactDetails.displayName : ""
|
|
|
|
sender.secondaryName: contactDetails ? contactDetails.localNickname : ""
|
|
|
|
sender.trustIndicator: contactDetails ? contactDetails.trustStatus : Constants.trustStatus.unknown
|
2022-11-16 17:17:38 +00:00
|
|
|
sender.profileImage {
|
|
|
|
width: 40
|
|
|
|
height: 40
|
2022-12-29 15:46:28 +00:00
|
|
|
name: contactDetails ? contactDetails.displayIcon : ""
|
|
|
|
assetSettings.isImage: contactDetails && contactDetails.displayIcon.startsWith("data")
|
|
|
|
pubkey: contactId
|
|
|
|
colorId: Utils.colorIdForPubkey(contactId)
|
2023-01-18 12:02:46 +00:00
|
|
|
colorHash: Utils.getColorHashAsJson(contactId, contactDetails && contactDetails.ensVerified)
|
2022-11-16 17:17:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
property Component messageSubheaderComponent: null
|
|
|
|
property Component messageBadgeComponent: null
|
|
|
|
|
|
|
|
function openProfilePopup() {
|
|
|
|
closeActivityCenter()
|
2022-12-29 15:46:28 +00:00
|
|
|
Global.openProfilePopup(contactId)
|
2022-11-16 17:17:38 +00:00
|
|
|
}
|
2022-11-30 11:15:29 +00:00
|
|
|
|
2022-12-30 09:08:25 +00:00
|
|
|
function updateContactDetails() {
|
|
|
|
contactDetails = notification ? Utils.getContactDetailsAsJson(contactId, false) : null
|
|
|
|
}
|
|
|
|
|
|
|
|
onContactIdChanged: root.updateContactDetails()
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: root.store.contactsStore.myContactsModel
|
|
|
|
|
|
|
|
function onItemChanged(pubKey) {
|
|
|
|
if (pubKey === root.contactId)
|
|
|
|
root.updateContactDetails()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-22 22:01:30 +00:00
|
|
|
bodyComponent: MouseArea {
|
2023-02-15 12:24:18 +00:00
|
|
|
implicitWidth: parent.width
|
|
|
|
implicitHeight: messageView.implicitHeight
|
2022-11-22 22:01:30 +00:00
|
|
|
hoverEnabled: root.messageBadgeComponent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
2022-12-01 10:24:25 +00:00
|
|
|
onClicked: {
|
|
|
|
root.activityCenterStore.switchTo(notification)
|
|
|
|
root.closeActivityCenter()
|
|
|
|
}
|
2022-11-30 11:15:29 +00:00
|
|
|
|
2023-01-13 13:32:36 +00:00
|
|
|
SimplifiedMessageView {
|
|
|
|
id: messageView
|
2022-11-22 22:01:30 +00:00
|
|
|
width: parent.width
|
2023-01-13 13:32:36 +00:00
|
|
|
maximumLineCount: root.maximumLineCount
|
|
|
|
messageDetails: root.messageDetails
|
2023-01-10 11:36:03 +00:00
|
|
|
timestamp: notification ? notification.timestamp : 0
|
2023-01-13 13:32:36 +00:00
|
|
|
messageSubheaderComponent: root.messageSubheaderComponent
|
|
|
|
messageBadgeComponent: root.messageBadgeComponent
|
|
|
|
onOpenProfilePopup: root.openProfilePopup()
|
2022-09-16 13:06:52 +00:00
|
|
|
}
|
2022-09-20 16:11:29 +00:00
|
|
|
}
|
2022-11-22 22:01:30 +00:00
|
|
|
}
|