2023-04-19 17:31:18 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQml 2.15
|
2023-04-21 15:05:34 +00:00
|
|
|
import QtQuick.Controls 2.15
|
2023-04-26 09:20:17 +00:00
|
|
|
import QtQuick.Layouts 1.15
|
2021-12-09 12:53:40 +00:00
|
|
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-03-07 14:56:05 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
2021-12-09 12:53:40 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared 1.0
|
2024-10-02 20:47:14 +00:00
|
|
|
import shared.stores 1.0 as SharedStores
|
2021-12-09 12:53:40 +00:00
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.status 1.0
|
|
|
|
import shared.controls 1.0
|
|
|
|
import shared.views.chat 1.0
|
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
import AppLayouts.Profile.stores 1.0
|
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
import "../helpers"
|
|
|
|
import "../controls"
|
|
|
|
import "../popups"
|
|
|
|
import "../panels"
|
|
|
|
import "../../Wallet"
|
|
|
|
import "../stores"
|
|
|
|
|
|
|
|
ColumnLayout {
|
2022-05-10 16:04:25 +00:00
|
|
|
id: root
|
2021-12-09 12:53:40 +00:00
|
|
|
|
2023-06-07 13:18:29 +00:00
|
|
|
// Important: each chat/channel has its own ChatContentModule
|
2021-12-09 12:53:40 +00:00
|
|
|
property var chatContentModule
|
2022-05-10 16:04:25 +00:00
|
|
|
property var chatSectionModule
|
2024-10-02 20:47:14 +00:00
|
|
|
property SharedStores.RootStore sharedRootStore
|
2024-10-22 12:39:42 +00:00
|
|
|
property SharedStores.UtilsStore utilsStore
|
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
property RootStore rootStore
|
|
|
|
property ContactsStore contactsStore
|
2023-04-18 18:23:57 +00:00
|
|
|
property string chatId
|
2023-04-27 14:21:41 +00:00
|
|
|
property int chatType: Constants.chatType.unknown
|
2023-03-10 17:33:26 +00:00
|
|
|
|
2023-04-17 20:43:23 +00:00
|
|
|
readonly property alias chatMessagesLoader: chatMessagesLoader
|
|
|
|
|
2022-03-07 14:56:05 +00:00
|
|
|
property var emojiPopup
|
2022-11-14 20:21:00 +00:00
|
|
|
property var stickersPopup
|
2024-10-30 19:02:46 +00:00
|
|
|
property UsersStore usersStore: UsersStore {
|
|
|
|
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
|
|
|
}
|
2022-02-08 12:08:02 +00:00
|
|
|
|
2022-02-14 23:27:23 +00:00
|
|
|
signal openStickerPackPopup(string stickerPackId)
|
2021-12-09 12:53:40 +00:00
|
|
|
|
2022-02-04 10:21:05 +00:00
|
|
|
property bool isBlocked: false
|
2023-04-28 10:28:19 +00:00
|
|
|
property bool isUserAllowedToSendMessage: root.rootStore.isUserAllowedToSendMessage
|
2022-01-05 15:50:03 +00:00
|
|
|
property bool stickersLoaded: false
|
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
readonly property MessageStore messageStore: MessageStore {
|
2022-09-30 14:36:49 +00:00
|
|
|
messageModule: chatContentModule ? chatContentModule.messagesModule : null
|
2022-05-10 16:04:25 +00:00
|
|
|
chatSectionModule: root.rootStore.chatCommunitySectionModule
|
2021-12-14 14:19:55 +00:00
|
|
|
}
|
|
|
|
|
2024-09-17 11:34:24 +00:00
|
|
|
property bool sendViaPersonalChatEnabled
|
|
|
|
|
2023-06-07 13:18:29 +00:00
|
|
|
signal showReplyArea(messageId: string)
|
|
|
|
signal forceInputFocus()
|
2021-12-20 14:21:35 +00:00
|
|
|
|
2023-06-07 13:18:29 +00:00
|
|
|
objectName: "chatContentViewColumn"
|
|
|
|
spacing: 0
|
fix(contacts): fix inconsistency when banning or unbanning contact
Fixes #10501
The problem was that didn't have access to the updated contact from status-go after banning or unbanning, so we just changed the banned property, but there is more that gets changed in the backend, like `removed` being set to `true` as well.
With this fix, when you unban someone, you go back to a fresh start, as **non** contact, so you need to send a request again. That was the state you got if you restarted the app, so "re-sync" the state with status-go.
Another issue was on the frontend (QML). When banned, and after restarting to get the right state, the unban button would be disabled and the Add contact request button would show, which is not good. We only want to send requests when unbanned.
2023-05-31 19:09:37 +00:00
|
|
|
|
2023-06-07 13:18:29 +00:00
|
|
|
onChatContentModuleChanged: if (!!chatContentModule) {
|
2024-10-30 19:02:46 +00:00
|
|
|
root.usersStore.chatDetails = root.chatContentModule.chatDetails
|
2023-06-07 13:18:29 +00:00
|
|
|
root.usersStore.usersModule = root.chatContentModule.usersModule
|
2021-12-14 14:19:55 +00:00
|
|
|
}
|
|
|
|
|
2023-06-07 13:18:29 +00:00
|
|
|
Loader {
|
2021-12-09 12:53:40 +00:00
|
|
|
Layout.fillWidth: true
|
2023-06-07 13:18:29 +00:00
|
|
|
active: root.isBlocked
|
|
|
|
visible: active
|
|
|
|
sourceComponent: StatusBanner {
|
|
|
|
type: StatusBanner.Type.Danger
|
|
|
|
statusText: qsTr("Blocked")
|
2021-12-09 12:53:40 +00:00
|
|
|
}
|
2023-06-07 13:18:29 +00:00
|
|
|
}
|
2021-12-09 12:53:40 +00:00
|
|
|
|
2023-06-07 13:18:29 +00:00
|
|
|
Loader {
|
|
|
|
id: chatMessagesLoader
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2022-09-22 07:13:03 +00:00
|
|
|
|
2023-06-07 13:18:29 +00:00
|
|
|
sourceComponent: ChatMessagesView {
|
|
|
|
chatContentModule: root.chatContentModule
|
2024-10-02 20:47:14 +00:00
|
|
|
|
|
|
|
sharedRootStore: root.sharedRootStore
|
2024-10-22 12:39:42 +00:00
|
|
|
utilsStore: root.utilsStore
|
2023-06-07 13:18:29 +00:00
|
|
|
rootStore: root.rootStore
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
messageStore: root.messageStore
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
stickersPopup: root.stickersPopup
|
|
|
|
usersStore: root.usersStore
|
|
|
|
stickersLoaded: root.stickersLoaded
|
|
|
|
chatId: root.chatId
|
|
|
|
isOneToOne: root.chatType === Constants.chatType.oneToOne
|
|
|
|
isChatBlocked: root.isBlocked || !root.isUserAllowedToSendMessage
|
|
|
|
channelEmoji: !chatContentModule ? "" : (chatContentModule.chatDetails.emoji || "")
|
2024-09-17 11:34:24 +00:00
|
|
|
sendViaPersonalChatEnabled: root.sendViaPersonalChatEnabled
|
2023-06-07 13:18:29 +00:00
|
|
|
onShowReplyArea: (messageId, senderId) => {
|
|
|
|
root.showReplyArea(messageId)
|
2023-04-19 17:31:18 +00:00
|
|
|
}
|
2023-06-07 13:18:29 +00:00
|
|
|
onOpenStickerPackPopup: {
|
|
|
|
root.openStickerPackPopup(stickerPackId);
|
|
|
|
}
|
|
|
|
onEditModeChanged: {
|
|
|
|
if (!editModeOn)
|
|
|
|
root.forceInputFocus()
|
2021-12-09 12:53:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|