fix: fix IOS MetaData (#134)

* changes to fix IOS MetaData

* chore: fix formatting

Co-authored-by: Bartol Karuza <bartol.k@gmail.com>
This commit is contained in:
Jack 2020-02-08 10:17:48 +08:00 committed by GitHub
parent 34444b21b3
commit e70cff5429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 15 deletions

View File

@ -140,7 +140,7 @@ RCT_EXPORT_METHOD(saveToCameraRoll:(NSURLRequest *)request
if ([options[@"type"] isEqualToString:@"video"]) {
assetRequest = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:inputURI];
} else {
assetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:inputImage];
assetRequest = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:inputURI];
}
placeholder = [assetRequest placeholderForCreatedAsset];
if (![options[@"album"] isEqualToString:@""]) {
@ -189,20 +189,8 @@ RCT_EXPORT_METHOD(saveToCameraRoll:(NSURLRequest *)request
};
void (^loadBlock)(void) = ^void() {
if ([options[@"type"] isEqualToString:@"video"]) {
inputURI = request.URL;
saveWithOptions();
} else {
[[self.bridge moduleForName:@"ImageLoader" lazilyLoadIfNecessary:YES] loadImageWithURLRequest:request callback:^(NSError *error, UIImage *image) {
if (error) {
reject(kErrorUnableToLoad, nil, error);
return;
}
inputImage = image;
saveWithOptions();
}];
}
inputURI = request.URL;
saveWithOptions();
};
requestPhotoLibraryAccess(reject, loadBlock);