refactor(ChatLayout): expose emoji and sticker popup properties and signals

Prior to this change `ChatLayout` exposed `chatView` which let other
components access it, its properties and signals.

This is problematic as we need to be able to swap out the `ChatView`
with the `JoinCommunityView` for token gated communities, in which case
there won't be an instance of `chatView`.

This commit ensures that we rely purely on inputs and outputs of the
component, without exposing the component instance itself.
This commit is contained in:
Pascal Precht 2023-03-07 17:34:36 +01:00 committed by r4bbit
parent d5cddbf79a
commit 48c322cbe4
2 changed files with 20 additions and 9 deletions

View File

@ -14,9 +14,12 @@ StackLayout {
property RootStore rootStore property RootStore rootStore
readonly property var contactsStore: rootStore.contactsStore readonly property var contactsStore: rootStore.contactsStore
property alias chatView: chatView property var emojiPopup
property var stickersPopup
signal importCommunityClicked() signal importCommunityClicked()
signal createCommunityClicked() signal createCommunityClicked()
signal profileButtonClicked()
signal openAppSearch()
onCurrentIndexChanged: { onCurrentIndexChanged: {
Global.closeCreateChatView() Global.closeCreateChatView()
@ -36,6 +39,8 @@ StackLayout {
ChatView { ChatView {
id: chatView id: chatView
emojiPopup: root.emojiPopup
stickersPopup: root.stickersPopup
contactsStore: root.contactsStore contactsStore: root.contactsStore
rootStore: root.rootStore rootStore: root.rootStore
membershipRequestPopup: membershipRequestPopupComponent membershipRequestPopup: membershipRequestPopupComponent
@ -49,6 +54,12 @@ StackLayout {
onCreateCommunityClicked: { onCreateCommunityClicked: {
root.createCommunityClicked(); root.createCommunityClicked();
} }
onProfileButtonClicked: {
root.profileButtonClicked()
}
onOpenAppSearch: {
root.openAppSearch()
}
} }
Loader { Loader {

View File

@ -771,14 +771,14 @@ Item {
} }
rootStore: appMain.rootChatStore rootStore: appMain.rootChatStore
chatView.emojiPopup: statusEmojiPopup emojiPopup: statusEmojiPopup
chatView.stickersPopup: statusStickersPopupLoader.item stickersPopup: statusStickersPopupLoader.item
chatView.onProfileButtonClicked: { onProfileButtonClicked: {
Global.changeAppSectionBySectionType(Constants.appSection.profile); Global.changeAppSectionBySectionType(Constants.appSection.profile);
} }
chatView.onOpenAppSearch: { onOpenAppSearch: {
appSearch.openSearchPopup() appSearch.openSearchPopup()
} }
@ -876,16 +876,16 @@ Item {
restoreMode: Binding.RestoreBindingOrValue restoreMode: Binding.RestoreBindingOrValue
} }
chatView.emojiPopup: statusEmojiPopup emojiPopup: statusEmojiPopup
chatView.stickersPopup: statusStickersPopupLoader.item stickersPopup: statusStickersPopupLoader.item
rootStore: appMain.rootChatStore rootStore: appMain.rootChatStore
chatView.onProfileButtonClicked: { onProfileButtonClicked: {
Global.changeAppSectionBySectionType(Constants.appSection.profile); Global.changeAppSectionBySectionType(Constants.appSection.profile);
} }
chatView.onOpenAppSearch: { onOpenAppSearch: {
appSearch.openSearchPopup() appSearch.openSearchPopup()
} }