Show message sync when sending a message

This commit is contained in:
Niels Andriesse 2020-12-07 13:19:46 +11:00
parent eafff041df
commit 61611db58e
2 changed files with 5 additions and 4 deletions

View File

@ -3715,13 +3715,14 @@ typedef enum : NSUInteger {
message.text = text;
message.quote = [SNQuote from:self.inputToolbar.quotedReply];
OWSLinkPreviewDraft *linkPreviewDraft = self.inputToolbar.linkPreviewDraft;
TSThread *thread = self.thread;
TSOutgoingMessage *tsMessage = [TSOutgoingMessage from:message associatedWith:thread];
[self.conversationViewModel appendUnsavedOutgoingTextMessage:tsMessage];
[LKStorage writeWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
message.linkPreview = [SNLinkPreview from:linkPreviewDraft using:transaction];
} completion:^{
dispatch_async(dispatch_get_main_queue(), ^{
TSThread *thread = self.thread;
TSOutgoingMessage *tsMessage = [TSOutgoingMessage from:message associatedWith:thread];
[self.conversationViewModel appendUnsavedOutgoingTextMessage:tsMessage];
tsMessage.linkPreview = [OWSLinkPreview from:message.linkPreview];
[LKStorage writeWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[tsMessage saveWithTransaction:transaction];
}];

View File

@ -1,7 +1,7 @@
extension OWSLinkPreview {
public static func from(_ linkPreview: VisibleMessage.LinkPreview?) -> OWSLinkPreview? {
@objc public static func from(_ linkPreview: VisibleMessage.LinkPreview?) -> OWSLinkPreview? {
guard let linkPreview = linkPreview else { return nil }
return OWSLinkPreview(urlString: linkPreview.url!, title: linkPreview.title, imageAttachmentId: linkPreview.attachmentID)
}