diff --git a/Podfile b/Podfile index 2495e35ea..d87aeac1f 100644 --- a/Podfile +++ b/Podfile @@ -9,8 +9,8 @@ def shared_pods # OWS Pods ### - pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', testspecs: ["Tests"] - # pod 'SignalCoreKit', path: '../SignalCoreKit', testspecs: ["Tests"] + # pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', testspecs: ["Tests"] + pod 'SignalCoreKit', path: '../SignalCoreKit', testspecs: ["Tests"] pod 'AxolotlKit', git: 'https://github.com/signalapp/SignalProtocolKit.git', branch: 'master', testspecs: ["Tests"] # pod 'AxolotlKit', path: '../SignalProtocolKit', testspecs: ["Tests"] diff --git a/Podfile.lock b/Podfile.lock index 3a77793d9..f8d35f79b 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -200,8 +200,8 @@ DEPENDENCIES: - PromiseKit (= 6.5.3) - PureLayout - Reachability - - SignalCoreKit (from `https://github.com/signalapp/SignalCoreKit.git`) - - SignalCoreKit/Tests (from `https://github.com/signalapp/SignalCoreKit.git`) + - SignalCoreKit (from `../SignalCoreKit`) + - SignalCoreKit/Tests (from `../SignalCoreKit`) - SignalMetadataKit (from `https://github.com/signalapp/SignalMetadataKit`) - SignalMetadataKit/Tests (from `https://github.com/signalapp/SignalMetadataKit`) - SignalServiceKit (from `.`) @@ -240,7 +240,7 @@ EXTERNAL SOURCES: :branch: signal-master :git: https://github.com/signalapp/Mantle SignalCoreKit: - :git: https://github.com/signalapp/SignalCoreKit.git + :path: "../SignalCoreKit" SignalMetadataKit: :git: https://github.com/signalapp/SignalMetadataKit SignalServiceKit: @@ -268,9 +268,6 @@ CHECKOUT OPTIONS: Mantle: :commit: 9599b1d9796280c97cb2f786f34984fc98a3b6ef :git: https://github.com/signalapp/Mantle - SignalCoreKit: - :commit: 2bf143469ab82fb35379fe9f5085450edefb2a2a - :git: https://github.com/signalapp/SignalCoreKit.git SignalMetadataKit: :commit: 56f28fc3a6e35d548d034ef7d0009f233ca0aa62 :git: https://github.com/signalapp/SignalMetadataKit @@ -294,7 +291,7 @@ SPEC CHECKSUMS: PureLayout: f08c01b8dec00bb14a1fefa3de4c7d9c265df85e Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c - SignalCoreKit: c2d8132cdedb95d35eb2f8ae7eac0957695d0a8b + SignalCoreKit: 2d5db80cda950a892383a4002146ec0d81460ce1 SignalMetadataKit: 6fa5e9a53c7f104568662521a2f3874672ff7a02 SignalServiceKit: c637b66e485538dda76836a1ec560dc556035430 SQLCipher: 4636a257060f6f1b4e143a143028b61a2b462d0d @@ -304,6 +301,6 @@ SPEC CHECKSUMS: YapDatabase: b418a4baa6906e8028748938f9159807fd039af4 YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54 -PODFILE CHECKSUM: b0748e1cca7826f2ed132c495589e6aea9b7d743 +PODFILE CHECKSUM: 15fd183a8e1c41a9df76d3cdb28f415e2d6c4ab5 COCOAPODS: 1.5.3 diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index ce8f314aa..c699e63e9 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -3975,26 +3975,13 @@ typedef enum : NSUInteger { // which are presented as normal text messages. BOOL didAddToProfileWhitelist = [ThreadUtil addThreadToProfileWhitelistIfEmptyContactThread:self.thread]; __block TSOutgoingMessage *message; - - if ([text lengthOfBytesUsingEncoding:NSUTF8StringEncoding] >= kOversizeTextMessageSizeThreshold) { - DataSource *_Nullable dataSource = [DataSourceValue dataSourceWithOversizeText:text]; - SignalAttachment *attachment = - [SignalAttachment attachmentWithDataSource:dataSource dataUTI:kOversizeTextAttachmentUTI]; - // TODO we should redundantly send the first n chars in the body field so it can be viewed - // on clients that don't support oversized text messgaes, (and potentially generate a preview - // before the attachment is downloaded) - message = [ThreadUtil enqueueMessageWithAttachment:attachment - inThread:self.thread - quotedReplyModel:self.inputToolbar.quotedReply]; - } else { - [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) { - message = [ThreadUtil enqueueMessageWithText:text - inThread:self.thread - quotedReplyModel:self.inputToolbar.quotedReply - linkPreviewDraft:self.inputToolbar.linkPreviewDraft - transaction:transaction]; - }]; - } + [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) { + message = [ThreadUtil enqueueMessageWithText:text + inThread:self.thread + quotedReplyModel:self.inputToolbar.quotedReply + linkPreviewDraft:self.inputToolbar.linkPreviewDraft + transaction:transaction]; + }]; [self.conversationViewModel appendUnsavedOutgoingTextMessage:message]; [self messageWasSent:message]; diff --git a/SignalMessaging/utils/ThreadUtil.m b/SignalMessaging/utils/ThreadUtil.m index 2d5b182f3..50040b5ae 100644 --- a/SignalMessaging/utils/ThreadUtil.m +++ b/SignalMessaging/utils/ThreadUtil.m @@ -71,6 +71,22 @@ NS_ASSUME_NONNULL_BEGIN linkPreviewDraft:(nullable nullable OWSLinkPreviewDraft *)linkPreviewDraft transaction:(YapDatabaseReadTransaction *)transaction { + + NSString *truncatedText; + SignalAttachment *_Nullable oversizeTextAttachment; + + if ([text lengthOfBytesUsingEncoding:NSUTF8StringEncoding] >= kOversizeTextMessageSizeThreshold) { + truncatedText = [text truncatedToByteCount:kOversizeTextMessageSizeThreshold]; + DataSource *_Nullable dataSource = [DataSourceValue dataSourceWithOversizeText:text]; + if (dataSource) { + oversizeTextAttachment = + [SignalAttachment attachmentWithDataSource:dataSource dataUTI:kOversizeTextAttachmentUTI]; + } + } else { + truncatedText = text; + oversizeTextAttachment = nil; + } + OWSDisappearingMessagesConfiguration *configuration = [OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:thread.uniqueId transaction:transaction];