Revert D6437807: [react-native][PR] Generalize ActionSheetManager items URL
Differential Revision: D6437807 fbshipit-source-id: 2d859c7e4d88950ec070813ec40f08685a5d6b44
This commit is contained in:
parent
c465599a27
commit
dab313a0de
|
@ -133,17 +133,11 @@ RCT_EXPORT_METHOD(showShareActionSheetWithOptions:(NSDictionary *)options
|
|||
if (message) {
|
||||
[items addObject:message];
|
||||
}
|
||||
NSArray<NSURL *> *URLS = [RCTConvert NSURLArray:options[@"url"]];
|
||||
|
||||
if (URLS.count == 0) {
|
||||
RCTLogError(@"No `url` or `message` to share");
|
||||
return;
|
||||
}
|
||||
|
||||
for (NSURL *url in URLS) {
|
||||
if ([url.scheme.lowercaseString isEqualToString:@"data"]) {
|
||||
NSURL *URL = [RCTConvert NSURL:options[@"url"]];
|
||||
if (URL) {
|
||||
if ([URL.scheme.lowercaseString isEqualToString:@"data"]) {
|
||||
NSError *error;
|
||||
NSData *data = [NSData dataWithContentsOfURL:url
|
||||
NSData *data = [NSData dataWithContentsOfURL:URL
|
||||
options:(NSDataReadingOptions)0
|
||||
error:&error];
|
||||
if (!data) {
|
||||
|
@ -152,9 +146,13 @@ RCT_EXPORT_METHOD(showShareActionSheetWithOptions:(NSDictionary *)options
|
|||
}
|
||||
[items addObject:data];
|
||||
} else {
|
||||
[items addObject:url];
|
||||
[items addObject:URL];
|
||||
}
|
||||
}
|
||||
if (items.count == 0) {
|
||||
RCTLogError(@"No `url` or `message` to share");
|
||||
return;
|
||||
}
|
||||
|
||||
UIActivityViewController *shareController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
|
||||
|
||||
|
|
Loading…
Reference in New Issue