mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 13:38:01 -05:00
Inji 408 error popup after maximum retries vc download (#926)
* feat(INJI-408):Display error message after max retries of downloading vcs Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com> * feat(INJI-408):refactor error message Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com> * feat(INJI-408):refactor naming convention and remove empty space Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com> * feat(INJI-408):refactor naming convention Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com> --------- Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>
This commit is contained in:
@@ -297,6 +297,10 @@
|
||||
"title": "لا يوجد اتصال بالإنترنت",
|
||||
"message": "الرجاء التحقق من اتصالك وإعادة المحاولة"
|
||||
},
|
||||
"downloadLimitExpires":{
|
||||
"title": "الخطأ تحميل",
|
||||
"message": "حدثت مشكلة أثناء تنزيل البطاقات التالية. حاول مرة اخرى"
|
||||
}
|
||||
}
|
||||
},
|
||||
"OnboardingOverlay": {
|
||||
|
||||
@@ -303,6 +303,10 @@
|
||||
"noInternetConnection": {
|
||||
"title": "No internet connection",
|
||||
"message": "Please check your connection and retry"
|
||||
},
|
||||
"downloadLimitExpires":{
|
||||
"title": "Download Error",
|
||||
"message": "There was an issue downloading following cards. Please try again"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -295,6 +295,10 @@
|
||||
"noInternetConnection": {
|
||||
"title": "Pakisuri ang iyong koneksyon at subukang muli",
|
||||
"message": "Mangyaring kumonekta sa internet at subukang muli."
|
||||
},
|
||||
"downloadLimitExpires":{
|
||||
"title": "Error sa Pag-download",
|
||||
"message": "Nagkaroon ng isyu sa pag-download ng mga sumusunod na card. Pakisubukang muli"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -296,6 +296,10 @@
|
||||
"title": "कोई इंटरनेट कनेक्शन नहीं",
|
||||
"message": "कृपया अपना कनेक्शन जांचें और पुनः प्रयास करें"
|
||||
},
|
||||
"downloadLimitExpires":{
|
||||
"title": "डाउनलोड त्रुटि",
|
||||
"message": "निम्नलिखित कार्ड डाउनलोड करने में एक समस्या थी। कृपया पुन: प्रयास करें"
|
||||
}
|
||||
}
|
||||
},
|
||||
"OnboardingOverlay": {
|
||||
|
||||
@@ -293,6 +293,10 @@
|
||||
"title": "ಇಂಟರ್ನೆಟ್ ಸಂಪರ್ಕವಿಲ್ಲ",
|
||||
"message": "ದಯವಿಟ್ಟು ನಿಮ್ಮ ಸಂಪರ್ಕವನ್ನು ಪರಿಶೀಲಿಸಿ ಮತ್ತು ಮರುಪ್ರಯತ್ನಿಸಿ"
|
||||
},
|
||||
"downloadLimitExpires":{
|
||||
"title": "ಡೌನ್ಲೋಡ್ ದೋಷ",
|
||||
"message": "ಕೆಳಗಿನ ಕಾರ್ಡ್ಗಳನ್ನು ಡೌನ್ಲೋಡ್ ಮಾಡುವಲ್ಲಿ ಸಮಸ್ಯೆ ಕಂಡುಬಂದಿದೆ. ದಯವಿಟ್ಟು ಪುನಃ ಪ್ರಯತ್ನಿಸಿ"
|
||||
}
|
||||
}
|
||||
},
|
||||
"OnboardingOverlay": {
|
||||
|
||||
@@ -206,6 +206,10 @@
|
||||
"title": "Sin conexión a Internet",
|
||||
"message": "Por favor verifique su conexión y vuelva a intentarlo"
|
||||
},
|
||||
"downloadLimitExpires":{
|
||||
"title": "Error de descarga",
|
||||
"message": "Hubo un problema al descargar las siguientes tarjetas. Inténtalo de nuevo"
|
||||
}
|
||||
}
|
||||
},
|
||||
"OnboardingOverlay": {
|
||||
|
||||
@@ -292,6 +292,10 @@
|
||||
"noInternetConnection": {
|
||||
"title": "இணைய இணைப்பு இல்லை",
|
||||
"message": "உங்கள் இணைப்பைச் சரிபார்த்து மீண்டும் முயற்சிக்கவும்"
|
||||
},
|
||||
"downloadLimitExpires":{
|
||||
"title": "பதிவிறக்கப் பிழை",
|
||||
"message": "பின்வரும் கார்டுகளைப் பதிவிறக்குவதில் சிக்கல் ஏற்பட்டது. தயவு செய்து மீண்டும் முயற்சிக்கவும்"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -173,7 +173,10 @@ export const ExistingMosipVCItemMachine =
|
||||
actions: ['setMaxDownloadCount', 'setDownloadInterval'],
|
||||
},
|
||||
onError: {
|
||||
actions: log((_, event) => (event.data as Error).message),
|
||||
actions: [
|
||||
log((_, event) => (event.data as Error).message),
|
||||
'sendDownloadLimitExpire',
|
||||
],
|
||||
target: 'checkingStatus',
|
||||
},
|
||||
},
|
||||
@@ -808,6 +811,18 @@ export const ExistingMosipVCItemMachine =
|
||||
},
|
||||
),
|
||||
|
||||
sendDownloadLimitExpire: send(
|
||||
(_context, event) => {
|
||||
return {
|
||||
type: 'DOWNLOAD_LIMIT_EXPIRED',
|
||||
vcMetadata: _context.vcMetadata,
|
||||
};
|
||||
},
|
||||
{
|
||||
to: context => context.serviceRefs.vc,
|
||||
},
|
||||
),
|
||||
|
||||
setWalletBindingError: assign({
|
||||
walletBindingError: () =>
|
||||
i18n.t(`errors.genericError`, {
|
||||
|
||||
@@ -22,6 +22,7 @@ const model = createModel(
|
||||
areAllVcsDownloaded: false as boolean,
|
||||
walletBindingSuccess: false,
|
||||
tamperedVcs: [] as VCMetadata[],
|
||||
downloadingFailedVcs: [] as VCMetadata[],
|
||||
},
|
||||
{
|
||||
events: {
|
||||
@@ -52,6 +53,8 @@ const model = createModel(
|
||||
RESET_ARE_ALL_VCS_DOWNLOADED: () => ({}),
|
||||
TAMPERED_VC: (VC: VCMetadata) => ({VC}),
|
||||
REMOVE_TAMPERED_VCS: () => ({}),
|
||||
DOWNLOAD_LIMIT_EXPIRED: (vcMetadata: VCMetadata) => ({vcMetadata}),
|
||||
DELETE_VC: () => ({}),
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -201,6 +204,13 @@ export const vcMachine =
|
||||
actions: 'setTamperedVcs',
|
||||
target: 'tamperedVCs',
|
||||
},
|
||||
DOWNLOAD_LIMIT_EXPIRED: {
|
||||
actions: [
|
||||
'removeVcFromInProgressDownlods',
|
||||
'setDownloadingFailedVcs',
|
||||
],
|
||||
target: 'downloadLimitExpired',
|
||||
},
|
||||
},
|
||||
},
|
||||
tamperedVCs: {
|
||||
@@ -211,6 +221,25 @@ export const vcMachine =
|
||||
},
|
||||
},
|
||||
},
|
||||
downloadLimitExpired: {
|
||||
on: {
|
||||
DELETE_VC: {
|
||||
target: 'deletingFailedVcs',
|
||||
},
|
||||
},
|
||||
},
|
||||
deletingFailedVcs: {
|
||||
entry: 'removeDownloadFailedVcsFromStorage',
|
||||
on: {
|
||||
STORE_RESPONSE: {
|
||||
actions: [
|
||||
'removeDownloadingFailedVcsFromMyVcs',
|
||||
'resetDownloadFailedVcs',
|
||||
],
|
||||
target: '#vc.ready.myVcs.refreshing',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -252,6 +281,17 @@ export const vcMachine =
|
||||
tamperedVcs: (context, event) => [event.VC, ...context.tamperedVcs],
|
||||
}),
|
||||
|
||||
setDownloadingFailedVcs: model.assign({
|
||||
downloadingFailedVcs: (context, event) => [
|
||||
event.vcMetadata,
|
||||
...context.downloadingFailedVcs,
|
||||
],
|
||||
}),
|
||||
|
||||
resetDownloadFailedVcs: model.assign({
|
||||
downloadingFailedVcs: (context, event) => [],
|
||||
}),
|
||||
|
||||
setDownloadedVc: (context, event) => {
|
||||
const vcUniqueId = VCMetadata.fromVC(event.vc).getVcKey();
|
||||
context.vcs[vcUniqueId] = event.vc;
|
||||
@@ -271,7 +311,10 @@ export const vcMachine =
|
||||
inProgressVcDownloads: (context, event) => {
|
||||
let paresedInProgressList: Set<string> =
|
||||
context.inProgressVcDownloads;
|
||||
const removeVcRequestID = event.requestId;
|
||||
const removeVcRequestID =
|
||||
event.type === 'REMOVE_VC_FROM_IN_PROGRESS_DOWNLOADS'
|
||||
? event.requestId
|
||||
: event.vcMetadata.requestId;
|
||||
paresedInProgressList.delete(removeVcRequestID);
|
||||
return paresedInProgressList;
|
||||
},
|
||||
@@ -323,6 +366,26 @@ export const vcMachine =
|
||||
),
|
||||
}),
|
||||
|
||||
removeDownloadingFailedVcsFromMyVcs: model.assign({
|
||||
myVcs: (context, event) =>
|
||||
context.myVcs.filter(
|
||||
value =>
|
||||
!context.downloadingFailedVcs.some(item => item?.equals(value)),
|
||||
),
|
||||
}),
|
||||
|
||||
removeDownloadFailedVcsFromStorage: send(
|
||||
context => {
|
||||
return StoreEvents.REMOVE_ITEMS(
|
||||
MY_VCS_STORE_KEY,
|
||||
context.downloadingFailedVcs.map(m => m.getVcKey()),
|
||||
);
|
||||
},
|
||||
{
|
||||
to: context => context.serviceRefs.store,
|
||||
},
|
||||
),
|
||||
|
||||
removeTamperedVcs: model.assign({
|
||||
myVcs: (context, event) =>
|
||||
context.myVcs.filter(
|
||||
@@ -462,3 +525,11 @@ export function selectWalletBindingSuccess(state: State) {
|
||||
export function selectIsTampered(state: State) {
|
||||
return state.matches('tamperedVCs');
|
||||
}
|
||||
|
||||
export function selectIsDownloadLimitExpired(state: State) {
|
||||
return state.matches('downloadLimitExpired');
|
||||
}
|
||||
|
||||
export function selectDownloadingFailedVcs(state: State) {
|
||||
return state.context.downloadingFailedVcs;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,14 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = props => {
|
||||
}
|
||||
}, [controller.areAllVcsLoaded, controller.inProgressVcDownloads]);
|
||||
|
||||
let failedVCsList = [];
|
||||
controller.downloadFailedVcs.forEach(vc => {
|
||||
failedVCsList.push(`${vc.idType}:${vc.id}\n`);
|
||||
});
|
||||
const downloadFailedVcsErrorMessage = `${t(
|
||||
'errors.downloadLimitExpires.message',
|
||||
)}\n${failedVCsList}`;
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Column fill style={{display: props.isVisible ? 'flex' : 'none'}}>
|
||||
@@ -233,6 +241,16 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = props => {
|
||||
buttonText={t('common:ok')}
|
||||
customHeight={'auto'}
|
||||
/>
|
||||
|
||||
<MessageOverlay
|
||||
isVisible={controller.isDownloadLimitExpires}
|
||||
title={t('errors.downloadLimitExpires.title')}
|
||||
message={downloadFailedVcsErrorMessage}
|
||||
onButtonPress={controller.DELETE_VC}
|
||||
buttonText={t('common:ok')}
|
||||
customHeight={'auto'}
|
||||
/>
|
||||
|
||||
{controller.isNetworkOff && (
|
||||
<Error
|
||||
testID={`networkOffError`}
|
||||
|
||||
@@ -9,6 +9,8 @@ import {
|
||||
selectAreAllVcsDownloaded,
|
||||
selectInProgressVcDownloads,
|
||||
selectIsTampered,
|
||||
selectIsDownloadLimitExpired,
|
||||
selectDownloadingFailedVcs,
|
||||
} from '../../machines/vc';
|
||||
import {
|
||||
selectWalletBindingError,
|
||||
@@ -66,6 +68,13 @@ export function useMyVcsTab(props: HomeScreenTabProps) {
|
||||
|
||||
isTampered: useSelector(vcService, selectIsTampered),
|
||||
|
||||
isDownloadLimitExpires: useSelector(
|
||||
vcService,
|
||||
selectIsDownloadLimitExpired,
|
||||
),
|
||||
|
||||
downloadFailedVcs: useSelector(vcService, selectDownloadingFailedVcs),
|
||||
|
||||
SET_STORE_VC_ITEM_STATUS: () =>
|
||||
service.send(MyVcsTabEvents.SET_STORE_VC_ITEM_STATUS()),
|
||||
|
||||
@@ -100,5 +109,6 @@ export function useMyVcsTab(props: HomeScreenTabProps) {
|
||||
settingsService.send(SettingsEvents.ACCEPT_HARDWARE_SUPPORT_NOT_EXISTS()),
|
||||
|
||||
REMOVE_TAMPERED_VCS: () => vcService?.send(VcEvents.REMOVE_TAMPERED_VCS()),
|
||||
DELETE_VC: () => vcService?.send(VcEvents.DELETE_VC()),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user