From 67a4a1500780cf76fa7d37971fbcd5519d3f4b2d Mon Sep 17 00:00:00 2001 From: Ryan Slobojan Date: Sat, 23 Oct 2021 18:51:36 -0400 Subject: [PATCH] Added new provinces and states to the list of accepted regions * Added links to NL and PEI proof-of-vaccination portals * Fixed Wallet and Pay buttons not looking disabled when inactive * Bumped version to 2.2.1 * Some dead code removal and warning cleanup * We need to find a better way to list regions - it's turning into an eternal run-on sentence, hard to identify supported regions --- components/Form.tsx | 74 +++++++----------------------------- components/Page.tsx | 2 +- package.json | 2 +- pages/index.tsx | 4 +- public/locales/en/common.yml | 2 +- public/locales/en/faq.yml | 2 +- src/sentry.ts | 2 +- 7 files changed, 20 insertions(+), 68 deletions(-) diff --git a/components/Form.tsx b/components/Form.tsx index a0914f3..9cc771f 100644 --- a/components/Form.tsx +++ b/components/Form.tsx @@ -43,8 +43,10 @@ const options = [ { label: 'Alberta', value: 'https://covidrecords.alberta.ca/form'}, { label: 'British Columbia', value: 'https://www.healthgateway.gov.bc.ca/vaccinecard'}, { label: 'Ontario', value: 'https://covid19.ontariohealth.ca'}, + { label: 'Newfoundland and Labrador', value: 'https://vaccineportal.nlchi.nl.ca/'}, { label: 'Northwest Territories', value: 'https://www.gov.nt.ca/covid-19/en/request/proof-vaccination'}, { label: 'Nova Scotia', value: 'https://novascotia.flow.canimmunize.ca/en/portal'}, + { label: 'Prince Edward Island', value: 'https://pei.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'}, @@ -66,7 +68,6 @@ function Form(): JSX.Element { const [qrCode, setQrCode] = useState(undefined); const [file, setFile] = useState(undefined); const [payloadBody, setPayloadBody] = useState(undefined); - const [photoBlob, setPhotoBlob] = useState(undefined); const [saveLoading, setSaveLoading] = useState(false); const [fileLoading, setFileLoading] = useState(false); @@ -186,7 +187,7 @@ function Form(): JSX.Element { inputFile.current.click(); } - async function goToFAQ(e) { + async function goToFAQ(e : any) { e.preventDefault(); window.location.href = '/faq'; } @@ -313,18 +314,8 @@ function Form(): JSX.Element { try { if (payloadBody) { - let selectedReceipt; - let filenameDetails = ''; - if (payloadBody.rawData.length > 0) { - // This is an SHC receipt, so do our SHC thing - selectedReceipt = payloadBody.shcReceipt; - filenameDetails = selectedReceipt.cardOrigin.replace(' ', '-'); - } else { - selectedReceipt = payloadBody.receipts[selectedDose]; - const vaxName = selectedReceipt.vaccineName.replace(' ', '-'); - const passDose = selectedReceipt.numDoses; - filenameDetails = `${vaxName}-${passDose}`; - } + const selectedReceipt = payloadBody.shcReceipt; + const filenameDetails = selectedReceipt.cardOrigin.replace(' ', '-'); const passName = selectedReceipt.name.replace(' ', '-'); const covidPassFilename = `grassroots-receipt-${passName}-${filenameDetails}.pkpass`; @@ -358,9 +349,9 @@ function Form(): JSX.Element { } // Add Pass to Google Pay - async function addToGooglePay() { + async function addToGooglePay(e : any) { - event.preventDefault(); + e.preventDefault(); setSaveLoading(true); if (!file && !qrCode) { @@ -371,15 +362,6 @@ function Form(): JSX.Element { try { if (payloadBody) { - - let selectedReceipt; - if (payloadBody.rawData.length > 0) { // shc stuff - const sortedKeys = Object.keys(payloadBody.shcReceipt.vaccinations).sort(); // pickup the last key in the receipt table - const lastKey = sortedKeys[sortedKeys.length - 1]; - selectedReceipt = payloadBody.shcReceipt.vaccinations[lastKey]; - } else { - selectedReceipt = payloadBody.receipts[selectedDose]; - } console.log('> increment count'); await incrementCount(); @@ -435,15 +417,13 @@ function Form(): JSX.Element { document.getElementById('shc-image-header').hidden = false; console.log('made canvas visible'); - const newPhotoBlob = await Photo.generateSHCPass(payloadBody, shouldRegister); + await Photo.generateSHCPass(payloadBody, shouldRegister); console.log('generated blob'); - setPhotoBlob(newPhotoBlob); } console.log('done photo render'); } catch (e) { Sentry.captureException(e); - setPhotoBlob(undefined); setAddErrorMessage(e.message); } } @@ -452,36 +432,7 @@ function Form(): JSX.Element { await renderPhoto(payloadBody, false); } - async function saveAsPhoto() { - - setSaveLoading(true); - - if (!file && !qrCode) { - setAddErrorMessage('noFileOrQrCode'); - setSaveLoading(false); - return; - } - - try { - // This is an SHC receipt, so do our SHC thing - const selectedReceipt = payloadBody.shcReceipt; - const filenameDetails = selectedReceipt.cardOrigin.replace(' ', '-'); - const passName = selectedReceipt.name.replace(' ', '-'); - const covidPassFilename = `grassroots-receipt-${passName}-${filenameDetails}.png`; - - await incrementCount(); - - saveAs(photoBlob, covidPassFilename); - - setSaveLoading(false); - } catch (e) { - Sentry.captureException(e); - - setAddErrorMessage(e.message); - setSaveLoading(false); - } - } - const setDose = (e) => { + const setDose = (e : any) => { setSelectedDose(e.target.value); } @@ -634,14 +585,15 @@ function Form(): JSX.Element {
- -
diff --git a/package.json b/package.json index c34986e..b22afc9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grassroots_covidpass", - "version": "2.2.0", + "version": "2.2.1", "author": "Billy Lo ", "license": "MIT", "private": false, diff --git a/pages/index.tsx b/pages/index.tsx index 24af6d3..ffa18eb 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -42,8 +42,8 @@ function Index(): JSX.Element { }, []); - const title = 'Grassroots - vaccination QR Code import for Apple and Android devices. Supports BC AB SK MB ON QC NS YK NT NY NJ CA LA VA HI UT DE'; - const description = 'Grassroots imports vaccination QR codes and stores them on Apple and Android devices in a convenient, secure, and privacy-respecting way. Supports SHC QR codes from BC AB SK MB ON QC NS YK NT NY NJ CA LA VA HI UT DE'; + const title = 'Grassroots - vaccination QR Code import for Apple and Android devices. Supports BC AB SK MB ON QC NS PE NL YK NT NY NJ CA LA VA HI UT KY OK NV NM DE'; + const description = 'Grassroots imports vaccination QR codes and stores them on Apple and Android devices in a convenient, secure, and privacy-respecting way. Supports SHC QR codes from BC AB SK MB ON QC NS PE NL YK NT NY NJ CA LA VA HI UT KY OK NV NM DE'; return ( <> diff --git a/public/locales/en/common.yml b/public/locales/en/common.yml index b6fac00..70ac549 100644 --- a/public/locales/en/common.yml +++ b/public/locales/en/common.yml @@ -1,6 +1,6 @@ title: Vaccination Receipt to Mobile Wallets subtitle: This utility (created by volunteers) copies your proof-of-vaccination QR code into either Apple Wallet (for iOS 15+), Google Pay Wallet (for Android 8.1+), or a Photo pass (for all others) for easy access. -subtitle2: We now support importing QR codes from Ontario, British Columbia, Québec, Alberta, Nova Scotia, Saskatchewan, Yukon, Northwest Territories, California, New York, Louisiana, New Jersey, Hawaii, Virginia, Utah, and Delaware! +subtitle2: We now support importing QR codes from Ontario, British Columbia, Québec, Alberta, Nova Scotia, Saskatchewan, Yukon, Northwest Territories, Newfoundland and Labrador, Prince Edward Island, California, New York, Louisiana, New Jersey, Hawaii, Virginia, Utah, Kentucky, Oklahoma, New Mexico, Nevada, Connecticut, and Delaware! continueSpirit: Continuing the spirit of ❤️ @VaxHuntersCanada ❤️ privacyPolicy: Privacy Policy gitHub: GitHub diff --git a/public/locales/en/faq.yml b/public/locales/en/faq.yml index 351161e..a55ab5b 100644 --- a/public/locales/en/faq.yml +++ b/public/locales/en/faq.yml @@ -28,7 +28,7 @@ familyA: Yes. You can save multiple Apple Wallet, Google Pay, or Photo cards on freeQ: Is this free and non-commercial? freeA: Similar to %s, there are no commercial interests. Just volunteers trying to do our part to help the community. otherProvincesQ: How about support for other provinces or US states? -otherProvincesA: We now have support for Ontario, British Columbia, Québec, Alberta, Saskatchewan, Nova Scotia, Yukon, Northwest Territories, California, New York, New Jersey, Louisiana, Hawaii, Virginia, Utah, and Delaware QR codes. If you have a QR code that is not currently supported by our app, please contact us at %s +otherProvincesA: We now have support for Ontario, British Columbia, Québec, Alberta, Saskatchewan, Nova Scotia, Yukon, Northwest Territories, Newfoundland and Labrador, Prince Edward Island, California, New York, New Jersey, Louisiana, Hawaii, Virginia, Utah, Kentucky, Oklahoma, New Mexico, Nevada, Connecticut, and Delaware QR codes. If you have a QR code that is not currently supported by our app, please contact us at %s appleWatchQ: How about Apple Watch? appleWatchA: If you have iCloud sync enabled, you will see the pass on the watch too. Please be aware though that the new QR codes may be too large to display accurately on older Apple Watches due to their screen size. whyQ: Why have we taken time to build this? diff --git a/src/sentry.ts b/src/sentry.ts index 7e34a8e..9d5eade 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.2.0', // App version. Needs to be manually updated as we go unless we make the build smarter + release: 'grassroots_covidpass@2.2.1', // 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(),