Files
inji-wallet/screens/Home/MyVcsTabController.ts
PoojaBabusing 0af87909c9 Sonar Pipeline tw mosip (#768)
* fix(INJI-223): show the camera in scan screen while sharing the VC and click on scan icon

Issue Link https://mosip.atlassian.net/browse/INJI-223

* chore: update pod deps' to match development team of 1st project

* feat[#211]:[Pooja] fix turncated passcode and confirm password button

* feat[#211]:[Pooja] fix truncated histroy title text in iOS

* feat[#211]:[Pooja] fix multiple error being displayed when the vc binding fails

* fix(INJI-223): disconnect the device while sharing the VC and click on tab icons except scan icon

Issue Link https://mosip.atlassian.net/browse/INJI-223

* feat[#211]:[Pooja] fix download card button styles

* version code for beta build in pipeline

* feat[#211]:[Pooja] add error message when VC activation fails in kebab pop up

* chore(INJI-216): bump up tuvali version to v0.4.3

* feat[#225]:[Pooja] fix about inji url in about page

* refactor(INJI-223): get the scan string from route config to keep it consistent

Issue Link https://mosip.atlassian.net/browse/INJI-223

* feat[mosip#211]:[Pooja] refactor onCancel

Co-authored-by: Harsh Vardhan <harsh59v@gmail.com>

* feat(INJI-222): add popup for error in decryption

* feat(INJI-222): wrap app init component & popups

* feat(INJI-222): propagate event from _store to app state machine

Co-authored-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* chore(INJI-222): move error msg text to errors obj

* Implemented Receive Card & Received Cards options in Settings

* Fixed all the locals

* [Pooja] add quality gate check for critical open bugs in sonar

---------

Co-authored-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>
Co-authored-by: vijay151096 <94220135+vijay151096@users.noreply.github.com>
Co-authored-by: Harsh Vardhan <harsh59v@gmail.com>
Co-authored-by: Pooja Babusingh <68894211+PoojaBabusingh@users.noreply.github.com>
Co-authored-by: adityankannan-tw <adityan.kannan@thoughtworks.com>
Co-authored-by: Alka <prasadalka1998@gmail.com>
Co-authored-by: anil_majji <majjianilkumar050@gmail.com>
Co-authored-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com>
2023-08-09 11:55:50 +05:30

70 lines
2.3 KiB
TypeScript

import { useSelector } from '@xstate/react';
import { useContext } from 'react';
import { ActorRefFrom } from 'xstate';
import { selectIsTampered } from '../../machines/store';
import {
selectIsRefreshingMyVcs,
selectMyVcs,
VcEvents,
} from '../../machines/vc';
import {
selectWalletBindingError,
selectShowWalletBindingError,
} from '../../machines/vcItem';
import { vcItemMachine } from '../../machines/vcItem';
import { GlobalContext } from '../../shared/GlobalContext';
import { HomeScreenTabProps } from './HomeScreen';
import {
MyVcsTabEvents,
MyVcsTabMachine,
selectAddVcModal,
selectIsOnboarding,
selectIsRequestSuccessful,
selectGetVcModal,
selectIsSavingFailedInIdle,
selectIsMinimumStorageLimitReached,
} from './MyVcsTabMachine';
export function useMyVcsTab(props: HomeScreenTabProps) {
const service = props.service as ActorRefFrom<typeof MyVcsTabMachine>;
const { appService } = useContext(GlobalContext);
const vcService = appService.children.get('vc');
const storeService = appService.children.get('store');
return {
service,
AddVcModalService: useSelector(service, selectAddVcModal),
GetVcModalService: useSelector(service, selectGetVcModal),
vcKeys: useSelector(vcService, selectMyVcs),
isTampered: useSelector(storeService, selectIsTampered),
isRefreshingVcs: useSelector(vcService, selectIsRefreshingMyVcs),
isRequestSuccessful: useSelector(service, selectIsRequestSuccessful),
isOnboarding: useSelector(service, selectIsOnboarding),
isSavingFailedInIdle: useSelector(service, selectIsSavingFailedInIdle),
walletBindingError: useSelector(service, selectWalletBindingError),
isBindingError: useSelector(service, selectShowWalletBindingError),
isMinimumStorageLimitReached: useSelector(
service,
selectIsMinimumStorageLimitReached
),
DISMISS: () => service.send(MyVcsTabEvents.DISMISS()),
DOWNLOAD_ID: () => service.send(MyVcsTabEvents.ADD_VC()),
GET_VC: () => service.send(MyVcsTabEvents.GET_VC()),
REFRESH: () => vcService.send(VcEvents.REFRESH_MY_VCS()),
VIEW_VC: (vcRef: ActorRefFrom<typeof vcItemMachine>) => {
return service.send(MyVcsTabEvents.VIEW_VC(vcRef));
},
ONBOARDING_DONE: () => service.send(MyVcsTabEvents.ONBOARDING_DONE()),
IS_TAMPERED: () => service.send(MyVcsTabEvents.IS_TAMPERED()),
};
}