mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-10 14:07:59 -05:00
[INJIMOB-1852] fix caching logic, to use cache if the device is offline Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
import {useSelector} from '@xstate/react';
|
|
import {
|
|
selectIsPasscodeUnlock,
|
|
selectIsBiometricUnlock,
|
|
SettingsEvents,
|
|
} from '../machines/settings';
|
|
import {useContext} from 'react';
|
|
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';
|
|
|
|
export const UseBannerNotification = () => {
|
|
const {appService} = useContext(GlobalContext);
|
|
const settingsService = appService.children.get('settings')!!;
|
|
const vcMetaService = appService.children.get('vcMeta')!!;
|
|
|
|
return {
|
|
isBindingSuccess: useSelector(vcMetaService, selectWalletBindingSuccess),
|
|
verificationStatus: useSelector(vcMetaService, selectVerificationStatus),
|
|
isPasscodeUnlock: useSelector(settingsService, selectIsPasscodeUnlock),
|
|
|
|
isBiometricUnlock: useSelector(settingsService, selectIsBiometricUnlock),
|
|
isDownloadingSuccess: useSelector(vcMetaService, selectIsDownloadingSuccess),
|
|
isDownloadingFailed: useSelector(vcMetaService, selectIsDownloadingFailed),
|
|
DISMISS: () => {
|
|
settingsService.send(SettingsEvents.DISMISS());
|
|
},
|
|
RESET_WALLET_BINDING_SUCCESS: () =>
|
|
vcMetaService.send(VcMetaEvents.RESET_WALLET_BINDING_SUCCESS()),
|
|
RESET_VERIFICATION_STATUS: () =>
|
|
vcMetaService.send(VcMetaEvents.RESET_VERIFICATION_STATUS(null)),
|
|
RESET_DOWNLOADING_FAILED: () => {
|
|
vcMetaService.send(VcMetaEvents.RESET_DOWNLOADING_FAILED());
|
|
},
|
|
RESET_DOWNLOADING_SUCCESS: () => {
|
|
vcMetaService.send(VcMetaEvents.RESET_DOWNLOADING_SUCCESS());
|
|
},
|
|
};
|
|
};
|