From 98c60aa3e79092e5c5c291fcf6e9d2cc077a1736 Mon Sep 17 00:00:00 2001 From: Samuel Yeung Date: Fri, 24 Sep 2021 01:53:16 -0400 Subject: [PATCH 1/4] enable non-iOS device to add to wallet with warning message --- components/Form.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/components/Form.tsx b/components/Form.tsx index 10853f9..b2d48f6 100644 --- a/components/Form.tsx +++ b/components/Form.tsx @@ -43,6 +43,7 @@ function Form(): JSX.Element { const [isDisabledAppleWallet, setIsDisabledAppleWallet] = useState(false); const [errorMessages, _setErrorMessages] = useState>([]); + const [warningMessages, _setWarningMessages] = useState>([]); const hitcountHost = 'https://stats.vaccine-ontario.ca'; @@ -84,6 +85,15 @@ function Form(): JSX.Element { _setErrorMessages(Array.from(new Set([...errorMessages, translation !== message ? translation : message]))); }; + const setWarningMessage = (message: string) => { + if (message == undefined) { + return; + } + + const translation = t('errors:'.concat(message)); + _setWarningMessages(Array.from(new Set([...warningMessages, translation !== message ? translation : message]))); + } + const deleteErrorMessage = (message: string) =>{ console.log(errorMessages) _setErrorMessages(errorMessages.filter(item => item !== message)) @@ -328,6 +338,10 @@ function Form(): JSX.Element { setErrorMessage('Sorry, only Safari can be used to add a Wallet Pass on iOS'); setIsDisabledAppleWallet(true); console.log('not safari') + } else if (!isIOS) { + setWarningMessage('Only Safari is officially supported at the moment. ' + + 'Please download a compitable apps on other platform to open .pkpass'); + setIsDisabledAppleWallet(false); } } @@ -438,6 +452,9 @@ function Form(): JSX.Element { {errorMessages.map((message, i) => )} + {warningMessages.map((message, i) => + + )} }/> @@ -446,4 +463,4 @@ function Form(): JSX.Element { ) } -export default Form; \ No newline at end of file +export default Form; From 0650e89a1fc5fae5c7047101dafa3821b74099ec Mon Sep 17 00:00:00 2001 From: Samuel Yeung Date: Fri, 24 Sep 2021 13:18:15 -0400 Subject: [PATCH 2/4] reword warning message --- components/Form.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Form.tsx b/components/Form.tsx index b2d48f6..0908da8 100644 --- a/components/Form.tsx +++ b/components/Form.tsx @@ -339,8 +339,8 @@ function Form(): JSX.Element { setIsDisabledAppleWallet(true); console.log('not safari') } else if (!isIOS) { - setWarningMessage('Only Safari is officially supported at the moment. ' + - 'Please download a compitable apps on other platform to open .pkpass'); + setWarningMessage('Only Safari on iOS is officially supported for Wallet import at the moment - ' + + 'for other platforms, please ensure you have an application which can open Apple Wallet .pkpass files'); setIsDisabledAppleWallet(false); } } From 6aafd987b6a0792e7a31db7cc4fb5f0d807a92cc Mon Sep 17 00:00:00 2001 From: Samuel Yeung Date: Fri, 24 Sep 2021 13:19:10 -0400 Subject: [PATCH 3/4] check warning message for null or empty as well in addition to undefined --- components/Form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Form.tsx b/components/Form.tsx index 0908da8..b09a37b 100644 --- a/components/Form.tsx +++ b/components/Form.tsx @@ -86,7 +86,7 @@ function Form(): JSX.Element { }; const setWarningMessage = (message: string) => { - if (message == undefined) { + if (!message) { return; } From cd5fd9a8b6eaae645b4ee5ca282beca4990c56e0 Mon Sep 17 00:00:00 2001 From: Samuel Yeung Date: Fri, 24 Sep 2021 13:19:33 -0400 Subject: [PATCH 4/4] check error message for null or empty as well in addition to undefined --- components/Form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Form.tsx b/components/Form.tsx index b09a37b..f112734 100644 --- a/components/Form.tsx +++ b/components/Form.tsx @@ -77,7 +77,7 @@ function Form(): JSX.Element { // Check if there is a translation and replace message accordingly const setErrorMessage = (message: string) => { - if (message == undefined) { + if (!message) { return; }