parent
e822c37716
commit
e2697ae5aa
|
@ -229,3 +229,6 @@ QtObject:
|
||||||
QtProperty[bool] loading:
|
QtProperty[bool] loading:
|
||||||
read = isLoading
|
read = isLoading
|
||||||
notify = loadingChanged
|
notify = loadingChanged
|
||||||
|
|
||||||
|
proc firstUnseenMentionMessageId(self: View): string {.slot.} =
|
||||||
|
return self.model.getFirstUnseenMentionMessageId()
|
||||||
|
|
|
@ -728,6 +728,12 @@ QtObject:
|
||||||
if messagesSet.len == 0:
|
if messagesSet.len == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
proc getFirstUnseenMentionMessageId*(self: Model): string =
|
||||||
|
result = ""
|
||||||
|
for i in countdown(self.items.len - 1, 0):
|
||||||
|
if not self.items[i].seen and self.items[i].mentioned:
|
||||||
|
return self.items[i].id
|
||||||
|
|
||||||
proc updateAlbumIfExists*(self: Model, albumId: string, messageImage: string, messageId: string): bool =
|
proc updateAlbumIfExists*(self: Model, albumId: string, messageImage: string, messageId: string): bool =
|
||||||
for i in 0 ..< self.items.len:
|
for i in 0 ..< self.items.len:
|
||||||
let item = self.items[i]
|
let item = self.items[i]
|
||||||
|
|
|
@ -14,6 +14,8 @@ Item {
|
||||||
property int mentionsCount
|
property int mentionsCount
|
||||||
property int recentMessagesCount
|
property int recentMessagesCount
|
||||||
|
|
||||||
|
property alias recentMessagesButtonVisible: recentMessagesButton.visible
|
||||||
|
|
||||||
signal mentionsButtonClicked
|
signal mentionsButtonClicked
|
||||||
signal recentMessagesButtonClicked
|
signal recentMessagesButtonClicked
|
||||||
|
|
||||||
|
@ -57,6 +59,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
AnchorButton {
|
AnchorButton {
|
||||||
|
id: recentMessagesButton
|
||||||
|
|
||||||
text: recentMessagesCount <= 0 ? "" : d.limitNumberTo99(recentMessagesCount)
|
text: recentMessagesCount <= 0 ? "" : d.limitNumberTo99(recentMessagesCount)
|
||||||
normalColor: Style.current.buttonSecondaryColor
|
normalColor: Style.current.buttonSecondaryColor
|
||||||
type: StatusRoundButton.Type.Tertiary
|
type: StatusRoundButton.Type.Tertiary
|
||||||
|
|
|
@ -210,4 +210,16 @@ QtObject {
|
||||||
return
|
return
|
||||||
messageModule.resendMessage(messageId)
|
messageModule.resendMessage(messageId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function jumpToMessage(messageId) {
|
||||||
|
if(!messageModule)
|
||||||
|
return
|
||||||
|
messageModule.jumpToMessage(messageId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function firstUnseenMentionMessageId() {
|
||||||
|
if(!messageModule)
|
||||||
|
return ""
|
||||||
|
return messageModule.firstUnseenMentionMessageId()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import shared.controls 1.0
|
||||||
import shared.views.chat 1.0
|
import shared.views.chat 1.0
|
||||||
|
|
||||||
import "../controls"
|
import "../controls"
|
||||||
|
import "../panels"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
@ -185,13 +186,10 @@ Item {
|
||||||
highlightMoveDuration: 200
|
highlightMoveDuration: 200
|
||||||
preferredHighlightBegin: 0
|
preferredHighlightBegin: 0
|
||||||
preferredHighlightEnd: chatLogView.height/2
|
preferredHighlightEnd: chatLogView.height/2
|
||||||
|
|
||||||
model: messageStore.messagesModel
|
model: messageStore.messagesModel
|
||||||
|
|
||||||
onContentYChanged: {
|
onContentYChanged: d.loadMoreMessagesIfScrollBelowThreshold()
|
||||||
scrollDownButton.visible = contentHeight - (d.scrollY + height) > 400
|
|
||||||
d.loadMoreMessagesIfScrollBelowThreshold()
|
|
||||||
}
|
|
||||||
|
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
d.markAllMessagesReadIfMostRecentMessageIsInViewport()
|
d.markAllMessagesReadIfMostRecentMessageIsInViewport()
|
||||||
|
@ -215,41 +213,24 @@ Item {
|
||||||
visible: chatLogView.visibleArea.heightRatio < 1
|
visible: chatLogView.visibleArea.heightRatio < 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
ChatAnchorButtonsPanel {
|
||||||
id: scrollDownButton
|
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: Style.current.padding
|
anchors.rightMargin: Style.current.padding
|
||||||
|
|
||||||
visible: false
|
mentionsCount: d.chatDetails ? d.chatDetails.notificationCount : 0
|
||||||
height: 32
|
recentMessagesButtonVisible: {
|
||||||
width: arrowImage.width + 2 * Style.current.halfPadding
|
chatLogView.contentY // trigger binding on contentY change
|
||||||
|
return chatLogView.contentHeight - (d.scrollY + chatLogView.height) > 400
|
||||||
background: Rectangle {
|
|
||||||
color: Style.current.buttonSecondaryColor
|
|
||||||
border.width: 0
|
|
||||||
radius: 16
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onRecentMessagesButtonClicked: chatLogView.positionViewAtBeginning()
|
||||||
scrollDownButton.visible = false
|
onMentionsButtonClicked: {
|
||||||
chatLogView.positionViewAtBeginning()
|
let id = messageStore.firstUnseenMentionMessageId()
|
||||||
}
|
if (id !== "") {
|
||||||
|
messageStore.jumpToMessage(id)
|
||||||
StatusIcon {
|
chatContentModule.markMessageRead(id)
|
||||||
id: arrowImage
|
}
|
||||||
anchors.centerIn: parent
|
|
||||||
width: 24
|
|
||||||
height: 24
|
|
||||||
icon: "arrow-down"
|
|
||||||
color: Style.current.pillButtonTextColor
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue