2023-02-21 16:11:44 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtGraphicalEffects 1.15
|
2022-07-13 12:29:38 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
2024-07-12 09:46:43 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Backpressure 0.1
|
2023-10-23 11:35:20 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-07-13 12:29:38 +00:00
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
2021-12-21 20:52:17 +00:00
|
|
|
import shared.popups 1.0
|
2022-07-26 14:23:45 +00:00
|
|
|
import shared.views.chat 1.0
|
|
|
|
|
2022-07-13 12:29:38 +00:00
|
|
|
import utils 1.0
|
2021-10-18 10:56:05 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
import AppLayouts.Chat.stores 1.0 as ChatStores
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
import "../views"
|
|
|
|
import "../panels"
|
2022-10-26 16:00:20 +00:00
|
|
|
import "../stores"
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2021-05-28 17:35:21 +00:00
|
|
|
Popup {
|
2022-07-26 14:23:45 +00:00
|
|
|
id: root
|
|
|
|
|
2022-10-26 16:00:20 +00:00
|
|
|
property ActivityCenterStore activityCenterStore
|
2024-05-22 08:13:39 +00:00
|
|
|
property ChatStores.RootStore store
|
2021-06-10 15:15:38 +00:00
|
|
|
|
2022-09-15 16:34:41 +00:00
|
|
|
onOpened: {
|
2023-05-23 12:46:16 +00:00
|
|
|
Global.activityPopupOpened = true
|
2022-09-15 16:34:41 +00:00
|
|
|
}
|
|
|
|
onClosed: {
|
2023-05-23 12:46:16 +00:00
|
|
|
Global.activityPopupOpened = false
|
2023-04-17 09:09:15 +00:00
|
|
|
Qt.callLater(activityCenterStore.markAsSeenActivityCenterNotifications)
|
2022-09-15 16:34:41 +00:00
|
|
|
}
|
2022-05-19 12:33:17 +00:00
|
|
|
|
2022-09-19 13:16:48 +00:00
|
|
|
width: 560
|
|
|
|
padding: 0
|
2023-04-17 08:29:20 +00:00
|
|
|
modal: true
|
2021-05-28 17:35:21 +00:00
|
|
|
parent: Overlay.overlay
|
2021-07-29 19:20:49 +00:00
|
|
|
|
2023-11-15 11:29:03 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
readonly property var loadMoreNotificationsIfScrollBelowThreshold: Backpressure.oneInTimeQueued(root, 100, function() {
|
|
|
|
if (listView.contentY >= listView.contentHeight - listView.height - 1) {
|
|
|
|
root.activityCenterStore.fetchActivityCenterNotifications()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-04-17 08:29:20 +00:00
|
|
|
Overlay.modal: MouseArea { // eat every event behind the popup
|
|
|
|
hoverEnabled: true
|
|
|
|
onPressed: (event) => {
|
|
|
|
event.accept()
|
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
onWheel: (event) => event.accept()
|
|
|
|
}
|
2021-09-08 02:11:51 +00:00
|
|
|
|
2021-05-28 17:35:21 +00:00
|
|
|
background: Rectangle {
|
|
|
|
color: Style.current.background
|
|
|
|
radius: Style.current.radius
|
2021-07-29 19:20:49 +00:00
|
|
|
layer.enabled: true
|
|
|
|
layer.effect: DropShadow {
|
|
|
|
verticalOffset: 3
|
|
|
|
radius: Style.current.radius
|
|
|
|
samples: 15
|
|
|
|
fast: true
|
|
|
|
cached: true
|
|
|
|
color: Style.current.dropShadow
|
|
|
|
}
|
2021-05-28 17:35:21 +00:00
|
|
|
}
|
2022-09-19 13:16:48 +00:00
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
ActivityCenterPopupTopBarPanel {
|
2021-05-28 17:35:21 +00:00
|
|
|
id: activityCenterTopBar
|
2022-09-12 10:06:26 +00:00
|
|
|
width: parent.width
|
2023-02-22 15:49:44 +00:00
|
|
|
unreadNotificationsCount: activityCenterStore.unreadNotificationsCount
|
2023-02-23 12:43:28 +00:00
|
|
|
hasAdmin: activityCenterStore.adminCount > 0
|
|
|
|
hasReplies: activityCenterStore.repliesCount > 0
|
|
|
|
hasMentions: activityCenterStore.mentionsCount > 0
|
|
|
|
hasContactRequests: activityCenterStore.contactRequestsCount > 0
|
2023-03-01 12:23:46 +00:00
|
|
|
hasIdentityVerification: activityCenterStore.identityVerificationCount > 0
|
2023-02-23 12:43:28 +00:00
|
|
|
hasMembership: activityCenterStore.membershipCount > 0
|
2023-02-23 11:09:05 +00:00
|
|
|
hideReadNotifications: activityCenterStore.activityCenterReadType === ActivityCenterStore.ActivityCenterReadType.Unread
|
2023-02-21 16:11:44 +00:00
|
|
|
activeGroup: activityCenterStore.activeNotificationGroup
|
|
|
|
onGroupTriggered: activityCenterStore.setActiveNotificationGroup(group)
|
2023-02-23 12:43:28 +00:00
|
|
|
onMarkAllReadClicked: activityCenterStore.markAllActivityCenterNotificationsRead()
|
2023-02-22 15:49:44 +00:00
|
|
|
onShowHideReadNotifications: activityCenterStore.setActivityCenterReadType(hideReadNotifications ?
|
2023-10-23 11:35:20 +00:00
|
|
|
ActivityCenterStore.ActivityCenterReadType.Unread :
|
|
|
|
ActivityCenterStore.ActivityCenterReadType.All)
|
2021-05-28 17:35:21 +00:00
|
|
|
}
|
|
|
|
|
2022-09-15 16:34:41 +00:00
|
|
|
StatusListView {
|
|
|
|
id: listView
|
2023-11-15 11:29:03 +00:00
|
|
|
|
2022-09-12 10:06:26 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2021-05-28 17:35:21 +00:00
|
|
|
anchors.top: activityCenterTopBar.bottom
|
2021-06-11 17:41:59 +00:00
|
|
|
anchors.bottom: parent.bottom
|
2022-09-15 16:34:41 +00:00
|
|
|
anchors.margins: Style.current.smallPadding
|
2023-01-23 09:00:06 +00:00
|
|
|
spacing: 1
|
2021-05-28 17:35:21 +00:00
|
|
|
|
2023-02-13 08:51:24 +00:00
|
|
|
model: root.activityCenterStore.activityCenterNotifications
|
2021-06-11 17:41:59 +00:00
|
|
|
|
2023-11-15 11:29:03 +00:00
|
|
|
onContentYChanged: d.loadMoreNotificationsIfScrollBelowThreshold()
|
|
|
|
|
2022-11-30 11:15:29 +00:00
|
|
|
delegate: Loader {
|
|
|
|
width: listView.availableWidth
|
|
|
|
|
|
|
|
property int filteredIndex: index
|
|
|
|
property var notification: model
|
|
|
|
|
|
|
|
sourceComponent: {
|
|
|
|
switch (model.notificationType) {
|
2023-10-23 11:35:20 +00:00
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.Mention:
|
|
|
|
return mentionNotificationComponent
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.Reply:
|
|
|
|
return replyNotificationComponent
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.ContactRequest:
|
|
|
|
return contactRequestNotificationComponent
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.ContactVerification:
|
|
|
|
return verificationRequestNotificationComponent
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.CommunityInvitation:
|
|
|
|
return communityInvitationNotificationComponent
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.CommunityMembershipRequest:
|
|
|
|
return membershipRequestNotificationComponent
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.CommunityRequest:
|
|
|
|
return communityRequestNotificationComponent
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.CommunityKicked:
|
|
|
|
return communityKickedNotificationComponent
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.ContactRemoved:
|
|
|
|
return contactRemovedComponent
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.NewKeypairAddedToPairedDevice:
|
|
|
|
return newKeypairFromPairedDeviceComponent
|
2024-01-04 12:22:12 +00:00
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.CommunityTokenReceived:
|
2024-01-29 13:29:15 +00:00
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.FirstCommunityTokenReceived:
|
2024-01-04 12:22:12 +00:00
|
|
|
return communityTokenReceivedComponent
|
2023-10-23 11:35:20 +00:00
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.OwnerTokenReceived:
|
2023-10-23 11:36:33 +00:00
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.OwnershipReceived:
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.OwnershipLost:
|
2023-10-23 11:35:20 +00:00
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.OwnershipFailed:
|
2023-10-23 11:36:33 +00:00
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.OwnershipDeclined:
|
2023-10-23 11:35:20 +00:00
|
|
|
return ownerTokenReceivedNotificationComponent
|
2023-11-28 13:41:11 +00:00
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.ShareAccounts:
|
|
|
|
return shareAccountsNotificationComponent
|
2024-02-22 11:01:01 +00:00
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.CommunityBanned:
|
|
|
|
return communityBannedNotificationComponent
|
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.CommunityUnbanned:
|
|
|
|
return communityUnbannedNotificationComponent
|
2024-04-12 16:28:28 +00:00
|
|
|
case ActivityCenterStore.ActivityCenterNotificationType.NewPrivateGroupChat:
|
|
|
|
return groupChatInvitationNotificationComponent
|
2023-10-23 11:35:20 +00:00
|
|
|
default:
|
|
|
|
return null
|
2022-10-18 19:46:57 +00:00
|
|
|
}
|
|
|
|
}
|
2021-06-11 17:41:59 +00:00
|
|
|
}
|
2021-05-28 17:35:21 +00:00
|
|
|
}
|
2022-11-30 11:15:29 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: mentionNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationMention {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Component {
|
|
|
|
id: replyNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationReply {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Component {
|
|
|
|
id: contactRequestNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationContactRequest {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
2022-11-15 10:11:55 +00:00
|
|
|
Component {
|
|
|
|
id: verificationRequestNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationContactVerification {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
2022-11-30 11:15:29 +00:00
|
|
|
Component {
|
|
|
|
id: communityInvitationNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationCommunityInvitation {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Component {
|
|
|
|
id: membershipRequestNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationCommunityMembershipRequest {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Component {
|
|
|
|
id: communityRequestNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationCommunityRequest {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Component {
|
|
|
|
id: communityKickedNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationCommunityKicked {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
2024-02-22 11:01:01 +00:00
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: communityBannedNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationCommunityBanUnban {
|
|
|
|
banned: true
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: communityUnbannedNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationCommunityBanUnban {
|
|
|
|
banned: false
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
2022-11-30 11:15:29 +00:00
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
2023-06-08 12:52:03 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: contactRemovedComponent
|
|
|
|
|
|
|
|
ActivityNotificationContactRemoved {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
2023-08-24 13:09:25 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: newKeypairFromPairedDeviceComponent
|
|
|
|
|
|
|
|
ActivityNotificationNewKeypairFromPairedDevice {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
2023-10-23 11:35:20 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: ownerTokenReceivedNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationTransferOwnership {
|
|
|
|
|
|
|
|
readonly property var community : notification ? root.store.getCommunityDetailsAsJson(notification.communityId) : null
|
|
|
|
|
|
|
|
type: setType(notification)
|
|
|
|
|
|
|
|
communityName: community ? community.name : ""
|
|
|
|
communityColor: community ? community.color : Theme.palette.directColor1
|
|
|
|
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
|
|
|
|
onFinaliseOwnershipClicked: Global.openFinaliseOwnershipPopup(notification.communityId)
|
|
|
|
onNavigateToCommunityClicked: root.store.setActiveCommunity(notification.communityId)
|
|
|
|
}
|
|
|
|
}
|
2023-11-28 13:41:11 +00:00
|
|
|
|
2024-01-04 12:22:12 +00:00
|
|
|
Component {
|
|
|
|
id: communityTokenReceivedComponent
|
|
|
|
|
|
|
|
ActivityNotificationCommunityTokenReceived {
|
|
|
|
|
|
|
|
readonly property var community : notification ? root.store.getCommunityDetailsAsJson(notification.communityId) : null
|
|
|
|
|
2024-01-29 13:29:15 +00:00
|
|
|
communityId: notification.communityId
|
2024-01-04 12:22:12 +00:00
|
|
|
communityName: community ? community.name : ""
|
|
|
|
communityImage: community ? community.image : ""
|
|
|
|
|
2024-02-19 13:58:20 +00:00
|
|
|
store: root.store
|
|
|
|
|
2024-01-04 12:22:12 +00:00
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-28 13:41:11 +00:00
|
|
|
Component {
|
|
|
|
id: shareAccountsNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationCommunityShareAddresses {
|
|
|
|
|
|
|
|
readonly property var community : notification ? root.store.getCommunityDetailsAsJson(notification.communityId) : null
|
|
|
|
|
|
|
|
communityName: community ? community.name : ""
|
2024-01-04 12:22:12 +00:00
|
|
|
communityColor: community ? community.color : "transparent"
|
2023-11-28 13:41:11 +00:00
|
|
|
communityImage: community ? community.image : ""
|
|
|
|
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
|
|
|
|
onOpenShareAccountsClicked: {
|
|
|
|
Global.communityShareAddressesPopupRequested(notification.communityId, communityName, communityImage)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-04-12 16:28:28 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: groupChatInvitationNotificationComponent
|
|
|
|
|
|
|
|
ActivityNotificationUnknownGroupChatInvitation {
|
|
|
|
filteredIndex: parent.filteredIndex
|
|
|
|
notification: parent.notification
|
|
|
|
store: root.store
|
|
|
|
activityCenterStore: root.activityCenterStore
|
|
|
|
onCloseActivityCenter: root.close()
|
|
|
|
}
|
|
|
|
}
|
2021-05-28 17:35:21 +00:00
|
|
|
}
|