|
1 | 1 | import 'core-js/proposals/promise-with-resolvers'; |
2 | 2 | // eslint-disable-next-line import/extensions |
3 | 3 | import pdfWorkerSource from 'pdfjs-dist/build/pdf.worker.min.mjs'; |
4 | | -// eslint-disable-next-line import/extensions |
5 | | -import pdfWorkerLegacySource from 'pdfjs-dist/legacy/build/pdf.worker.min.mjs'; |
6 | 4 | import React, {useMemo, useState} from 'react'; |
7 | 5 | import {View} from 'react-native'; |
8 | 6 | import {Document, pdfjs, Thumbnail} from 'react-pdf'; |
9 | 7 | import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; |
10 | 8 | import useThemeStyles from '@hooks/useThemeStyles'; |
11 | 9 | import addEncryptedAuthTokenToURL from '@libs/addEncryptedAuthTokenToURL'; |
12 | | -import {isMobileSafari, isModernSafari} from '@libs/Browser'; |
13 | 10 | import PDFThumbnailError from './PDFThumbnailError'; |
14 | 11 | import type PDFThumbnailProps from './types'; |
15 | 12 |
|
16 | | -const shouldUseLegacyWorker = isMobileSafari() && !isModernSafari(); |
17 | | -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment |
18 | | -const pdfWorker = shouldUseLegacyWorker ? pdfWorkerLegacySource : pdfWorkerSource; |
19 | | - |
20 | 13 | if (!pdfjs.GlobalWorkerOptions.workerSrc) { |
21 | | - pdfjs.GlobalWorkerOptions.workerSrc = URL.createObjectURL(new Blob([pdfWorker], {type: 'text/javascript'})); |
| 14 | + pdfjs.GlobalWorkerOptions.workerSrc = URL.createObjectURL(new Blob([pdfWorkerSource], {type: 'text/javascript'})); |
22 | 15 | } |
23 | 16 |
|
24 | 17 | function PDFThumbnail({previewSourceURL, style, isAuthTokenRequired = false, enabled = true, onPassword, onLoadError, onLoadSuccess}: PDFThumbnailProps) { |
|
0 commit comments