mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 01:22:46 +02:00
Delete video files in temp folder when the upload is done or has failed
This commit is contained in:
@@ -3560,13 +3560,35 @@ static const CGFloat kCellVisibilityMinimumHeight = 8.0;
|
||||
- (void)roomInputToolbarView:(MXKRoomInputToolbarView*)toolbarView sendVideoAsset:(AVAsset*)videoAsset withThumbnail:(UIImage*)videoThumbnail
|
||||
{
|
||||
// Let the datasource send it and manage the local echo
|
||||
[roomDataSource sendVideoAsset:videoAsset withThumbnail:videoThumbnail success:nil failure:^(NSError *error)
|
||||
{
|
||||
[roomDataSource sendVideoAsset:videoAsset withThumbnail:videoThumbnail success:^(NSString *eventId) {
|
||||
// bwi: 5365
|
||||
NSURL *url = [(AVURLAsset *)videoAsset URL];
|
||||
if(url) {
|
||||
[self deleteFileAtURL: url];
|
||||
}
|
||||
} failure:^(NSError *error) {
|
||||
// Nothing to do. The video is marked as unsent in the room history by the datasource
|
||||
MXLogDebug(@"[MXKRoomViewController] sendVideo failed.");
|
||||
// bwi: 5365
|
||||
NSURL *url = [(AVURLAsset *)videoAsset URL];
|
||||
if(url) {
|
||||
[self deleteFileAtURL: url];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)deleteFileAtURL:(NSURL *)url {
|
||||
if (url == nil) {
|
||||
return;
|
||||
}
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSError *error = nil;
|
||||
if (![fileManager removeItemAtURL:url error:&error]) {
|
||||
MXLogDebug(@"Cannot delete file at %@", [url absoluteString])
|
||||
MXLogDebug(@"%@", [error localizedDescription])
|
||||
}
|
||||
}
|
||||
|
||||
- (void)roomInputToolbarView:(MXKRoomInputToolbarView*)toolbarView sendFile:(NSURL *)fileLocalURL withMimeType:(NSString*)mimetype
|
||||
{
|
||||
// Let the datasource send it and manage the local echo
|
||||
|
||||
Reference in New Issue
Block a user