Message forwarding.

This commit is contained in:
Matthew Chen 2019-10-23 13:03:41 -03:00
parent 26435359ba
commit cfd705c64e
4 changed files with 19 additions and 18 deletions

View File

@ -5409,26 +5409,27 @@ typedef enum : NSUInteger {
#pragma mark - ForwardMessageDelegate
- (void)forwardMessageFlowDidComplete:(NSArray<TSThread *> *)threads
- (void)forwardMessageFlowDidCompleteWithThreads:(NSArray<TSThread *> *)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<TSThread *> *)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];

View File

@ -6,7 +6,6 @@ import PromiseKit
@objc
public protocol ForwardMessageDelegate: AnyObject {
@objc(forwardMessageFlowDidComplete:)
func forwardMessageFlowDidComplete(threads: [TSThread])
func forwardMessageFlowDidCancel()
}

View File

@ -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;

View File

@ -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;
}