callback to js with more info
This commit is contained in:
parent
2a4f155601
commit
aeefe87ada
|
@ -31,7 +31,7 @@
|
|||
* on the same Wi-Fi network.
|
||||
*/
|
||||
|
||||
jsCodeLocation = [NSURL URLWithString:@"http://172.31.9.92:8081/index.ios.bundle?platform=ios&dev=true"];
|
||||
jsCodeLocation = [NSURL URLWithString:@"http://172.31.9.77:8081/index.ios.bundle?platform=ios&dev=true"];
|
||||
|
||||
/**
|
||||
* OPTION 2
|
||||
|
|
|
@ -417,16 +417,24 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
|
|||
[PHPhotoLibrary requestAuthorization:^( PHAuthorizationStatus status ) {
|
||||
if ( status == PHAuthorizationStatusAuthorized ) {
|
||||
|
||||
NSMutableDictionary *imageInfoDict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
NSURL *temporaryFileURL = [self saveToTmpFolder:imageData];
|
||||
if (temporaryFileURL) {
|
||||
imageInfoDict[@"uri"] = temporaryFileURL.description;
|
||||
imageInfoDict[@"name"] = temporaryFileURL.lastPathComponent;
|
||||
}
|
||||
|
||||
imageInfoDict[@"size"] = [NSNumber numberWithInteger:imageData.length];
|
||||
|
||||
|
||||
|
||||
if (shouldSaveToCameraRoll) {
|
||||
|
||||
[self saveImageToCameraRoll:imageData temporaryFileURL:temporaryFileURL];
|
||||
}
|
||||
|
||||
if (block) {
|
||||
block(temporaryFileURL.description);
|
||||
block(imageInfoDict);
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
@ -755,7 +763,7 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
|
|||
{
|
||||
// CGPoint devicePoint = CGPointMake( 0.5, 0.5 );
|
||||
// [self focusWithMode:AVCaptureFocusModeContinuousAutoFocus exposeWithMode:AVCaptureExposureModeContinuousAutoExposure atDevicePoint:devicePoint monitorSubjectAreaChange:NO];
|
||||
// NSLog(@"subjectAreaDidChange");
|
||||
// NSLog(@"subjectAreaDidChange");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,6 +100,12 @@ RCT_EXPORT_MODULE();
|
|||
NSMutableDictionary *albumsDict = [[NSMutableDictionary alloc] init];
|
||||
NSInteger collectionCount = collections.count;
|
||||
|
||||
if (collectionCount == 0) {
|
||||
if (block) {
|
||||
block(nil);
|
||||
}
|
||||
}
|
||||
|
||||
[collections enumerateObjectsUsingBlock:^(PHAssetCollection *collection, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
|
||||
[self extractCollection:collection imageRequestOptions:options thumbnailSize:thumbnailSize block:^(NSDictionary *album) {
|
||||
|
|
|
@ -181,29 +181,10 @@ static NSString * const CellReuseIdentifier = @"Cell";
|
|||
[self.selectedAssets addObject:asset];
|
||||
}
|
||||
}
|
||||
|
||||
// [self.imageManager requestImageDataForAsset:asset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
|
||||
//
|
||||
// self.selectedImagesUrls addObject:
|
||||
//
|
||||
//
|
||||
// }];
|
||||
|
||||
// [asset requestContentEditingInputWithOptions:nil
|
||||
// completionHandler:^(PHContentEditingInput * _Nullable contentEditingInput, NSDictionary * _Nonnull info)
|
||||
// {
|
||||
// [self.selectedImagesUrls removeObject:contentEditingInput.fullSizeImageURL.description];
|
||||
//
|
||||
//
|
||||
// if (ckCell.isSelected) {
|
||||
// [self.selectedImagesUrls addObject:contentEditingInput.fullSizeImageURL.absoluteString];
|
||||
// }
|
||||
// }];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
}
|
||||
|
@ -241,6 +222,7 @@ RCT_EXPORT_METHOD(getSelectedImages:(RCTPromiseResolveBlock)resolve
|
|||
NSMutableArray *assetsUrls = [[NSMutableArray alloc] init];
|
||||
|
||||
for (PHAsset *asset in self.galleryView.selectedAssets) {
|
||||
|
||||
[self.galleryView.imageManager requestImageDataForAsset:asset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
|
||||
|
||||
NSURL *fileURLKey = info[@"PHImageFileURLKey"];
|
||||
|
@ -250,13 +232,26 @@ RCT_EXPORT_METHOD(getSelectedImages:(RCTPromiseResolveBlock)resolve
|
|||
}
|
||||
}
|
||||
|
||||
NSMutableDictionary *assetInfoDict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
NSString *fileName = ((NSURL*)info[@"PHImageFileURLKey"]).lastPathComponent;
|
||||
if (fileName) {
|
||||
assetInfoDict[@"name"] = fileName;
|
||||
}
|
||||
|
||||
float imageSize = imageData.length;
|
||||
assetInfoDict[@"size"] = [NSNumber numberWithFloat:imageSize];
|
||||
|
||||
NSURL *fileURL = [directoryURL URLByAppendingPathComponent:fileName];
|
||||
NSError *error = nil;
|
||||
[imageData writeToURL:fileURL options:NSDataWritingAtomic error:&error];
|
||||
|
||||
[assetsUrls addObject:fileURL.absoluteString];
|
||||
if (!error && fileURL) {
|
||||
assetInfoDict[@"uri"] = fileURL.absoluteString;
|
||||
}
|
||||
|
||||
|
||||
[assetsUrls addObject:assetInfoDict];
|
||||
|
||||
|
||||
if (asset == self.galleryView.selectedAssets.lastObject) {
|
||||
|
|
Loading…
Reference in New Issue