diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index 6389c0643a..3d7368879a 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -17,6 +17,8 @@ StackLayout { } property alias chatView: chatView + signal importCommunityClicked() + signal createCommunityClicked() clip: true @@ -40,6 +42,13 @@ StackLayout { onCommunityInfoButtonClicked: root.currentIndex = 1 onCommunityManageButtonClicked: root.currentIndex = 1 + + onImportCommunityClicked: { + root.importCommunityClicked(); + } + onCreateCommunityClicked: { + root.createCommunityClicked(); + } } Loader { @@ -53,14 +62,14 @@ StackLayout { community: root.rootStore.mainModuleInst ? root.rootStore.mainModuleInst.activeSection || {} : {} - onBackToCommunityClicked: root.currentIndex = 0 + onBackToCommunityClicked: root.currentIndex = 0 - // TODO: remove me when migration to new settings is done - onOpenLegacyPopupClicked: Global.openPopup(communityProfilePopup, { - "store": root.rootStore, - "community": community, - "communitySectionModule": chatCommunitySectionModule - }) + // TODO: remove me when migration to new settings is done + onOpenLegacyPopupClicked: Global.openPopup(Global.communityProfilePopup, { + "store": root.rootStore, + "community": community, + "communitySectionModule": chatCommunitySectionModule + }) } } } diff --git a/ui/app/AppLayouts/Chat/controls/activityCenter/ReplyComponent.qml b/ui/app/AppLayouts/Chat/controls/activityCenter/ReplyComponent.qml index 79e8e41244..0ae8dce3ee 100644 --- a/ui/app/AppLayouts/Chat/controls/activityCenter/ReplyComponent.qml +++ b/ui/app/AppLayouts/Chat/controls/activityCenter/ReplyComponent.qml @@ -12,12 +12,7 @@ import StatusQ.Core.Utils 0.1 as StatusQUtils Item { id: replyComponent - property int repliedMessageId: wrapper.repliedMessageId - property string repliedMessageContent: wrapper.repliedMessageContent - - onRepliedMessageIdChanged: { - wrapper.visible = (repliedMessageId.length > 0) - } + property string repliedMessageContent SVGImage { id: replyIcon diff --git a/ui/app/AppLayouts/Chat/panels/ActivityCenterPopupTopBarPanel.qml b/ui/app/AppLayouts/Chat/panels/ActivityCenterPopupTopBarPanel.qml index 12337495d6..e4c33bfb16 100644 --- a/ui/app/AppLayouts/Chat/panels/ActivityCenterPopupTopBarPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/ActivityCenterPopupTopBarPanel.qml @@ -15,17 +15,19 @@ Item { width: parent.width height: 64 + property bool hasMentions: false + property bool hasReplies: false + property bool hideReadNotifications: false property bool allBtnHighlighted: false property bool repliesBtnHighlighted: false property bool mentionsBtnHighlighted: false - property alias repliesBtnEnabled: repliesbtn.enabled - property alias mentionsBtnEnabled: mentionsBtn.enabled property alias errorText: errorText.text signal allBtnClicked() signal repliesBtnClicked() signal mentionsBtnClicked() signal preferencesClicked() signal markAllReadClicked() + signal hideReadNotificationsTriggered() Row { id: filterButtons diff --git a/ui/app/AppLayouts/Chat/panels/ActivityChannelBadgePanel.qml b/ui/app/AppLayouts/Chat/panels/ActivityChannelBadgePanel.qml index 3d80329f88..1288d960d0 100644 --- a/ui/app/AppLayouts/Chat/panels/ActivityChannelBadgePanel.qml +++ b/ui/app/AppLayouts/Chat/panels/ActivityChannelBadgePanel.qml @@ -20,7 +20,7 @@ Rectangle { property string communityName: "" property string communityColor: "" property string communityThumbnailImage: "" - property string repliedMessageId: "" + property int repliedMessageId property string repliedMessageContent: "" property int notificationType property string profileImage: "" @@ -36,6 +36,8 @@ Rectangle { border.color: Style.current.borderSecondary border.width: 1 radius: 11 + visible: (repliedMessageId > -1) + Loader { active: true @@ -56,7 +58,6 @@ Rectangle { ActivityCenter.ReplyComponent { width: childrenRect.width height: parent.height - repliedMessageId: wrapper.repliedMessageId repliedMessageContent: wrapper.repliedMessageContent } } diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityChannelsAndCategoriesBannerPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityChannelsAndCategoriesBannerPanel.qml index 7187e09db7..6e4726abfe 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityChannelsAndCategoriesBannerPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityChannelsAndCategoriesBannerPanel.qml @@ -14,6 +14,11 @@ import utils 1.0 Rectangle { id: root + + property string communityId + signal addMembersClicked() + signal addCategoriesClicked() + height: childrenRect.height + Style.current.padding anchors.left: parent.left anchors.leftMargin: Style.current.padding @@ -22,8 +27,6 @@ Rectangle { border.color: Style.current.border radius: 16 color: Style.current.transparent - property string communityId - Rectangle { width: 66 @@ -86,7 +89,9 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter anchors.top: descriptionText.bottom anchors.topMargin: Style.current.padding - onClicked: Global.openPopup(createChannelPopup) + onClicked: { + root.addMembersClicked(); + } } StatusFlatButton { @@ -95,6 +100,8 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter anchors.top: addMembersBtn.bottom - onClicked: Global.openPopup(createCategoryPopup) + onClicked: { + root.addCategoriesClicked(); + } } } diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityWelcomeBannerPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityWelcomeBannerPanel.qml index 2f2747b177..9611d73c0f 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityWelcomeBannerPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityWelcomeBannerPanel.qml @@ -100,7 +100,7 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: manageBtn.top anchors.bottomMargin: Style.current.halfPadding - onClicked: Global.openPopup(inviteFriendsToCommunityPopup, { + onClicked: Global.openPopup(Global.inviteFriendsToCommunityPopup, { community: root.activeCommunity, hasAddedContacts: root.hasAddedContacts, communitySectionModule: root.communitySectionModule diff --git a/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml b/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml index 065ff87518..6b9ffc9225 100644 --- a/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml @@ -64,8 +64,9 @@ Popup { ActivityCenterPopupTopBarPanel { id: activityCenterTopBar - repliesBtnEnabled: hasReplies - mentionsBtnEnabled: hasMentions + hasReplies: activityCenter.hasReplies + hasMentions: activityCenter.hasMentions + hideReadNotifications: activityCenter.hideReadNotifications allBtnHighlighted: activityCenter.currentFilter === ActivityCenterPopup.Filter.All mentionsBtnHighlighted: activityCenter.currentFilter === ActivityCenterPopup.Filter.Mentions repliesBtnHighlighted: activityCenter.currentFilter === ActivityCenterPopup.Filter.Replies @@ -211,14 +212,17 @@ Popup { ActivityCenterMessageComponentView { id: activityCenterMessageView store: activityCenter.store + acCurrentFilter: activityCenter.currentFilter chatSectionModule: activityCenter.chatSectionModule messageContextMenu: activityCenter.messageContextMenu - + hideReadNotifications: activityCenter.hideReadNotifications Connections { target: activityCenter onOpened: activityCenterMessageView.reevaluateItemBadge() } - + onActivityCenterClose: { + activityCenter.close(); + } Component.onCompleted: { activityCenterMessageView.reevaluateItemBadge() } @@ -230,6 +234,8 @@ Popup { ActivityCenterGroupRequest { store: activityCenter.store + hideReadNotifications: activityCenter.hideReadNotifications + acCurrentFilterAll: activityCenter.currentFilter === ActivityCenter.Filter.All } } } diff --git a/ui/app/AppLayouts/Chat/popups/GroupInfoPopup.qml b/ui/app/AppLayouts/Chat/popups/GroupInfoPopup.qml index 336cbb5bf1..748b8ae34d 100644 --- a/ui/app/AppLayouts/Chat/popups/GroupInfoPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/GroupInfoPopup.qml @@ -33,7 +33,6 @@ StatusModal { property int channelType: GroupInfoPopup.ChannelType.ActiveChannel property var chatDetails property bool isAdmin: popup.chatSectionModule.activeItem.amIChatAdmin - property Component pinnedMessagesPopupComponent property var chatContentModule @@ -176,7 +175,7 @@ StatusModal { popup.store.messageStore.messageModule = popup.chatContentModule.messagesModule popup.store.messageStore.chatSectionModule = popup.chatSectionModule - Global.openPopup(pinnedMessagesPopupComponent, { + Global.openPopup(Global.pinnedMessagesPopup, { store: popup.store, messageStore: popup.store.messageStore, pinnedMessagesModel: popup.chatContentModule.pinnedMessagesModel, diff --git a/ui/app/AppLayouts/Chat/popups/community/CommunitiesPopup.qml b/ui/app/AppLayouts/Chat/popups/community/CommunitiesPopup.qml index a1394787a4..cfabf848c3 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CommunitiesPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CommunitiesPopup.qml @@ -18,6 +18,9 @@ StatusModal { property var communitiesList signal setActiveCommunity(string id) signal setObservedCommunity(string id) + signal openCommunityDetail() + signal importCommunityClicked() + signal createCommunityClicked() onOpened: { contentItem.searchBox.input.text = ""; @@ -39,7 +42,9 @@ StatusModal { StatusMenuItem { icon.name: "download" text: qsTr("Access existing community") - onTriggered: Global.openPopup(importCommunitiesPopupComponent) + onTriggered: { + popup.importCommunityClicked(); + } } } } @@ -131,7 +136,7 @@ StatusModal { popup.setActiveCommunity(model.id); } else { popup.setObservedCommunity(model.id); - Global.openPopup(communityDetailPopup) + popup.openCommunityDetail(); } popup.close() } @@ -145,7 +150,7 @@ StatusModal { StatusButton { text: qsTr("Create a community") onClicked: { - Global.openPopup(createCommunitiesPopupComponent) + popup.createCommunityClicked(); popup.close() } } diff --git a/ui/app/AppLayouts/Chat/popups/community/CommunityDetailPopup.qml b/ui/app/AppLayouts/Chat/popups/community/CommunityDetailPopup.qml index 5972ff2476..d31beef0b8 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CommunityDetailPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CommunityDetailPopup.qml @@ -141,7 +141,6 @@ StatusModal { icon.width: 20 rotation: 180 onClicked: { - Global.openPopup(communitiesPopupComponent) root.close() } } diff --git a/ui/app/AppLayouts/Chat/popups/community/MembershipRequestsPopup.qml b/ui/app/AppLayouts/Chat/popups/community/MembershipRequestsPopup.qml index 0977bbceb7..f7428ce8a2 100644 --- a/ui/app/AppLayouts/Chat/popups/community/MembershipRequestsPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/MembershipRequestsPopup.qml @@ -61,10 +61,8 @@ StatusModal { anchors.horizontalCenter: parent.horizontalCenter property var contactDetails: Utils.getContactDetailsAsJson(model.pubKey) - property string displayName: contactDetails.displayName || root.store.generateAlias(model.pubKey) - + property string displayName: contactDetails.displayName || popup.store.generateAlias(model.pubKey) image.source: contactDetails.thumbnailImage - title: displayName components: [ diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index 523a9ef161..c8c03f5173 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -18,6 +18,8 @@ QtObject { property string createChatStickerHashId: "" property string createChatStickerPackId: "" + property var groupInfoPopupComponent + property var membershipRequestPopup property var contactsModel: root.contactsStore.myContactsModel // Important: diff --git a/ui/app/AppLayouts/Chat/views/ActivityCenterGroupRequest.qml b/ui/app/AppLayouts/Chat/views/ActivityCenterGroupRequest.qml index 8cd55b495e..41673f8652 100644 --- a/ui/app/AppLayouts/Chat/views/ActivityCenterGroupRequest.qml +++ b/ui/app/AppLayouts/Chat/views/ActivityCenterGroupRequest.qml @@ -21,6 +21,8 @@ Item { property var store property int previousNotificationIndex property string previousNotificationTimestamp + property bool hideReadNotifications: false + property bool acCurrentFilterAll: false DateGroup { id: dateGroupLbl @@ -40,7 +42,7 @@ Item { return false } - return activityCenter.currentFilter === ActivityCenter.Filter.All + return acCurrentFilterAll; } width: parent.width height: visible ? 60 : 0 diff --git a/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml b/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml index 3d53c77b14..da99b2045e 100644 --- a/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml +++ b/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml @@ -24,15 +24,17 @@ Item { if (hideReadNotifications && model.read) { return false } - return activityCenter.currentFilter === ActivityCenterPopup.Filter.All || - (model.notificationType === Constants.activityCenterNotificationTypeMention && activityCenter.currentFilter === ActivityCenterPopup.Filter.Mentions) || - (model.notificationType === Constants.activityCenterNotificationTypeOneToOne && activityCenter.currentFilter === ActivityCenterPopup.Filter.ContactRequests) || - (model.notificationType === Constants.activityCenterNotificationTypeReply && activityCenter.currentFilter === ActivityCenterPopup.Filter.Replies) + return acCurrentFilter === ActivityCenterPopup.Filter.All || + (model.notificationType === Constants.activityCenterNotificationTypeMention && acCurrentFilter === ActivityCenterPopup.Filter.Mentions) || + (model.notificationType === Constants.activityCenterNotificationTypeOneToOne && acCurrentFilter === ActivityCenterPopup.Filter.ContactRequests) || + (model.notificationType === Constants.activityCenterNotificationTypeReply && acCurrentFilter === ActivityCenterPopup.Filter.Replies) } property var store + property int acCurrentFilter property var chatSectionModule property int previousNotificationIndex + property bool hideReadNotifications property string previousNotificationTimestamp // Not Refactored Yet property int communityIndex: -1 //root.store.chatsModelInst.communities.joinedCommunities.getCommunityIndex(model.message.communityId) @@ -40,6 +42,7 @@ Item { function openProfile() { Global.openProfilePopup(model.author) } + signal activityCenterClose() function reevaluateItemBadge() { let details = root.store.getBadgeDetails(model.sectionId, model.chatId) @@ -145,7 +148,7 @@ Item { return Global.openProfilePopup(model.message.senderId); } - activityCenter.close() + activityCenterClose() root.store.activityCenterModuleInst.switchTo(model.sectionId, model.chatId, model.id) } prevMessageIndex: root.previousNotificationIndex @@ -191,11 +194,11 @@ Item { onCommunityNameClicked: { root.store.activityCenterModuleInst.switchTo(model.sectionId, "", "") - activityCenter.close() + activityCenterClose(); } onChannelNameClicked: { root.store.activityCenterModuleInst.switchTo(model.sectionId, model.chatId, "") - activityCenter.close() + activityCenterClose(); } } } diff --git a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml index 72c5b3f36d..da6ec7f2f7 100644 --- a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml @@ -34,7 +34,6 @@ Item { property var contactsStore property var emojiPopup - property Component pinnedMessagesPopupComponent // Not Refactored Yet //property int chatGroupsListViewCount: 0 property bool isReply: false @@ -57,6 +56,7 @@ Item { property var contactDetails: Utils.getContactDetailsAsJson(root.activeChatId) property bool isUserAdded: root.contactDetails.isAdded property bool contactRequestReceived: root.contactDetails.requestReceived + property Component pinnedMessagesListPopupComponent signal openAppSearch() signal openStickerPackPopup(string stickerPackId) @@ -224,18 +224,29 @@ Item { rootStore: root.rootStore contactsStore: root.contactsStore emojiPopup: root.emojiPopup + isConnected: root.isConnected sendTransactionNoEnsModal: cmpSendTransactionNoEns receiveTransactionModal: cmpReceiveTransaction sendTransactionWithEnsModal: cmpSendTransactionWithEns stickersLoaded: root.stickersLoaded isBlocked: model.blocked isActiveChannel: categoryChatLoader.isActiveChannel + activityCenterVisible: activityCenter.visible + activityCenterNotificationsCount: activityCenter.unreadNotificationsCount + pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent onOpenStickerPackPopup: { root.openStickerPackPopup(stickerPackId) } + onNotificationButtonClicked: { + activityCenter.open(); + } + onOpenAppSearch: { + root.openAppSearch(); + } Component.onCompleted: { parentModule.prepareChatContentModuleForChatId(model.itemId) chatContentModule = parentModule.getChatContentModule() + chatSectionModule = root.chatSectionModule; } } } @@ -269,6 +280,7 @@ Item { clip: true rootStore: root.rootStore contactsStore: root.contactsStore + isConnected: root.isConnected emojiPopup: root.emojiPopup sendTransactionNoEnsModal: cmpSendTransactionNoEns receiveTransactionModal: cmpReceiveTransaction @@ -276,12 +288,22 @@ Item { stickersLoaded: root.stickersLoaded isBlocked: model.blocked isActiveChannel: chatLoader.isActiveChannel + activityCenterVisible: activityCenter.visible + activityCenterNotificationsCount: activityCenter.unreadNotificationsCount + pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent onOpenStickerPackPopup: { root.openStickerPackPopup(stickerPackId) } + onNotificationButtonClicked: { + activityCenter.open(); + } + onOpenAppSearch: { + root.openAppSearch(); + } Component.onCompleted: { parentModule.prepareChatContentModuleForChatId(model.itemId) chatContentModule = parentModule.getChatContentModule() + chatSectionModule = root.chatSectionModule; root.checkForCreateChatOptions(model.itemId) } } diff --git a/ui/app/AppLayouts/Chat/views/ChatContentView.qml b/ui/app/AppLayouts/Chat/views/ChatContentView.qml index 8846374dd5..3ed5f076e2 100644 --- a/ui/app/AppLayouts/Chat/views/ChatContentView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatContentView.qml @@ -24,23 +24,30 @@ import "../../Wallet" import "../stores" ColumnLayout { - id: chatContentRoot + id: root spacing: 0 // Important: // Each chat/channel has its own ChatContentModule property var chatContentModule + property var chatSectionModule property var rootStore property var contactsStore property bool isActiveChannel: false + property bool isConnected: false property var emojiPopup + property bool activityCenterVisible: false + property int activityCenterNotificationsCount property alias textInputField: chatInput property UsersStore usersStore: UsersStore {} + property Component pinnedMessagesPopupComponent onChatContentModuleChanged: { - chatContentRoot.usersStore.usersModule = chatContentRoot.chatContentModule.usersModule + root.usersStore.usersModule = root.chatContentModule.usersModule } + signal openAppSearch() + signal notificationButtonClicked() signal openStickerPackPopup(string stickerPackId) property Component sendTransactionNoEnsModal @@ -54,7 +61,7 @@ ColumnLayout { // NOTE: Used this property change as it is the current way used for displaying new channel/chat data of content view. // If in the future content is loaded dynamically, input focus should be activated when loaded / created content view. onHeightChanged: { - if(chatContentRoot.height > 0) { + if(root.height > 0) { chatInput.forceInputActiveFocus() } } @@ -82,7 +89,7 @@ ColumnLayout { case Constants.chatType.publicChat: return qsTr("Public chat") case Constants.chatType.privateGroupChat: - let cnt = chatContentRoot.usersStore.usersModule.model.count + let cnt = root.usersStore.usersModule.model.count if(cnt > 1) return qsTr("%1 members").arg(cnt); return qsTr("1 member"); case Constants.chatType.communityChat: @@ -135,7 +142,7 @@ ColumnLayout { onClicked: { switch (chatContentModule.chatDetails.type) { case Constants.chatType.privateGroupChat: - Global.openPopup(groupInfoPopupComponent, { + Global.openPopup(root.rootStore.groupInfoPopupComponent, { chatContentModule: chatContentModule, chatDetails: chatContentModule.chatDetails }) @@ -152,11 +159,10 @@ ColumnLayout { Component { id: contactsSelector GroupChatPanel { - sectionModule: chatSectionModule - chatContentModule: chatContentRoot.chatContentModule - rootStore: chatContentRoot.rootStore - maxHeight: chatContentRoot.height - + sectionModule: root.chatSectionModule + chatContentModule: root.chatContentModule + rootStore: root.rootStore + maxHeight: root.height onPanelClosed: topBar.toolbarComponent = statusChatInfoButton } } @@ -177,16 +183,16 @@ ColumnLayout { membersButton.highlighted: localAccountSensitiveSettings.expandUsersList notificationButton.tooltip.offset: localAccountSensitiveSettings.expandUsersList && membersButton.visible ? 0 : 14 - notificationCount: activityCenter.unreadNotificationsCount + notificationCount: root.activityCenterNotificationsCount onSearchButtonClicked: root.openAppSearch() onMembersButtonClicked: localAccountSensitiveSettings.expandUsersList = !localAccountSensitiveSettings.expandUsersList - onNotificationButtonClicked: activityCenter.open() - notificationButton.highlighted: activityCenter.visible + notificationButton.highlighted: root.activityCenterVisible + onNotificationButtonClicked: root.notificationButtonClicked() popupMenu: ChatContextMenuView { - emojiPopup: chatContentRoot.emojiPopup + emojiPopup: root.emojiPopup openHandler: function () { if(!chatContentModule) { console.debug("error on open chat context menu handler - chat content module is not set") @@ -264,7 +270,7 @@ ColumnLayout { } onDisplayGroupInfoPopup: { - Global.openPopup(groupInfoPopupComponent, { + Global.openPopup(root.rootStore.groupInfoPopupComponent, { chatContentModule: chatContentModule, chatDetails: chatContentModule.chatDetails }) @@ -285,7 +291,7 @@ ColumnLayout { topBar.toolbarComponent = contactsSelector } onFetchMoreMessages: { - chatContentRoot.rootStore.messageStore.requestMoreMessages(); + root.rootStore.messageStore.requestMoreMessages(); } onLeaveGroup: { chatContentModule.leaveChat(); @@ -322,10 +328,8 @@ ColumnLayout { onOnlineStatusChanged: { if (connected === isConnected) return; isConnected = connected; - if(isConnected){ - timer.setTimeout(function(){ - connectedStatusRect.visible = false; - }, 5000); + if(isConnected) { + onlineStatusTimer.start(); } else { connectedStatusRect.visible = true; } @@ -339,9 +343,17 @@ ColumnLayout { } } + Timer { + id: onlineStatusTimer + interval: 5000 + onTriggered: { + connectedStatusRect.visible = false; + } + } + StatusBanner { Layout.fillWidth: true - visible: chatContentRoot.isBlocked + visible: root.isBlocked type: StatusBanner.Type.Danger statusText: qsTr("Blocked") } @@ -349,13 +361,13 @@ ColumnLayout { MessageStore { id: messageStore messageModule: chatContentModule? chatContentModule.messagesModule : null - chatSectionModule: chatContentRoot.rootStore.chatCommunitySectionModule + chatSectionModule: root.rootStore.chatCommunitySectionModule } MessageContextMenuView { id: contextmenu - store: chatContentRoot.rootStore - reactionModel: chatContentRoot.rootStore.emojiReactionsModel + store: root.rootStore + reactionModel: root.rootStore.emojiReactionsModel onPinMessage: { messageStore.pinMessage(messageId) } @@ -369,7 +381,7 @@ ColumnLayout { console.debug("error on open pinned messages limit reached from message context menu - chat content module is not set") return } - Global.openPopup(pinnedMessagesPopupComponent, { + Global.openPopup(Global.pinnedMessagesPopup, { store: rootStore, messageStore: messageStore, pinnedMessagesModel: chatContentModule.pinnedMessagesModel, @@ -413,16 +425,16 @@ ColumnLayout { id: chatMessages Layout.fillWidth: true Layout.fillHeight: true - store: chatContentRoot.rootStore - contactsStore: chatContentRoot.contactsStore + store: root.rootStore + contactsStore: root.contactsStore messageContextMenuInst: contextmenu messageStore: messageStore - emojiPopup: chatContentRoot.emojiPopup - usersStore: chatContentRoot.usersStore - stickersLoaded: chatContentRoot.stickersLoaded - isChatBlocked: chatContentRoot.isBlocked + emojiPopup: root.emojiPopup + usersStore: root.usersStore + stickersLoaded: root.stickersLoaded + isChatBlocked: root.isBlocked channelEmoji: chatContentModule.chatDetails.emoji || "" - isActiveChannel: chatContentRoot.isActiveChannel + isActiveChannel: root.isActiveChannel onShowReplyArea: { let obj = messageStore.getMessageByIdAsJson(messageId) if (!obj) { @@ -458,19 +470,19 @@ ColumnLayout { StatusChatInput { id: chatInput - store: chatContentRoot.rootStore - usersStore: chatContentRoot.usersStore + store: root.rootStore + usersStore: root.usersStore messageContextMenu: contextmenu - emojiPopup: chatContentRoot.emojiPopup - isContactBlocked: chatContentRoot.isBlocked - isActiveChannel: chatContentRoot.isActiveChannel - chatInputPlaceholder: chatContentRoot.isBlocked ? + emojiPopup: root.emojiPopup + isContactBlocked: root.isBlocked + isActiveChannel: root.isActiveChannel + chatInputPlaceholder: root.isBlocked ? qsTr("This user has been blocked.") : qsTr("Type a message.") anchors.bottom: parent.bottom - recentStickers: chatContentRoot.rootStore.stickersModuleInst.recent - stickerPackList: chatContentRoot.rootStore.stickersModuleInst.stickerPacks + recentStickers: root.rootStore.stickersModuleInst.recent + stickerPackList: root.rootStore.stickersModuleInst.stickerPacks chatType: chatContentModule? chatContentModule.chatDetails.type : Constants.chatType.unknown onSendTransactionCommandButtonClicked: { if(!chatContentModule) { @@ -479,16 +491,16 @@ ColumnLayout { } if (Utils.getContactDetailsAsJson(chatContentModule.getMyChatId()).ensVerified) { - Global.openPopup(chatContentRoot.sendTransactionWithEnsModal) + Global.openPopup(root.sendTransactionWithEnsModal) } else { - Global.openPopup(chatContentRoot.sendTransactionNoEnsModal) + Global.openPopup(root.sendTransactionNoEnsModal) } } onReceiveTransactionCommandButtonClicked: { - Global.openPopup(chatContentRoot.receiveTransactionModal) + Global.openPopup(root.receiveTransactionModal) } onStickerSelected: { - chatContentRoot.rootStore.sendSticker(chatContentModule.getMyChatId(), + root.rootStore.sendSticker(chatContentModule.getMyChatId(), hashId, chatInput.isReply ? chatInput.replyMessageId : "", packId) @@ -501,14 +513,14 @@ ColumnLayout { return } - if(chatContentRoot.rootStore.sendMessage(event, + if(root.rootStore.sendMessage(event, chatInput.textInput.text, chatInput.isReply? chatInput.replyMessageId : "", chatInput.fileUrls )) { - sendMessageSound.stop(); - Qt.callLater(sendMessageSound.play); + Global.sendMessageSound.stop(); + Qt.callLater(Global.sendMessageSound.play); chatInput.textInput.clear(); chatInput.textInput.textFormat = TextEdit.PlainText; diff --git a/ui/app/AppLayouts/Chat/views/ChatView.qml b/ui/app/AppLayouts/Chat/views/ChatView.qml index 1a53b4104a..5dbc239a0a 100644 --- a/ui/app/AppLayouts/Chat/views/ChatView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatView.qml @@ -37,6 +37,8 @@ StatusAppThreePanelLayout { signal communityManageButtonClicked() signal profileButtonClicked() signal openAppSearch() + signal importCommunityClicked() + signal createCommunityClicked() Connections { target: root.rootStore.stickersStore.stickersModule @@ -72,7 +74,7 @@ StatusAppThreePanelLayout { parentModule: root.rootStore.chatCommunitySectionModule rootStore: root.rootStore contactsStore: root.contactsStore - pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent + pinnedMessagesListPopupComponent: root.pinnedMessagesListPopupComponent stickersLoaded: root.stickersLoaded emojiPopup: root.emojiPopup onOpenStickerPackPopup: { @@ -134,6 +136,12 @@ StatusAppThreePanelLayout { onOpenAppSearch: { root.openAppSearch() } + onImportCommunityClicked: { + root.importCommunityClicked(); + } + onCreateCommunityClicked: { + root.createCommunityClicked(); + } } } @@ -156,7 +164,6 @@ StatusAppThreePanelLayout { GroupInfoPopup { chatSectionModule: root.rootStore.chatCommunitySectionModule store: root.rootStore - pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent } } @@ -197,4 +204,8 @@ StatusAppThreePanelLayout { root.rootStore.chatCommunitySectionModule.createOneToOneChat(communityId, chatId, ensName) } } + + Component.onCompleted: { + rootStore.groupInfoPopupComponent = groupInfoPopupComponent; + } } diff --git a/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml b/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml index bc2d0e0d80..a8ba468f64 100644 --- a/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml @@ -207,7 +207,7 @@ Item { text: qsTr("Invite people") icon.name: "share-ios" enabled: communityData.canManageUsers - onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, { + onTriggered: Global.openPopup(Global.inviteFriendsToCommunityPopup, { community: communityData, hasAddedContacts: root.hasAddedContacts, communitySectionModule: root.communitySectionModule @@ -341,7 +341,7 @@ Item { onDisplayGroupInfoPopup: { communitySectionModule.prepareChatContentModuleForChatId(chatId) let chatContentModule = communitySectionModule.getChatContentModule() - Global.openPopup(groupInfoPopupComponent, { + Global.openPopup(root.store.groupInfoPopupComponent, { chatContentModule: chatContentModule, chatDetails: chatContentModule.chatDetails }) @@ -409,6 +409,12 @@ Item { CommunityChannelsAndCategoriesBannerPanel { id: channelsAndCategoriesBanner communityId: communityData.id + onAddMembersClicked: { + Global.openPopup(createChannelPopup); + } + onAddCategoriesClicked: { + Global.openPopup(createCategoryPopup); + } } MouseArea { diff --git a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml index ed483f9a9a..b0a3a0c91f 100644 --- a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml @@ -23,7 +23,7 @@ StatusAppTwoPanelLayout { id: root // TODO: get this model from backend? - property var model: [{name: qsTr("Overview"), icon: "help"}, + property var settingsMenuModel: [{name: qsTr("Overview"), icon: "help"}, {name: qsTr("Members"), icon: "group-chat"}, // {name: qsTr("Permissions"), icon: "objects"}, // {name: qsTr("Tokens"), icon: "token"}, @@ -73,7 +73,7 @@ StatusAppTwoPanelLayout { Layout.fillWidth: true implicitHeight: contentItem.childrenRect.height - model: root.model + model: root.settingsMenuModel delegate: StatusNavigationListItem { width: listView.width title: modelData.name @@ -256,15 +256,4 @@ StatusAppTwoPanelLayout { } } } - - Component { - id: membershipRequestPopup - MembershipRequestsPopup { - anchors.centerIn: parent - store: root.rootStore - onClosed: { - destroy() - } - } - } } diff --git a/ui/app/AppLayouts/Chat/views/ContactsColumnView.qml b/ui/app/AppLayouts/Chat/views/ContactsColumnView.qml index ef8dc4fc58..fd47e9cd0a 100644 --- a/ui/app/AppLayouts/Chat/views/ContactsColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ContactsColumnView.qml @@ -35,6 +35,8 @@ Item { //property int chatGroupsListViewCount: channelList.model.count signal openProfileClicked() signal openAppSearch() + signal importCommunityClicked() + signal createCommunityClicked() // main layout ColumnLayout { @@ -212,7 +214,6 @@ Item { onDownloadMessages: { root.chatSectionModule.downloadMessages(chatId, file) } - onDisplayProfilePopup: { Global.openProfilePopup(publicKey) } @@ -222,7 +223,7 @@ Item { onDisplayGroupInfoPopup: { chatSectionModule.prepareChatContentModuleForChatId(chatId) let chatContentModule = chatSectionModule.getChatContentModule() - Global.openPopup(groupInfoPopupComponent, { + Global.openPopup(root.store.groupInfoPopupComponent, { chatContentModule: chatContentModule, chatDetails: chatContentModule.chatDetails }) @@ -296,6 +297,15 @@ Item { onClosed: { destroy() } + onOpenCommunityDetail: { + Global.openPopup(communityDetailPopup); + } + onImportCommunityClicked: { + root.importCommunityClicked(); + } + onCreateCommunityClicked: { + root.createCommunityClicked(); + } } } @@ -305,6 +315,7 @@ Item { anchors.centerIn: parent store: root.store onClosed: { + Global.openPopup(communitiesPopupComponent) destroy() } } diff --git a/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml b/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml index 29ef90f9e5..740204693c 100644 --- a/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml +++ b/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml @@ -17,6 +17,8 @@ StatusScrollView { id: root property CommunitiesStore communitiesStore: CommunitiesStore {} + property var importCommunitiesPopup: importCommunitiesPopupComponent + property var createCommunitiesPopup: createCommunitiesPopupComponent QtObject { id: d diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index 1d12b2db88..65a5acd6cd 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -182,18 +182,27 @@ Item { id: sendMessageSound store: rootStore track: Qt.resolvedUrl("../imports/assets/audio/send_message.wav") + Component.onCompleted: { + Global.sendMessageSound = this; + } } Audio { id: notificationSound store: rootStore track: Qt.resolvedUrl("../imports/assets/audio/notification.wav") + Component.onCompleted: { + Global.notificationSound = this; + } } Audio { id: errorSound track: Qt.resolvedUrl("../imports/assets/audio/error.mp3") store: rootStore + Component.onCompleted: { + Global.errorSound = this; + } } AppSearch { @@ -511,6 +520,14 @@ Item { appSearch.openSearchPopup() } + onImportCommunityClicked: { + Global.openPopup(communitiesPortalLayoutContainer.importCommunitiesPopup); + } + + onCreateCommunityClicked: { + Global.openPopup(communitiesPortalLayoutContainer.createCommunitiesPopup); + } + Component.onCompleted: { rootStore.chatCommunitySectionModule = mainModule.getChatSectionModule() } @@ -980,6 +997,9 @@ Item { Component.onCompleted: { Global.appMain = this; + Global.pinnedMessagesPopup = pinnedMessagesPopupComponent; + Global.communityProfilePopup = communityProfilePopup; + Global.inviteFriendsToCommunityPopup = inviteFriendsToCommunityPopup; const whitelist = appMain.rootStore.messagingStore.getLinkPreviewWhitelist() try { const whiteListedSites = JSON.parse(whitelist) diff --git a/ui/imports/utils/Global.qml b/ui/imports/utils/Global.qml index a5f0fcfed0..4d7b63a58a 100644 --- a/ui/imports/utils/Global.qml +++ b/ui/imports/utils/Global.qml @@ -10,12 +10,19 @@ QtObject { property var appMain property bool popupOpened: false property int settingsSubsection: Constants.settingsSubsection.profile - property var errorSound property var mainModuleInst property var privacyModuleInst + property var toastMessage + property var pinnedMessagesPopup + property var communityProfilePopup + property var inviteFriendsToCommunityPopup property bool profilePopupOpened: false + property var sendMessageSound + property var notificationSound + property var errorSound + signal openImagePopup(var image, var contextMenu) signal openLinkInBrowser(string link) signal openChooseBrowserPopup(string link)