Skip to content

Commit fead831

Browse files
authored
Merge pull request #736 from wymsee/ph-uri
Added support for ph:// uris to copyAssetsFileIOS
2 parents a77e79a + 026b301 commit fead831

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ android/*.iml
2929
android/local.properties
3030
android/.settings
3131
android/.project
32+
Session.vim

RNFSManager.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,12 @@ + (BOOL)requiresMainQueueSetup
758758
CGSize size = CGSizeMake(width, height);
759759

760760
NSURL* url = [NSURL URLWithString:imageUri];
761-
PHFetchResult *results = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
761+
PHFetchResult *results = nil;
762+
if ([url.scheme isEqualToString:@"ph"]) {
763+
results = [PHAsset fetchAssetsWithLocalIdentifiers:@[[imageUri substringFromIndex: 5]] options:nil];
764+
} else {
765+
results = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
766+
}
762767

763768
if (results.count == 0) {
764769
NSString *errorText = [NSString stringWithFormat:@"Failed to fetch PHAsset with local identifier %@ with no error message.", imageUri];

0 commit comments

Comments
 (0)