mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-25 07:08:11 +00:00
fix dubplicated download images
This commit is contained in:
parent
451537bfc2
commit
9fdd0f7aff
3 changed files with 6 additions and 7 deletions
|
|
@ -87,6 +87,7 @@
|
|||
@property (weak, nonatomic) IBOutlet UIButton *encryptedButton;
|
||||
|
||||
+ (void)markAsRead:(LinphoneChatRoom *)chatRoom;
|
||||
+ (void)autoDownload:(LinphoneChatMessage *)message;
|
||||
|
||||
- (void)configureForRoom:(BOOL)editing;
|
||||
- (IBAction)onBackClick:(id)event;
|
||||
|
|
@ -104,7 +105,6 @@
|
|||
- (void)clearMessageView;
|
||||
|
||||
- (void)showFileDownloadError;
|
||||
- (void)autoDownload:(LinphoneChatMessage *)message view:(ChatConversationView *)view;
|
||||
- (NSURL *)getICloudFileUrl:(NSString *)name;
|
||||
- (BOOL)writeFileInICloud:(NSData *)data fileURL:(NSURL *)fileURL;
|
||||
|
||||
|
|
|
|||
|
|
@ -1065,7 +1065,6 @@ void on_chat_room_chat_message_received(LinphoneChatRoom *cr, const LinphoneEven
|
|||
return;
|
||||
|
||||
if (hasFile) {
|
||||
[view autoDownload:chat view:view];
|
||||
[view.tableController addEventEntry:(LinphoneEventLog *)event_log];
|
||||
return;
|
||||
}
|
||||
|
|
@ -1291,7 +1290,8 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)autoDownload:(LinphoneChatMessage *)message view:(ChatConversationView *)view {
|
||||
+ (void)autoDownload:(LinphoneChatMessage *)message {
|
||||
ChatConversationView *view = VIEW(ChatConversationView);
|
||||
//TODO: migrate with "linphone_iphone_file_transfer_recv"
|
||||
LinphoneContent *content = linphone_chat_message_get_file_transfer_information(message);
|
||||
NSString *name = [NSString stringWithUTF8String:linphone_content_get_name(content)];
|
||||
|
|
@ -1308,7 +1308,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
// we're finished, save the image and update the message
|
||||
UIImage *image = [UIImage imageWithData:data];
|
||||
if (!image) {
|
||||
[self showFileDownloadError];
|
||||
[view showFileDownloadError];
|
||||
return;
|
||||
}
|
||||
__block PHObjectPlaceholder *placeHolder;
|
||||
|
|
@ -1396,7 +1396,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
} else {
|
||||
NSString *key = @"localfile";
|
||||
//write file to path
|
||||
if([self writeFileInICloud:data fileURL:[self getICloudFileUrl:name]]) {
|
||||
if([view writeFileInICloud:data fileURL:[view getICloudFileUrl:name]]) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[LinphoneManager setValueInMessageAppData:name forKey:key inMessage:message];
|
||||
//[LinphoneManager setValueInMessageAppData:filePath forKey:@"cachedfile" inMessage:message];
|
||||
|
|
|
|||
|
|
@ -1153,8 +1153,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
|
|||
return;
|
||||
|
||||
if (hasFile) {
|
||||
ChatConversationView *view = VIEW(ChatConversationView);
|
||||
[view autoDownload:msg view:nil];
|
||||
[ChatConversationView autoDownload:msg];
|
||||
}
|
||||
|
||||
// Post event
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue