fix message with two links and a link preview, second link uses address of first
This commit is contained in:
parent
95797d427c
commit
81317db165
|
@ -590,10 +590,7 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
|
|||
navigationController!.present(shareVC, animated: true, completion: nil)
|
||||
}
|
||||
case .textOnlyMessage:
|
||||
if let preview = viewItem.linkPreview, let urlAsString = preview.urlString, let url = URL(string: urlAsString) {
|
||||
// Open the link preview URL
|
||||
openURL(url)
|
||||
} else if let reply = viewItem.quotedReply {
|
||||
if let reply = viewItem.quotedReply {
|
||||
// Scroll to the source of the reply
|
||||
guard let indexPath = viewModel.ensureLoadWindowContainsQuotedReply(reply) else { return }
|
||||
messagesTableView.scrollToRow(at: indexPath, at: UITableView.ScrollPosition.middle, animated: true)
|
||||
|
|
|
@ -58,6 +58,8 @@ final class LinkPreviewView : UIView {
|
|||
result.addTarget(self, action: #selector(cancel), for: UIControl.Event.touchUpInside)
|
||||
return result
|
||||
}()
|
||||
|
||||
var bodyTextView: UITextView?
|
||||
|
||||
// MARK: Settings
|
||||
private static let loaderSize: CGFloat = 24
|
||||
|
@ -145,6 +147,7 @@ final class LinkPreviewView : UIView {
|
|||
bodyTextViewContainer.subviews.forEach { $0.removeFromSuperview() }
|
||||
if let viewItem = viewItem {
|
||||
let bodyTextView = VisibleMessageCell.getBodyTextView(for: viewItem, with: maxWidth, textColor: sentLinkPreviewTextColor, searchText: delegate.lastSearchedText, delegate: delegate)
|
||||
self.bodyTextView = bodyTextView
|
||||
bodyTextViewContainer.addSubview(bodyTextView)
|
||||
bodyTextView.pin(to: bodyTextViewContainer, withInset: 12)
|
||||
}
|
||||
|
|
|
@ -324,6 +324,7 @@ final class VisibleMessageCell : MessageCell, LinkPreviewViewDelegate {
|
|||
snContentView.addSubview(linkPreviewView)
|
||||
linkPreviewView.pin(to: snContentView)
|
||||
linkPreviewView.layer.mask = bubbleViewMaskLayer
|
||||
self.bodyTextView = linkPreviewView.bodyTextView
|
||||
} else if let openGroupInvitationName = message.openGroupInvitationName, let openGroupInvitationURL = message.openGroupInvitationURL {
|
||||
let openGroupInvitationView = OpenGroupInvitationView(name: openGroupInvitationName, url: openGroupInvitationURL, textColor: bodyLabelTextColor, isOutgoing: isOutgoing)
|
||||
snContentView.addSubview(openGroupInvitationView)
|
||||
|
|
Loading…
Reference in New Issue