Skip to content

Commit

Permalink
Merge pull request #1722 from tw-mosip/injimob-2462-fix-error-cta-not…
Browse files Browse the repository at this point in the history
…-working-dev

[INJIMOB-2462] fix error screen CTAs not working in VC download flow
  • Loading branch information
sree96 authored Dec 2, 2024
2 parents 324349b + 381a34b commit 997e700
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 30 deletions.
2 changes: 1 addition & 1 deletion locales/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
},
"technicalDifficulty": {
"title": "حدث خطأ!",
"message": "شكرًا على صبرك! نحن نواجه صعوبات تقنية في الوقت الحالي. يُرجى المحاولة مرة أخرى لاحقًا أو الاتصال بالمسؤول للحصول على مزيد من المساعدة!"
"message": "شكرا لك على صبركم! نواجه حاليًا صعوبات فنية. يرجى محاولة التنزيل مرة أخرى قريبًا."
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "نوع المنحة غير مدعوم خطأ في التفويض!",
Expand Down
2 changes: 1 addition & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
},
"technicalDifficulty": {
"title": "An error occurred!",
"message": "Thanks for your patience! We're experiencing technical difficulties right now. Please try again later or contact the admin for further assistance!"
"message": "Thank you for your patience! We're currently experiencing technical difficulties. Please try downloading again shortly."
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "Grant type not supported authorization error!",
Expand Down
2 changes: 1 addition & 1 deletion locales/fil.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
},
"technicalDifficulty": {
"title": "May naganap na error!",
"message": "Salamat sa iyong pasensya! Nakakaranas kami ng mga teknikal na paghihirap ngayon. Pakisubukang muli mamaya o makipag-ugnayan sa admin para sa karagdagang tulong!"
"message": "Salamat sa iyong pasensya! Kasalukuyan kaming nakakaranas ng mga teknikal na paghihirap. Pakisubukang mag-download muli sa ilang sandali."
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "Ang uri ng grant ay hindi sinusuportahan ng error sa pahintulot!",
Expand Down
2 changes: 1 addition & 1 deletion locales/hin.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
},
"technicalDifficulty": {
"title": "एक त्रुटि पाई गई!",
"message": "आपके धैर्य के लिए धन्यवाद! हम अभी तकनीकी समस्याओं का सामना कर रहे हैं। कृपया बाद में पुनः प्रयास करें या आगे की सहायता के लिए व्यवस्थापक से संपर्क करें!"
"message": "आपके धैर्य के लिए धन्यवाद! हम वर्तमान में तकनीकी कठिनाइयों का सामना कर रहे हैं। कृपया शीघ्र ही पुनः डाउनलोड करने का प्रयास करें"
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "अनुदान प्रकार समर्थित नहीं प्राधिकरण त्रुटि!",
Expand Down
2 changes: 1 addition & 1 deletion locales/kan.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
},
"technicalDifficulty": {
"title": "ದೋಷ ಸಂಭವಿಸಿದೆ!",
"message": "ನಿಮ್ಮ ತಾಳ್ಮೆಗೆ ಧನ್ಯವಾದಗಳು! ನಾವು ಇದೀಗ ತಾಂತ್ರಿಕ ತೊಂದರೆಗಳನ್ನು ಎದುರಿಸುತ್ತಿದ್ದೇವೆ. ದಯವಿಟ್ಟು ನಂತರ ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ ಅಥವಾ ಹೆಚ್ಚಿನ ಸಹಾಯಕ್ಕಾಗಿ ನಿರ್ವಾಹಕರನ್ನು ಸಂಪರ್ಕಿಸಿ!"
"message": "ನಿಮ್ಮ ತಾಳ್ಮೆಗೆ ಧನ್ಯವಾದಗಳು! ನಾವು ಪ್ರಸ್ತುತ ತಾಂತ್ರಿಕ ತೊಂದರೆಗಳನ್ನು ಎದುರಿಸುತ್ತಿದ್ದೇವೆ. ದಯವಿಟ್ಟು ಸ್ವಲ್ಪ ಸಮಯದ ನಂತರ ಡೌನ್‌ಲೋಡ್ ಮಾಡಲು ಪ್ರಯತ್ನಿಸಿ."
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "ಅನುದಾನದ ಪ್ರಕಾರವನ್ನು ಬೆಂಬಲಿಸುವುದಿಲ್ಲ ದೃಢೀಕರಣ ದೋಷ!",
Expand Down
2 changes: 1 addition & 1 deletion locales/tam.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
},
"technicalDifficulty": {
"title": "பிழை ஏற்பட்டது!",
"message": "உங்கள் பொறுமைக்கு நன்றி! நாங்கள் தற்போது தொழில்நுட்ப சிக்கல்களை எதிர்கொள்கிறோம். பிறகு முயற்சிக்கவும் அல்லது கூடுதல் உதவிக்கு நிர்வாகியைத் தொடர்பு கொள்ளவும்!"
"message": "உங்கள் பொறுமைக்கு நன்றி! தற்போது தொழில்நுட்ப சிக்கல்களை சந்தித்து வருகிறோம். சிறிது நேரத்தில் மீண்டும் பதிவிறக்க முயற்சிக்கவும்."
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "கிராண்ட் வகை ஆதரிக்கப்படவில்லை அங்கீகார பிழை!",
Expand Down
21 changes: 11 additions & 10 deletions machines/Issuers/IssuersActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from '../../shared/openId4VCI/Utils';
import {
MY_VCS_STORE_KEY,
NETWORK_REQUEST_FAILED,
REQUEST_TIMEOUT,
isIOS,
EXPIRED_VC_ERROR_CODE,
Expand All @@ -27,6 +26,7 @@ import {TelemetryConstants} from '../../shared/telemetry/TelemetryConstants';
import {NativeModules} from 'react-native';
import {KeyTypes} from '../../shared/cryptoutil/KeyTypes';
import {VCActivityLog} from '../../components/ActivityLogEvent';
import {isNetworkError} from '../../shared/Utils';

const {RNSecureKeystoreModule} = NativeModules;
export const IssuersActions = (model: any) => {
Expand Down Expand Up @@ -83,19 +83,20 @@ export const IssuersActions = (model: any) => {
resetSelectedCredentialType: model.assign({
selectedCredentialType: {},
}),
setFetchWellknownError: model.assign({
setNetworkOrTechnicalError: model.assign({
errorMessage: (_: any, event: any) => {
const error = event.data.message;
if (error.includes(NETWORK_REQUEST_FAILED)) {
return ErrorMessage.NO_INTERNET;
}
return ErrorMessage.TECHNICAL_DIFFICULTIES;
console.error(
`Error occurred during ${event} flow`,
event.data.message,
);
return isNetworkError(event.data.message)
? ErrorMessage.NO_INTERNET
: ErrorMessage.TECHNICAL_DIFFICULTIES;
},
}),
setCredentialTypeListDownloadFailureError: model.assign({
errorMessage: (_: any, event: any) => {
const error = event.data.message;
if (error.includes(NETWORK_REQUEST_FAILED)) {
if (isNetworkError(event.data.message)) {
return ErrorMessage.NO_INTERNET;
}
return ErrorMessage.CREDENTIAL_TYPE_DOWNLOAD_FAILURE;
Expand All @@ -106,7 +107,7 @@ export const IssuersActions = (model: any) => {
errorMessage: (_: any, event: any) => {
console.error(`Error occurred while ${event} -> `, event.data.message);
const error = event.data.message;
if (error.includes(NETWORK_REQUEST_FAILED)) {
if (isNetworkError(error)) {
return ErrorMessage.NO_INTERNET;
}
if (error.includes(REQUEST_TIMEOUT)) {
Expand Down
11 changes: 5 additions & 6 deletions machines/Issuers/IssuersMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const IssuersMachine = model.createMachine(
target: 'downloadCredentialTypes',
},
onError: {
actions: ['setFetchWellknownError', 'resetLoadingReason'],
actions: ['setNetworkOrTechnicalError', 'resetLoadingReason'],
target: 'error',
},
},
Expand Down Expand Up @@ -234,16 +234,15 @@ export const IssuersMachine = model.createMachine(
{
actions: [
'resetSelectedCredentialType',
'setError',
'setNetworkOrTechnicalError',
'resetLoadingReason',
'sendDownloadingFailedToVcMeta',
(_, event) =>
console.error(
'Error Occurred while invoking Auth - ',
event.data,
),
],
target: 'selectingIssuer',
target: 'error',
},
],
},
Expand All @@ -265,7 +264,7 @@ export const IssuersMachine = model.createMachine(
'sendDownloadingFailedToVcMeta',
(_, event) =>
console.error(
'Error Occurred while invoking Auth - ',
'Error Occurred while getting key order - ',
event.data,
),
],
Expand Down Expand Up @@ -294,7 +293,7 @@ export const IssuersMachine = model.createMachine(
'sendDownloadingFailedToVcMeta',
(_, event) =>
console.error(
'Error Occurred while invoking Auth - ',
'Error Occurred while getting keypair from keystore - ',
event.data,
),
],
Expand Down
12 changes: 6 additions & 6 deletions machines/Issuers/IssuersMachine.typegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ export interface Typegen0 {
| 'setCredentialTypeListDownloadFailureError'
| 'setCredentialWrapper'
| 'setError'
| 'setFetchWellknownError'
| 'setIssuers'
| 'setLoadingReasonAsDisplayIssuers'
| 'setLoadingReasonAsDownloadingCredentials'
| 'setLoadingReasonAsSettingUp'
| 'setMetadataInCredentialData'
| 'setNetworkOrTechnicalError'
| 'setNoInternet'
| 'setOIDCConfigError'
| 'setPrivateKey'
Expand Down Expand Up @@ -234,8 +234,7 @@ export interface Typegen0 {
sendDownloadingFailedToVcMeta:
| 'error.platform.issuersMachine.downloadCredentials:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization.getKeyPairFromKeystore:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization.setSelectedKey:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
| 'error.platform.issuersMachine.performAuthorization.setSelectedKey:invocation[0]';
sendErrorEndEvent: 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
sendImpressionEvent: 'done.invoke.issuersMachine.displayIssuers:invocation[0]';
sendSuccessEndEvent: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
Expand All @@ -246,9 +245,7 @@ export interface Typegen0 {
| 'error.platform.issuersMachine.downloadCredentials:invocation[0]'
| 'error.platform.issuersMachine.fetchAuthorizationEndpoint:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization.getKeyPairFromKeystore:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization.setSelectedKey:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
setFetchWellknownError: 'error.platform.issuersMachine.downloadIssuerWellknown:invocation[0]';
| 'error.platform.issuersMachine.performAuthorization.setSelectedKey:invocation[0]';
setIssuers: 'done.invoke.issuersMachine.displayIssuers:invocation[0]';
setLoadingReasonAsDisplayIssuers: 'TRY_AGAIN';
setLoadingReasonAsDownloadingCredentials:
Expand All @@ -264,6 +261,9 @@ export interface Typegen0 {
setMetadataInCredentialData:
| 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'
| 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
setNetworkOrTechnicalError:
| 'error.platform.issuersMachine.downloadIssuerWellknown:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
setNoInternet: 'done.invoke.checkInternet';
setOIDCConfigError: 'error.platform.issuersMachine.performAuthorization:invocation[0]';
setPrivateKey: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
Expand Down
1 change: 1 addition & 0 deletions screens/Issuers/IssuerScreenController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export function useIssuerScreenController({route, navigation}) {
service,
selectVerificationErrorMessage,
),
isError: useSelector(service, selectIsError),

CANCEL: () => service.send(IssuerScreenTabEvents.CANCEL()),
SELECTED_ISSUER: id =>
Expand Down
5 changes: 3 additions & 2 deletions screens/Issuers/IssuersScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const IssuersScreen: React.FC<
const [search, setSearch] = useState('');
const [tapToSearch, setTapToSearch] = useState(false);
const [clearSearchIcon, setClearSearchIcon] = useState(false);
const showFullScreenError = controller.isError && controller.errorMessageType;

const isVerificationFailed = controller.verificationErrorMessage !== '';

Expand All @@ -51,7 +52,7 @@ export const IssuersScreen: React.FC<
: t(`errors.verificationFailed.ERR_GENERIC`);

useLayoutEffect(() => {
if (controller.loadingReason || controller.errorMessageType) {
if (controller.loadingReason || showFullScreenError) {
props.navigation.setOptions({
headerShown: false,
});
Expand Down Expand Up @@ -202,7 +203,7 @@ export const IssuersScreen: React.FC<
</MessageOverlay>
);
}
if (controller.errorMessageType) {
if (showFullScreenError) {
return (
<Error
testID={`${controller.errorMessageType}Error`}
Expand Down
5 changes: 5 additions & 0 deletions shared/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {VCMetadata} from './VCMetadata';
import {NETWORK_REQUEST_FAILED} from './constants';
import {groupBy} from './javascript';
import {Issuers} from './openId4VCI/Utils';

Expand Down Expand Up @@ -49,3 +50,7 @@ export const parseJSON = (input: any) => {
}
return result;
};

export const isNetworkError = (error: string) => {
return error.includes(NETWORK_REQUEST_FAILED);
};

0 comments on commit 997e700

Please sign in to comment.