2022-09-15 16:34:41 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
|
|
|
import shared 1.0
|
2022-09-27 16:21:00 +00:00
|
|
|
import shared.panels 1.0
|
2022-09-15 16:34:41 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-09-27 16:21:00 +00:00
|
|
|
import "../panels"
|
2022-12-05 15:37:21 +00:00
|
|
|
import "../popups"
|
2022-09-27 16:21:00 +00:00
|
|
|
|
2022-09-16 13:06:52 +00:00
|
|
|
ActivityNotificationMessage {
|
2022-09-15 16:34:41 +00:00
|
|
|
id: root
|
|
|
|
|
2022-12-22 13:26:27 +00:00
|
|
|
readonly property bool pending: notification && notification.message.contactRequestState === Constants.contactRequestStatePending
|
|
|
|
readonly property bool accepted: notification && notification.message.contactRequestState === Constants.contactRequestStateAccepted
|
|
|
|
readonly property bool dismissed: notification && notification.message.contactRequestState === Constants.contactRequestStateDismissed
|
|
|
|
|
2022-12-30 09:08:25 +00:00
|
|
|
Connections {
|
|
|
|
target: root.isOutgoingRequest ? root.store.contactsStore.sentContactRequestsModel :
|
|
|
|
root.store.contactsStore.receivedContactRequestsModel
|
|
|
|
|
|
|
|
function onItemChanged(pubKey) {
|
|
|
|
if (pubKey === root.contactId)
|
|
|
|
root.updateContactDetails()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-16 17:17:38 +00:00
|
|
|
maximumLineCount: 5
|
2022-12-22 13:26:27 +00:00
|
|
|
messageDetails.messageText: {
|
|
|
|
if (isOutgoingRequest && contactDetails) {
|
|
|
|
const status = accepted ? qsTr("accepted") : dismissed ? qsTr("dismissed") : qsTr("recieved")
|
|
|
|
return qsTr("%1 %2 your contact request").arg(contactDetails.displayName).arg(status)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isOutgoingRequest && notification) {
|
|
|
|
return notification.message.messageText
|
|
|
|
}
|
|
|
|
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
messageSubheaderComponent: !isOutgoingRequest ? subheaderComponent : null
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: subheaderComponent
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
text: qsTr("Sent contact request:")
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
font.italic: true
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-27 16:21:00 +00:00
|
|
|
ctaComponent: ContactRequestCta {
|
2022-12-22 13:26:27 +00:00
|
|
|
isOutgoingRequest: root.isOutgoingRequest
|
|
|
|
pending: root.pending
|
|
|
|
accepted: root.accepted
|
|
|
|
dismissed: root.dismissed
|
2022-11-30 11:15:29 +00:00
|
|
|
blocked: contactDetails && contactDetails.isBlocked
|
2022-12-22 13:26:27 +00:00
|
|
|
onAcceptClicked: root.store.contactsStore.acceptContactRequest(root.contactId)
|
|
|
|
onDeclineClicked: root.store.contactsStore.dismissContactRequest(root.contactId)
|
|
|
|
onProfileClicked: Global.openProfilePopup(root.contactId)
|
2022-09-30 16:49:54 +00:00
|
|
|
onBlockClicked: {
|
2022-12-22 13:26:27 +00:00
|
|
|
root.store.contactsStore.dismissContactRequest(root.contactId)
|
|
|
|
root.store.contactsStore.blockContact(root.contactId)
|
2022-09-30 16:49:54 +00:00
|
|
|
}
|
2022-12-05 15:37:21 +00:00
|
|
|
onDetailsClicked: {
|
2022-12-22 13:26:27 +00:00
|
|
|
Global.openPopup(reviewContactRequestPopupComponent, {
|
|
|
|
messageDetails: root.messageDetails,
|
2023-01-10 11:36:03 +00:00
|
|
|
timestamp: notification ? notification.timestamp : 0
|
2022-12-22 13:26:27 +00:00
|
|
|
})
|
2022-12-05 15:37:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: reviewContactRequestPopupComponent
|
2022-12-22 13:26:27 +00:00
|
|
|
|
2022-12-05 15:37:21 +00:00
|
|
|
ReviewContactRequestPopup {
|
|
|
|
id: reviewRequestPopup
|
2022-12-22 13:26:27 +00:00
|
|
|
onAccepted: root.store.contactsStore.acceptContactRequest(root.contactId)
|
|
|
|
onDeclined: root.store.contactsStore.dismissContactRequest(root.contactId)
|
2022-12-05 15:37:21 +00:00
|
|
|
}
|
2022-09-27 16:21:00 +00:00
|
|
|
}
|
2022-12-01 10:24:25 +00:00
|
|
|
}
|