|
|
|
|
461
|
return;
|
461
|
return;
|
462
|
}
|
462
|
}
|
463
|
if (request.URL.host) {
|
463
|
if (request.URL.host) {
|
464
|
- [_webView loadRequest:request];
|
|
|
465
|
- }
|
|
|
466
|
- else {
|
|
|
|
|
464
|
+ NSString *path = [request.URL path];
|
|
|
465
|
+ NSString *extension = [path pathExtension];
|
|
|
466
|
+ NSString* absolutePath = request.URL.absoluteString;
|
|
|
467
|
+ if (@available(iOS 13, *) && [extension caseInsensitiveCompare:@"pdf"] == NSOrderedSame) {
|
|
|
468
|
+ NSData *pdfData = [NSData dataWithContentsOfURL:request.URL];
|
|
|
469
|
+ [self.webView loadData:pdfData MIMEType:@"application/pdf" characterEncodingName:[NSString string] baseURL:[NSURL URLWithString:absolutePath]];
|
|
|
470
|
+
|
|
|
471
|
+ } else {
|
|
|
472
|
+ [_webView loadRequest:request];
|
|
|
473
|
+ }
|
|
|
474
|
+ } else {
|
467
|
NSURL* readAccessUrl = _allowingReadAccessToURL ? [RCTConvert NSURL:_allowingReadAccessToURL] : request.URL;
|
475
|
NSURL* readAccessUrl = _allowingReadAccessToURL ? [RCTConvert NSURL:_allowingReadAccessToURL] : request.URL;
|
468
|
[_webView loadFileURL:request.URL allowingReadAccessToURL:readAccessUrl];
|
476
|
[_webView loadFileURL:request.URL allowingReadAccessToURL:readAccessUrl];
|
469
|
}
|
477
|
}
|