From f8c4682885c0165799ce1796ecf8fb31a1f38992 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 12 Jan 2023 14:06:18 -0500 Subject: [PATCH] chore(contact-request): remove old contact request button and popup Fixes #9072 I made clicking on the OS notification open the AC instead of the old popup --- src/app/modules/main/module.nim | 2 +- src/app/modules/main/view.nim | 6 +- .../Chat/popups/ContactRequestsPopup.qml | 97 ------------------- .../Chat/views/ContactsColumnView.qml | 33 ------- ui/app/mainui/AppMain.qml | 4 + 5 files changed, 8 insertions(+), 134 deletions(-) delete mode 100644 ui/app/AppLayouts/Chat/popups/ContactRequestsPopup.qml diff --git a/src/app/modules/main/module.nim b/src/app/modules/main/module.nim index 0526cb8349..5fca1ccfb7 100644 --- a/src/app/modules/main/module.nim +++ b/src/app/modules/main/module.nim @@ -861,7 +861,7 @@ method displayWindowsOsNotification*[T](self: Module[T], title: string, method osNotificationClicked*[T](self: Module[T], details: NotificationDetails) = if(details.notificationType == NotificationType.NewContactRequest): self.controller.switchTo(details.sectionId, "", "") - self.view.emitOpenContactRequestsPopupSignal() + self.view.emitOpenActivityCenterSignal() elif(details.notificationType == NotificationType.JoinCommunityRequest): self.controller.switchTo(details.sectionId, "", "") self.view.emitOpenCommunityMembershipRequestsPopupSignal(details.sectionId) diff --git a/src/app/modules/main/view.nim b/src/app/modules/main/view.nim index 26469caa14..c27be0efff 100644 --- a/src/app/modules/main/view.nim +++ b/src/app/modules/main/view.nim @@ -197,9 +197,9 @@ QtObject: proc emitResolvedENSSignal*(self: View, resolvedPubKey: string, resolvedAddress: string, uuid: string) = self.resolvedENS(resolvedPubKey, resolvedAddress, uuid) - proc openContactRequestsPopup*(self: View) {.signal.} - proc emitOpenContactRequestsPopupSignal*(self: View) = - self.openContactRequestsPopup() + proc openActivityCenter*(self: View) {.signal.} + proc emitOpenActivityCenterSignal*(self: View) = + self.openActivityCenter() proc openCommunityMembershipRequestsPopup*(self: View, sectionId: string) {.signal.} proc emitOpenCommunityMembershipRequestsPopupSignal*(self: View, sectionId: string) = diff --git a/ui/app/AppLayouts/Chat/popups/ContactRequestsPopup.qml b/ui/app/AppLayouts/Chat/popups/ContactRequestsPopup.qml deleted file mode 100644 index fd14cb209c..0000000000 --- a/ui/app/AppLayouts/Chat/popups/ContactRequestsPopup.qml +++ /dev/null @@ -1,97 +0,0 @@ -import QtQuick 2.13 -import QtQuick.Controls 2.13 -import QtQuick.Layouts 1.13 -import QtGraphicalEffects 1.13 - -import StatusQ.Core 0.1 -import StatusQ.Controls 0.1 - -import utils 1.0 -import shared.popups 1.0 - -import "../panels" - -// TODO: Replace with StatusModal -ModalPopup { - id: popup - - property var store - - title: qsTr("Contact requests") - - StatusListView { - id: contactList - - anchors.fill: parent - anchors.leftMargin: -Style.current.halfPadding - anchors.rightMargin: -Style.current.halfPadding - - model: popup.store.contactRequestsModel - - delegate: ContactRequestPanel { - contactPubKey: model.pubKey - contactName: model.displayName - contactIcon: model.icon - - onOpenProfilePopup: { - Global.openProfilePopup(model.pubKey) - } - onBlockContactActionTriggered: { - Global.blockContactRequested(model.pubKey, model.displayName) - } - onAcceptClicked: { - popup.store.acceptContactRequest(model.pubKey) - } - onDeclineClicked: { - popup.store.dismissContactRequest(model.pubKey) - } - } - } - - footer: Item { - width: parent.width - height: children[0].height - - ConfirmationDialog { - id: declineAllDialog - header.title: qsTr("Decline all contacts") - confirmationText: qsTr("Are you sure you want to decline all these contact requests") - onConfirmButtonClicked: { - popup.store.dismissAllContactRequests() - declineAllDialog.close() - popup.close() - } - } - - ConfirmationDialog { - id: acceptAllDialog - header.title: qsTr("Accept all contacts") - confirmationText: qsTr("Are you sure you want to accept all these contact requests") - onConfirmButtonClicked: { - popup.store.acceptAllContactRequests() - acceptAllDialog.close() - popup.close() - } - } - - StatusButton { - id: blockBtn - enabled: contactList.count > 0 - anchors.right: addToContactsButton.left - anchors.rightMargin: Style.current.padding - anchors.bottom: parent.bottom - type: StatusBaseButton.Type.Danger - text: qsTr("Decline all") - onClicked: declineAllDialog.open() - } - - StatusButton { - id: addToContactsButton - enabled: contactList.count > 0 - anchors.right: parent.right - text: qsTr("Accept all") - anchors.bottom: parent.bottom - onClicked: acceptAllDialog.open() - } - } -} diff --git a/ui/app/AppLayouts/Chat/views/ContactsColumnView.qml b/ui/app/AppLayouts/Chat/views/ContactsColumnView.qml index 2170302867..e32fccf6ac 100644 --- a/ui/app/AppLayouts/Chat/views/ContactsColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ContactsColumnView.qml @@ -127,21 +127,6 @@ Item { } } - // contact requests - StatusContactRequestsIndicatorListItem { - id: contactRequests - Layout.fillWidth: true - Layout.preferredHeight: visible ? implicitHeight : 0 - - readonly property int nbRequests: root.store.contactRequestsModel.count - - visible: nbRequests > 0 - title: qsTr("Contact requests") - requestsCount: nbRequests - - onClicked: Global.openPopup(contactRequestsPopup) - } - Item { Layout.fillWidth: true Layout.fillHeight: true @@ -309,16 +294,6 @@ Item { } } - Component { - id: contactRequestsPopup - ContactRequestsPopup { - store: root.store - onClosed: { - destroy() - } - } - } - Connections { target: root.store function onImportingCommunityStateChanged(communityId, state, errorMsg) { @@ -353,12 +328,4 @@ Item { "") } } - - Connections { - target: root.store.mainModuleInst - - function onOpenContactRequestsPopup() { - Global.openPopup(contactRequestsPopup) - } - } } diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index 68a9bf1af5..73be228322 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -74,6 +74,10 @@ Item { onActiveSectionChanged: { createChatView.opened = false } + + onOpenActivityCenter: { + Global.openPopup(activityCenterPopupComponent) + } } Popups {