Files
inji-wallet/components/kebabMenuUtils.ts
KiruthikaJeyashankar 6c1e23a3d2 [INJIMOB-3453] fix share-with-selfie not coming with vc with face (#2095)
* [INJIMOB-3453] fix share-with-selfie not coming with vc with face and remove mosip vc hardcoding

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>

* [INJIMOB-3453] pass issuerHost instead of issuer name in activitylogs

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>

* [INJIMOB-3453] exclude processed credentialdata data in ble share

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>

* [INJIMOB-3453] refactor: rename vcHasImage to getFaceAtribute

Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>

* [INJIMOB-3453] refactor: modify fallback for face in VC

Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>

* [INJIMOB-3453] fix: inexisting function import

Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>

---------

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
Co-authored-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
2025-10-03 11:57:25 +05:30

84 lines
2.6 KiB
TypeScript

import {useTranslation} from 'react-i18next';
import {SvgImage} from './ui/svg';
import {useKebabPopUp} from './KebabPopUpController';
import {isActivationNeeded} from '../shared/openId4VCI/Utils';
import {VCShareFlowType} from '../shared/Utils';
export const getKebabMenuOptions = props => {
const controller = useKebabPopUp(props);
const {t} = useTranslation('HomeScreenKebabPopUp');
const loadScanScreen = flowType => () => {
controller.SELECT_VC_ITEM(props.service, flowType),
controller.GOTO_SCANSCREEN(),
props.service.send('CLOSE_VC_MODAL');
};
const activationNotCompleted =
!controller.walletBindingResponse &&
isActivationNeeded(props?.vcMetadata.issuer);
const vcActionsList = [
{
label: props.vcMetadata.isPinned ? t('unPinCard') : t('pinCard'),
icon: SvgImage.OutlinedPinIcon(),
onPress: controller.PIN_CARD,
testID: 'pinOrUnPinCard',
},
{
label: t('viewActivityLog'),
icon: SvgImage.OutlinedScheduleIcon(),
onPress: controller.SHOW_ACTIVITY,
testID: 'viewActivityLog',
},
{
label: t('removeFromWallet'),
icon: SvgImage.outlinedDeleteIcon(),
onPress: () => controller.REMOVE(props.vcMetadata),
testID: 'removeFromWallet',
},
];
const share = {
label: t('share'),
icon: SvgImage.OutlinedShareIcon(),
onPress: loadScanScreen(VCShareFlowType.MINI_VIEW_SHARE),
testID: 'shareVcFromKebab',
};
const shareWithSelfieOption = {
label: t('shareWithSelfie'),
icon: SvgImage.OutlinedShareWithSelfieIcon(),
onPress: loadScanScreen(VCShareFlowType.MINI_VIEW_SHARE_WITH_SELFIE),
testID: 'shareVcWithSelfieFromKebab',
};
const VCActivationOption = {
label: activationNotCompleted
? t('WalletBinding:offlineAuthenticationDisabled')
: isActivationNeeded(props.vcMetadata.issuer)
? t('WalletBinding:profileAuthenticated')
: t('WalletBinding:credentialActivated'),
icon: SvgImage.OutlinedShieldedIcon(),
onPress: activationNotCompleted
? controller.ADD_WALLET_BINDING_ID
: loadScanScreen(VCShareFlowType.MINI_VIEW_QR_LOGIN),
testID: 'pendingActivationOrActivated',
};
if (props.vcMetadata.isVerified) {
vcActionsList.splice(1, 0, share);
if (props.vcHasImage) {
vcActionsList.splice(2, 0, shareWithSelfieOption, VCActivationOption);
}
if (props.vcMetadata.isExpired) {
const indexOfActivation = vcActionsList.indexOf(VCActivationOption);
if (indexOfActivation !== -1) {
vcActionsList.splice(indexOfActivation, 1);
}
}
}
return vcActionsList;
};