Add support for iPhone 6 iOS 12.5

- Using the legacy build of PdfJS allows for the Select File button to open the file dialog on iPhone 6 12.5.4. It also fixes the Ontario Ministry of Health button and an error that appears due to PdfJS import when opening the app in dev mode.
- Fix selected files not being used when selected on iOS devices. Safari on these devices currently does not support "input" event on selected file change. "change" event should be used to support these devices. https://stackoverflow.com/a/58342757 https://caniuse.com/input-event
This commit is contained in:
Coteh 2021-09-26 21:10:32 -04:00
parent 884ba7bbec
commit 1b2d5309b8
2 changed files with 2 additions and 2 deletions

View File

@ -106,7 +106,7 @@ function Form(): JSX.Element {
// Add event listener to listen for file change events
useEffect(() => {
if (inputFile && inputFile.current) {
inputFile.current.addEventListener('input', () => {
inputFile.current.addEventListener('change', () => {
let selectedFile = inputFile.current.files[0];
if (selectedFile !== undefined) {
setQrCode(undefined);

View File

@ -1,5 +1,5 @@
import {PayloadBody, Receipt} from "./payload";
import * as PdfJS from 'pdfjs-dist'
import * as PdfJS from 'pdfjs-dist/legacy/build/pdf'
import {COLORS} from "./colors";
import { getCertificatesInfoFromPDF } from "@ninja-labs/verify-pdf"; // ES6
import * as Sentry from '@sentry/react';