|
|
|
|
592
|
return;
|
592
|
return;
|
593
|
}
|
593
|
}
|
594
|
if (request.URL.host) {
|
594
|
if (request.URL.host) {
|
595
|
- [_webView loadRequest:request];
|
|
|
596
|
- }
|
|
|
597
|
- else {
|
|
|
|
|
595
|
+ NSString *path = [request.URL path];
|
|
|
596
|
+ NSString *extension = [path pathExtension];
|
|
|
597
|
+ NSString* absolutePath = request.URL.absoluteString;
|
|
|
598
|
+ if (@available(iOS 13, *) && [extension caseInsensitiveCompare:@"pdf"] == NSOrderedSame) {
|
|
|
599
|
+ NSData *pdfData = [NSData dataWithContentsOfURL:request.URL];
|
|
|
600
|
+ [self.webView loadData:pdfData MIMEType:@"application/pdf" characterEncodingName:[NSString string] baseURL:[NSURL URLWithString:absolutePath]];
|
|
|
601
|
+
|
|
|
602
|
+ } else {
|
|
|
603
|
+ [_webView loadRequest:request];
|
|
|
604
|
+ }
|
|
|
605
|
+ } else {
|
598
|
NSURL* readAccessUrl = _allowingReadAccessToURL ? [RCTConvert NSURL:_allowingReadAccessToURL] : request.URL;
|
606
|
NSURL* readAccessUrl = _allowingReadAccessToURL ? [RCTConvert NSURL:_allowingReadAccessToURL] : request.URL;
|
599
|
[_webView loadFileURL:request.URL allowingReadAccessToURL:readAccessUrl];
|
607
|
[_webView loadFileURL:request.URL allowingReadAccessToURL:readAccessUrl];
|
600
|
}
|
608
|
}
|