From 0a91eadb14c246c7a10fefae86051d7fc13d18f9 Mon Sep 17 00:00:00 2001 From: Ryan Slobojan Date: Mon, 18 Oct 2021 18:25:55 -0400 Subject: [PATCH] Another attempt to fix Mobile Safari not saving photo cards correctly * Moved photo card right underneath "Save as Photo" button * Update to latest html-to-image library (1.9.0) * Added 1px border to photo card * Hide photo card when camera opened or new file selected * Rev version to 2.1.5 --- components/Form.tsx | 86 +++++++++++++++++++++--------------- components/Page.tsx | 103 +------------------------------------------- package.json | 4 +- src/payload.ts | 3 -- src/sentry.ts | 2 +- 5 files changed, 55 insertions(+), 143 deletions(-) diff --git a/components/Form.tsx b/components/Form.tsx index d4eba06..b0cf057 100644 --- a/components/Form.tsx +++ b/components/Form.tsx @@ -1,9 +1,8 @@ import {saveAs} from 'file-saver'; -import React, {FormEvent, useEffect, useRef, useState, Component} from "react"; +import React, {FormEvent, useEffect, useRef, useState} from "react"; import {BrowserQRCodeReader, IScannerControls} from "@zxing/browser"; import {Result} from "@zxing/library"; import {useTranslation} from 'next-i18next'; -import Link from 'next/link'; import Card from "./Card"; import Alert from "./Alert"; @@ -25,8 +24,7 @@ const options = [ { label: 'Nova Scotia', value: 'https://novascotia.flow.canimmunize.ca/en/portal'}, { label: 'Québec', value: 'https://covid19.quebec.ca/PreuveVaccinale'}, { label: 'Saskatchewan', value: 'https://services.saskatchewan.ca/#/login'}, - { label: 'Yukon', value: 'https://service.yukon.ca/forms/en/get-covid19-proof-of-vaccination'} - + { label: 'Yukon', value: 'https://service.yukon.ca/forms/en/get-covid19-proof-of-vaccination'}, ] function Form(): JSX.Element { @@ -63,7 +61,6 @@ function Form(): JSX.Element { // const [warningMessages, _setWarningMessages] = useState>([]); const hitcountHost = 'https://stats.vaccine-ontario.ca'; - // Check if there is a translation and replace message accordingly const setAddErrorMessage = (message: string) => { if (!message) { @@ -83,21 +80,9 @@ function Form(): JSX.Element { _setFileErrorMessages(Array.from(new Set([...addErrorMessages, translation !== message ? translation : message]))); }; - // const setWarningMessage = (message: string) => { - // if (!message) { - // return; - // } - - // const translation = t('errors:'.concat(message)); - // _setWarningMessages(Array.from(new Set([...warningMessages, translation !== message ? translation : message]))); - // } - const deleteAddErrorMessage = (message: string) =>{ _setAddErrorMessages(addErrorMessages.filter(item => item !== message)) } - const deleteFileErrorMessage = (message: string) =>{ - _setFileErrorMessages(addErrorMessages.filter(item => item !== message)) - } // File Input ref const inputFile = useRef(undefined) @@ -171,16 +156,13 @@ function Form(): JSX.Element { // Clear out any currently-selected files inputFile.current.value = ''; - + + // Hide our existing pass image + document.getElementById('shc-pass-image').hidden = true; + inputFile.current.click(); } - async function gotoOntarioHealth(e) { - e.preventDefault(); - // window.open('https://covid19.ontariohealth.ca','_blank'); // this created many extra steps in mobile chrome to return to the grassroots main window... if user has many windows open, they get lost (BACK button on the same window is easier for user to return) - window.location.href = 'https://covid19.ontariohealth.ca'; - - } async function goToFAQ(e) { e.preventDefault(); window.location.href = '/faq'; @@ -259,6 +241,9 @@ function Form(): JSX.Element { ) ); + // Hide our existing pass image + document.getElementById('shc-pass-image').hidden = true; + setQrCode(undefined); setPayloadBody(undefined); setFile(undefined); @@ -407,7 +392,6 @@ function Form(): JSX.Element { setSaveLoading(false); } catch (e) { - Sentry.captureException(e); setAddErrorMessage(e.message); @@ -442,7 +426,6 @@ function Form(): JSX.Element { if (isMacOs) { setAddErrorMessage('Reminder: iOS 15+ is needed for the Apple Wallet functionality to work with Smart Health Card') return; - } if (isIOS && !isSafari) { @@ -450,7 +433,6 @@ function Form(): JSX.Element { setAddErrorMessage('Sorry, only Safari can be used to add a Wallet Pass on iOS'); setIsDisabledAppleWallet(true); return; - } // } else if (!isIOS) { // setWarningMessage('Only Safari on iOS is officially supported for Wallet import at the moment - ' + @@ -463,10 +445,6 @@ function Form(): JSX.Element { window.location.href = option.value; } - function promptTextCreator(value) { - return 'Select province...'; - } - return (
@@ -598,9 +576,48 @@ function Form(): JSX.Element { {addErrorMessages.map((message, i) => )} - {/* {warningMessages.map((message, i) => - - )} */} +
+
}/> @@ -627,7 +644,6 @@ function Form(): JSX.Element { }/> - ) } diff --git a/components/Page.tsx b/components/Page.tsx index d2faab8..dbe906d 100644 --- a/components/Page.tsx +++ b/components/Page.tsx @@ -34,114 +34,13 @@ function Page(props: PageProps): JSX.Element { {t('common:gitHub')} {t('common:returnToMainSite')} -
Last updated: 2021-10-18 (v2.1.4)
+
Last updated: 2021-10-18 (v2.1.5)



- - ) diff --git a/package.json b/package.json index 4c70f97..5c02c73 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grassroots_covidpass", - "version": "2.1.4", + "version": "2.1.5", "author": "Billy Lo ", "license": "MIT", "private": false, @@ -33,7 +33,7 @@ "file-saver": "^2.0.5", "fs-extra": "^10.0.0", "fs.promises": "^0.1.2", - "html-to-image": "^1.7.0", + "html-to-image": "^1.9.0", "html2canvas": "^1.3.2", "jpeg-js": "^0.4.3", "jsqr": "^1.4.0", diff --git a/src/payload.ts b/src/payload.ts index e74c8ba..55e5823 100644 --- a/src/payload.ts +++ b/src/payload.ts @@ -219,7 +219,4 @@ function processSHCReceipt(receipt: SHCReceipt, generic: PassDictionary) { ) } - - - } diff --git a/src/sentry.ts b/src/sentry.ts index ef290de..81633b4 100644 --- a/src/sentry.ts +++ b/src/sentry.ts @@ -3,7 +3,7 @@ import { Integrations } from '@sentry/tracing'; export const initSentry = () => { SentryModule.init({ - release: 'grassroots_covidpass@2.1.4', // App version. Needs to be manually updated as we go unless we make the build smarter + release: 'grassroots_covidpass@2.1.5', // App version. Needs to be manually updated as we go unless we make the build smarter dsn: 'https://7120dcf8548c4c5cb148cdde2ed6a778@o1015766.ingest.sentry.io/5981424', integrations: [ new Integrations.BrowserTracing(),