From 1b2d5309b8b5dcb54223f88e02d53d618e935abb Mon Sep 17 00:00:00 2001 From: Coteh <3276350+Coteh@users.noreply.github.com> Date: Sun, 26 Sep 2021 21:10:32 -0400 Subject: [PATCH] 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 --- components/Form.tsx | 2 +- src/process.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Form.tsx b/components/Form.tsx index 67bf46c..cecb600 100644 --- a/components/Form.tsx +++ b/components/Form.tsx @@ -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); diff --git a/src/process.ts b/src/process.ts index 0191ff1..60af42e 100644 --- a/src/process.ts +++ b/src/process.ts @@ -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';