Delete video files in temp folder when the upload is done or has failed

This commit is contained in:
Arnfried Griesert
2024-02-09 09:33:50 +01:00
parent 95f2332738
commit 315e040d93
4 changed files with 42 additions and 6 deletions

View File

@@ -779,7 +779,8 @@ NSString* MXKFileSizes_description(MXKFileSizes sizes)
[self sendSelectedVideoAsset:videoAsset isPhotoLibraryAsset:isPhotoLibraryAsset];
}
- (void)sendSelectedVideoAsset:(AVAsset*)selectedVideo isPhotoLibraryAsset:(BOOL)isPhotoLibraryAsset
// bwi: added boolean return value to inform the caller if the asset could be sent to the content repository
- (BOOL)sendSelectedVideoAsset:(AVAsset*)selectedVideo isPhotoLibraryAsset:(BOOL)isPhotoLibraryAsset
{
// Check condition before saving this media in user's library
if (_enableAutoSaving && !isPhotoLibraryAsset)
@@ -799,7 +800,7 @@ NSString* MXKFileSizes_description(MXKFileSizes sizes)
{
if (![selectedVideo isKindOfClass:[AVURLAsset class]]) {
MXLogDebug(@"sendSelectedVideoAsset failed because asset is not an AVURLAsset");
return;
return false;
}
// Retrieve the video frame at 1 sec to define the video thumbnail
@@ -813,13 +814,16 @@ NSString* MXKFileSizes_description(MXKFileSizes sizes)
CFRelease(imageRef);
[self.delegate roomInputToolbarView:self sendVideoAsset:selectedVideo withThumbnail:videoThumbnail];
return true;
} else {
MXLogDebug(@"sendSelectedVideoAsset failed because imageRef is nil");
return false;
}
}
else
{
MXLogDebug(@"[RoomInputToolbarView] Attach video is not supported");
return false;
}
}