fix(LinkPreviews): Left align the message link preview tight corner

This commit is contained in:
Alex Jbanca 2023-11-01 13:19:18 +02:00 committed by Alex Jbanca
parent 544b2c1806
commit 0f07ea09da
7 changed files with 5 additions and 25 deletions

View File

@ -27,7 +27,6 @@ SplitView {
playAnimations: true playAnimations: true
linkPreviewModel: mockedLinkPreviewModel linkPreviewModel: mockedLinkPreviewModel
gifLinks: [ "https://media.tenor.com/qN_ytiwLh24AAAAC/cold.gif" ] gifLinks: [ "https://media.tenor.com/qN_ytiwLh24AAAAC/cold.gif" ]
isCurrentUser: true
gifUnfurlingEnabled: false gifUnfurlingEnabled: false
canAskToUnfurlGifs: true canAskToUnfurlGifs: true
@ -44,14 +43,6 @@ SplitView {
ColumnLayout { ColumnLayout {
spacing: 25 spacing: 25
ColumnLayout { ColumnLayout {
Label {
text: qsTr("Sender")
}
CheckBox {
text: qsTr("Current user")
checked: linksMessageView.isCurrentUser
onToggled: linksMessageView.isCurrentUser = !linksMessageView.isCurrentUser
}
Label { Label {
text: qsTr("GIF unfuring settings") text: qsTr("GIF unfuring settings")
} }

View File

@ -315,7 +315,7 @@ Control {
album: root.messageDetails.albumCount > 0 ? root.messageDetails.album : [root.messageDetails.messageContent] album: root.messageDetails.albumCount > 0 ? root.messageDetails.album : [root.messageDetails.messageContent]
albumCount: root.messageDetails.albumCount > 0 ? root.messageDetails.albumCount : 1 albumCount: root.messageDetails.albumCount > 0 ? root.messageDetails.albumCount : 1
imageWidth: Math.min(messageLayout.width / root.messageDetails.albumCount - 9 * (root.messageDetails.albumCount - 1), 144) imageWidth: Math.min(messageLayout.width / root.messageDetails.albumCount - 9 * (root.messageDetails.albumCount - 1), 144)
shapeType: root.messageDetails.amISender ? StatusImageMessage.ShapeType.RIGHT_ROUNDED : StatusImageMessage.ShapeType.LEFT_ROUNDED shapeType: StatusImageMessage.ShapeType.LEFT_ROUNDED
onImageClicked: root.imageClicked(image, mouse, imageSource) onImageClicked: root.imageClicked(image, mouse, imageSource)
} }
} }
@ -333,7 +333,7 @@ Control {
delegate: StatusImageMessage { delegate: StatusImageMessage {
source: model.source source: model.source
onClicked: root.imageClicked(image, mouse, imageSource) onClicked: root.imageClicked(image, mouse, imageSource)
shapeType: root.messageDetails.amISender ? StatusImageMessage.ShapeType.RIGHT_ROUNDED : StatusImageMessage.ShapeType.LEFT_ROUNDED shapeType: StatusImageMessage.ShapeType.LEFT_ROUNDED
} }
} }
} }

View File

@ -48,9 +48,6 @@ LinkPreviewCard {
required property var statusCommunityChannelCommunityPreviewBanner required property var statusCommunityChannelCommunityPreviewBanner
//View properties //View properties
property bool isCurrentUser: false
leftTail: !isCurrentUser
type: root.previewType type: root.previewType
linkData { linkData {
title: standardPreview ? standardPreview.title : "" title: standardPreview ? standardPreview.title : ""

View File

@ -13,7 +13,6 @@ CalloutCard {
required property string link required property string link
required property bool playAnimation required property bool playAnimation
required property bool isOnline required property bool isOnline
required property bool isCurrentUser
readonly property bool isPlaying: linkImage.playing readonly property bool isPlaying: linkImage.playing
readonly property alias imageAlias: linkImage.imageAlias readonly property alias imageAlias: linkImage.imageAlias
@ -23,7 +22,6 @@ CalloutCard {
implicitWidth: linkImage.width implicitWidth: linkImage.width
implicitHeight: linkImage.height implicitHeight: linkImage.height
leftTail: !isCurrentUser
StatusChatImageLoader { StatusChatImageLoader {
id: linkImage id: linkImage
@ -34,7 +32,6 @@ CalloutCard {
anchors.centerIn: parent anchors.centerIn: parent
source: root.link source: root.link
imageWidth: 300 imageWidth: 300
isCurrentUser: root.isCurrentUser
playing: root.playAnimation && localAnimationEnabled playing: root.playAnimation && localAnimationEnabled
isOnline: root.isOnline isOnline: root.isOnline
asynchronous: true asynchronous: true

View File

@ -10,7 +10,6 @@ Item {
property int verticalPadding: 0 property int verticalPadding: 0
property int imageWidth: 350 property int imageWidth: 350
property bool isCurrentUser: false
property url source property url source
property bool isActiveChannel: false property bool isActiveChannel: false
property bool playing: Global.applicationWindow.active property bool playing: Global.applicationWindow.active
@ -20,6 +19,7 @@ Item {
property bool isOnline: true // TODO: mark as required when migrating to 5.15 or above property bool isOnline: true // TODO: mark as required when migrating to 5.15 or above
property bool imageLoaded: (imageMessage.status === Image.Ready) property bool imageLoaded: (imageMessage.status === Image.Ready)
property alias asynchronous: imageMessage.asynchronous property alias asynchronous: imageMessage.asynchronous
property bool leftTail: true
signal clicked(var image, var mouse) signal clicked(var image, var mouse)
@ -90,7 +90,7 @@ Item {
width: 32 width: 32
height: 32 height: 32
radius: 4 radius: 4
visible: !root.isCurrentUser && !allCornersRounded visible: root.leftTail && !allCornersRounded
} }
Rectangle { Rectangle {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -98,7 +98,7 @@ Item {
width: 32 width: 32
height: 32 height: 32
radius: 4 radius: 4
visible: root.isCurrentUser && !allCornersRounded visible: !root.leftTail && !allCornersRounded
} }
} }
} }

View File

@ -22,8 +22,6 @@ Flow {
required property var linkPreviewModel required property var linkPreviewModel
required property var gifLinks required property var gifLinks
required property bool isCurrentUser
required property bool gifUnfurlingEnabled required property bool gifUnfurlingEnabled
required property bool canAskToUnfurlGifs required property bool canAskToUnfurlGifs
@ -65,7 +63,6 @@ Flow {
link: modelData link: modelData
isOnline: root.isOnline isOnline: root.isOnline
isCurrentUser: root.isCurrentUser
playAnimation: root.playAnimations playAnimation: root.playAnimations
onClicked: root.imageClicked(imageAlias, mouse, link, link) onClicked: root.imageClicked(imageAlias, mouse, link, link)
} }
@ -79,7 +76,6 @@ Flow {
model: root.linkPreviewModel model: root.linkPreviewModel
delegate: LinkPreviewCardDelegate { delegate: LinkPreviewCardDelegate {
id: delegate id: delegate
isCurrentUser: root.isCurrentUser
highlight: url === root.highlightLink highlight: url === root.highlightLink
onHoveredChanged: { onHoveredChanged: {
linksRepeater.hoveredUrl = hovered ? url : "" linksRepeater.hoveredUrl = hovered ? url : ""

View File

@ -758,7 +758,6 @@ Loader {
gifLinks: root.gifLinks gifLinks: root.gifLinks
playAnimations: root.messageStore.playAnimation playAnimations: root.messageStore.playAnimation
isOnline: root.rootStore.mainModuleInst.isOnline isOnline: root.rootStore.mainModuleInst.isOnline
isCurrentUser: root.amISender
highlightLink: delegate.hoveredLink highlightLink: delegate.hoveredLink
onImageClicked: (image, mouse, imageSource, url) => { onImageClicked: (image, mouse, imageSource, url) => {
d.onImageClicked(image, mouse, imageSource, url) d.onImageClicked(image, mouse, imageSource, url)