diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index ccc028988..a0fbbfcb8 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -1559,7 +1559,9 @@ extension ConversationVC: body: cellViewModel.body, timestampMs: cellViewModel.timestampMs, attachments: cellViewModel.attachments, - linkPreviewAttachment: cellViewModel.linkPreviewAttachment + linkPreviewAttachment: cellViewModel.linkPreviewAttachment, + currentUserPublicKey: cellViewModel.currentUserPublicKey, + currentUserBlindedPublicKey: cellViewModel.currentUserBlindedPublicKey ) guard let quoteDraft: QuotedReplyModel = maybeQuoteDraft else { return } diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index f19f9e58f..528c9ca0c 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -808,7 +808,8 @@ final class ConversationVC: BaseVC, ConversationSearchControllerDelegate, UITabl /// Unfortunately the UITableView also does some weird things when updating (where it won't have updated it's internal data until /// after it performs the next layout); the below code checks a condition on layout and if it passes it calls a closure if let itemChangeInfo: ItemChangeInfo = itemChangeInfo, itemChangeInfo.isInsertAtTop { - let oldCellHeight: CGFloat = self.tableView.rectForRow(at: itemChangeInfo.oldVisibleIndexPath).height + let oldCellRect: CGRect = self.tableView.rectForRow(at: itemChangeInfo.oldVisibleIndexPath) + let oldCellTopOffset: CGFloat = (self.tableView.frame.minY - self.tableView.convert(oldCellRect, to: self.tableView.superview).minY) // The the user triggered the 'scrollToTop' animation (by tapping in the nav bar) then we // need to stop the animation before attempting to lock the offset (otherwise things break) @@ -828,27 +829,13 @@ final class ConversationVC: BaseVC, ConversationSearchControllerDelegate, UITabl // loaded was smaller than 2 pages (this will prevent calculating the frames of // a large number of cells when getting search results which are very far away // only to instantly start scrolling making the calculation redundant) - if (abs(itemChangeInfo.visibleIndexPath.row - itemChangeInfo.oldVisibleIndexPath.row) <= (ConversationViewModel.pageSize * 2)) { - UIView.performWithoutAnimation { - let calculatedRowHeights: CGFloat = (0.. targetIndexPath.section && - numRowInSections[targetIndexPath.section] > targetIndexPath.row - else { return true } - - lastSize = updatedContentSize - - self?.tableView.scrollToRow( - at: targetIndexPath, - at: position, - animated: false - ) - - return false - }, - then: {} - ) - } - } } diff --git a/Session/Conversations/Input View/InputView.swift b/Session/Conversations/Input View/InputView.swift index f2c716921..8fd6d99f6 100644 --- a/Session/Conversations/Input View/InputView.swift +++ b/Session/Conversations/Input View/InputView.swift @@ -245,8 +245,8 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M authorId: quoteDraftInfo.model.authorId, quotedText: quoteDraftInfo.model.body, threadVariant: threadVariant, - currentUserPublicKey: nil, - currentUserBlindedPublicKey: nil, + currentUserPublicKey: quoteDraftInfo.model.currentUserPublicKey, + currentUserBlindedPublicKey: quoteDraftInfo.model.currentUserBlindedPublicKey, direction: (quoteDraftInfo.isOutgoing ? .outgoing : .incoming), attachment: quoteDraftInfo.model.attachment, hInset: hInset, diff --git a/Session/Conversations/Message Cells/Content Views/LinkPreviewView.swift b/Session/Conversations/Message Cells/Content Views/LinkPreviewView.swift index 6e312ef55..97a0c87db 100644 --- a/Session/Conversations/Message Cells/Content Views/LinkPreviewView.swift +++ b/Session/Conversations/Message Cells/Content Views/LinkPreviewView.swift @@ -112,7 +112,7 @@ final class LinkPreviewView: UIView { // Title label let titleLabelContainer = UIView() titleLabelContainer.addSubview(titleLabel) - titleLabel.pin(to: titleLabelContainer, withInset: Values.smallSpacing) + titleLabel.pin(to: titleLabelContainer, withInset: Values.mediumSpacing) // Horizontal stack view hStackView.addArrangedSubview(imageViewContainer) diff --git a/Session/Conversations/Message Cells/Content Views/QuoteView.swift b/Session/Conversations/Message Cells/Content Views/QuoteView.swift index b43e345fc..2ee2f9068 100644 --- a/Session/Conversations/Message Cells/Content Views/QuoteView.swift +++ b/Session/Conversations/Message Cells/Content Views/QuoteView.swift @@ -187,14 +187,19 @@ final class QuoteView: UIView { } // Body label - let bodyLabel = UILabel() + let bodyLabel = TappableLabel() bodyLabel.numberOfLines = 0 bodyLabel.lineBreakMode = .byTruncatingTail - let targetThemeColor: ThemeValue = (direction == .outgoing ? - .messageBubble_outgoingText : - .messageBubble_incomingText - ) + let targetThemeColor: ThemeValue = { + switch mode { + case .regular: return (direction == .outgoing ? + .messageBubble_outgoingText : + .messageBubble_incomingText + ) + case .draft: return .textPrimary + } + }() bodyLabel.font = .systemFont(ofSize: Values.smallFontSize) ThemeManager.onThemeChange(observer: bodyLabel) { [weak bodyLabel] theme, primaryColor in diff --git a/SessionMessagingKit/Sending & Receiving/Quotes/QuotedReplyModel.swift b/SessionMessagingKit/Sending & Receiving/Quotes/QuotedReplyModel.swift index 9e688faaa..562621a36 100644 --- a/SessionMessagingKit/Sending & Receiving/Quotes/QuotedReplyModel.swift +++ b/SessionMessagingKit/Sending & Receiving/Quotes/QuotedReplyModel.swift @@ -12,6 +12,8 @@ public struct QuotedReplyModel { public let contentType: String? public let sourceFileName: String? public let thumbnailDownloadFailed: Bool + public let currentUserPublicKey: String? + public let currentUserBlindedPublicKey: String? // MARK: - Initialization @@ -23,7 +25,9 @@ public struct QuotedReplyModel { attachment: Attachment?, contentType: String?, sourceFileName: String?, - thumbnailDownloadFailed: Bool + thumbnailDownloadFailed: Bool, + currentUserPublicKey: String?, + currentUserBlindedPublicKey: String? ) { self.attachment = attachment self.threadId = threadId @@ -33,6 +37,8 @@ public struct QuotedReplyModel { self.contentType = contentType self.sourceFileName = sourceFileName self.thumbnailDownloadFailed = thumbnailDownloadFailed + self.currentUserPublicKey = currentUserPublicKey + self.currentUserBlindedPublicKey = currentUserBlindedPublicKey } public static func quotedReplyForSending( @@ -42,7 +48,9 @@ public struct QuotedReplyModel { body: String?, timestampMs: Int64, attachments: [Attachment]?, - linkPreviewAttachment: Attachment? + linkPreviewAttachment: Attachment?, + currentUserPublicKey: String?, + currentUserBlindedPublicKey: String? ) -> QuotedReplyModel? { guard variant == .standardOutgoing || variant == .standardIncoming else { return nil } guard (body != nil && body?.isEmpty == false) || attachments?.isEmpty == false else { return nil } @@ -57,7 +65,9 @@ public struct QuotedReplyModel { attachment: targetAttachment, contentType: targetAttachment?.contentType, sourceFileName: targetAttachment?.sourceFilename, - thumbnailDownloadFailed: false + thumbnailDownloadFailed: false, + currentUserPublicKey: currentUserPublicKey, + currentUserBlindedPublicKey: currentUserBlindedPublicKey ) } }