diff --git a/storybook/pages/MetricsEnablePopupPage.qml b/storybook/pages/MetricsEnablePopupPage.qml index 8239f2d777..15cb8597be 100644 --- a/storybook/pages/MetricsEnablePopupPage.qml +++ b/storybook/pages/MetricsEnablePopupPage.qml @@ -1,4 +1,5 @@ import QtQuick 2.15 +import QtQuick.Layouts 1.15 import QtQuick.Controls 2.15 import shared.popups 1.0 @@ -9,8 +10,9 @@ import Storybook 1.0 SplitView { orientation: Qt.Vertical - Item { + Logs { id: logs } + Item { SplitView.fillWidth: true SplitView.fillHeight: true @@ -24,14 +26,54 @@ SplitView { onClicked: popup.open() } + + MetricsEnablePopup { + id: popup + anchors.centerIn: parent + modal: false + visible: true + placement: ctrlPlacement.currentValue + onSetMetricsEnabledRequested: logs.logEvent("setMetricsEnabledRequested", ["enabled"], arguments) + onClosed: logs.logEvent("closed()") + } + + Connections { + target: Global + function onPrivacyPolicyRequested() { + logs.logEvent("Global::privacyPolicyRequested()") + } + } } - MetricsEnablePopup { - id: popup - anchors.centerIn: parent - modal: false - visible: true - placement: Constants.metricsEnablePlacement.unknown + LogsAndControlsPanel { + id: logsAndControlsPanel + + SplitView.minimumHeight: 100 + SplitView.preferredHeight: 200 + + logsView.logText: logs.logText + + ColumnLayout { + anchors.fill: parent + + RowLayout { + Layout.fillWidth: true + Label { + text: "Placement:" + } + ComboBox { + Layout.preferredWidth: 200 + id: ctrlPlacement + model: [ + Constants.metricsEnablePlacement.unknown, + Constants.metricsEnablePlacement.welcome, + Constants.metricsEnablePlacement.privacyAndSecurity, + Constants.metricsEnablePlacement.startApp + ] + } + } + Item { Layout.fillHeight: true } + } } } diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index e9d21e260f..f66878eeb0 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -128,7 +128,7 @@ headline_StatusTitleSubtitle = {"container": statusDesktop_mainWindow_overlay, " keys_exist_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "type": "StatusBaseText", "unnamed": 1, "visible": True} # Share Usage Data Popup -not_now_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "notShareMetricsButton", "type": "StatusButton", "visible": True} +not_now_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "notShareMetricsButton", "type": "StatusFlatButton", "visible": True} share_usage_data_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "shareMetricsButton", "type": "StatusButton", "visible": True} """ Communities """ diff --git a/ui/app/AppLayouts/Profile/views/PrivacyAndSecurityView.qml b/ui/app/AppLayouts/Profile/views/PrivacyAndSecurityView.qml index e68b607929..f9d2ee4a53 100644 --- a/ui/app/AppLayouts/Profile/views/PrivacyAndSecurityView.qml +++ b/ui/app/AppLayouts/Profile/views/PrivacyAndSecurityView.qml @@ -3,23 +3,10 @@ import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import utils 1.0 -import shared.panels 1.0 -import shared.popups 1.0 -import shared.stores 1.0 -import StatusQ 0.1 -import StatusQ.Core 0.1 -import StatusQ.Core.Theme 0.1 -import StatusQ.Core.Utils 0.1 as StatusQUtils import StatusQ.Components 0.1 import StatusQ.Controls 0.1 -import AppLayouts.Profile.stores 1.0 - -import "../popups" - -import SortFilterProxyModel 0.2 - SettingsContentBase { id: root @@ -29,6 +16,11 @@ SettingsContentBase { enableMetricsSwitch.checked = Qt.binding(function() { return root.isCentralizedMetricsEnabled }) } + titleRowComponentLoader.sourceComponent: StatusButton { + text: qsTr("Privacy policy") + onClicked: Global.privacyPolicyRequested() + } + ColumnLayout { StatusListItem { Layout.preferredWidth: root.contentWidth @@ -38,13 +30,15 @@ SettingsContentBase { StatusSwitch { id: enableMetricsSwitch checked: root.isCentralizedMetricsEnabled - onClicked: { - Global.openMetricsEnablePopupRequested(Constants.metricsEnablePlacement.privacyAndSecurity, popup => popup.toggleMetrics.connect(refreshSwitch)) + onToggled: { + Global.openMetricsEnablePopupRequested(Constants.metricsEnablePlacement.privacyAndSecurity, null) + refreshSwitch() } } ] onClicked: { - Global.openMetricsEnablePopupRequested(Constants.metricsEnablePlacement.privacyAndSecurity, popup => popup.toggleMetrics.connect(refreshSwitch)) + Global.openMetricsEnablePopupRequested(Constants.metricsEnablePlacement.privacyAndSecurity, null) + refreshSwitch() } } } diff --git a/ui/app/mainui/Popups.qml b/ui/app/mainui/Popups.qml index 122f2cd7c9..89b8dc14b9 100644 --- a/ui/app/mainui/Popups.qml +++ b/ui/app/mainui/Popups.qml @@ -8,6 +8,7 @@ import StatusQ.Core 0.1 import StatusQ.Controls 0.1 import StatusQ.Components 0.1 import StatusQ.Popups 0.1 +import StatusQ.Popups.Dialog 0.1 import StatusQ.Core.Theme 0.1 import StatusQ.Core.Utils 0.1 as SQUtils @@ -95,6 +96,7 @@ QtObject { Global.openCommunityMemberMessagesPopupRequested.connect(openCommunityMemberMessagesPopup) Global.openSwapModalRequested.connect(openSwapModal) Global.openBuyCryptoModalRequested.connect(openBuyCryptoModal) + Global.privacyPolicyRequested.connect(() => openPopup(privacyPolicyPopupComponent)) } property var currentPopup @@ -1269,6 +1271,28 @@ QtObject { } onClosed: destroy() } + }, + Component { + id: privacyPolicyPopupComponent + StatusDialog { + width: 600 + padding: 0 + title: qsTr("Status Software Privacy Policy") + StatusScrollView { + id: privacyDialogScrollView + anchors.fill: parent + contentWidth: availableWidth + StatusBaseText { + width: privacyDialogScrollView.availableWidth + wrapMode: Text.Wrap + textFormat: Text.MarkdownText + text: SQUtils.StringUtils.readTextFile(":/imports/assets/docs/privacy.mdwn") + onLinkActivated: Global.openLinkWithConfirmation(link, SQUtils.StringUtils.extractDomainFromLink(link)) + } + } + standardButtons: Dialog.Ok + destroyOnClose: true + } } ] } diff --git a/ui/imports/shared/popups/MetricsEnablePopup.qml b/ui/imports/shared/popups/MetricsEnablePopup.qml index d193c15c00..1c53fde040 100644 --- a/ui/imports/shared/popups/MetricsEnablePopup.qml +++ b/ui/imports/shared/popups/MetricsEnablePopup.qml @@ -16,7 +16,7 @@ StatusModal { property string placement: Constants.metricsEnablePlacement.unknown - signal toggleMetrics(bool enabled) + signal setMetricsEnabledRequested(bool enabled) width: 640 title: qsTr("Help us improve Status") @@ -83,31 +83,38 @@ StatusModal { Paragraph { Layout.fillWidth: true Layout.fillHeight: true - text: qsTr("Usage data will be shared from all profiles added to device. %1").arg(root.placement !== Constants.metricsEnablePlacement.privacyAndSecurity ? "Sharing usage data can be turned off anytime in Settings / Privacy and Security." : "") + textFormat: Text.RichText + text: qsTr("Usage data will be shared from all profiles added to device. %1 %2") + .arg(root.placement !== Constants.metricsEnablePlacement.privacyAndSecurity ? qsTr("Sharing usage data can be turned off anytime in Settings / Privacy and Security.") : "") + .arg(root.placement === Constants.metricsEnablePlacement.privacyAndSecurity ? qsTr("For more details refer to our %1.").arg(Utils.getStyledLink("Privacy Policy", "#", hoveredLink)) : "") + onLinkActivated: { + root.close() + Global.privacyPolicyRequested() + } + HoverHandler { + cursorShape: !!parent.hoveredLink ? Qt.PointingHandCursor : undefined + } } } } rightButtons: [ + StatusFlatButton { + text: qsTr("Do not share") + onClicked: { + root.setMetricsEnabledRequested(false) + close() + } + objectName: "notShareMetricsButton" + normalColor: "transparent" + }, StatusButton { text: qsTr("Share usage data") onClicked: { - root.toggleMetrics(true) + root.setMetricsEnabledRequested(true) close() } objectName: "shareMetricsButton" } ] - - leftButtons: [ - StatusButton { - text: qsTr("Not now") - onClicked: { - root.toggleMetrics(false) - close() - } - objectName: "notShareMetricsButton" - normalColor: "transparent" - } - ] } diff --git a/ui/imports/utils/Global.qml b/ui/imports/utils/Global.qml index 1dc992ef1a..ba0ebda407 100644 --- a/ui/imports/utils/Global.qml +++ b/ui/imports/utils/Global.qml @@ -103,6 +103,8 @@ QtObject { signal openTestnetPopup() + signal privacyPolicyRequested() + // Swap signal openSwapModalRequested(var formDataParams) diff --git a/ui/main.qml b/ui/main.qml index 7b84c0538b..f4f1d71e26 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -381,7 +381,7 @@ StatusWindow { sourceComponent: MetricsEnablePopup { visible: true onClosed: metricsPopupLoader.active = false - onToggleMetrics: { + onSetMetricsEnabledRequested: { applicationWindow.metricsStore.toggleCentralizedMetrics(enabled) if (enabled) { Global.addCentralizedMetricIfEnabled("usage_data_shared", {placement: metricsPopupLoader.item.placement})