|
@@ -1432,13 +1432,11 @@
|
|
|
|
|
|
+ (void)extractImageVideoFromAssetLocalIdentifierForUpload:(tableMetadata *)metadata notification:(BOOL)notification completion:(void(^)(tableMetadata *newMetadata, NSString* fileNamePath))completion
|
|
|
{
|
|
|
- tableMetadata *newMetadata = [[NCManageDatabase sharedInstance] copyObjectWithMetadata:metadata];
|
|
|
- tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", metadata.account]];
|
|
|
-
|
|
|
- if (tableAccount == nil) {
|
|
|
+ if ([[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", metadata.account]] == nil) {
|
|
|
completion(nil, nil);
|
|
|
return;
|
|
|
}
|
|
|
+ NSString *ocId = metadata.ocId;
|
|
|
|
|
|
PHFetchResult *result = [PHAsset fetchAssetsWithLocalIdentifiers:@[metadata.assetLocalIdentifier] options:nil];
|
|
|
if (!result.count) {
|
|
@@ -1490,6 +1488,9 @@
|
|
|
|
|
|
[[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
|
|
|
|
|
|
+ tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"ocId == %@", ocId]];
|
|
|
+ tableMetadata *newMetadata = [[NCManageDatabase sharedInstance] copyObjectWithMetadata:metadata];
|
|
|
+
|
|
|
NSError *error = nil;
|
|
|
NSString *extensionAsset = [[[asset valueForKey:@"filename"] pathExtension] uppercaseString];
|
|
|
NSString *fileName = metadata.fileNameView;
|
|
@@ -1547,7 +1548,10 @@
|
|
|
[[PHImageManager defaultManager] requestAVAssetForVideo:asset options:options resultHandler:^(AVAsset *asset, AVAudioMix *audioMix, NSDictionary *info) {
|
|
|
|
|
|
if ([asset isKindOfClass:[AVURLAsset class]]) {
|
|
|
-
|
|
|
+
|
|
|
+ tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"ocId == %@", ocId]];
|
|
|
+ tableMetadata *newMetadata = [[NCManageDatabase sharedInstance] copyObjectWithMetadata:metadata];
|
|
|
+
|
|
|
NSString *fileNamePath = [NSTemporaryDirectory() stringByAppendingString:newMetadata.fileNameView];
|
|
|
NSURL *fileNamePathURL = [[NSURL alloc] initFileURLWithPath:fileNamePath];
|
|
|
NSError *error = nil;
|