From 3d015540cdb112799e5b32efebf6644de4e662f4 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Mon, 28 Oct 2019 10:57:47 +0100 Subject: [PATCH] fix delete record file after sharing it --- Classes/ChatConversationView.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 12f66828e..066fe58ec 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -1171,13 +1171,14 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Info", nil) message:NSLocalizedString(@"ICloud Drive is unavailable.", nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:nil, nil] show]; return FALSE; } - - if ([fileManager fileExistsAtPath:[fileURL path]]) { - // if it exists, replace the file + + NSString *fileName = fileURL.lastPathComponent; + if ([fileManager fileExistsAtPath:[fileURL path]] || [fileName hasPrefix:@"recording"]) { + // if it exists, replace the file. If it's a record file, copy the file return [data writeToURL:fileURL atomically:TRUE]; } else { // get the url of localfile - NSString *filePath = [[LinphoneManager cacheDirectory] stringByAppendingPathComponent:fileURL.lastPathComponent]; + NSString *filePath = [[LinphoneManager cacheDirectory] stringByAppendingPathComponent:fileName]; NSURL *localURL = nil; if ([fileManager createFileAtPath:filePath contents:data attributes:nil]) { localURL = [NSURL fileURLWithPath:filePath];