feat(act-center): scroll to the clicked message in the act center
Fixes #2681
This commit is contained in:
parent
0f5d889a0d
commit
d5032430f9
|
@ -192,6 +192,10 @@ StackLayout {
|
||||||
id: timer
|
id: timer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function positionAtMessage(messageId) {
|
||||||
|
stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].item.scrollToMessage(messageId)
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,18 @@ Popup {
|
||||||
pinnedBy: model.message.pinnedBy
|
pinnedBy: model.message.pinnedBy
|
||||||
pinnedMessage: model.message.isPinned
|
pinnedMessage: model.message.isPinned
|
||||||
activityCenterMessage: true
|
activityCenterMessage: true
|
||||||
|
clickMessage: function (isProfileClick) {
|
||||||
|
if (isProfileClick) {
|
||||||
|
const pk = model.message.fromAuthor
|
||||||
|
const userProfileImage = appMain.getProfileImage(pk)
|
||||||
|
return openProfilePopup(chatsModel.userNameOrAlias(pk), pk, userProfileImage || utilsModel.generateIdenticon(pk))
|
||||||
|
}
|
||||||
|
|
||||||
|
activityCenter.close()
|
||||||
|
chatsModel.setActiveChannel(model.message.chatId)
|
||||||
|
positionAtMessage(model.message.messageId)
|
||||||
|
}
|
||||||
|
|
||||||
prevMessageIndex: {
|
prevMessageIndex: {
|
||||||
if (notificationDelegate.idx === 0) {
|
if (notificationDelegate.idx === 0) {
|
||||||
return 0
|
return 0
|
||||||
|
@ -222,6 +234,7 @@ Popup {
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivityChannelBadge {
|
ActivityChannelBadge {
|
||||||
|
id: badge
|
||||||
name: model.name
|
name: model.name
|
||||||
chatId: model.chatId
|
chatId: model.chatId
|
||||||
notificationType: model.notificationType
|
notificationType: model.notificationType
|
||||||
|
|
|
@ -17,6 +17,7 @@ ScrollView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias chatLogView: chatLogView
|
property alias chatLogView: chatLogView
|
||||||
|
property alias scrollToMessage: chatLogView.scrollToMessage
|
||||||
|
|
||||||
property var messageList: MessagesData {}
|
property var messageList: MessagesData {}
|
||||||
property bool loadingMessages: false
|
property bool loadingMessages: false
|
||||||
|
@ -64,6 +65,17 @@ ScrollView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property var scrollToMessage: function (messageId) {
|
||||||
|
let item
|
||||||
|
for (let i = 0; i < messageListDelegate.count; i++) {
|
||||||
|
item = messageListDelegate.items.get(i)
|
||||||
|
if (item.model.messageId === messageId) {
|
||||||
|
chatLogView.positionViewAtIndex(i, ListView.Center)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
id: contentHeightConnection
|
id: contentHeightConnection
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
|
@ -176,7 +176,7 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickMessage(isProfileClick, isSticker = false, isImage = false, image = null, emojiOnly = false, hideEmojiPicker = false) {
|
property var clickMessage: function(isProfileClick, isSticker = false, isImage = false, image = null, emojiOnly = false, hideEmojiPicker = false) {
|
||||||
if (placeholderMessage || activityCenterMessage) {
|
if (placeholderMessage || activityCenterMessage) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,9 @@ Rectangle {
|
||||||
property int contentType: 2
|
property int contentType: 2
|
||||||
|
|
||||||
id: buttonsContainer
|
id: buttonsContainer
|
||||||
visible: (buttonsContainer.parentIsHovered || isMessageActive) && contentType !== Constants.transactionType
|
visible: !activityCenterMessage &&
|
||||||
|
(buttonsContainer.parentIsHovered || isMessageActive)
|
||||||
|
&& contentType !== Constants.transactionType
|
||||||
width: buttonRow.width + buttonsContainer.containerMargin * 2
|
width: buttonRow.width + buttonsContainer.containerMargin * 2
|
||||||
height: 36
|
height: 36
|
||||||
radius: Style.current.radius
|
radius: Style.current.radius
|
||||||
|
|
|
@ -23,10 +23,12 @@ Item {
|
||||||
+ (dateGroupLbl.visible ? dateGroupLbl.height + dateGroupLbl.anchors.topMargin : 0)
|
+ (dateGroupLbl.visible ? dateGroupLbl.height + dateGroupLbl.anchors.topMargin : 0)
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
enabled: !placeholderMessage && !activityCenterMessage
|
enabled: !placeholderMessage
|
||||||
anchors.fill: messageContainer
|
anchors.fill: messageContainer
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: activityCenterMessage ? Qt.LeftButton : Qt.RightButton
|
||||||
onClicked: messageMouseArea.clicked(mouse)
|
onClicked: {
|
||||||
|
messageMouseArea.clicked(mouse)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatButtons {
|
ChatButtons {
|
||||||
|
@ -238,6 +240,7 @@ Item {
|
||||||
MessageMouseArea {
|
MessageMouseArea {
|
||||||
id: messageMouseArea
|
id: messageMouseArea
|
||||||
anchors.fill: stickerLoader.active ? stickerLoader : chatText
|
anchors.fill: stickerLoader.active ? stickerLoader : chatText
|
||||||
|
z: activityCenterMessage ? chatText.z + 1 : chatText.z -1
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
@ -320,7 +323,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
enabled: forceHoverHandler || (typeof messageContextMenu !== "undefined" && typeof profilePopupOpened !== "undefined" && !messageContextMenu.opened && !profilePopupOpened && !popupOpened)
|
enabled: !activityCenterMessage &&
|
||||||
|
(forceHoverHandler || (typeof messageContextMenu !== "undefined" && typeof profilePopupOpened !== "undefined" && !messageContextMenu.opened && !profilePopupOpened && !popupOpened))
|
||||||
onHoveredChanged: setHovered(messageId, hovered)
|
onHoveredChanged: setHovered(messageId, hovered)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,16 @@ import "../../../../../shared"
|
||||||
import "../../../../../imports"
|
import "../../../../../imports"
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
enabled: !placeholderMessage && !activityCenterMessage
|
enabled: !placeholderMessage
|
||||||
cursorShape: chatText.hoveredLink ? Qt.PointingHandCursor : undefined
|
cursorShape: chatText.hoveredLink ? Qt.PointingHandCursor : undefined
|
||||||
acceptedButtons: Qt.RightButton | Qt.LeftButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
z: 50
|
z: 50
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(mouse.button & Qt.RightButton) {
|
if (activityCenterMessage) {
|
||||||
clickMessage(false, isSticker, false);
|
return clickMessage(false, isSticker, false)
|
||||||
|
}
|
||||||
|
if(mouse.button === Qt.RightButton) {
|
||||||
|
clickMessage(false, isSticker, false)
|
||||||
if (typeof isMessageActive !== "undefined") {
|
if (typeof isMessageActive !== "undefined") {
|
||||||
setMessageActive(messageId, true)
|
setMessageActive(messageId, true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue