mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-10 05:58:01 -05:00
* [INJIMOB-722]: Showing Success Banner on Face Verification and Error screen on Face Verification Failure. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [injimob-604]: Updating the messagein error screen. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Injimob-722]: Updating the constants. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Injimob-722]: Changes in event params of scan machine. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [InjiMob-745] Implemented sharing error modal with respective CTA's and message when VC sharing has failed. (#1234) * [INJIMOB-745]: Implemented Error moda of sharing failure with title, message & CTAs were display based on Error_codes Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * [INJIMOB-745]: Implemented Error modal of sharing failure with title, message & CTAs were display based on Error_codes Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * [INJIMOB-745]: Updated respective text in all the locals Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * [INJIMOB-745]: Fixed the error of go to history button in success sharing status Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * [INJIMOB-745]: Resolved PR Merge conflicts Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * [INJIMOB-745]: remove duplicate import which causes build issue Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-745]: Modified SharingStatusModal into dynamic props for buttons, text as per requirement Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * [INJIMOB-745]: Made changes in the rendering of respective button as per requirements Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * [INJIMOB-745]: Adjusted the alignment of bottom buttons & Made header as per wire frame Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * [INJIMOB-745]: Changed the verifier side text messages of Error codes[TUV_UNK_001, TVV_UNK_001, 002, 003] Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * [INJIMOB-745]: Added accessible props to Pressable in SharingStatusModal Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * [INJIMOB-745]: Modified success screen icons in to SVG's Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> --------- Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> Co-authored-by: srikanth716 <srikanthsri7447@gmail.com> * MOSIP-31468 MOSIP-31384 added sprint 20 testcases for android (#1267) * MOSIP-31255 MOSIP-31106 Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * resolve conflicts Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * MOSIP-31456 Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * resolve conflict Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * added sunbird test case for ios Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * MOSIP-31478 Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * resolve conflict Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * resolve conflict Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * resolve conflict Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * resolve conflict Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * MOSIP-31468 MOSIP-31384 Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * resolve conflict Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * MOSIP-31384 Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * resolve conflict Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> * resolve conflict Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> --------- Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Injimob-685] fix download error issue which we are getting when the received vc is tampered (#1268) * [INJIMOB-685] remove received vc metadata from storage when it is tampered or failed to store vc into storage Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJIMOB-685] remove redundant store error in request machine Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJIMOB-685] remove redundant logic to remove the tampered vc metadata Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJIMOB-685] fix the logic of checking if tampered vc is myvc or received vc Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJIMOB-685] fix tampering of received vcs If the received vc is tampered, we should be deleting the vc file & metadata of it. Since the metadata removal was not performed, we were getting download error. This is resolved here. Co-authored-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * [INJIMOB-685] remove unused state and actions in requestMachine After adding timestamp to the incoming received vc, every vc shared from wallet is condered as separate vc. Due to this reason, the check if the incoming vc is already available in our received vcs will always be returning false. Thus removing the mergingIncomingVcrelated states in requestMachine to avoid unnecessary checks. Co-authored-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * [INJIMOB-685] remove sharing reason related code Co-authored-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * [INJIMOB_685] remove unused event in vc machine Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> --------- Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Co-authored-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * Fixed receive card header is fully in caps (#1269) Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-856] add testIds (#1272) testIDs added for - Inji tour guide slides, banner notification, issuer component Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * [INJIMOB-852] - Grace fully handling scrollToIndex error of flatlist (#1275) Signed-off-by: Sreenadh S <32409698+sree96@users.noreply.github.com> Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-632] show backup / restore in progress banner (#1264) * [INJIMOB-632] show backup in progress banner Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * [INJIMOB-632] show restore in progress banner Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * [INJIMOB-632] change info banner's color Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> --------- Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * [INJIMOB-864] disable backup button when restoring and vice versa (#1279) Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Injimob-722]: Adding Banner type Info Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-867] - remove all files including unsynced files and get latest file based on date (#1281) Signed-off-by: Sreenadh S <32409698+sree96@users.noreply.github.com> Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB - 865,868] - Fix duplicate VC key for restored VC's and remove metadata if vc file not found (#1283) * [INJIMOB-something] use incremental timestamp for restore and make unload take a flag start time Signed-off-by: Harsh Vardhan <harsh59v@gmail.com> * [INJIMOB-865,868] fix duplicate vckey value for restored vcs and remove vc metadata if file not found Co-authored-by: adityankannan-tw <109274996+adityankannan-tw@users.noreply.github.com> Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJIMOB-869] remove unused method in store.ts machine Co-authored-by: adityankannan-tw <109274996+adityankannan-tw@users.noreply.github.com> Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJIMOB-869] revert removing vc metadata if file not found Co-authored-by: adityankannan-tw <109274996+adityankannan-tw@users.noreply.github.com> Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJIMOB-865] fix tamper vc removal When a VC is tampered, we get the tampered vc popup. Once we press okay button in the popup, we will be refreshing the vc machine's myVcs & recievedVcs context. Due to calling of parallel states, we were having issue with refreshing of myVcs. It is fixed by targeting to init state to refresh Co-authored-by: adityankannan-tw <109274996+adityankannan-tw@users.noreply.github.com> Co-authored-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * [INJIMOB-865] remove vc metadata when file is not found Co-authored-by: adityankannan-tw <109274996+adityankannan-tw@users.noreply.github.com> Co-authored-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJIMOB-869] add code comments & fix minor code issues Signed-off-by: Harsh Vardhan <harsh59v@gmail.com> --------- Signed-off-by: Harsh Vardhan <harsh59v@gmail.com> Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Co-authored-by: Harsh Vardhan <harsh59v@gmail.com> Co-authored-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> Co-authored-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Injimob-722]: Updating face capture success banner status. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * INJIMOB-604 VC Verification Failure Scenarios (#1228) * [INJI-604]: Handle Verification VC Error Scenarios Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-604] remove the card from UI when verify credential is failed and show error overlay Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJIMOB-604] remove unused actions in existingMosipVcItem and issuers machine Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * INJIMOB-604 Replace Error message overlay with new error screen. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJI-611]: New Error screen implemented Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJI-604]: Transation added for Verification error messages. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJI-604] merge develop and resolve conflicts Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJI-604] remove unnecessary log in error screen Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * [INJIMOB-604] remove removeVcFromMyVcs action from verify vc failed event and fix typegen warnings Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * INJIMOB-604 : Removing logs and renaming functions Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-604]: Removing unused method. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Inji-604]: Fixing the issue of recursive VC deletion during Go Back event in Verification Error screen. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Inji-604]: Fixing bugs post conflict resolve. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Inji-604]: Removing unused events and adding translations for Go Back button * [Inji-604]: Removed angle brackets for Technical Error * [Inji-604]: Added ToDo to handle backup * [Inji-604]: Removing isVerified flag from the Existing VC Item Machine. * [Inji-604] iOS crash fixed for Verification error Go Back Button Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Inji-604]: Simplified condition for result in verify Credential call. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> --------- Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> Co-authored-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> * Inji mob 737 rtl issue (#1254) * [INJIMOB-737]: fix RTL issue Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-737]: fix receive card navigation issue Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-737]: fix receive card back icon rendering position Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-737]: refactor the header right and left Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-737]: fix rendering issue in ios Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-737]: fix rtl rendering issue in ios Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-737]: refactor screen otion to render in ios Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-737]: refactor HomeScreenOptions to render in ios Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-737]: moving HistoryHeaderTitleStyles to style files Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-737]: fix RTL issue Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> * [INJIMOB-737]: refactor the header right and left Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> --------- Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Injimob-695] : Crash issue on iOS during Home screen navigation is fixed. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [Injimob-722]: Reverting the changes from java files of Injitest. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> --------- Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> Signed-off-by: srikanth716 <srikanthsri7447@gmail.com> Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in> Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Signed-off-by: Sreenadh S <32409698+sree96@users.noreply.github.com> Signed-off-by: Harsh Vardhan <harsh59v@gmail.com> Co-authored-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> Co-authored-by: srikanth716 <srikanthsri7447@gmail.com> Co-authored-by: anup-nehe <117707464+anup-nehe@users.noreply.github.com> Co-authored-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com> Co-authored-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Co-authored-by: Sreenadh S <32409698+sree96@users.noreply.github.com> Co-authored-by: adityankannan-tw <109274996+adityankannan-tw@users.noreply.github.com> Co-authored-by: Harsh Vardhan <harsh59v@gmail.com> Co-authored-by: Srikanth Kola <97477121+srikanth716@users.noreply.github.com>
250 lines
7.6 KiB
TypeScript
250 lines
7.6 KiB
TypeScript
import {NavigationProp, useNavigation} from '@react-navigation/native';
|
|
import {useSelector} from '@xstate/react';
|
|
import {useContext, useEffect} from 'react';
|
|
import {useTranslation} from 'react-i18next';
|
|
import {MessageOverlayProps} from '../../components/MessageOverlay';
|
|
import {MainBottomTabParamList, changeTabBarVisible} from '../../routes/main';
|
|
import {GlobalContext} from '../../shared/GlobalContext';
|
|
import {
|
|
selectIsConnecting,
|
|
selectIsConnectingTimeout,
|
|
selectIsInvalid,
|
|
selectIsLocationDenied,
|
|
selectIsLocationDisabled,
|
|
selectIsQrLoginDone,
|
|
selectIsScanning,
|
|
selectIsSendingVc,
|
|
selectIsSendingVcTimeout,
|
|
selectIsSent,
|
|
selectIsDone,
|
|
selectIsFaceIdentityVerified,
|
|
} from '../../machines/bleShare/scan/selectors';
|
|
import {
|
|
selectBleError,
|
|
selectIsAccepted,
|
|
selectIsDisconnected,
|
|
selectIsExchangingDeviceInfo,
|
|
selectIsExchangingDeviceInfoTimeout,
|
|
selectIsHandlingBleError,
|
|
selectIsOffline,
|
|
selectIsRejected,
|
|
selectIsReviewing,
|
|
} from '../../machines/bleShare/commonSelectors';
|
|
import {ScanEvents} from '../../machines/bleShare/scan/scanMachine';
|
|
import {BOTTOM_TAB_ROUTES, SCAN_ROUTES} from '../../routes/routesConstants';
|
|
import {ScanStackParamList} from '../../routes/routesConstants';
|
|
|
|
type ScanLayoutNavigation = NavigationProp<
|
|
ScanStackParamList & MainBottomTabParamList
|
|
>;
|
|
|
|
// TODO: refactor
|
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
export function useScanLayout() {
|
|
const {t} = useTranslation('ScanScreen');
|
|
const {appService} = useContext(GlobalContext);
|
|
const scanService = appService.children.get('scan');
|
|
const navigation = useNavigation<ScanLayoutNavigation>();
|
|
|
|
const isLocationDisabled = useSelector(scanService, selectIsLocationDisabled);
|
|
const isLocationDenied = useSelector(scanService, selectIsLocationDenied);
|
|
const isBleError = useSelector(scanService, selectIsHandlingBleError);
|
|
const bleError = useSelector(scanService, selectBleError);
|
|
|
|
const locationError = {message: '', button: ''};
|
|
|
|
if (isLocationDisabled) {
|
|
locationError.message = t('errors.locationDisabled.message');
|
|
locationError.button = t('errors.locationDisabled.button');
|
|
} else if (isLocationDenied) {
|
|
locationError.message = t('errors.locationDenied.message');
|
|
locationError.button = t('errors.locationDenied.button');
|
|
}
|
|
|
|
const DISMISS = () => scanService.send(ScanEvents.DISMISS());
|
|
const CANCEL = () => scanService.send(ScanEvents.CANCEL());
|
|
const CLOSE_BANNER = () => scanService.send(ScanEvents.CLOSE_BANNER());
|
|
const onStayInProgress = () =>
|
|
scanService.send(ScanEvents.STAY_IN_PROGRESS());
|
|
const onRetry = () => scanService.send(ScanEvents.RETRY());
|
|
const GOTO_HOME = () => {
|
|
scanService.send(ScanEvents.DISMISS());
|
|
changeTabBarVisible('flex');
|
|
navigation.navigate(BOTTOM_TAB_ROUTES.home);
|
|
};
|
|
const GOTO_HISTORY = () => {
|
|
scanService.send(ScanEvents.GOTO_HISTORY());
|
|
changeTabBarVisible('flex');
|
|
navigation.navigate(BOTTOM_TAB_ROUTES.history);
|
|
};
|
|
|
|
const isInvalid = useSelector(scanService, selectIsInvalid);
|
|
const isConnecting = useSelector(scanService, selectIsConnecting);
|
|
const isConnectingTimeout = useSelector(
|
|
scanService,
|
|
selectIsConnectingTimeout,
|
|
);
|
|
const isExchangingDeviceInfo = useSelector(
|
|
scanService,
|
|
selectIsExchangingDeviceInfo,
|
|
);
|
|
const isExchangingDeviceInfoTimeout = useSelector(
|
|
scanService,
|
|
selectIsExchangingDeviceInfoTimeout,
|
|
);
|
|
const isAccepted = useSelector(scanService, selectIsAccepted);
|
|
const isRejected = useSelector(scanService, selectIsRejected);
|
|
const isSent = useSelector(scanService, selectIsSent);
|
|
const isOffline = useSelector(scanService, selectIsOffline);
|
|
const isSendingVc = useSelector(scanService, selectIsSendingVc);
|
|
const isSendingVcTimeout = useSelector(scanService, selectIsSendingVcTimeout);
|
|
const isStayInProgress = isConnectingTimeout || isSendingVcTimeout;
|
|
let isFaceIdentityVerified = useSelector(
|
|
scanService,
|
|
selectIsFaceIdentityVerified,
|
|
);
|
|
|
|
let statusOverlay: Pick<
|
|
MessageOverlayProps,
|
|
| 'title'
|
|
| 'message'
|
|
| 'hint'
|
|
| 'onButtonPress'
|
|
| 'minHeight'
|
|
| 'buttonText'
|
|
| 'onStayInProgress'
|
|
| 'onRetry'
|
|
| 'progress'
|
|
| 'onBackdropPress'
|
|
| 'requester'
|
|
> = null;
|
|
if (isConnecting) {
|
|
statusOverlay = {
|
|
title: t('status.inProgress.title'),
|
|
hint: t('status.inProgress.hint'),
|
|
progress: true,
|
|
onButtonPress: CANCEL,
|
|
};
|
|
} else if (isConnectingTimeout) {
|
|
statusOverlay = {
|
|
title: t('status.connectionInProgress'),
|
|
hint: t('status.connectingTimeout'),
|
|
onButtonPress: CANCEL,
|
|
onStayInProgress,
|
|
onRetry,
|
|
progress: true,
|
|
};
|
|
} else if (isExchangingDeviceInfo) {
|
|
statusOverlay = {
|
|
message: t('status.exchangingDeviceInfo'),
|
|
progress: true,
|
|
};
|
|
} else if (isExchangingDeviceInfoTimeout) {
|
|
statusOverlay = {
|
|
message: t('status.exchangingDeviceInfo'),
|
|
hint: t('status.exchangingDeviceInfoTimeout'),
|
|
onButtonPress: CANCEL,
|
|
progress: true,
|
|
};
|
|
} else if (isSendingVc) {
|
|
statusOverlay = {
|
|
title: t('status.sharing.title'),
|
|
hint: t('status.sharing.hint'),
|
|
onButtonPress: CANCEL,
|
|
progress: true,
|
|
};
|
|
} else if (isSent) {
|
|
statusOverlay = {
|
|
title: t('status.sharing.title'),
|
|
hint: t('status.sharing.hint'),
|
|
progress: true,
|
|
};
|
|
} else if (isSendingVcTimeout) {
|
|
statusOverlay = {
|
|
title: t('status.sharing.title'),
|
|
hint: t('status.sharing.timeoutHint'),
|
|
onButtonPress: CANCEL,
|
|
onStayInProgress,
|
|
onRetry,
|
|
progress: true,
|
|
};
|
|
} else if (isAccepted) {
|
|
statusOverlay = {
|
|
title: t('status.accepted.title'),
|
|
message: t('status.accepted.message'),
|
|
onButtonPress: DISMISS,
|
|
};
|
|
} else if (isRejected) {
|
|
statusOverlay = {
|
|
title: t('status.rejected.title'),
|
|
message: t('status.rejected.message'),
|
|
onBackdropPress: DISMISS,
|
|
};
|
|
} else if (isInvalid) {
|
|
statusOverlay = {
|
|
message: t('status.invalid'),
|
|
onBackdropPress: DISMISS,
|
|
};
|
|
} else if (isOffline) {
|
|
statusOverlay = {
|
|
message: t('status.offline'),
|
|
onBackdropPress: DISMISS,
|
|
};
|
|
}
|
|
|
|
useEffect(() => {
|
|
const subscriptions = [
|
|
navigation.addListener('focus', () =>
|
|
scanService.send(ScanEvents.SCREEN_FOCUS()),
|
|
),
|
|
navigation.addListener('blur', () =>
|
|
scanService.send(ScanEvents.SCREEN_BLUR()),
|
|
),
|
|
];
|
|
|
|
return () => {
|
|
subscriptions.forEach(unsubscribe => unsubscribe());
|
|
};
|
|
}, []);
|
|
|
|
const isDone = useSelector(scanService, selectIsDone);
|
|
const isReviewing = useSelector(scanService, selectIsReviewing);
|
|
const isScanning = useSelector(scanService, selectIsScanning);
|
|
const isQrLoginDone = useSelector(scanService, selectIsQrLoginDone);
|
|
|
|
useEffect(() => {
|
|
if (isDone) {
|
|
changeTabBarVisible('flex');
|
|
navigation.navigate(BOTTOM_TAB_ROUTES.home);
|
|
} else if (isReviewing) {
|
|
changeTabBarVisible('none');
|
|
navigation.navigate(SCAN_ROUTES.SendVcScreen);
|
|
} else if (isScanning) {
|
|
changeTabBarVisible('flex');
|
|
navigation.navigate(SCAN_ROUTES.ScanScreen);
|
|
} else if (isQrLoginDone) {
|
|
changeTabBarVisible('flex');
|
|
navigation.navigate(BOTTOM_TAB_ROUTES.history);
|
|
}
|
|
}, [isDone, isReviewing, isScanning, isQrLoginDone, isBleError]);
|
|
|
|
return {
|
|
isInvalid,
|
|
isDone,
|
|
GOTO_HOME,
|
|
GOTO_HISTORY,
|
|
isDisconnected: useSelector(scanService, selectIsDisconnected),
|
|
statusOverlay,
|
|
isStayInProgress,
|
|
isBleError,
|
|
bleError,
|
|
DISMISS,
|
|
isAccepted,
|
|
onRetry,
|
|
CANCEL,
|
|
isSendingVc,
|
|
isFaceIdentityVerified,
|
|
CLOSE_BANNER,
|
|
};
|
|
}
|