Skip to content

Commit ffb5eca

Browse files
committed
feat(AC): Added placeholder on News tab when settings are disabled
It creates a component placeholder for both `Enable RSS Notifications` and `Enable Status News` information panel and integrates it into the AC logic. Closes #17795
1 parent ea82f85 commit ffb5eca

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

ui/app/mainui/AppMain.qml

+2
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,8 @@ Item {
22982298
chatCommunitySectionModule: appMain.rootStore.mainModuleInst.getChatSectionModule()
22992299
}
23002300
activityCenterStore: appMain.activityCenterStore
2301+
privacyStore: appMain.profileSectionStore.privacyStore
2302+
notificationsStore: appMain.profileSectionStore.notificationsStore
23012303
}
23022304
}
23032305

ui/app/mainui/activitycenter/popups/ActivityCenterPopup.qml

+82
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import shared.views.chat 1.0
1818
import utils 1.0
1919

2020
import AppLayouts.Chat.stores 1.0 as ChatStores
21+
import AppLayouts.Profile.stores 1.0
2122

2223
import "../views"
2324
import "../panels"
@@ -28,6 +29,8 @@ Popup {
2829

2930
property ActivityCenterStore activityCenterStore
3031
property ChatStores.RootStore store
32+
property PrivacyStore privacyStore
33+
property NotificationsStore notificationsStore
3134

3235
onOpened: {
3336
Global.activityPopupOpened = true
@@ -50,6 +53,9 @@ Popup {
5053
root.activityCenterStore.fetchActivityCenterNotifications()
5154
}
5255
})
56+
57+
readonly property bool isStatusNewsViaRSSEnabled: root.privacyStore.isStatusNewsViaRSSEnabled
58+
readonly property var notificationsSettings: root.notificationsStore.notificationsSettings
5359
}
5460

5561
Overlay.modal: StatusMouseArea { // eat every event behind the popup
@@ -96,6 +102,7 @@ Popup {
96102
StatusListView {
97103
id: listView
98104

105+
visible: !statusNewsNotificationPlaceholder.visible
99106
anchors.left: parent.left
100107
anchors.right: parent.right
101108
anchors.top: activityCenterTopBar.bottom
@@ -167,6 +174,15 @@ Popup {
167174
}
168175
}
169176

177+
// Placeholders for the status news when their settings are disbled
178+
Loader {
179+
id: statusNewsNotificationPlaceholder
180+
visible: activityCenterTopBar.activeGroup === ActivityCenterStore.ActivityCenterGroup.NewsMessage &&
181+
(!d.isStatusNewsViaRSSEnabled || d.notificationsSettings.notifSettingStatusNews === Constants.settingsSection.notifications.turnOffValue)
182+
anchors.centerIn: parent
183+
sourceComponent: newsPlaceholderPanel
184+
}
185+
170186
Component {
171187
id: mentionNotificationComponent
172188

@@ -524,4 +540,70 @@ Popup {
524540
footer: null
525541
}
526542
}
543+
544+
Component {
545+
id: newsMessagePopup
546+
547+
NewsMessagePopup {
548+
onLinkClicked: Global.openLinkWithConfirmation(link, StatusQUtils.StringUtils.extractDomainFromLink(link));
549+
}
550+
}
551+
552+
Component {
553+
id: newsPlaceholderPanel
554+
555+
ColumnLayout {
556+
id: newsPanelLayout
557+
558+
// Property used to setup the panel layout:
559+
// If true it means the panel is for enabling RSS notification
560+
// If false, it means it is for enabling status news notifications
561+
readonly property bool isEnableRSSNotificationPanelType: !d.isStatusNewsViaRSSEnabled
562+
563+
anchors.centerIn: parent
564+
width: 320
565+
spacing: 12
566+
567+
StatusBaseText {
568+
Layout.alignment: Qt.AlignHCenter
569+
Layout.maximumWidth: parent.width
570+
571+
text: newsPanelLayout.isEnableRSSNotificationPanelType ? qsTr("Enable RSS to receive Status News notifications") :
572+
qsTr("Enable Status News notifications")
573+
font.weight: Font.Bold
574+
lineHeight: 1.2
575+
horizontalAlignment: Text.AlignHCenter
576+
wrapMode: Text.WordWrap
577+
}
578+
579+
StatusBaseText {
580+
Layout.alignment: Qt.AlignHCenter
581+
Layout.maximumWidth: parent.width
582+
583+
font.pixelSize: Theme.additionalTextSize
584+
color: Theme.palette.baseColor1
585+
text: newsPanelLayout.isEnableRSSNotificationPanelType ? qsTr("RSS is currently disabled via your Privacy & Security settings. Enable RSS to receive Status News notifications about upcoming features and important announcements.") :
586+
qsTr("This feature is currently turned off. Enable Status News notifications to receive notifications about upcoming features and important announcements")
587+
lineHeight: 1.2
588+
horizontalAlignment: Text.AlignHCenter
589+
wrapMode: Text.WordWrap
590+
}
591+
592+
StatusButton {
593+
Layout.alignment: Qt.AlignHCenter
594+
595+
text: newsPanelLayout.isEnableRSSNotificationPanelType ? qsTr("Enable RSS"):
596+
qsTr("Enable Status News notifications")
597+
font.pixelSize: Theme.additionalTextSize
598+
599+
onClicked: {
600+
if(isEnableRSSNotificationPanelType) {
601+
root.privacyStore.isStatusNewsViaRSSEnabled = true
602+
} else {
603+
d.notificationsSettings.notifSettingStatusNews = Constants.settingsSection.notifications.sendAlertsValue
604+
}
605+
}
606+
}
607+
}
608+
}
527609
}

0 commit comments

Comments
 (0)