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
|
|
|
|
|
|
2023-04-03 16:27:56 +00:00
|
|
|
|
readonly property string contactRequestId: notification && notification.message ? notification.message.id : ""
|
|
|
|
|
|
2022-12-30 09:08:25 +00:00
|
|
|
|
Connections {
|
2023-03-14 10:09:05 +00:00
|
|
|
|
target: root.isOutgoingMessage ? root.store.contactsStore.sentContactRequestsModel :
|
2022-12-30 09:08:25 +00:00
|
|
|
|
root.store.contactsStore.receivedContactRequestsModel
|
|
|
|
|
|
|
|
|
|
function onItemChanged(pubKey) {
|
|
|
|
|
if (pubKey === root.contactId)
|
|
|
|
|
root.updateContactDetails()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-16 17:17:38 +00:00
|
|
|
|
maximumLineCount: 5
|
2023-03-14 10:09:05 +00:00
|
|
|
|
messageDetails.messageText: !root.isOutgoingMessage && notification ? notification.message.messageText : ""
|
|
|
|
|
|
|
|
|
|
messageSubheaderComponent: StatusBaseText {
|
|
|
|
|
text: root.isOutgoingMessage ? qsTr("Сontact request sent to %1").arg(contactName) :
|
|
|
|
|
qsTr("Сontact request:")
|
|
|
|
|
font.italic: true
|
|
|
|
|
font.pixelSize: 15
|
|
|
|
|
maximumLineCount: 2
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
color: Theme.palette.baseColor1
|
2022-12-22 13:26:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-27 16:21:00 +00:00
|
|
|
|
ctaComponent: ContactRequestCta {
|
2023-03-14 10:09:05 +00:00
|
|
|
|
isOutgoingRequest: root.isOutgoingMessage
|
2022-12-22 13:26:27 +00:00
|
|
|
|
pending: root.pending
|
|
|
|
|
accepted: root.accepted
|
|
|
|
|
dismissed: root.dismissed
|
2022-11-30 11:15:29 +00:00
|
|
|
|
blocked: contactDetails && contactDetails.isBlocked
|
2023-04-03 16:27:56 +00:00
|
|
|
|
onAcceptClicked: root.store.contactsStore.acceptContactRequest(root.contactId, root.contactRequestId)
|
|
|
|
|
onDeclineClicked: root.store.contactsStore.dismissContactRequest(root.contactId, root.contactRequestId)
|
2022-12-22 13:26:27 +00:00
|
|
|
|
onProfileClicked: Global.openProfilePopup(root.contactId)
|
2022-09-30 16:49:54 +00:00
|
|
|
|
onBlockClicked: {
|
2023-04-03 16:27:56 +00:00
|
|
|
|
root.store.contactsStore.dismissContactRequest(root.contactId, root.contactRequestId)
|
2022-12-22 13:26:27 +00:00
|
|
|
|
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
|
2023-04-03 16:27:56 +00:00
|
|
|
|
onAccepted: root.store.contactsStore.acceptContactRequest(root.contactId, root.contactRequestId)
|
|
|
|
|
onDeclined: root.store.contactsStore.dismissContactRequest(root.contactId, root.contactRequestId)
|
2022-12-05 15:37:21 +00:00
|
|
|
|
}
|
2022-09-27 16:21:00 +00:00
|
|
|
|
}
|
2022-12-01 10:24:25 +00:00
|
|
|
|
}
|