fix chat section being squished
This commit is contained in:
parent
8340a28ad1
commit
d827433ad4
|
@ -29,17 +29,16 @@ StackLayout {
|
||||||
property var doNotShowAddToContactBannerToThose: ([])
|
property var doNotShowAddToContactBannerToThose: ([])
|
||||||
|
|
||||||
property var onActivated: function () {
|
property var onActivated: function () {
|
||||||
inputArea.chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
|
chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
|
||||||
}
|
}
|
||||||
|
|
||||||
property string activeChatId: chatsModel.activeChannel.id
|
property string activeChatId: chatsModel.activeChannel.id
|
||||||
property bool isBlocked: profileModel.contacts.isContactBlocked(activeChatId)
|
property bool isBlocked: profileModel.contacts.isContactBlocked(activeChatId)
|
||||||
property bool isContact: profileModel.contacts.isAdded(activeChatId)
|
property bool isContact: profileModel.contacts.isAdded(activeChatId)
|
||||||
|
|
||||||
property alias input: inputArea.chatInput
|
|
||||||
|
|
||||||
property string currentNotificationChatId
|
property string currentNotificationChatId
|
||||||
property string currentNotificationCommunityId
|
property string currentNotificationCommunityId
|
||||||
|
property alias input: chatInput
|
||||||
|
|
||||||
property string hoveredMessage
|
property string hoveredMessage
|
||||||
property string activeMessage
|
property string activeMessage
|
||||||
|
@ -61,7 +60,7 @@ StackLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
inputArea.chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
|
chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
|
||||||
}
|
}
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
@ -99,12 +98,12 @@ StackLayout {
|
||||||
identicon: chatsModel.messageList.getMessageData(i, "identicon"),
|
identicon: chatsModel.messageList.getMessageData(i, "identicon"),
|
||||||
localNickname: chatsModel.messageList.getMessageData(i, "localName")
|
localNickname: chatsModel.messageList.getMessageData(i, "localName")
|
||||||
})
|
})
|
||||||
inputArea.chatInput.suggestionsList.append(suggestionsObj[suggestionsObj.length - 1]);
|
chatInput.suggestionsList.append(suggestionsObj[suggestionsObj.length - 1]);
|
||||||
idMap[contactAddr] = true;
|
idMap[contactAddr] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateSuggestions() {
|
function populateSuggestions() {
|
||||||
inputArea.chatInput.suggestionsList.clear()
|
chatInput.suggestionsList.clear()
|
||||||
const len = chatsModel.suggestionList.rowCount()
|
const len = chatsModel.suggestionList.rowCount()
|
||||||
|
|
||||||
idMap = {}
|
idMap = {}
|
||||||
|
@ -120,7 +119,7 @@ StackLayout {
|
||||||
localNickname: chatsModel.suggestionList.rowData(i, "localNickname")
|
localNickname: chatsModel.suggestionList.rowData(i, "localNickname")
|
||||||
})
|
})
|
||||||
|
|
||||||
inputArea.chatInput.suggestionsList.append(suggestionsObj[suggestionsObj.length - 1]);
|
chatInput.suggestionsList.append(suggestionsObj[suggestionsObj.length - 1]);
|
||||||
idMap[contactAddr] = true;
|
idMap[contactAddr] = true;
|
||||||
}
|
}
|
||||||
const len2 = chatsModel.messageList.rowCount();
|
const len2 = chatsModel.messageList.rowCount();
|
||||||
|
@ -139,7 +138,7 @@ StackLayout {
|
||||||
let message = chatsModel.messageList.getMessageData(replyMessageIndex, "message")
|
let message = chatsModel.messageList.getMessageData(replyMessageIndex, "message")
|
||||||
let identicon = chatsModel.messageList.getMessageData(replyMessageIndex, "identicon")
|
let identicon = chatsModel.messageList.getMessageData(replyMessageIndex, "identicon")
|
||||||
|
|
||||||
inputArea.chatInput.showReplyArea(userName, message, identicon)
|
chatInput.showReplyArea(userName, message, identicon)
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestAddressForTransaction(address, amount, tokenAddress, tokenDecimals = 18) {
|
function requestAddressForTransaction(address, amount, tokenAddress, tokenDecimals = 18) {
|
||||||
|
@ -284,8 +283,8 @@ StackLayout {
|
||||||
Connections {
|
Connections {
|
||||||
target: chatsModel
|
target: chatsModel
|
||||||
onActiveChannelChanged: {
|
onActiveChannelChanged: {
|
||||||
inputArea.chatInput.suggestions.hide();
|
chatInput.suggestions.hide();
|
||||||
inputArea.chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
|
chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
|
||||||
populateSuggestions();
|
populateSuggestions();
|
||||||
}
|
}
|
||||||
onMessagePushed: {
|
onMessagePushed: {
|
||||||
|
@ -306,11 +305,96 @@ StackLayout {
|
||||||
Layout.bottomMargin: Style.current.bigPadding
|
Layout.bottomMargin: Style.current.bigPadding
|
||||||
}
|
}
|
||||||
|
|
||||||
InputArea {
|
Item {
|
||||||
id: inputArea
|
id: inputArea
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredWidth: parent.width
|
Layout.preferredWidth: parent.width
|
||||||
|
height: chatInput.height
|
||||||
|
Layout.preferredHeight: height
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: chatsModel
|
||||||
|
onLoadingMessagesChanged:
|
||||||
|
if(value){
|
||||||
|
loadingMessagesIndicator.active = true
|
||||||
|
} else {
|
||||||
|
timer.setTimeout(function(){
|
||||||
|
loadingMessagesIndicator.active = false;
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: loadingMessagesIndicator
|
||||||
|
active: chatsModel.loadingMessages
|
||||||
|
sourceComponent: loadingIndicator
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: chatInput.top
|
||||||
|
anchors.rightMargin: Style.current.padding
|
||||||
|
anchors.bottomMargin: Style.current.padding
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: loadingIndicator
|
||||||
|
LoadingAnimation {}
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusChatInput {
|
||||||
|
id: chatInput
|
||||||
|
visible: {
|
||||||
|
const community = chatsModel.communities.activeCommunity
|
||||||
|
if (chatsModel.activeChannel.chatType === Constants.chatTypePrivateGroupChat) {
|
||||||
|
return chatsModel.activeChannel.isMember
|
||||||
|
}
|
||||||
|
return !community.active ||
|
||||||
|
community.access === Constants.communityChatPublicAccess ||
|
||||||
|
community.admin ||
|
||||||
|
chatsModel.activeChannel.canPost
|
||||||
|
}
|
||||||
|
enabled: !isBlocked
|
||||||
|
chatInputPlaceholder: isBlocked ?
|
||||||
|
//% "This user has been blocked."
|
||||||
|
qsTrId("this-user-has-been-blocked-") :
|
||||||
|
//% "Type a message."
|
||||||
|
qsTrId("type-a-message-")
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
recentStickers: chatsModel.stickers.recent
|
||||||
|
stickerPackList: chatsModel.stickers.stickerPacks
|
||||||
|
chatType: chatsModel.activeChannel.chatType
|
||||||
|
onSendTransactionCommandButtonClicked: {
|
||||||
|
if (chatsModel.activeChannel.ensVerified) {
|
||||||
|
txModalLoader.sourceComponent = cmpSendTransactionWithEns
|
||||||
|
} else {
|
||||||
|
txModalLoader.sourceComponent = cmpSendTransactionNoEns
|
||||||
|
}
|
||||||
|
txModalLoader.item.open()
|
||||||
|
}
|
||||||
|
onReceiveTransactionCommandButtonClicked: {
|
||||||
|
txModalLoader.sourceComponent = cmpReceiveTransaction
|
||||||
|
txModalLoader.item.open()
|
||||||
|
}
|
||||||
|
onStickerSelected: {
|
||||||
|
chatsModel.stickers.send(hashId, packId)
|
||||||
|
}
|
||||||
|
onSendMessage: {
|
||||||
|
if (chatInput.fileUrls.length > 0){
|
||||||
|
chatsModel.sendImages(JSON.stringify(fileUrls));
|
||||||
|
}
|
||||||
|
let msg = chatsModel.plainText(Emoji.deparse(chatInput.textInput.text))
|
||||||
|
if (msg.length > 0){
|
||||||
|
msg = chatInput.interpretMessage(msg)
|
||||||
|
chatsModel.sendMessage(msg, chatInput.isReply ? SelectedMessage.messageId : "", Utils.isOnlyEmoji(msg) ? Constants.emojiType : Constants.messageType, false, JSON.stringify(suggestionsObj));
|
||||||
|
if(event) event.accepted = true
|
||||||
|
sendMessageSound.stop();
|
||||||
|
Qt.callLater(sendMessageSound.play);
|
||||||
|
|
||||||
|
chatInput.textInput.clear();
|
||||||
|
chatInput.textInput.textFormat = TextEdit.PlainText;
|
||||||
|
chatInput.textInput.textFormat = TextEdit.RichText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,6 @@ ScrollView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: timer
|
id: timer
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue