2022-09-15 19:34:41 +03: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 20:21:00 +04:00
|
|
|
|
import shared.panels 1.0
|
2022-09-15 19:34:41 +03:00
|
|
|
|
import utils 1.0
|
|
|
|
|
|
2022-09-27 20:21:00 +04:00
|
|
|
|
import "../panels"
|
2022-12-05 18:37:21 +03:00
|
|
|
|
import "../popups"
|
2023-04-18 19:08:24 +04:00
|
|
|
|
import "../stores"
|
2022-09-27 20:21:00 +04:00
|
|
|
|
|
2022-09-16 16:06:52 +03:00
|
|
|
|
ActivityNotificationMessage {
|
2022-09-15 19:34:41 +03:00
|
|
|
|
id: root
|
|
|
|
|
|
2023-04-18 19:08:24 +04:00
|
|
|
|
readonly property bool pending: notification && notification.message.contactRequestState === ActivityCenterStore.ActivityCenterContactRequestState.Pending
|
|
|
|
|
readonly property bool accepted: notification && notification.message.contactRequestState === ActivityCenterStore.ActivityCenterContactRequestState.Accepted
|
|
|
|
|
readonly property bool dismissed: notification && notification.message.contactRequestState === ActivityCenterStore.ActivityCenterContactRequestState.Dismissed
|
2022-12-22 17:26:27 +04:00
|
|
|
|
|
2023-04-03 20:27:56 +04:00
|
|
|
|
readonly property string contactRequestId: notification && notification.message ? notification.message.id : ""
|
|
|
|
|
|
2022-12-30 13:08:25 +04:00
|
|
|
|
Connections {
|
2023-03-14 15:39:05 +05:30
|
|
|
|
target: root.isOutgoingMessage ? root.store.contactsStore.sentContactRequestsModel :
|
2022-12-30 13:08:25 +04:00
|
|
|
|
root.store.contactsStore.receivedContactRequestsModel
|
|
|
|
|
|
|
|
|
|
function onItemChanged(pubKey) {
|
|
|
|
|
if (pubKey === root.contactId)
|
|
|
|
|
root.updateContactDetails()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-16 21:17:38 +04:00
|
|
|
|
maximumLineCount: 5
|
2023-03-14 15:39:05 +05:30
|
|
|
|
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 17:26:27 +04:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-27 20:21:00 +04:00
|
|
|
|
ctaComponent: ContactRequestCta {
|
2023-03-14 15:39:05 +05:30
|
|
|
|
isOutgoingRequest: root.isOutgoingMessage
|
2022-12-22 17:26:27 +04:00
|
|
|
|
pending: root.pending
|
|
|
|
|
accepted: root.accepted
|
|
|
|
|
dismissed: root.dismissed
|
2022-11-30 15:15:29 +04:00
|
|
|
|
blocked: contactDetails && contactDetails.isBlocked
|
2023-04-03 20:27:56 +04:00
|
|
|
|
onAcceptClicked: root.store.contactsStore.acceptContactRequest(root.contactId, root.contactRequestId)
|
|
|
|
|
onDeclineClicked: root.store.contactsStore.dismissContactRequest(root.contactId, root.contactRequestId)
|
2022-12-22 17:26:27 +04:00
|
|
|
|
onProfileClicked: Global.openProfilePopup(root.contactId)
|
2022-09-30 20:49:54 +04:00
|
|
|
|
onBlockClicked: {
|
2023-04-03 20:27:56 +04:00
|
|
|
|
root.store.contactsStore.dismissContactRequest(root.contactId, root.contactRequestId)
|
2022-12-22 17:26:27 +04:00
|
|
|
|
root.store.contactsStore.blockContact(root.contactId)
|
2022-09-30 20:49:54 +04:00
|
|
|
|
}
|
2022-12-05 18:37:21 +03:00
|
|
|
|
onDetailsClicked: {
|
2022-12-22 17:26:27 +04:00
|
|
|
|
Global.openPopup(reviewContactRequestPopupComponent, {
|
|
|
|
|
messageDetails: root.messageDetails,
|
2023-01-10 13:36:03 +02:00
|
|
|
|
timestamp: notification ? notification.timestamp : 0
|
2022-12-22 17:26:27 +04:00
|
|
|
|
})
|
2022-12-05 18:37:21 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: reviewContactRequestPopupComponent
|
2022-12-22 17:26:27 +04:00
|
|
|
|
|
2022-12-05 18:37:21 +03:00
|
|
|
|
ReviewContactRequestPopup {
|
|
|
|
|
id: reviewRequestPopup
|
2023-04-03 20:27:56 +04:00
|
|
|
|
onAccepted: root.store.contactsStore.acceptContactRequest(root.contactId, root.contactRequestId)
|
|
|
|
|
onDeclined: root.store.contactsStore.dismissContactRequest(root.contactId, root.contactRequestId)
|
2022-12-05 18:37:21 +03:00
|
|
|
|
}
|
2022-09-27 20:21:00 +04:00
|
|
|
|
}
|
2022-12-01 11:24:25 +01:00
|
|
|
|
}
|