diff --git a/src/app/modules/main/activity_center/item.nim b/src/app/modules/main/activity_center/item.nim index 4abcbe9df5..188e4ce731 100644 --- a/src/app/modules/main/activity_center/item.nim +++ b/src/app/modules/main/activity_center/item.nim @@ -2,6 +2,8 @@ import strformat, stint import ../../shared_models/message_item_qobject import ../../../../app_service/service/activity_center/dto/notification +const CONTACT_REQUEST_PENDING_STATE = 1 + type Item* = ref object id: string # ID is the id of the chat, for public chats it is the name e.g. status, for one-to-one is the hex encoded public key and for group chats is a random uuid appended with the hex encoded pk of the creator of the chat chatId: string @@ -111,4 +113,15 @@ proc messageItem*(self: Item): MessageItem = return self.messageItem proc repliedMessageItem*(self: Item): MessageItem = - return self.repliedMessageItem \ No newline at end of file + return self.repliedMessageItem + +# TODO: this logic should be moved to status-go +proc isNotReadOrActiveCTA*(self: Item): bool = + return ((self.notificationType == ActivityCenterNotificationType.CommunityMembershipRequest and + self.membershipStatus == ActivityCenterMembershipStatus.Pending) or + (self.notificationType == ActivityCenterNotificationType.ContactRequest and + self.messageItem.contactRequestState == CONTACT_REQUEST_PENDING_STATE) or + (self.notificationType == ActivityCenterNotificationType.Mention and + not self.read) or + (self.notificationType == ActivityCenterNotificationType.Reply and + not self.read)) \ No newline at end of file diff --git a/src/app/modules/main/activity_center/model.nim b/src/app/modules/main/activity_center/model.nim index 8c008d63d1..25a5ec660f 100644 --- a/src/app/modules/main/activity_center/model.nim +++ b/src/app/modules/main/activity_center/model.nim @@ -22,7 +22,6 @@ QtObject: type Model* = ref object of QAbstractListModel activityCenterNotifications*: seq[Item] - nbUnreadNotifications*: int proc setup(self: Model) = self.QAbstractListModel.setup @@ -43,23 +42,25 @@ QtObject: proc unreadCountChanged*(self: Model) {.signal.} - proc unreadCount*(self: Model): int {.slot.} = - self.nbUnreadNotifications + proc unreadCount*(self: Model): int {.slot.} = + result = 0 + for notification in self.activityCenterNotifications: + if (notification.isNotReadOrActiveCTA()): + result += 1 + return result QtProperty[int] unreadCount: read = unreadCount notify = unreadCountChanged proc markAllAsRead*(self: Model) = - self.nbUnreadNotifications = 0 - self.unreadCountChanged() - for activityCenterNotification in self.activityCenterNotifications: activityCenterNotification.read = true let topLeft = self.createIndex(0, 0, nil) let bottomRight = self.createIndex(self.activityCenterNotifications.len - 1, 0, nil) self.dataChanged(topLeft, bottomRight, @[NotifRoles.Read.int]) + self.unreadCountChanged() method rowCount*(self: Model, index: QModelIndex = nil): int = self.activityCenterNotifications.len @@ -124,16 +125,7 @@ QtObject: NotifRoles.RepliedMessage.int: "repliedMessage" }.toTable - proc reduceUnreadCount(self: Model, numberNotifs: int) = - self.nbUnreadNotifications = self.nbUnreadNotifications - numberNotifs - if (self.nbUnreadNotifications < 0): - self.nbUnreadNotifications = 0 - self.unreadCountChanged() - proc markActivityCenterNotificationUnread*(self: Model, notificationId: string) = - self.nbUnreadNotifications = self.nbUnreadNotifications + 1 - self.unreadCountChanged() - var i = 0 for acnViewItem in self.activityCenterNotifications: if (acnViewItem.id == notificationId): @@ -142,13 +134,9 @@ QtObject: self.dataChanged(index, index, @[NotifRoles.Read.int]) break i.inc - - proc markActivityCenterNotificationRead*(self: Model, notificationId: string) = - self.nbUnreadNotifications = self.nbUnreadNotifications - 1 - if (self.nbUnreadNotifications < 0): - self.nbUnreadNotifications = 0 self.unreadCountChanged() + proc markActivityCenterNotificationRead*(self: Model, notificationId: string) = var i = 0 for acnViewItem in self.activityCenterNotifications: if (acnViewItem.id == notificationId): @@ -157,6 +145,7 @@ QtObject: self.dataChanged(index, index, @[NotifRoles.Read.int]) break i.inc + self.unreadCountChanged() proc removeNotifications*(self: Model, ids: seq[string]) = var i = 0 @@ -175,8 +164,7 @@ QtObject: self.activityCenterNotifications.delete(indexUpdated) self.endRemoveRows() i = i + 1 - - self.reduceUnreadCount(ids.len) + self.unreadCountChanged() proc setNewData*(self: Model, activityCenterNotifications: seq[Item]) = self.beginResetModel() @@ -189,13 +177,6 @@ QtObject: self.activityCenterNotifications.add(activityCenterNotification) self.endInsertRows() - - if (addToCount and not activityCenterNotification.read): - self.nbUnreadNotifications = self.nbUnreadNotifications + 1 - self.unreadCountChanged() - - proc updateUnreadCount*(self: Model, count: int) = - self.nbUnreadNotifications = count self.unreadCountChanged() proc addActivityNotificationItemsToList*(self: Model, activityCenterNotifications: seq[Item]) = @@ -208,3 +189,4 @@ QtObject: self.removeNotifications(@[notif.id]) break self.addActivityNotificationItemToList(activityCenterNotification, false) + self.unreadCountChanged() diff --git a/src/app/modules/main/activity_center/view.nim b/src/app/modules/main/activity_center/view.nim index ee2ea608e4..5051310a00 100644 --- a/src/app/modules/main/activity_center/view.nim +++ b/src/app/modules/main/activity_center/view.nim @@ -46,9 +46,6 @@ QtObject: self.model.addActivityNotificationItemsToList(activityCenterNotifications) self.hasMoreToShowChanged() - let count = self.delegate.unreadActivityCenterNotificationsCount() - self.model.updateUnreadCount(count) - proc loadMoreNotifications(self: View) {.slot.} = self.delegate.fetchActivityCenterNotifications() diff --git a/ui/app/AppLayouts/Browser/BrowserLayout.qml b/ui/app/AppLayouts/Browser/BrowserLayout.qml index 3b0a096e5f..21029c775c 100644 --- a/ui/app/AppLayouts/Browser/BrowserLayout.qml +++ b/ui/app/AppLayouts/Browser/BrowserLayout.qml @@ -35,7 +35,7 @@ StatusSectionLayout { tab.item.url = _internal.determineRealURL(url) } - notificationCount: root.globalStore.unreadNotificationsCount + notificationCount: activityCenterStore.unreadNotificationsCount onNotificationButtonClicked: Global.openActivityCenterPopup() QtObject { diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index 2babe24b34..d9d0968c5b 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -125,13 +125,6 @@ QtObject { property var globalUtilsInst: globalUtils property var mainModuleInst: mainModule - property var activityCenterModuleInst: activityCenterModule - property var activityCenterList: activityCenterModuleInst.activityNotificationsModel - property int unreadNotificationsCount: activityCenterList.unreadCount - - function loadMoreNotifications() { - activityCenterModuleInst.loadMoreNotifications() - } property var communitiesModuleInst: communitiesModule property var communitiesList: communitiesModuleInst.model @@ -157,29 +150,6 @@ QtObject { stickersModule: stickersModuleInst } - // Not Refactored Yet -// property var activeCommunity: chatsModelInst.communities.activeCommunity - - function getBadgeDetails(sectionId, chatId) { - try { - const jsonObj = root.activityCenterModuleInst.getDetails(sectionId, chatId) - let obj = JSON.parse(jsonObj) - return obj - } - catch (e) { - return { - sType: "", - sName: "", - sImage: "", - sColor: "", - cName: "", - cImage: "", - cColor: "", - cEmoji: "" - } - } - } - function sendSticker(channelId, hash, replyTo, pack, url) { stickersModuleInst.send(channelId, hash, replyTo, pack, url) } diff --git a/ui/app/AppLayouts/Chat/views/ChatView.qml b/ui/app/AppLayouts/Chat/views/ChatView.qml index ac2350fe46..b4b87840bb 100644 --- a/ui/app/AppLayouts/Chat/views/ChatView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatView.qml @@ -59,7 +59,7 @@ StatusSectionLayout { notificationButton.tooltip.offset: localAccountSensitiveSettings.expandUsersList && headerContent.membersButton.visible ? 0 : 14 onNotificationButtonClicked: Global.openActivityCenterPopup() - notificationCount: root.rootStore.unreadNotificationsCount + notificationCount: activityCenterStore.unreadNotificationsCount headerContent: ChatHeaderContentView { id: headerContent diff --git a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml index 704d81bc77..b9c869c197 100644 --- a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml @@ -23,7 +23,7 @@ import "../layouts" StatusSectionLayout { id: root - notificationCount: root.rootStore.unreadNotificationsCount + notificationCount: activityCenterStore.unreadNotificationsCount onNotificationButtonClicked: Global.openActivityCenterPopup() // TODO: get this model from backend? property var settingsMenuModel: root.rootStore.communityPermissionsEnabled ? [{name: qsTr("Overview"), icon: "show"}, diff --git a/ui/app/AppLayouts/Chat/views/CreateChatView.qml b/ui/app/AppLayouts/Chat/views/CreateChatView.qml index 28f16eb288..6de6913128 100644 --- a/ui/app/AppLayouts/Chat/views/CreateChatView.qml +++ b/ui/app/AppLayouts/Chat/views/CreateChatView.qml @@ -85,7 +85,7 @@ Page { StatusActivityCenterButton { Layout.alignment: Qt.AlignVCenter - unreadNotificationsCount: root.rootStore.unreadNotificationsCount + unreadNotificationsCount: activityCenterStore.unreadNotificationsCount onClicked: Global.openActivityCenterPopup() } } diff --git a/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml b/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml index 302fea7989..54201bad49 100644 --- a/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml +++ b/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml @@ -31,7 +31,7 @@ StatusSectionLayout { property var createCommunitiesPopup: createCommunitiesPopupComponent property var discordImportProgressPopup: discordImportProgressDialog - notificationCount: root.communitiesStore.unreadNotificationsCount + notificationCount: activityCenterStore.unreadNotificationsCount onNotificationButtonClicked: Global.openActivityCenterPopup() onVisibleChanged: { diff --git a/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml b/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml index 2764524a34..78222c95c8 100644 --- a/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml +++ b/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml @@ -26,9 +26,6 @@ QtObject { property var advancedModule: profileSectionModule.advancedModule property bool isCommunityHistoryArchiveSupportEnabled: advancedModule? advancedModule.isCommunityHistoryArchiveSupportEnabled : false - property var activityCenterModuleInst: activityCenterModule - property var activityCenterList: activityCenterModuleInst.activityNotificationsModel - property int unreadNotificationsCount: activityCenterList.unreadCount // TODO: Could the backend provide directly 2 filtered models?? //property var featuredCommunitiesModel: root.communitiesModuleInst.curatedFeaturedCommunities //property var popularCommunitiesModel: root.communitiesModuleInst.curatedPopularCommunities diff --git a/ui/app/AppLayouts/Node/NodeLayout.qml b/ui/app/AppLayouts/Node/NodeLayout.qml index 25ca3c7fd0..45b207a60b 100644 --- a/ui/app/AppLayouts/Node/NodeLayout.qml +++ b/ui/app/AppLayouts/Node/NodeLayout.qml @@ -19,7 +19,7 @@ StatusSectionLayout { property RootStore store: RootStore {} - notificationCount: root.store.unreadNotificationsCount + notificationCount: activityCenterStore.unreadNotificationsCount onNotificationButtonClicked: Global.openActivityCenterPopup() centerPanel: ColumnLayout { id: rpcColumn diff --git a/ui/app/AppLayouts/Node/stores/RootStore.qml b/ui/app/AppLayouts/Node/stores/RootStore.qml index e57d32e62d..cb58072c1d 100644 --- a/ui/app/AppLayouts/Node/stores/RootStore.qml +++ b/ui/app/AppLayouts/Node/stores/RootStore.qml @@ -5,10 +5,6 @@ import utils 1.0 QtObject { id: root - property var activityCenterModuleInst: activityCenterModule - property var activityCenterList: activityCenterModuleInst.activityNotificationsModel - property int unreadNotificationsCount: activityCenterList.unreadCount - property var nodeModelInst: nodeModel // property var profileModelInst: profileModel diff --git a/ui/app/AppLayouts/Profile/ProfileLayout.qml b/ui/app/AppLayouts/Profile/ProfileLayout.qml index 28caced2e9..08bbdd8435 100644 --- a/ui/app/AppLayouts/Profile/ProfileLayout.qml +++ b/ui/app/AppLayouts/Profile/ProfileLayout.qml @@ -22,7 +22,7 @@ StatusSectionLayout { property var emojiPopup backButtonName: root.store.backButtonName - notificationCount: root.store.unreadNotificationsCount + notificationCount: activityCenterStore.unreadNotificationsCount onNotificationButtonClicked: Global.openActivityCenterPopup() onBackButtonClicked: { diff --git a/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml b/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml index c7442f0ebf..fb2e00e55b 100644 --- a/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml @@ -8,10 +8,6 @@ QtObject { property string backButtonName - property var activityCenterModuleInst: activityCenterModule - property var activityCenterList: activityCenterModuleInst.activityNotificationsModel - property int unreadNotificationsCount: activityCenterList.unreadCount - property var aboutModuleInst: aboutModule property var profileSectionModuleInst: profileSectionModule diff --git a/ui/app/AppLayouts/Wallet/WalletLayout.qml b/ui/app/AppLayouts/Wallet/WalletLayout.qml index 5096af88f5..a57e3a14db 100644 --- a/ui/app/AppLayouts/Wallet/WalletLayout.qml +++ b/ui/app/AppLayouts/Wallet/WalletLayout.qml @@ -65,7 +65,7 @@ Item { height: root.height - seedPhraseWarning.height width: root.width backButtonName: RootStore.backButtonName - notificationCount: RootStore.unreadNotificationsCount + notificationCount: activityCenterStore.unreadNotificationsCount onNotificationButtonClicked: Global.openActivityCenterPopup() onBackButtonClicked: { rightPanelStackView.currentItem.resetStack(); diff --git a/ui/app/AppLayouts/Wallet/stores/RootStore.qml b/ui/app/AppLayouts/Wallet/stores/RootStore.qml index 3f68652b3c..37a777d995 100644 --- a/ui/app/AppLayouts/Wallet/stores/RootStore.qml +++ b/ui/app/AppLayouts/Wallet/stores/RootStore.qml @@ -23,10 +23,6 @@ QtObject { property string signingPhrase: walletSection.signingPhrase property string mnemonicBackedUp: walletSection.isMnemonicBackedUp - property var activityCenterModuleInst: activityCenterModule - property var activityCenterList: activityCenterModuleInst.activityNotificationsModel - property int unreadNotificationsCount: activityCenterList.unreadCount - property var walletTokensModule: walletSectionAllTokens property var tokens: walletSectionAllTokens.all diff --git a/ui/app/AppLayouts/stores/RootStore.qml b/ui/app/AppLayouts/stores/RootStore.qml index ff6e983c61..3b94cf37e1 100644 --- a/ui/app/AppLayouts/stores/RootStore.qml +++ b/ui/app/AppLayouts/stores/RootStore.qml @@ -14,10 +14,6 @@ QtObject { property var communitiesModuleInst: communitiesModule property var observedCommunity: communitiesModuleInst.observedCommunity - property var activityCenterModuleInst: activityCenterModule - property var activityCenterList: activityCenterModuleInst.activityNotificationsModel - property int unreadNotificationsCount: activityCenterList.unreadCount - property bool newVersionAvailable: false property string latestVersion property string downloadURL diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index 747bb9f12e..1c8e8e15ad 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -40,14 +40,14 @@ import AppLayouts.stores 1.0 import "popups" import "panels" import "activitycenter/popups" -import "activitycenter/stores" as AC +import "activitycenter/stores" Item { id: appMain property alias appLayout: appLayout property RootStore rootStore: RootStore {} - property AC.RootStore acStore: AC.RootStore {} + property ActivityCenterStore activityCenterStore: ActivityCenterStore {} // set from main.qml property var sysPalette @@ -993,8 +993,7 @@ Item { height: appView.height - 56 * 2 // TODO get screen size // Taken from old code top bar height was fixed there to 56 y: 56 store: chatLayoutContainer.rootStore - acStore: appMain.acStore - chatSectionModule: chatLayoutContainer.rootStore.chatCommunitySectionModule + activityCenterStore: appMain.activityCenterStore onClosed: { Global.activityCenterPopupOpened = false } diff --git a/ui/app/mainui/activitycenter/popups/ActivityCenterPopup.qml b/ui/app/mainui/activitycenter/popups/ActivityCenterPopup.qml index 621962153d..1d4aecf123 100644 --- a/ui/app/mainui/activitycenter/popups/ActivityCenterPopup.qml +++ b/ui/app/mainui/activitycenter/popups/ActivityCenterPopup.qml @@ -16,6 +16,7 @@ import utils 1.0 import "../views" import "../panels" +import "../stores" Popup { id: root @@ -39,15 +40,14 @@ Popup { property int contactRequestsCount: 0 property int membershipCount: 0 + property ActivityCenterStore activityCenterStore property var store - property var acStore - property var chatSectionModule property var messageContextMenu: MessageContextMenuView { store: root.store reactionModel: root.store.emojiReactionsModel } - readonly property int unreadNotificationsCount : root.store.unreadNotificationsCount + readonly property int unreadNotificationsCount: root.activityCenterStore.unreadNotificationsCount function filterActivityCategories(notificationType) { switch (root.currentActivityCategory) { @@ -136,7 +136,7 @@ Popup { Repeater { id: notificationTypeCounter - model: root.store.activityCenterList + model: root.activityCenterStore.activityCenterList delegate: Item { Component.onCompleted: calcNotificationType(model.notificationType, 1) @@ -153,11 +153,11 @@ Popup { hasMentions: root.mentionsCount > 0 hasContactRequests: root.contactRequestsCount > 0 hasMembership: root.membershipCount > 0 - hideReadNotifications: acStore.hideReadNotifications + hideReadNotifications: activityCenterStore.hideReadNotifications currentActivityCategory: root.currentActivityCategory onCategoryTriggered: root.currentActivityCategory = category - onMarkAllReadClicked: errorText = root.store.activityCenterModuleInst.markAllActivityCenterNotificationsRead() - onShowHideReadNotifications: acStore.hideReadNotifications = hideReadNotifications + onMarkAllReadClicked: errorText = root.activityCenterStore.markAllActivityCenterNotificationsRead() + onShowHideReadNotifications: activityCenterStore.hideReadNotifications = hideReadNotifications } StatusListView { @@ -169,10 +169,10 @@ Popup { anchors.margins: Style.current.smallPadding model: SortFilterProxyModel { - sourceModel: root.store.activityCenterList + sourceModel: root.activityCenterStore.activityCenterList filters: ExpressionFilter { expression: filterActivityCategories(model.notificationType) && - !(acStore.hideReadNotifications && model.read) } + !(activityCenterStore.hideReadNotifications && model.read) } sorters: [ RoleSorter { @@ -191,6 +191,7 @@ Popup { ActivityNotificationMention { width: listView.availableWidth store: root.store + activityCenterStore: root.activityCenterStore notification: model messageContextMenu: root.messageContextMenu previousNotificationIndex: Math.min(listView.count - 1, index + 1) @@ -203,6 +204,7 @@ Popup { ActivityNotificationReply { width: listView.availableWidth store: root.store + activityCenterStore: root.activityCenterStore notification: model messageContextMenu: root.messageContextMenu previousNotificationIndex: Math.min(listView.count - 1, index + 1) @@ -215,6 +217,7 @@ Popup { ActivityNotificationContactRequest { width: listView.availableWidth store: root.store + activityCenterStore: root.activityCenterStore notification: model messageContextMenu: root.messageContextMenu previousNotificationIndex: Math.min(listView.count - 1, index + 1) @@ -227,6 +230,7 @@ Popup { ActivityNotificationCommunityInvitation { width: listView.availableWidth store: root.store + activityCenterStore: root.activityCenterStore notification: model messageContextMenu: root.messageContextMenu previousNotificationIndex: Math.min(listView.count - 1, index + 1) @@ -239,6 +243,7 @@ Popup { ActivityNotificationCommunityMembershipRequest { width: listView.availableWidth store: root.store + activityCenterStore: root.activityCenterStore notification: model messageContextMenu: root.messageContextMenu previousNotificationIndex: Math.min(listView.count - 1, index + 1) @@ -251,6 +256,7 @@ Popup { ActivityNotificationCommunityRequest { width: listView.availableWidth store: root.store + activityCenterStore: root.activityCenterStore notification: model previousNotificationIndex: Math.min(listView.count - 1, index + 1) } @@ -261,6 +267,7 @@ Popup { ActivityNotificationCommunityKicked { width: listView.availableWidth store: root.store + activityCenterStore: root.activityCenterStore notification: model previousNotificationIndex: Math.min(listView.count - 1, index + 1) } diff --git a/ui/app/mainui/activitycenter/stores/ActivityCenterStore.qml b/ui/app/mainui/activitycenter/stores/ActivityCenterStore.qml new file mode 100644 index 0000000000..30d8cead60 --- /dev/null +++ b/ui/app/mainui/activitycenter/stores/ActivityCenterStore.qml @@ -0,0 +1,31 @@ +import QtQuick 2.14 + +QtObject { + id: root + + property bool hideReadNotifications: false + + property var activityCenterModuleInst: activityCenterModule + property var activityCenterList: activityCenterModuleInst.activityNotificationsModel + property int unreadNotificationsCount: activityCenterList.unreadCount + + function markAllActivityCenterNotificationsRead() { + root.activityCenterModuleInst.markAllActivityCenterNotificationsRead() + } + + function markActivityCenterNotificationRead(notification) { + root.activityCenterModuleInst.markActivityCenterNotificationRead( + notification.id, notification.message.communityId, + notification.message.chatId, notification.notificationType) + } + + function markActivityCenterNotificationUnread(notification) { + root.activityCenterModuleInst.markActivityCenterNotificationUnread( + notification.id, notification.message.communityId, + notification.message.chatId, notification.notificationType) + } + + function switchTo(notification) { + root.activityCenterModuleInst.switchTo(notification.sectionId, notification.chatId, notification.id) + } +} \ No newline at end of file diff --git a/ui/app/mainui/activitycenter/stores/RootStore.qml b/ui/app/mainui/activitycenter/stores/RootStore.qml deleted file mode 100644 index bcef4d936f..0000000000 --- a/ui/app/mainui/activitycenter/stores/RootStore.qml +++ /dev/null @@ -1,9 +0,0 @@ -import QtQuick 2.14 - -QtObject { - id: root - - property bool hideReadNotifications: false - - // TODO: move AC-related stuff from chat here -} \ No newline at end of file diff --git a/ui/app/mainui/activitycenter/stores/qmldir b/ui/app/mainui/activitycenter/stores/qmldir index 9f660d70af..3f236ae574 100644 --- a/ui/app/mainui/activitycenter/stores/qmldir +++ b/ui/app/mainui/activitycenter/stores/qmldir @@ -1 +1 @@ -RootStore 1.0 RootStore.qml \ No newline at end of file +ActivityCenterStore 1.0 ActivityCenterStore.qml \ No newline at end of file diff --git a/ui/app/mainui/activitycenter/views/ActivityNotificationBase.qml b/ui/app/mainui/activitycenter/views/ActivityNotificationBase.qml index b58e99705c..dafd31e62d 100644 --- a/ui/app/mainui/activitycenter/views/ActivityNotificationBase.qml +++ b/ui/app/mainui/activitycenter/views/ActivityNotificationBase.qml @@ -13,6 +13,7 @@ Item { property var notification property var store + property var activityCenterStore property alias bodyComponent: bodyLoader.sourceComponent property alias badgeComponent: badgeLoader.sourceComponent @@ -30,8 +31,8 @@ Item { anchors.left: parent.left messageTimestamp: notification.timestamp previousMessageTimestamp: root.previousNotificationIndex == 0 ? "" : - root.store.activityCenterList.getNotificationData(previousNotificationIndex, - "timestamp") + root.activityCenterStore.activityCenterList.getNotificationData( + previousNotificationIndex, "timestamp") visible: text !== "" } @@ -57,21 +58,18 @@ Item { sourceComponent: StatusFlatRoundButton { id: markReadBtn + icon.width: 20 + icon.height: 20 icon.source: Style.svg("check-activity") - icon.color: notification.read ? icon.disabledColor : "transparent" - color: "transparent" - tooltip.text: !notification.read ? qsTr("Mark as Read") : qsTr("Mark as Unread") + icon.color: root.notification.read ? icon.disabledColor : "transparent" + tooltip.text: !root.notification.read ? qsTr("Mark as Read") : qsTr("Mark as Unread") tooltip.orientation: StatusToolTip.Orientation.Left tooltip.x: -tooltip.width - Style.current.padding tooltip.y: 4 onClicked: { notification.read ? - root.store.activityCenterModuleInst.markActivityCenterNotificationUnread( - notification.id, notification.message.communityId, - notification.message.chatId, notification.notificationType) : - root.store.activityCenterModuleInst.markActivityCenterNotificationRead( - notification.id, notification.message.communityId, - notification.chatId, notification.notificationType) + root.activityCenterStore.markActivityCenterNotificationUnread(root.notification) : + root.activityCenterStore.markActivityCenterNotificationRead(root.notification) } } } diff --git a/ui/app/mainui/activitycenter/views/ActivityNotificationCommunityInvitation.qml b/ui/app/mainui/activitycenter/views/ActivityNotificationCommunityInvitation.qml index 70b82a4fcd..e78d7037e4 100644 --- a/ui/app/mainui/activitycenter/views/ActivityNotificationCommunityInvitation.qml +++ b/ui/app/mainui/activitycenter/views/ActivityNotificationCommunityInvitation.qml @@ -28,7 +28,7 @@ ActivityNotificationMessage { } onChannelNameClicked: { root.activityCenterClose() - root.store.activityCenterModuleInst.switchTo(notification.sectionId, notification.chatId, notification.id) + root.activityCenterStore.switchTo(notification) } } } \ No newline at end of file diff --git a/ui/app/mainui/activitycenter/views/ActivityNotificationCommunityMembershipRequest.qml b/ui/app/mainui/activitycenter/views/ActivityNotificationCommunityMembershipRequest.qml index 26f5a5353f..5fe6e66b22 100644 --- a/ui/app/mainui/activitycenter/views/ActivityNotificationCommunityMembershipRequest.qml +++ b/ui/app/mainui/activitycenter/views/ActivityNotificationCommunityMembershipRequest.qml @@ -52,14 +52,14 @@ ActivityNotificationBase { } root.activityCenterClose() - root.store.activityCenterModuleInst.switchTo(notification.sectionId, notification.chatId, notification.id) + root.activityCenterStore.switchTo(notification) } CommunityBadge { readonly property var community: root.store.getCommunityDetailsAsJson(notification.communityId) - anchors.bottom: parent.bottom - anchors.bottomMargin: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: 15 anchors.left: parent.left anchors.leftMargin: 160 // TODO: get right text margin communityName: community.name diff --git a/ui/app/mainui/activitycenter/views/ActivityNotificationMention.qml b/ui/app/mainui/activitycenter/views/ActivityNotificationMention.qml index da00c6ce60..ce79935320 100644 --- a/ui/app/mainui/activitycenter/views/ActivityNotificationMention.qml +++ b/ui/app/mainui/activitycenter/views/ActivityNotificationMention.qml @@ -23,7 +23,7 @@ ActivityNotificationMessage { property var community: root.store.getCommunityDetailsAsJson(notification.message.communityId) // TODO: here i need chanel - // property var channel: root.store.chatSectionModule.getItemAsJson(notification.chatId) + // property var channel: root.store.getItemAsJson(notification.chatId) communityName: community.name communityImage: community.image @@ -36,7 +36,7 @@ ActivityNotificationMessage { } onChannelNameClicked: { root.activityCenterClose() - root.store.activityCenterModuleInst.switchTo(notification.sectionId, notification.chatId, notification.id) + root.activityCenterStore.switchTo(notification) } } } diff --git a/ui/app/mainui/activitycenter/views/ActivityNotificationMessage.qml b/ui/app/mainui/activitycenter/views/ActivityNotificationMessage.qml index 016a847ff4..00fa196e3c 100644 --- a/ui/app/mainui/activitycenter/views/ActivityNotificationMessage.qml +++ b/ui/app/mainui/activitycenter/views/ActivityNotificationMessage.qml @@ -52,7 +52,7 @@ ActivityNotificationBase { } root.activityCenterClose() - root.store.activityCenterModuleInst.switchTo(notification.sectionId, notification.chatId, notification.id) + root.activityCenterStore.switchTo(notification) } } } diff --git a/ui/app/mainui/activitycenter/views/ActivityNotificationReply.qml b/ui/app/mainui/activitycenter/views/ActivityNotificationReply.qml index a1bee30ea2..5fe7d9bfcf 100644 --- a/ui/app/mainui/activitycenter/views/ActivityNotificationReply.qml +++ b/ui/app/mainui/activitycenter/views/ActivityNotificationReply.qml @@ -15,6 +15,6 @@ ActivityNotificationMessage { badgeComponent: ReplyBadge { repliedMessageContent: notification.repliedMessage.messageText - onReplyClicked: root.store.activityCenterModuleInst.switchTo(notification.sectionId, notification.chatId, notification.id) + onReplyClicked: root.activityCenterStore.switchTo(notification) } } \ No newline at end of file diff --git a/vendor/status-go b/vendor/status-go index de61ed1213..bb4237f616 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit de61ed1213db6f05052bd60e18a2ecc46a27496d +Subproject commit bb4237f616ea17fb7083b91bf20ceed11ca253aa