mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 13:38:01 -05:00
[INJIMOB-2018] add vc download success banner (#1646)
[INJIMOB-1852] fix caching logic, to use cache if the device is offline Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
This commit is contained in:
@@ -122,6 +122,16 @@ export const BannerNotificationContainer: React.FC<
|
||||
testId={'downloadingVcFailedPopup'}
|
||||
/>
|
||||
)}
|
||||
|
||||
{bannerNotificationController.isDownloadingSuccess && (
|
||||
<BannerNotification
|
||||
type={BannerStatusType.SUCCESS}
|
||||
message={t('MyVcsTab:downloadingVcSuccess')}
|
||||
onClosePress={bannerNotificationController.RESET_DOWNLOADING_SUCCESS}
|
||||
key={'downloadingVcSuccessPopup'}
|
||||
testId={'downloadingVcSuccessPopup'}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@ import {GlobalContext} from '../shared/GlobalContext';
|
||||
import {VcMetaEvents} from '../machines/VerifiableCredential/VCMetaMachine/VCMetaMachine';
|
||||
import {
|
||||
selectIsDownloadingFailed,
|
||||
selectIsDownloadingSuccess,
|
||||
selectWalletBindingSuccess,
|
||||
} from '../machines/VerifiableCredential/VCMetaMachine/VCMetaSelectors';
|
||||
import {selectVerificationStatus} from '../machines/VerifiableCredential/VCItemMachine/VCItemSelectors';
|
||||
@@ -24,6 +25,7 @@ export const UseBannerNotification = () => {
|
||||
isPasscodeUnlock: useSelector(settingsService, selectIsPasscodeUnlock),
|
||||
|
||||
isBiometricUnlock: useSelector(settingsService, selectIsBiometricUnlock),
|
||||
isDownloadingSuccess: useSelector(vcMetaService, selectIsDownloadingSuccess),
|
||||
isDownloadingFailed: useSelector(vcMetaService, selectIsDownloadingFailed),
|
||||
DISMISS: () => {
|
||||
settingsService.send(SettingsEvents.DISMISS());
|
||||
@@ -35,5 +37,8 @@ export const UseBannerNotification = () => {
|
||||
RESET_DOWNLOADING_FAILED: () => {
|
||||
vcMetaService.send(VcMetaEvents.RESET_DOWNLOADING_FAILED());
|
||||
},
|
||||
RESET_DOWNLOADING_SUCCESS: () => {
|
||||
vcMetaService.send(VcMetaEvents.RESET_DOWNLOADING_SUCCESS());
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -377,6 +377,7 @@
|
||||
"generateVcFABDescription": "Tap on \"+\" below to download your card",
|
||||
"downloadCard": "Download Card",
|
||||
"downloadingYourCard": "Downloading your card, this can take upto 5 minutes",
|
||||
"downloadingVcSuccess":"Your Card has been downloaded successfully",
|
||||
"downloadingVcFailed": "Sorry! Due to technical error we are unable to download your card now. Please try again later.",
|
||||
"activated": "Credentials are enabled for online authentication.",
|
||||
"noCardsTitle": "No Cards Found!",
|
||||
|
||||
@@ -220,6 +220,13 @@ export const VCMetaActions = (model: any) => {
|
||||
resetDownloadCreadentialsFailed: model.assign({
|
||||
DownloadingCredentialsFailed: () => false,
|
||||
}),
|
||||
setDownloadCredentialsSuccess: model.assign({
|
||||
DownloadingCredentialsSuccess: () => true
|
||||
|
||||
}),
|
||||
resetDownloadCredentialsSuccess: model.assign({
|
||||
DownloadingCredentialsSuccess: () => false,
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -44,4 +44,5 @@ export const VcMetaEvents = {
|
||||
}),
|
||||
VC_DOWNLOADING_FAILED: () => ({}),
|
||||
RESET_DOWNLOADING_FAILED: () => ({}),
|
||||
RESET_DOWNLOADING_SUCCESS: () => ({}),
|
||||
};
|
||||
|
||||
@@ -25,6 +25,9 @@ export const vcMetaMachine =
|
||||
VC_DOWNLOADING_FAILED: {
|
||||
actions: 'setDownloadCreadentialsFailed',
|
||||
},
|
||||
RESET_DOWNLOADING_SUCCESS:{
|
||||
actions: 'resetDownloadCredentialsSuccess'
|
||||
},
|
||||
RESET_DOWNLOADING_FAILED: {
|
||||
actions: 'resetDownloadCreadentialsFailed',
|
||||
},
|
||||
@@ -115,7 +118,7 @@ export const vcMetaMachine =
|
||||
actions: ['updateMyVcsMetadata', 'setUpdatedVcMetadatas'],
|
||||
},
|
||||
VC_DOWNLOADED: {
|
||||
actions: 'setDownloadedVc',
|
||||
actions: ['setDownloadCredentialsSuccess','setDownloadedVc',]
|
||||
},
|
||||
ADD_VC_TO_IN_PROGRESS_DOWNLOADS: {
|
||||
actions: 'addVcToInProgressDownloads',
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"isUserSignedAlready": "done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]";
|
||||
};
|
||||
missingImplementations: {
|
||||
actions: "addVcToInProgressDownloads" | "getVcItemResponse" | "loadMyVcs" | "loadReceivedVcs" | "logTamperedVCsremoved" | "prependToMyVcsMetadata" | "removeDownloadFailedVcsFromStorage" | "removeDownloadingFailedVcsFromMyVcs" | "removeVcFromInProgressDownlods" | "removeVcFromMyVcsMetadata" | "resetDownloadCreadentialsFailed" | "resetDownloadFailedVcs" | "resetInProgressVcsDownloaded" | "resetTamperedVcs" | "resetVerificationErrorMessage" | "resetVerificationStatus" | "resetWalletBindingSuccess" | "sendBackupEvent" | "setDownloadCreadentialsFailed" | "setDownloadedVc" | "setDownloadingFailedVcs" | "setMyVcs" | "setReceivedVcs" | "setUpdatedVcMetadatas" | "setVerificationErrorMessage" | "setVerificationStatus" | "setWalletBindingSuccess" | "updateMyVcsMetadata";
|
||||
actions: "addVcToInProgressDownloads" | "getVcItemResponse" | "loadMyVcs" | "loadReceivedVcs" | "logTamperedVCsremoved" | "prependToMyVcsMetadata" | "removeDownloadFailedVcsFromStorage" | "removeDownloadingFailedVcsFromMyVcs" | "removeVcFromInProgressDownlods" | "removeVcFromMyVcsMetadata" | "resetDownloadCreadentialsFailed" | "resetDownloadCredentialsSuccess" | "resetDownloadFailedVcs" | "resetInProgressVcsDownloaded" | "resetTamperedVcs" | "resetVerificationErrorMessage" | "resetVerificationStatus" | "resetWalletBindingSuccess" | "sendBackupEvent" | "setDownloadCreadentialsFailed" | "setDownloadCredentialsSuccess" | "setDownloadedVc" | "setDownloadingFailedVcs" | "setMyVcs" | "setReceivedVcs" | "setUpdatedVcMetadatas" | "setVerificationErrorMessage" | "setVerificationStatus" | "setWalletBindingSuccess" | "updateMyVcsMetadata";
|
||||
delays: never;
|
||||
guards: "isAnyVcTampered" | "isSignedIn";
|
||||
services: "isUserSignedAlready";
|
||||
@@ -28,6 +28,7 @@
|
||||
"removeVcFromInProgressDownlods": "DOWNLOAD_LIMIT_EXPIRED" | "REMOVE_VC_FROM_IN_PROGRESS_DOWNLOADS" | "VERIFY_VC_FAILED";
|
||||
"removeVcFromMyVcsMetadata": "REMOVE_VC_FROM_CONTEXT";
|
||||
"resetDownloadCreadentialsFailed": "RESET_DOWNLOADING_FAILED";
|
||||
"resetDownloadCredentialsSuccess": "RESET_DOWNLOADING_SUCCESS";
|
||||
"resetDownloadFailedVcs": "STORE_RESPONSE";
|
||||
"resetInProgressVcsDownloaded": "RESET_IN_PROGRESS_VCS_DOWNLOADED";
|
||||
"resetTamperedVcs": "REMOVE_TAMPERED_VCS";
|
||||
@@ -36,6 +37,7 @@
|
||||
"resetWalletBindingSuccess": "RESET_WALLET_BINDING_SUCCESS";
|
||||
"sendBackupEvent": "done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]";
|
||||
"setDownloadCreadentialsFailed": "VC_DOWNLOADING_FAILED";
|
||||
"setDownloadCredentialsSuccess": "VC_DOWNLOADED";
|
||||
"setDownloadedVc": "VC_DOWNLOADED";
|
||||
"setDownloadingFailedVcs": "DOWNLOAD_LIMIT_EXPIRED";
|
||||
"setMyVcs": "STORE_RESPONSE";
|
||||
|
||||
@@ -20,6 +20,7 @@ export const VCMetamodel = createModel(
|
||||
verificationErrorMessage: '' as string,
|
||||
verificationStatus: null as vcVerificationBannerDetails | null,
|
||||
DownloadingCredentialsFailed: false,
|
||||
DownloadingCredentialsSuccess: false
|
||||
},
|
||||
{
|
||||
events: VcMetaEvents,
|
||||
|
||||
@@ -87,3 +87,7 @@ export function selectVerificationErrorMessage(state: State) {
|
||||
export function selectIsDownloadingFailed(state: State) {
|
||||
return state.context.DownloadingCredentialsFailed;
|
||||
}
|
||||
|
||||
export function selectIsDownloadingSuccess(state: State) {
|
||||
return state.context.DownloadingCredentialsSuccess;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
sendImpressionEvent,
|
||||
} from './telemetry/TelemetryUtils';
|
||||
import {TelemetryConstants} from './telemetry/TelemetryConstants';
|
||||
import NetInfo, {NetInfoState} from '@react-native-community/netinfo';
|
||||
|
||||
export const API_URLS: ApiUrls = {
|
||||
trustedVerifiersList: {
|
||||
@@ -257,9 +258,10 @@ async function generateCacheAPIFunctionWithAPIPreference(
|
||||
}`);
|
||||
|
||||
console.log(error);
|
||||
|
||||
const response = await getItem(cacheKey, null, '');
|
||||
|
||||
var response=null;
|
||||
if(!(await NetInfo.fetch()).isConnected){
|
||||
response = await getItem(cacheKey, null, '');
|
||||
}
|
||||
if (response) {
|
||||
return response;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user