feat: show activity center notification if user must reveal addressed to join/rejoin the community (#12856)

This commit is contained in:
Mykhailo Prakhov 2023-11-28 14:41:11 +01:00 committed by GitHub
parent b5ceddb208
commit 3af73a44a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 138 additions and 2 deletions

View File

@ -26,6 +26,7 @@ type ActivityCenterNotificationType* {.pure.}= enum
OwnershipLost = 15 OwnershipLost = 15
SetSignerFailed = 16 SetSignerFailed = 16
SetSignerDeclined = 17 SetSignerDeclined = 17
ShareAccounts = 18
type ActivityCenterGroup* {.pure.}= enum type ActivityCenterGroup* {.pure.}= enum
All = 0, All = 0,
@ -162,7 +163,8 @@ proc activityCenterNotificationTypesByGroup*(group: ActivityCenterGroup) : seq[i
ActivityCenterNotificationType.OwnershipReceived.int, ActivityCenterNotificationType.OwnershipReceived.int,
ActivityCenterNotificationType.SetSignerFailed.int, ActivityCenterNotificationType.SetSignerFailed.int,
ActivityCenterNotificationType.SetSignerDeclined.int, ActivityCenterNotificationType.SetSignerDeclined.int,
ActivityCenterNotificationType.OwnershipLost.int ActivityCenterNotificationType.OwnershipLost.int,
ActivityCenterNotificationType.ShareAccounts.int
] ]
of ActivityCenterGroup.Mentions: of ActivityCenterGroup.Mentions:
return @[ActivityCenterNotificationType.Mention.int] return @[ActivityCenterNotificationType.Mention.int]

View File

@ -60,6 +60,7 @@ QtObject {
Global.openCommunityProfilePopupRequested.connect(openCommunityProfilePopup) Global.openCommunityProfilePopupRequested.connect(openCommunityProfilePopup)
Global.createCommunityPopupRequested.connect(openCreateCommunityPopup) Global.createCommunityPopupRequested.connect(openCreateCommunityPopup)
Global.importCommunityPopupRequested.connect(openImportCommunityPopup) Global.importCommunityPopupRequested.connect(openImportCommunityPopup)
Global.communityShareAddressesPopupRequested.connect(openCommunityShareAddressesPopup)
Global.communityIntroPopupRequested.connect(openCommunityIntroPopup) Global.communityIntroPopupRequested.connect(openCommunityIntroPopup)
Global.removeContactRequested.connect(openRemoveContactConfirmationPopup) Global.removeContactRequested.connect(openRemoveContactConfirmationPopup)
Global.openPopupRequested.connect(openPopup) Global.openPopupRequested.connect(openPopup)
@ -241,6 +242,18 @@ QtObject {
}) })
} }
function openCommunityShareAddressesPopup(communityId, name, imageSrc) {
openPopup(communityIntroDialogPopup,
{communityId: communityId,
stackTitle: qsTr("Share addresses with %1's owner").arg(name),
name: name,
introMessage: qsTr("Share addresses to rejoin %1").arg(name),
imageSrc: imageSrc,
accessType: Constants.communityChatOnRequestAccess,
isInvitationPending: false
})
}
function openEditSharedAddressesPopup(communityId) { function openEditSharedAddressesPopup(communityId) {
openPopup(editSharedAddressesPopupComponent, {communityId: communityId, isEditMode: true}) openPopup(editSharedAddressesPopupComponent, {communityId: communityId, isEditMode: true})
} }

View File

@ -135,6 +135,8 @@ Popup {
case ActivityCenterStore.ActivityCenterNotificationType.OwnershipFailed: case ActivityCenterStore.ActivityCenterNotificationType.OwnershipFailed:
case ActivityCenterStore.ActivityCenterNotificationType.OwnershipDeclined: case ActivityCenterStore.ActivityCenterNotificationType.OwnershipDeclined:
return ownerTokenReceivedNotificationComponent return ownerTokenReceivedNotificationComponent
case ActivityCenterStore.ActivityCenterNotificationType.ShareAccounts:
return shareAccountsNotificationComponent
default: default:
return null return null
} }
@ -275,4 +277,27 @@ Popup {
onNavigateToCommunityClicked: root.store.setActiveCommunity(notification.communityId) onNavigateToCommunityClicked: root.store.setActiveCommunity(notification.communityId)
} }
} }
Component {
id: shareAccountsNotificationComponent
ActivityNotificationCommunityShareAddresses {
readonly property var community : notification ? root.store.getCommunityDetailsAsJson(notification.communityId) : null
communityName: community ? community.name : ""
communityColor: community ? community.color : "black"
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)
}
}
}
} }

View File

@ -35,7 +35,8 @@ QtObject {
OwnershipReceived = 14, OwnershipReceived = 14,
OwnershipLost = 15, OwnershipLost = 15,
OwnershipFailed = 16, OwnershipFailed = 16,
OwnershipDeclined = 17 OwnershipDeclined = 17,
ShareAccounts = 18
} }
enum ActivityCenterReadType { enum ActivityCenterReadType {

View File

@ -0,0 +1,93 @@
import QtQuick 2.14
import QtQuick.Layouts 1.14
import StatusQ.Controls 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import shared 1.0
import shared.panels 1.0
import utils 1.0
import "../panels"
import "../popups"
import "../stores"
ActivityNotificationBase {
id: root
required property string communityName
required property string communityColor
required property string communityImage
signal openCommunityClicked
signal openShareAccountsClicked
bodyComponent: RowLayout {
spacing: 8
StatusSmartIdenticon {
name: root.communityName
Layout.preferredWidth: 40
Layout.preferredHeight: 40
Layout.alignment: Qt.AlignTop
Layout.leftMargin: Style.current.padding
Layout.topMargin: 2
asset {
width: 24
height: width
name: root.communityImage
color: root.communityColor
bgWidth: 40
bgHeight: 40
}
}
ColumnLayout {
spacing: 2
Layout.alignment: Qt.AlignTop
RowLayout {
StatusBaseText {
Layout.fillWidth: true
verticalAlignment: Text.AlignVCenter
font.weight: Font.Medium
font.pixelSize: Theme.primaryTextFontSize
wrapMode: Text.WordWrap
color: Theme.palette.primaryColor1
text: qsTr("%1 requires you to share your Accounts").arg(root.communityName)
}
StatusTimeStampLabel {
id: timestamp
verticalAlignment: Text.AlignVCenter
timestamp: root.notification.timestamp
}
}
RowLayout {
spacing: Style.current.padding
StatusBaseText {
Layout.fillWidth: true
text: qsTr("To continue to be a member of %1, you need to share your accounts").arg(root.communityName)
font.italic: true
wrapMode: Text.WordWrap
color: Theme.palette.baseColor1
}
StatusFlatButton {
size: StatusBaseButton.Size.Small
text: qsTr("Share")
onClicked: {
root.openShareAccountsClicked()
}
}
}
}
}
ctaComponent: undefined
}

View File

@ -1,2 +1,3 @@
ActivityNotificationCommunityMembershipRequest 1.0 ActivityNotificationCommunityMembershipRequest.qml ActivityNotificationCommunityMembershipRequest 1.0 ActivityNotificationCommunityMembershipRequest.qml
ActivityNotificationTransferOwnership 1.0 ActivityNotificationTransferOwnership.qml ActivityNotificationTransferOwnership 1.0 ActivityNotificationTransferOwnership.qml
ActivityNotificationCommunityShareAddresses 1.0 ActivityNotificationCommunityShareAddresses.qml

View File

@ -70,6 +70,7 @@ QtObject {
signal importCommunityPopupRequested() signal importCommunityPopupRequested()
signal communityIntroPopupRequested(string communityId, string name, string introMessage, signal communityIntroPopupRequested(string communityId, string name, string introMessage,
string imageSrc, int accessType, bool isInvitationPending) string imageSrc, int accessType, bool isInvitationPending)
signal communityShareAddressesPopupRequested(string communityId, string name, string imageSrc)
signal leaveCommunityRequested(string community, string communityId, string outroMessage) signal leaveCommunityRequested(string community, string communityId, string outroMessage)
signal openEditSharedAddressesFlow(string communityId) signal openEditSharedAddressesFlow(string communityId)