From d24c7d8df7fd3318ae847b4fb3356f0fefd22018 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Fri, 25 Oct 2019 17:41:30 +0200 Subject: [PATCH] fix: it takes too much time to share file the first time --- Classes/ChatConversationView.m | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index e647e5748..12f66828e 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -423,25 +423,22 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)confirmShare:(NSData *)data url:(NSString *)url fileName:(NSString *)fileName assetId:(NSString *)phAssetId { - DTActionSheet *sheet = [[DTActionSheet alloc] initWithTitle:NSLocalizedString(@"", nil)]; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - [sheet addButtonWithTitle:@"send to this friend" - block:^() { - if (![[self.messageField text] isEqualToString:@""]) { - [self sendMessageInMessageField]; - } - if (url) - [self sendMessage:url withExterlBodyUrl:nil withInternalURL:nil]; - else if (fileName) - [self startFileUpload:data withName:fileName]; - else - [self startFileUpload:data assetId:phAssetId]; - }]; + DTActionSheet *sheet = [[DTActionSheet alloc] initWithTitle:@""]; + dispatch_async(dispatch_get_main_queue(), ^{ + [sheet addButtonWithTitle:NSLocalizedString(@"Send to this friend", nil) + block:^() { + if (![[self.messageField text] isEqualToString:@""]) { + [self sendMessageInMessageField]; + } + if (url) + [self sendMessage:url withExterlBodyUrl:nil withInternalURL:nil]; + else if (fileName) + [self startFileUpload:data withName:fileName]; + else + [self startFileUpload:data assetId:phAssetId];}]; [sheet addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil) block:nil]; - dispatch_async(dispatch_get_main_queue(), ^{ - [sheet showInView:PhoneMainView.instance.view]; - }); + [sheet showInView:PhoneMainView.instance.view]; }); }