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
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
})
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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
}
}

View File

@ -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();
}
}
}

View File

@ -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

View File

@ -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
}
}
}

View File

@ -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,

View File

@ -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()
}
}

View File

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

View File

@ -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: [

View File

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

View File

@ -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

View File

@ -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();
}
}
}

View File

@ -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)
}
}

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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 {

View File

@ -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()
}
}
}
}

View File

@ -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()
}
}

View File

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

View File

@ -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)

View File

@ -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)