Fix video editing for existing messages

This commit is contained in:
Ilya Laktyushin 2021-02-22 21:26:18 +04:00
parent b8c06ddffe
commit 37947173d9
2 changed files with 10 additions and 1 deletions

View File

@ -40,6 +40,13 @@
self = [super init];
if (self != nil)
{
if (![url.absoluteString.lowercaseString hasSuffix:@".mp4"]) {
NSURL *pathUrl = [NSURL fileURLWithPath:[[[LegacyComponentsGlobals provider] dataStoragePath] stringByAppendingPathComponent:@"videos"]];
[[NSFileManager defaultManager] createDirectoryAtPath:pathUrl.path withIntermediateDirectories:true attributes:nil error:nil];
NSURL *updatedUrl = [pathUrl URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.mp4", [TGStringUtils md5:url.absoluteString]]];
[[NSFileManager defaultManager] createSymbolicLinkAtPath:updatedUrl.path withDestinationPath:url.path error:nil];
url = updatedUrl;
}
_cachedAVAsset = [[AVURLAsset alloc] initWithURL:url options:nil];
_cachedSize = CGSizeZero;
_cachedDuration = 0.0;

View File

@ -204,7 +204,9 @@
}
};
[model.interfaceView immediateEditorTransitionIn];
if (paint) {
[model.interfaceView immediateEditorTransitionIn];
}
for (UIView *view in snapshots) {
[galleryController.view addSubview:view];