diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 9641b6c824..6b72b3004a 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -5409,26 +5409,27 @@ typedef enum : NSUInteger { #pragma mark - ForwardMessageDelegate -- (void)forwardMessageFlowDidComplete:(NSArray *)threads +- (void)forwardMessageFlowDidCompleteWithThreads:(NSArray *)threads { __weak ConversationViewController *weakSelf = self; [self dismissViewControllerAnimated:true completion:^{ - ConversationViewController *_Nullable strongSelf = weakSelf; - if (strongSelf == nil) { - return; - } - if (threads.count > 1) { - return; - } - TSThread *thread = threads.firstObject; - if ([thread.uniqueId isEqualToString:strongSelf.thread.uniqueId]) { - return; - } - [SignalApp.sharedApp presentConversationForThread:thread animated:YES]; + [weakSelf didForwardMessageToThreads:threads]; }]; } +- (void)didForwardMessageToThreads:(NSArray *)threads +{ + if (threads.count > 1) { + return; + } + TSThread *thread = threads.firstObject; + if ([thread.uniqueId isEqualToString:strongSelf.thread.uniqueId]) { + return; + } + [SignalApp.sharedApp presentConversationForThread:thread animated:YES]; +} + - (void)forwardMessageFlowDidCancel { [self dismissViewControllerAnimated:true completion:nil]; diff --git a/Signal/src/ViewControllers/ForwardMessageNavigationController.swift b/Signal/src/ViewControllers/ForwardMessageNavigationController.swift index d5cc82821c..03955eff9c 100644 --- a/Signal/src/ViewControllers/ForwardMessageNavigationController.swift +++ b/Signal/src/ViewControllers/ForwardMessageNavigationController.swift @@ -6,7 +6,6 @@ import PromiseKit @objc public protocol ForwardMessageDelegate: AnyObject { - @objc(forwardMessageFlowDidComplete:) func forwardMessageFlowDidComplete(threads: [TSThread]) func forwardMessageFlowDidCancel() } diff --git a/SignalMessaging/utils/ThreadUtil.h b/SignalMessaging/utils/ThreadUtil.h index 8d8a945010..fee2eed315 100644 --- a/SignalMessaging/utils/ThreadUtil.h +++ b/SignalMessaging/utils/ThreadUtil.h @@ -68,10 +68,6 @@ NS_ASSUME_NONNULL_BEGIN error:(NSError **)error; + (TSOutgoingMessage *)enqueueMessageWithContactShare:(OWSContact *)contactShare inThread:(TSThread *)thread; - - inThread:(TSThread *)thread - transaction:(SDSAnyReadTransaction *)transaction; - + (void)enqueueLeaveGroupMessageInThread:(TSGroupThread *)thread; + (TSOutgoingMessage *)enqueueMessageWithSticker:(StickerInfo *)stickerInfo inThread:(TSThread *)thread; diff --git a/SignalMessaging/utils/ThreadUtil.m b/SignalMessaging/utils/ThreadUtil.m index e63afaa49c..aa95b61036 100644 --- a/SignalMessaging/utils/ThreadUtil.m +++ b/SignalMessaging/utils/ThreadUtil.m @@ -194,6 +194,11 @@ typedef void (^BuildOutgoingMessageCompletionBlock)(TSOutgoingMessage *savedMess messageSticker:nil isViewOnceMessage:NO]; + [self.databaseStorage asyncWriteWithBlock:^(SDSAnyWriteTransaction *transaction) { + [message anyInsertWithTransaction:transaction]; + [self.messageSenderJobQueue addMessage:message.asPreparer transaction:transaction]; + }]; + return message; }