Message forwarding.
This commit is contained in:
parent
26435359ba
commit
cfd705c64e
@ -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];
|
||||
|
||||
@ -6,7 +6,6 @@ import PromiseKit
|
||||
|
||||
@objc
|
||||
public protocol ForwardMessageDelegate: AnyObject {
|
||||
@objc(forwardMessageFlowDidComplete:)
|
||||
func forwardMessageFlowDidComplete(threads: [TSThread])
|
||||
func forwardMessageFlowDidCancel()
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user