feat(chat): Removing dynamic scoping from chat section

Closes #4244
This commit is contained in:
Alexandra Betouni 2022-05-10 19:04:25 +03:00 committed by Alexandra Betouni
parent 5f97a1c157
commit 2bd685943f
23 changed files with 219 additions and 111 deletions

View File

@ -17,6 +17,8 @@ StackLayout {
} }
property alias chatView: chatView property alias chatView: chatView
signal importCommunityClicked()
signal createCommunityClicked()
clip: true clip: true
@ -40,6 +42,13 @@ StackLayout {
onCommunityInfoButtonClicked: root.currentIndex = 1 onCommunityInfoButtonClicked: root.currentIndex = 1
onCommunityManageButtonClicked: root.currentIndex = 1 onCommunityManageButtonClicked: root.currentIndex = 1
onImportCommunityClicked: {
root.importCommunityClicked();
}
onCreateCommunityClicked: {
root.createCommunityClicked();
}
} }
Loader { Loader {
@ -53,14 +62,14 @@ StackLayout {
community: root.rootStore.mainModuleInst ? root.rootStore.mainModuleInst.activeSection 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 // TODO: remove me when migration to new settings is done
onOpenLegacyPopupClicked: Global.openPopup(communityProfilePopup, { onOpenLegacyPopupClicked: Global.openPopup(Global.communityProfilePopup, {
"store": root.rootStore, "store": root.rootStore,
"community": community, "community": community,
"communitySectionModule": chatCommunitySectionModule "communitySectionModule": chatCommunitySectionModule
}) })
} }
} }
} }

View File

@ -12,12 +12,7 @@ import StatusQ.Core.Utils 0.1 as StatusQUtils
Item { Item {
id: replyComponent id: replyComponent
property int repliedMessageId: wrapper.repliedMessageId property string repliedMessageContent
property string repliedMessageContent: wrapper.repliedMessageContent
onRepliedMessageIdChanged: {
wrapper.visible = (repliedMessageId.length > 0)
}
SVGImage { SVGImage {
id: replyIcon id: replyIcon

View File

@ -15,17 +15,19 @@ Item {
width: parent.width width: parent.width
height: 64 height: 64
property bool hasMentions: false
property bool hasReplies: false
property bool hideReadNotifications: false
property bool allBtnHighlighted: false property bool allBtnHighlighted: false
property bool repliesBtnHighlighted: false property bool repliesBtnHighlighted: false
property bool mentionsBtnHighlighted: false property bool mentionsBtnHighlighted: false
property alias repliesBtnEnabled: repliesbtn.enabled
property alias mentionsBtnEnabled: mentionsBtn.enabled
property alias errorText: errorText.text property alias errorText: errorText.text
signal allBtnClicked() signal allBtnClicked()
signal repliesBtnClicked() signal repliesBtnClicked()
signal mentionsBtnClicked() signal mentionsBtnClicked()
signal preferencesClicked() signal preferencesClicked()
signal markAllReadClicked() signal markAllReadClicked()
signal hideReadNotificationsTriggered()
Row { Row {
id: filterButtons id: filterButtons

View File

@ -20,7 +20,7 @@ Rectangle {
property string communityName: "" property string communityName: ""
property string communityColor: "" property string communityColor: ""
property string communityThumbnailImage: "" property string communityThumbnailImage: ""
property string repliedMessageId: "" property int repliedMessageId
property string repliedMessageContent: "" property string repliedMessageContent: ""
property int notificationType property int notificationType
property string profileImage: "" property string profileImage: ""
@ -36,6 +36,8 @@ Rectangle {
border.color: Style.current.borderSecondary border.color: Style.current.borderSecondary
border.width: 1 border.width: 1
radius: 11 radius: 11
visible: (repliedMessageId > -1)
Loader { Loader {
active: true active: true
@ -56,7 +58,6 @@ Rectangle {
ActivityCenter.ReplyComponent { ActivityCenter.ReplyComponent {
width: childrenRect.width width: childrenRect.width
height: parent.height height: parent.height
repliedMessageId: wrapper.repliedMessageId
repliedMessageContent: wrapper.repliedMessageContent repliedMessageContent: wrapper.repliedMessageContent
} }
} }

View File

@ -14,6 +14,11 @@ import utils 1.0
Rectangle { Rectangle {
id: root id: root
property string communityId
signal addMembersClicked()
signal addCategoriesClicked()
height: childrenRect.height + Style.current.padding height: childrenRect.height + Style.current.padding
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.current.padding anchors.leftMargin: Style.current.padding
@ -22,8 +27,6 @@ Rectangle {
border.color: Style.current.border border.color: Style.current.border
radius: 16 radius: 16
color: Style.current.transparent color: Style.current.transparent
property string communityId
Rectangle { Rectangle {
width: 66 width: 66
@ -86,7 +89,9 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: descriptionText.bottom anchors.top: descriptionText.bottom
anchors.topMargin: Style.current.padding anchors.topMargin: Style.current.padding
onClicked: Global.openPopup(createChannelPopup) onClicked: {
root.addMembersClicked();
}
} }
StatusFlatButton { StatusFlatButton {
@ -95,6 +100,8 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: addMembersBtn.bottom anchors.top: addMembersBtn.bottom
onClicked: Global.openPopup(createCategoryPopup) onClicked: {
root.addCategoriesClicked();
}
} }
} }

View File

@ -100,7 +100,7 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: manageBtn.top anchors.bottom: manageBtn.top
anchors.bottomMargin: Style.current.halfPadding anchors.bottomMargin: Style.current.halfPadding
onClicked: Global.openPopup(inviteFriendsToCommunityPopup, { onClicked: Global.openPopup(Global.inviteFriendsToCommunityPopup, {
community: root.activeCommunity, community: root.activeCommunity,
hasAddedContacts: root.hasAddedContacts, hasAddedContacts: root.hasAddedContacts,
communitySectionModule: root.communitySectionModule communitySectionModule: root.communitySectionModule

View File

@ -64,8 +64,9 @@ Popup {
ActivityCenterPopupTopBarPanel { ActivityCenterPopupTopBarPanel {
id: activityCenterTopBar id: activityCenterTopBar
repliesBtnEnabled: hasReplies hasReplies: activityCenter.hasReplies
mentionsBtnEnabled: hasMentions hasMentions: activityCenter.hasMentions
hideReadNotifications: activityCenter.hideReadNotifications
allBtnHighlighted: activityCenter.currentFilter === ActivityCenterPopup.Filter.All allBtnHighlighted: activityCenter.currentFilter === ActivityCenterPopup.Filter.All
mentionsBtnHighlighted: activityCenter.currentFilter === ActivityCenterPopup.Filter.Mentions mentionsBtnHighlighted: activityCenter.currentFilter === ActivityCenterPopup.Filter.Mentions
repliesBtnHighlighted: activityCenter.currentFilter === ActivityCenterPopup.Filter.Replies repliesBtnHighlighted: activityCenter.currentFilter === ActivityCenterPopup.Filter.Replies
@ -211,14 +212,17 @@ Popup {
ActivityCenterMessageComponentView { ActivityCenterMessageComponentView {
id: activityCenterMessageView id: activityCenterMessageView
store: activityCenter.store store: activityCenter.store
acCurrentFilter: activityCenter.currentFilter
chatSectionModule: activityCenter.chatSectionModule chatSectionModule: activityCenter.chatSectionModule
messageContextMenu: activityCenter.messageContextMenu messageContextMenu: activityCenter.messageContextMenu
hideReadNotifications: activityCenter.hideReadNotifications
Connections { Connections {
target: activityCenter target: activityCenter
onOpened: activityCenterMessageView.reevaluateItemBadge() onOpened: activityCenterMessageView.reevaluateItemBadge()
} }
onActivityCenterClose: {
activityCenter.close();
}
Component.onCompleted: { Component.onCompleted: {
activityCenterMessageView.reevaluateItemBadge() activityCenterMessageView.reevaluateItemBadge()
} }
@ -230,6 +234,8 @@ Popup {
ActivityCenterGroupRequest { ActivityCenterGroupRequest {
store: activityCenter.store store: activityCenter.store
hideReadNotifications: activityCenter.hideReadNotifications
acCurrentFilterAll: activityCenter.currentFilter === ActivityCenter.Filter.All
} }
} }
} }

View File

@ -33,7 +33,6 @@ StatusModal {
property int channelType: GroupInfoPopup.ChannelType.ActiveChannel property int channelType: GroupInfoPopup.ChannelType.ActiveChannel
property var chatDetails property var chatDetails
property bool isAdmin: popup.chatSectionModule.activeItem.amIChatAdmin property bool isAdmin: popup.chatSectionModule.activeItem.amIChatAdmin
property Component pinnedMessagesPopupComponent
property var chatContentModule property var chatContentModule
@ -176,7 +175,7 @@ StatusModal {
popup.store.messageStore.messageModule = popup.chatContentModule.messagesModule popup.store.messageStore.messageModule = popup.chatContentModule.messagesModule
popup.store.messageStore.chatSectionModule = popup.chatSectionModule popup.store.messageStore.chatSectionModule = popup.chatSectionModule
Global.openPopup(pinnedMessagesPopupComponent, { Global.openPopup(Global.pinnedMessagesPopup, {
store: popup.store, store: popup.store,
messageStore: popup.store.messageStore, messageStore: popup.store.messageStore,
pinnedMessagesModel: popup.chatContentModule.pinnedMessagesModel, pinnedMessagesModel: popup.chatContentModule.pinnedMessagesModel,

View File

@ -18,6 +18,9 @@ StatusModal {
property var communitiesList property var communitiesList
signal setActiveCommunity(string id) signal setActiveCommunity(string id)
signal setObservedCommunity(string id) signal setObservedCommunity(string id)
signal openCommunityDetail()
signal importCommunityClicked()
signal createCommunityClicked()
onOpened: { onOpened: {
contentItem.searchBox.input.text = ""; contentItem.searchBox.input.text = "";
@ -39,7 +42,9 @@ StatusModal {
StatusMenuItem { StatusMenuItem {
icon.name: "download" icon.name: "download"
text: qsTr("Access existing community") text: qsTr("Access existing community")
onTriggered: Global.openPopup(importCommunitiesPopupComponent) onTriggered: {
popup.importCommunityClicked();
}
} }
} }
} }
@ -131,7 +136,7 @@ StatusModal {
popup.setActiveCommunity(model.id); popup.setActiveCommunity(model.id);
} else { } else {
popup.setObservedCommunity(model.id); popup.setObservedCommunity(model.id);
Global.openPopup(communityDetailPopup) popup.openCommunityDetail();
} }
popup.close() popup.close()
} }
@ -145,7 +150,7 @@ StatusModal {
StatusButton { StatusButton {
text: qsTr("Create a community") text: qsTr("Create a community")
onClicked: { onClicked: {
Global.openPopup(createCommunitiesPopupComponent) popup.createCommunityClicked();
popup.close() popup.close()
} }
} }

View File

@ -141,7 +141,6 @@ StatusModal {
icon.width: 20 icon.width: 20
rotation: 180 rotation: 180
onClicked: { onClicked: {
Global.openPopup(communitiesPopupComponent)
root.close() root.close()
} }
} }

View File

@ -61,10 +61,8 @@ StatusModal {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
property var contactDetails: Utils.getContactDetailsAsJson(model.pubKey) 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 image.source: contactDetails.thumbnailImage
title: displayName title: displayName
components: [ components: [

View File

@ -18,6 +18,8 @@ QtObject {
property string createChatStickerHashId: "" property string createChatStickerHashId: ""
property string createChatStickerPackId: "" property string createChatStickerPackId: ""
property var groupInfoPopupComponent
property var membershipRequestPopup
property var contactsModel: root.contactsStore.myContactsModel property var contactsModel: root.contactsStore.myContactsModel
// Important: // Important:

View File

@ -21,6 +21,8 @@ Item {
property var store property var store
property int previousNotificationIndex property int previousNotificationIndex
property string previousNotificationTimestamp property string previousNotificationTimestamp
property bool hideReadNotifications: false
property bool acCurrentFilterAll: false
DateGroup { DateGroup {
id: dateGroupLbl id: dateGroupLbl
@ -40,7 +42,7 @@ Item {
return false return false
} }
return activityCenter.currentFilter === ActivityCenter.Filter.All return acCurrentFilterAll;
} }
width: parent.width width: parent.width
height: visible ? 60 : 0 height: visible ? 60 : 0

View File

@ -24,15 +24,17 @@ Item {
if (hideReadNotifications && model.read) { if (hideReadNotifications && model.read) {
return false return false
} }
return activityCenter.currentFilter === ActivityCenterPopup.Filter.All || return acCurrentFilter === ActivityCenterPopup.Filter.All ||
(model.notificationType === Constants.activityCenterNotificationTypeMention && activityCenter.currentFilter === ActivityCenterPopup.Filter.Mentions) || (model.notificationType === Constants.activityCenterNotificationTypeMention && acCurrentFilter === ActivityCenterPopup.Filter.Mentions) ||
(model.notificationType === Constants.activityCenterNotificationTypeOneToOne && activityCenter.currentFilter === ActivityCenterPopup.Filter.ContactRequests) || (model.notificationType === Constants.activityCenterNotificationTypeOneToOne && acCurrentFilter === ActivityCenterPopup.Filter.ContactRequests) ||
(model.notificationType === Constants.activityCenterNotificationTypeReply && activityCenter.currentFilter === ActivityCenterPopup.Filter.Replies) (model.notificationType === Constants.activityCenterNotificationTypeReply && acCurrentFilter === ActivityCenterPopup.Filter.Replies)
} }
property var store property var store
property int acCurrentFilter
property var chatSectionModule property var chatSectionModule
property int previousNotificationIndex property int previousNotificationIndex
property bool hideReadNotifications
property string previousNotificationTimestamp property string previousNotificationTimestamp
// Not Refactored Yet // Not Refactored Yet
property int communityIndex: -1 //root.store.chatsModelInst.communities.joinedCommunities.getCommunityIndex(model.message.communityId) property int communityIndex: -1 //root.store.chatsModelInst.communities.joinedCommunities.getCommunityIndex(model.message.communityId)
@ -40,6 +42,7 @@ Item {
function openProfile() { function openProfile() {
Global.openProfilePopup(model.author) Global.openProfilePopup(model.author)
} }
signal activityCenterClose()
function reevaluateItemBadge() { function reevaluateItemBadge() {
let details = root.store.getBadgeDetails(model.sectionId, model.chatId) let details = root.store.getBadgeDetails(model.sectionId, model.chatId)
@ -145,7 +148,7 @@ Item {
return Global.openProfilePopup(model.message.senderId); return Global.openProfilePopup(model.message.senderId);
} }
activityCenter.close() activityCenterClose()
root.store.activityCenterModuleInst.switchTo(model.sectionId, model.chatId, model.id) root.store.activityCenterModuleInst.switchTo(model.sectionId, model.chatId, model.id)
} }
prevMessageIndex: root.previousNotificationIndex prevMessageIndex: root.previousNotificationIndex
@ -191,11 +194,11 @@ Item {
onCommunityNameClicked: { onCommunityNameClicked: {
root.store.activityCenterModuleInst.switchTo(model.sectionId, "", "") root.store.activityCenterModuleInst.switchTo(model.sectionId, "", "")
activityCenter.close() activityCenterClose();
} }
onChannelNameClicked: { onChannelNameClicked: {
root.store.activityCenterModuleInst.switchTo(model.sectionId, model.chatId, "") root.store.activityCenterModuleInst.switchTo(model.sectionId, model.chatId, "")
activityCenter.close() activityCenterClose();
} }
} }
} }

View File

@ -34,7 +34,6 @@ Item {
property var contactsStore property var contactsStore
property var emojiPopup property var emojiPopup
property Component pinnedMessagesPopupComponent
// Not Refactored Yet // Not Refactored Yet
//property int chatGroupsListViewCount: 0 //property int chatGroupsListViewCount: 0
property bool isReply: false property bool isReply: false
@ -57,6 +56,7 @@ Item {
property var contactDetails: Utils.getContactDetailsAsJson(root.activeChatId) property var contactDetails: Utils.getContactDetailsAsJson(root.activeChatId)
property bool isUserAdded: root.contactDetails.isAdded property bool isUserAdded: root.contactDetails.isAdded
property bool contactRequestReceived: root.contactDetails.requestReceived property bool contactRequestReceived: root.contactDetails.requestReceived
property Component pinnedMessagesListPopupComponent
signal openAppSearch() signal openAppSearch()
signal openStickerPackPopup(string stickerPackId) signal openStickerPackPopup(string stickerPackId)
@ -224,18 +224,29 @@ Item {
rootStore: root.rootStore rootStore: root.rootStore
contactsStore: root.contactsStore contactsStore: root.contactsStore
emojiPopup: root.emojiPopup emojiPopup: root.emojiPopup
isConnected: root.isConnected
sendTransactionNoEnsModal: cmpSendTransactionNoEns sendTransactionNoEnsModal: cmpSendTransactionNoEns
receiveTransactionModal: cmpReceiveTransaction receiveTransactionModal: cmpReceiveTransaction
sendTransactionWithEnsModal: cmpSendTransactionWithEns sendTransactionWithEnsModal: cmpSendTransactionWithEns
stickersLoaded: root.stickersLoaded stickersLoaded: root.stickersLoaded
isBlocked: model.blocked isBlocked: model.blocked
isActiveChannel: categoryChatLoader.isActiveChannel isActiveChannel: categoryChatLoader.isActiveChannel
activityCenterVisible: activityCenter.visible
activityCenterNotificationsCount: activityCenter.unreadNotificationsCount
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
onOpenStickerPackPopup: { onOpenStickerPackPopup: {
root.openStickerPackPopup(stickerPackId) root.openStickerPackPopup(stickerPackId)
} }
onNotificationButtonClicked: {
activityCenter.open();
}
onOpenAppSearch: {
root.openAppSearch();
}
Component.onCompleted: { Component.onCompleted: {
parentModule.prepareChatContentModuleForChatId(model.itemId) parentModule.prepareChatContentModuleForChatId(model.itemId)
chatContentModule = parentModule.getChatContentModule() chatContentModule = parentModule.getChatContentModule()
chatSectionModule = root.chatSectionModule;
} }
} }
} }
@ -269,6 +280,7 @@ Item {
clip: true clip: true
rootStore: root.rootStore rootStore: root.rootStore
contactsStore: root.contactsStore contactsStore: root.contactsStore
isConnected: root.isConnected
emojiPopup: root.emojiPopup emojiPopup: root.emojiPopup
sendTransactionNoEnsModal: cmpSendTransactionNoEns sendTransactionNoEnsModal: cmpSendTransactionNoEns
receiveTransactionModal: cmpReceiveTransaction receiveTransactionModal: cmpReceiveTransaction
@ -276,12 +288,22 @@ Item {
stickersLoaded: root.stickersLoaded stickersLoaded: root.stickersLoaded
isBlocked: model.blocked isBlocked: model.blocked
isActiveChannel: chatLoader.isActiveChannel isActiveChannel: chatLoader.isActiveChannel
activityCenterVisible: activityCenter.visible
activityCenterNotificationsCount: activityCenter.unreadNotificationsCount
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
onOpenStickerPackPopup: { onOpenStickerPackPopup: {
root.openStickerPackPopup(stickerPackId) root.openStickerPackPopup(stickerPackId)
} }
onNotificationButtonClicked: {
activityCenter.open();
}
onOpenAppSearch: {
root.openAppSearch();
}
Component.onCompleted: { Component.onCompleted: {
parentModule.prepareChatContentModuleForChatId(model.itemId) parentModule.prepareChatContentModuleForChatId(model.itemId)
chatContentModule = parentModule.getChatContentModule() chatContentModule = parentModule.getChatContentModule()
chatSectionModule = root.chatSectionModule;
root.checkForCreateChatOptions(model.itemId) root.checkForCreateChatOptions(model.itemId)
} }
} }

View File

@ -24,23 +24,30 @@ import "../../Wallet"
import "../stores" import "../stores"
ColumnLayout { ColumnLayout {
id: chatContentRoot id: root
spacing: 0 spacing: 0
// Important: // Important:
// Each chat/channel has its own ChatContentModule // Each chat/channel has its own ChatContentModule
property var chatContentModule property var chatContentModule
property var chatSectionModule
property var rootStore property var rootStore
property var contactsStore property var contactsStore
property bool isActiveChannel: false property bool isActiveChannel: false
property bool isConnected: false
property var emojiPopup property var emojiPopup
property bool activityCenterVisible: false
property int activityCenterNotificationsCount
property alias textInputField: chatInput property alias textInputField: chatInput
property UsersStore usersStore: UsersStore {} property UsersStore usersStore: UsersStore {}
property Component pinnedMessagesPopupComponent
onChatContentModuleChanged: { onChatContentModuleChanged: {
chatContentRoot.usersStore.usersModule = chatContentRoot.chatContentModule.usersModule root.usersStore.usersModule = root.chatContentModule.usersModule
} }
signal openAppSearch()
signal notificationButtonClicked()
signal openStickerPackPopup(string stickerPackId) signal openStickerPackPopup(string stickerPackId)
property Component sendTransactionNoEnsModal 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. // 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. // If in the future content is loaded dynamically, input focus should be activated when loaded / created content view.
onHeightChanged: { onHeightChanged: {
if(chatContentRoot.height > 0) { if(root.height > 0) {
chatInput.forceInputActiveFocus() chatInput.forceInputActiveFocus()
} }
} }
@ -82,7 +89,7 @@ ColumnLayout {
case Constants.chatType.publicChat: case Constants.chatType.publicChat:
return qsTr("Public chat") return qsTr("Public chat")
case Constants.chatType.privateGroupChat: 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); if(cnt > 1) return qsTr("%1 members").arg(cnt);
return qsTr("1 member"); return qsTr("1 member");
case Constants.chatType.communityChat: case Constants.chatType.communityChat:
@ -135,7 +142,7 @@ ColumnLayout {
onClicked: { onClicked: {
switch (chatContentModule.chatDetails.type) { switch (chatContentModule.chatDetails.type) {
case Constants.chatType.privateGroupChat: case Constants.chatType.privateGroupChat:
Global.openPopup(groupInfoPopupComponent, { Global.openPopup(root.rootStore.groupInfoPopupComponent, {
chatContentModule: chatContentModule, chatContentModule: chatContentModule,
chatDetails: chatContentModule.chatDetails chatDetails: chatContentModule.chatDetails
}) })
@ -152,11 +159,10 @@ ColumnLayout {
Component { Component {
id: contactsSelector id: contactsSelector
GroupChatPanel { GroupChatPanel {
sectionModule: chatSectionModule sectionModule: root.chatSectionModule
chatContentModule: chatContentRoot.chatContentModule chatContentModule: root.chatContentModule
rootStore: chatContentRoot.rootStore rootStore: root.rootStore
maxHeight: chatContentRoot.height maxHeight: root.height
onPanelClosed: topBar.toolbarComponent = statusChatInfoButton onPanelClosed: topBar.toolbarComponent = statusChatInfoButton
} }
} }
@ -177,16 +183,16 @@ ColumnLayout {
membersButton.highlighted: localAccountSensitiveSettings.expandUsersList membersButton.highlighted: localAccountSensitiveSettings.expandUsersList
notificationButton.tooltip.offset: localAccountSensitiveSettings.expandUsersList && membersButton.visible ? 0 : 14 notificationButton.tooltip.offset: localAccountSensitiveSettings.expandUsersList && membersButton.visible ? 0 : 14
notificationCount: activityCenter.unreadNotificationsCount notificationCount: root.activityCenterNotificationsCount
onSearchButtonClicked: root.openAppSearch() onSearchButtonClicked: root.openAppSearch()
onMembersButtonClicked: localAccountSensitiveSettings.expandUsersList = !localAccountSensitiveSettings.expandUsersList onMembersButtonClicked: localAccountSensitiveSettings.expandUsersList = !localAccountSensitiveSettings.expandUsersList
onNotificationButtonClicked: activityCenter.open() notificationButton.highlighted: root.activityCenterVisible
notificationButton.highlighted: activityCenter.visible onNotificationButtonClicked: root.notificationButtonClicked()
popupMenu: ChatContextMenuView { popupMenu: ChatContextMenuView {
emojiPopup: chatContentRoot.emojiPopup emojiPopup: root.emojiPopup
openHandler: function () { openHandler: function () {
if(!chatContentModule) { if(!chatContentModule) {
console.debug("error on open chat context menu handler - chat content module is not set") console.debug("error on open chat context menu handler - chat content module is not set")
@ -264,7 +270,7 @@ ColumnLayout {
} }
onDisplayGroupInfoPopup: { onDisplayGroupInfoPopup: {
Global.openPopup(groupInfoPopupComponent, { Global.openPopup(root.rootStore.groupInfoPopupComponent, {
chatContentModule: chatContentModule, chatContentModule: chatContentModule,
chatDetails: chatContentModule.chatDetails chatDetails: chatContentModule.chatDetails
}) })
@ -285,7 +291,7 @@ ColumnLayout {
topBar.toolbarComponent = contactsSelector topBar.toolbarComponent = contactsSelector
} }
onFetchMoreMessages: { onFetchMoreMessages: {
chatContentRoot.rootStore.messageStore.requestMoreMessages(); root.rootStore.messageStore.requestMoreMessages();
} }
onLeaveGroup: { onLeaveGroup: {
chatContentModule.leaveChat(); chatContentModule.leaveChat();
@ -322,10 +328,8 @@ ColumnLayout {
onOnlineStatusChanged: { onOnlineStatusChanged: {
if (connected === isConnected) return; if (connected === isConnected) return;
isConnected = connected; isConnected = connected;
if(isConnected){ if(isConnected) {
timer.setTimeout(function(){ onlineStatusTimer.start();
connectedStatusRect.visible = false;
}, 5000);
} else { } else {
connectedStatusRect.visible = true; connectedStatusRect.visible = true;
} }
@ -339,9 +343,17 @@ ColumnLayout {
} }
} }
Timer {
id: onlineStatusTimer
interval: 5000
onTriggered: {
connectedStatusRect.visible = false;
}
}
StatusBanner { StatusBanner {
Layout.fillWidth: true Layout.fillWidth: true
visible: chatContentRoot.isBlocked visible: root.isBlocked
type: StatusBanner.Type.Danger type: StatusBanner.Type.Danger
statusText: qsTr("Blocked") statusText: qsTr("Blocked")
} }
@ -349,13 +361,13 @@ ColumnLayout {
MessageStore { MessageStore {
id: messageStore id: messageStore
messageModule: chatContentModule? chatContentModule.messagesModule : null messageModule: chatContentModule? chatContentModule.messagesModule : null
chatSectionModule: chatContentRoot.rootStore.chatCommunitySectionModule chatSectionModule: root.rootStore.chatCommunitySectionModule
} }
MessageContextMenuView { MessageContextMenuView {
id: contextmenu id: contextmenu
store: chatContentRoot.rootStore store: root.rootStore
reactionModel: chatContentRoot.rootStore.emojiReactionsModel reactionModel: root.rootStore.emojiReactionsModel
onPinMessage: { onPinMessage: {
messageStore.pinMessage(messageId) 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") console.debug("error on open pinned messages limit reached from message context menu - chat content module is not set")
return return
} }
Global.openPopup(pinnedMessagesPopupComponent, { Global.openPopup(Global.pinnedMessagesPopup, {
store: rootStore, store: rootStore,
messageStore: messageStore, messageStore: messageStore,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel, pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
@ -413,16 +425,16 @@ ColumnLayout {
id: chatMessages id: chatMessages
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
store: chatContentRoot.rootStore store: root.rootStore
contactsStore: chatContentRoot.contactsStore contactsStore: root.contactsStore
messageContextMenuInst: contextmenu messageContextMenuInst: contextmenu
messageStore: messageStore messageStore: messageStore
emojiPopup: chatContentRoot.emojiPopup emojiPopup: root.emojiPopup
usersStore: chatContentRoot.usersStore usersStore: root.usersStore
stickersLoaded: chatContentRoot.stickersLoaded stickersLoaded: root.stickersLoaded
isChatBlocked: chatContentRoot.isBlocked isChatBlocked: root.isBlocked
channelEmoji: chatContentModule.chatDetails.emoji || "" channelEmoji: chatContentModule.chatDetails.emoji || ""
isActiveChannel: chatContentRoot.isActiveChannel isActiveChannel: root.isActiveChannel
onShowReplyArea: { onShowReplyArea: {
let obj = messageStore.getMessageByIdAsJson(messageId) let obj = messageStore.getMessageByIdAsJson(messageId)
if (!obj) { if (!obj) {
@ -458,19 +470,19 @@ ColumnLayout {
StatusChatInput { StatusChatInput {
id: chatInput id: chatInput
store: chatContentRoot.rootStore store: root.rootStore
usersStore: chatContentRoot.usersStore usersStore: root.usersStore
messageContextMenu: contextmenu messageContextMenu: contextmenu
emojiPopup: chatContentRoot.emojiPopup emojiPopup: root.emojiPopup
isContactBlocked: chatContentRoot.isBlocked isContactBlocked: root.isBlocked
isActiveChannel: chatContentRoot.isActiveChannel isActiveChannel: root.isActiveChannel
chatInputPlaceholder: chatContentRoot.isBlocked ? chatInputPlaceholder: root.isBlocked ?
qsTr("This user has been blocked.") : qsTr("This user has been blocked.") :
qsTr("Type a message.") qsTr("Type a message.")
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
recentStickers: chatContentRoot.rootStore.stickersModuleInst.recent recentStickers: root.rootStore.stickersModuleInst.recent
stickerPackList: chatContentRoot.rootStore.stickersModuleInst.stickerPacks stickerPackList: root.rootStore.stickersModuleInst.stickerPacks
chatType: chatContentModule? chatContentModule.chatDetails.type : Constants.chatType.unknown chatType: chatContentModule? chatContentModule.chatDetails.type : Constants.chatType.unknown
onSendTransactionCommandButtonClicked: { onSendTransactionCommandButtonClicked: {
if(!chatContentModule) { if(!chatContentModule) {
@ -479,16 +491,16 @@ ColumnLayout {
} }
if (Utils.getContactDetailsAsJson(chatContentModule.getMyChatId()).ensVerified) { if (Utils.getContactDetailsAsJson(chatContentModule.getMyChatId()).ensVerified) {
Global.openPopup(chatContentRoot.sendTransactionWithEnsModal) Global.openPopup(root.sendTransactionWithEnsModal)
} else { } else {
Global.openPopup(chatContentRoot.sendTransactionNoEnsModal) Global.openPopup(root.sendTransactionNoEnsModal)
} }
} }
onReceiveTransactionCommandButtonClicked: { onReceiveTransactionCommandButtonClicked: {
Global.openPopup(chatContentRoot.receiveTransactionModal) Global.openPopup(root.receiveTransactionModal)
} }
onStickerSelected: { onStickerSelected: {
chatContentRoot.rootStore.sendSticker(chatContentModule.getMyChatId(), root.rootStore.sendSticker(chatContentModule.getMyChatId(),
hashId, hashId,
chatInput.isReply ? chatInput.replyMessageId : "", chatInput.isReply ? chatInput.replyMessageId : "",
packId) packId)
@ -501,14 +513,14 @@ ColumnLayout {
return return
} }
if(chatContentRoot.rootStore.sendMessage(event, if(root.rootStore.sendMessage(event,
chatInput.textInput.text, chatInput.textInput.text,
chatInput.isReply? chatInput.replyMessageId : "", chatInput.isReply? chatInput.replyMessageId : "",
chatInput.fileUrls chatInput.fileUrls
)) ))
{ {
sendMessageSound.stop(); Global.sendMessageSound.stop();
Qt.callLater(sendMessageSound.play); Qt.callLater(Global.sendMessageSound.play);
chatInput.textInput.clear(); chatInput.textInput.clear();
chatInput.textInput.textFormat = TextEdit.PlainText; chatInput.textInput.textFormat = TextEdit.PlainText;

View File

@ -37,6 +37,8 @@ StatusAppThreePanelLayout {
signal communityManageButtonClicked() signal communityManageButtonClicked()
signal profileButtonClicked() signal profileButtonClicked()
signal openAppSearch() signal openAppSearch()
signal importCommunityClicked()
signal createCommunityClicked()
Connections { Connections {
target: root.rootStore.stickersStore.stickersModule target: root.rootStore.stickersStore.stickersModule
@ -72,7 +74,7 @@ StatusAppThreePanelLayout {
parentModule: root.rootStore.chatCommunitySectionModule parentModule: root.rootStore.chatCommunitySectionModule
rootStore: root.rootStore rootStore: root.rootStore
contactsStore: root.contactsStore contactsStore: root.contactsStore
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent pinnedMessagesListPopupComponent: root.pinnedMessagesListPopupComponent
stickersLoaded: root.stickersLoaded stickersLoaded: root.stickersLoaded
emojiPopup: root.emojiPopup emojiPopup: root.emojiPopup
onOpenStickerPackPopup: { onOpenStickerPackPopup: {
@ -134,6 +136,12 @@ StatusAppThreePanelLayout {
onOpenAppSearch: { onOpenAppSearch: {
root.openAppSearch() root.openAppSearch()
} }
onImportCommunityClicked: {
root.importCommunityClicked();
}
onCreateCommunityClicked: {
root.createCommunityClicked();
}
} }
} }
@ -156,7 +164,6 @@ StatusAppThreePanelLayout {
GroupInfoPopup { GroupInfoPopup {
chatSectionModule: root.rootStore.chatCommunitySectionModule chatSectionModule: root.rootStore.chatCommunitySectionModule
store: root.rootStore store: root.rootStore
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
} }
} }
@ -197,4 +204,8 @@ StatusAppThreePanelLayout {
root.rootStore.chatCommunitySectionModule.createOneToOneChat(communityId, chatId, ensName) root.rootStore.chatCommunitySectionModule.createOneToOneChat(communityId, chatId, ensName)
} }
} }
Component.onCompleted: {
rootStore.groupInfoPopupComponent = groupInfoPopupComponent;
}
} }

View File

@ -207,7 +207,7 @@ Item {
text: qsTr("Invite people") text: qsTr("Invite people")
icon.name: "share-ios" icon.name: "share-ios"
enabled: communityData.canManageUsers enabled: communityData.canManageUsers
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, { onTriggered: Global.openPopup(Global.inviteFriendsToCommunityPopup, {
community: communityData, community: communityData,
hasAddedContacts: root.hasAddedContacts, hasAddedContacts: root.hasAddedContacts,
communitySectionModule: root.communitySectionModule communitySectionModule: root.communitySectionModule
@ -341,7 +341,7 @@ Item {
onDisplayGroupInfoPopup: { onDisplayGroupInfoPopup: {
communitySectionModule.prepareChatContentModuleForChatId(chatId) communitySectionModule.prepareChatContentModuleForChatId(chatId)
let chatContentModule = communitySectionModule.getChatContentModule() let chatContentModule = communitySectionModule.getChatContentModule()
Global.openPopup(groupInfoPopupComponent, { Global.openPopup(root.store.groupInfoPopupComponent, {
chatContentModule: chatContentModule, chatContentModule: chatContentModule,
chatDetails: chatContentModule.chatDetails chatDetails: chatContentModule.chatDetails
}) })
@ -409,6 +409,12 @@ Item {
CommunityChannelsAndCategoriesBannerPanel { CommunityChannelsAndCategoriesBannerPanel {
id: channelsAndCategoriesBanner id: channelsAndCategoriesBanner
communityId: communityData.id communityId: communityData.id
onAddMembersClicked: {
Global.openPopup(createChannelPopup);
}
onAddCategoriesClicked: {
Global.openPopup(createCategoryPopup);
}
} }
MouseArea { MouseArea {

View File

@ -23,7 +23,7 @@ StatusAppTwoPanelLayout {
id: root id: root
// TODO: get this model from backend? // 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("Members"), icon: "group-chat"},
// {name: qsTr("Permissions"), icon: "objects"}, // {name: qsTr("Permissions"), icon: "objects"},
// {name: qsTr("Tokens"), icon: "token"}, // {name: qsTr("Tokens"), icon: "token"},
@ -73,7 +73,7 @@ StatusAppTwoPanelLayout {
Layout.fillWidth: true Layout.fillWidth: true
implicitHeight: contentItem.childrenRect.height implicitHeight: contentItem.childrenRect.height
model: root.model model: root.settingsMenuModel
delegate: StatusNavigationListItem { delegate: StatusNavigationListItem {
width: listView.width width: listView.width
title: modelData.name title: modelData.name
@ -256,15 +256,4 @@ StatusAppTwoPanelLayout {
} }
} }
} }
Component {
id: membershipRequestPopup
MembershipRequestsPopup {
anchors.centerIn: parent
store: root.rootStore
onClosed: {
destroy()
}
}
}
} }

View File

@ -35,6 +35,8 @@ Item {
//property int chatGroupsListViewCount: channelList.model.count //property int chatGroupsListViewCount: channelList.model.count
signal openProfileClicked() signal openProfileClicked()
signal openAppSearch() signal openAppSearch()
signal importCommunityClicked()
signal createCommunityClicked()
// main layout // main layout
ColumnLayout { ColumnLayout {
@ -212,7 +214,6 @@ Item {
onDownloadMessages: { onDownloadMessages: {
root.chatSectionModule.downloadMessages(chatId, file) root.chatSectionModule.downloadMessages(chatId, file)
} }
onDisplayProfilePopup: { onDisplayProfilePopup: {
Global.openProfilePopup(publicKey) Global.openProfilePopup(publicKey)
} }
@ -222,7 +223,7 @@ Item {
onDisplayGroupInfoPopup: { onDisplayGroupInfoPopup: {
chatSectionModule.prepareChatContentModuleForChatId(chatId) chatSectionModule.prepareChatContentModuleForChatId(chatId)
let chatContentModule = chatSectionModule.getChatContentModule() let chatContentModule = chatSectionModule.getChatContentModule()
Global.openPopup(groupInfoPopupComponent, { Global.openPopup(root.store.groupInfoPopupComponent, {
chatContentModule: chatContentModule, chatContentModule: chatContentModule,
chatDetails: chatContentModule.chatDetails chatDetails: chatContentModule.chatDetails
}) })
@ -296,6 +297,15 @@ Item {
onClosed: { onClosed: {
destroy() destroy()
} }
onOpenCommunityDetail: {
Global.openPopup(communityDetailPopup);
}
onImportCommunityClicked: {
root.importCommunityClicked();
}
onCreateCommunityClicked: {
root.createCommunityClicked();
}
} }
} }
@ -305,6 +315,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
store: root.store store: root.store
onClosed: { onClosed: {
Global.openPopup(communitiesPopupComponent)
destroy() destroy()
} }
} }

View File

@ -17,6 +17,8 @@ StatusScrollView {
id: root id: root
property CommunitiesStore communitiesStore: CommunitiesStore {} property CommunitiesStore communitiesStore: CommunitiesStore {}
property var importCommunitiesPopup: importCommunitiesPopupComponent
property var createCommunitiesPopup: createCommunitiesPopupComponent
QtObject { QtObject {
id: d id: d

View File

@ -182,18 +182,27 @@ Item {
id: sendMessageSound id: sendMessageSound
store: rootStore store: rootStore
track: Qt.resolvedUrl("../imports/assets/audio/send_message.wav") track: Qt.resolvedUrl("../imports/assets/audio/send_message.wav")
Component.onCompleted: {
Global.sendMessageSound = this;
}
} }
Audio { Audio {
id: notificationSound id: notificationSound
store: rootStore store: rootStore
track: Qt.resolvedUrl("../imports/assets/audio/notification.wav") track: Qt.resolvedUrl("../imports/assets/audio/notification.wav")
Component.onCompleted: {
Global.notificationSound = this;
}
} }
Audio { Audio {
id: errorSound id: errorSound
track: Qt.resolvedUrl("../imports/assets/audio/error.mp3") track: Qt.resolvedUrl("../imports/assets/audio/error.mp3")
store: rootStore store: rootStore
Component.onCompleted: {
Global.errorSound = this;
}
} }
AppSearch { AppSearch {
@ -511,6 +520,14 @@ Item {
appSearch.openSearchPopup() appSearch.openSearchPopup()
} }
onImportCommunityClicked: {
Global.openPopup(communitiesPortalLayoutContainer.importCommunitiesPopup);
}
onCreateCommunityClicked: {
Global.openPopup(communitiesPortalLayoutContainer.createCommunitiesPopup);
}
Component.onCompleted: { Component.onCompleted: {
rootStore.chatCommunitySectionModule = mainModule.getChatSectionModule() rootStore.chatCommunitySectionModule = mainModule.getChatSectionModule()
} }
@ -980,6 +997,9 @@ Item {
Component.onCompleted: { Component.onCompleted: {
Global.appMain = this; Global.appMain = this;
Global.pinnedMessagesPopup = pinnedMessagesPopupComponent;
Global.communityProfilePopup = communityProfilePopup;
Global.inviteFriendsToCommunityPopup = inviteFriendsToCommunityPopup;
const whitelist = appMain.rootStore.messagingStore.getLinkPreviewWhitelist() const whitelist = appMain.rootStore.messagingStore.getLinkPreviewWhitelist()
try { try {
const whiteListedSites = JSON.parse(whitelist) const whiteListedSites = JSON.parse(whitelist)

View File

@ -10,12 +10,19 @@ QtObject {
property var appMain property var appMain
property bool popupOpened: false property bool popupOpened: false
property int settingsSubsection: Constants.settingsSubsection.profile property int settingsSubsection: Constants.settingsSubsection.profile
property var errorSound
property var mainModuleInst property var mainModuleInst
property var privacyModuleInst property var privacyModuleInst
property var toastMessage
property var pinnedMessagesPopup
property var communityProfilePopup
property var inviteFriendsToCommunityPopup
property bool profilePopupOpened: false property bool profilePopupOpened: false
property var sendMessageSound
property var notificationSound
property var errorSound
signal openImagePopup(var image, var contextMenu) signal openImagePopup(var image, var contextMenu)
signal openLinkInBrowser(string link) signal openLinkInBrowser(string link)
signal openChooseBrowserPopup(string link) signal openChooseBrowserPopup(string link)