[INJIMOB-3543] fix: input_descriptor_id lost issue when user selects the VC (#2086)

* [INJIMOB-3543] fix: input_descriptor_id lost issue when user selects the VC

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

* [INJIMOB-3543] refactor: remove debug logs

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

* [INJIMOB-3543] refactor: renmae variable

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

* [INJIMOB-3543] refactor: remove debug logs

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

* [INJIMOB-3543] update ios dependencies for release-0.20.0

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

---------

Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
Co-authored-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
This commit is contained in:
KiruthikaJeyashankar
2025-09-19 15:52:48 +05:30
committed by GitHub
parent df4dc7b383
commit f4ef7f66e5
5 changed files with 55 additions and 39 deletions

View File

@@ -849,8 +849,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/mosip/pixelpass-ios-swift/";
requirement = {
branch = "release-0.6.x";
kind = branch;
kind = exactVersion;
version = 0.6.3;
};
};
9CCCA19C2CF87A8400D5A461 /* XCRemoteSwiftPackageReference "secure-keystore-ios-swift" */ = {
@@ -865,7 +865,7 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/mosip/inji-vc-renderer-ios-swift.git";
requirement = {
branch = develop;
branch = "release-0.1.x";
kind = branch;
};
};
@@ -873,7 +873,7 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/mosip/inji-openid4vp-ios-swift.git";
requirement = {
branch = develop;
branch = "release-0.5.x";
kind = branch;
};
};
@@ -881,7 +881,7 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/mosip/inji-vci-client-ios-swift";
requirement = {
branch = develop;
branch = "release-0.6.x";
kind = branch;
};
};

View File

@@ -1,5 +1,5 @@
{
"originHash" : "c97fbee22fce758b0bea2f875d3805ef3530cfb7d60c2832b0b36cf3f72da606",
"originHash" : "a3146fb582ba55930e9db89f50cf0454e89ade6fb6a380b0e7d649e8527e703a",
"pins" : [
{
"identity" : "alamofire",
@@ -69,8 +69,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/mosip/inji-openid4vp-ios-swift.git",
"state" : {
"branch" : "develop",
"revision" : "93d9cda26cf863888814813b63e1aa8250045a9e"
"branch" : "release-0.5.x",
"revision" : "e939d4acf4e9f54d902b65913b93432fcd068b46"
}
},
{
@@ -78,7 +78,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/mosip/inji-vc-renderer-ios-swift.git",
"state" : {
"branch" : "develop",
"branch" : "release-0.1.x",
"revision" : "58237eae6caf198d725ecfcd397b4d6f8f2d87bd"
}
},
@@ -87,7 +87,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/mosip/inji-vci-client-ios-swift",
"state" : {
"branch" : "develop",
"branch" : "release-0.6.x",
"revision" : "c64213b4598f65f887acc1b7a309d3cb1e895129"
}
},
@@ -105,8 +105,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/mosip/pixelpass-ios-swift/",
"state" : {
"branch" : "release-0.6.x",
"revision" : "78faea2ff48626ef9a6d198123bcf7b299acefd1"
"revision" : "78faea2ff48626ef9a6d198123bcf7b299acefd1",
"version" : "0.6.3"
}
},
{
@@ -141,7 +141,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/abhip2565/SwiftCBOR",
"state" : {
"revision" : "cc4e195a0ea2dce88f2fd6c6d73b2504e3c884fd",
"revision" : "04ccff117f6549121d5721ec84fdf0162122b90e",
"version" : "0.5.0"
}
},

View File

@@ -296,7 +296,7 @@ function getVcsMatchingAuthRequest(context, event) {
requestedClaimsByVerifier,
);
let shouldInclude = false;
let shouldInclude: boolean;
if (inputDescriptor.constraints.fields && format) {
shouldInclude = isMatchingConstraints && areMatchingFormatAndProofType;
} else {

View File

@@ -268,7 +268,7 @@ export const SendVPScreen: React.FC<ScanLayoutProps> = props => {
const noOfCardsSelected = controller.areAllVCsChecked
? Object.values(controller.vcsMatchingAuthRequest).length
: Object.keys(controller.selectedVCKeys).length;
: Object.values(controller.inputDescriptorIdToSelectedVcKeys).reduce((vcCount, arr) => vcCount + arr.length, 0);
const cardsSelectedText =
noOfCardsSelected === 1
@@ -339,7 +339,7 @@ export const SendVPScreen: React.FC<ScanLayoutProps> = props => {
([inputDescriptorId, vcs]) =>
vcs.map(vcData => (
<VcItemContainer
key={getVcKey(vcData)}
key={`${getVcKey(vcData)}-${inputDescriptorId}`}
vcMetadata={vcData.vcMetadata}
margin="0 2 8 2"
onPress={controller.SELECT_VC_ITEM(
@@ -348,10 +348,9 @@ export const SendVPScreen: React.FC<ScanLayoutProps> = props => {
)}
selectable
selected={
controller.areAllVCsChecked ||
Object.keys(controller.selectedVCKeys).includes(
getVcKey(vcData),
)
controller.areAllVCsChecked || (
Object.keys(controller.inputDescriptorIdToSelectedVcKeys).includes(inputDescriptorId) && controller.inputDescriptorIdToSelectedVcKeys[inputDescriptorId].includes(getVcKey(vcData))
)
}
flow={VCItemContainerFlowType.VP_SHARE}
isPinned={vcData.vcMetadata.isPinned}

View File

@@ -65,7 +65,8 @@ export function useSendVPScreen() {
const activityLogService = appService.children.get('activityLog')!!;
const navigation = useNavigation<MyVcsTabNavigation>();
const openID4VPService = scanService.getSnapshot().context.OpenId4VPRef;
const [selectedVCKeys, setSelectedVCKeys] = useState<Record<string, string>>(
// input descriptor id to VCs mapping
const [inputDescriptorIdToSelectedVcKeys, setInputDescriptorIdToSelectedVcKeys] = useState<Record<string, [string]>>(
{},
);
@@ -108,15 +109,15 @@ export function useSendVPScreen() {
};
const getSelectedVCs = (): Record<string, any[]> => {
let selectedVcsData: Record<string, any[]> = {};
Object.entries(selectedVCKeys).forEach(([vcKey, inputDescriptorId]) => {
const vcData = myVcs[vcKey];
if (!selectedVcsData[inputDescriptorId]) {
selectedVcsData[inputDescriptorId] = [];
}
selectedVcsData[inputDescriptorId].push(vcData);
let selectedVcsData: Record<string, any[]> = {}; // input_descriptor_id to VC[]
Object.entries(inputDescriptorIdToSelectedVcKeys).forEach(([inputDescriptorId, vcKeys]) => {
vcKeys.forEach((vcKey : string) => {
const vcData = myVcs[vcKey];
selectedVcsData[inputDescriptorId] = selectedVcsData[inputDescriptorId] || [];
selectedVcsData[inputDescriptorId].push(vcData);
});
});
return selectedVcsData;
return selectedVcsData
};
const showConfirmationPopup = useSelector(
@@ -240,7 +241,7 @@ export function useSendVPScreen() {
vcsMatchingAuthRequest,
userSelectedVCs: useSelector(openID4VPService, selectSelectedVCs),
areAllVCsChecked,
selectedVCKeys,
inputDescriptorIdToSelectedVcKeys,
isVerifyingIdentity: useSelector(
openID4VPService,
selectIsVerifyingIdentity,
@@ -280,33 +281,49 @@ export function useSendVPScreen() {
SELECT_VC_ITEM:
(vcKey: string, inputDescriptorId: string) =>
(vcRef: ActorRefFrom<typeof VCItemMachine>) => {
let selectedVcs = {...selectedVCKeys};
const isVCSelected = !!!selectedVcs[vcKey];
let descriptorMappingToVCs = {...inputDescriptorIdToSelectedVcKeys};
const isVCSelected = Object.keys(inputDescriptorIdToSelectedVcKeys)?.includes(inputDescriptorId) && inputDescriptorIdToSelectedVcKeys[inputDescriptorId]?.includes(vcKey) ? false : true;
if (isVCSelected) {
selectedVcs[vcKey] = inputDescriptorId;
if (descriptorMappingToVCs[inputDescriptorId]) {
if (!descriptorMappingToVCs[inputDescriptorId].includes(vcKey)) {
descriptorMappingToVCs[inputDescriptorId].push(vcKey);
}
} else {
descriptorMappingToVCs[inputDescriptorId] = [vcKey];
}
} else {
delete selectedVcs[vcKey];
// remove vc key from the input descriptor mapping
if (descriptorMappingToVCs[inputDescriptorId]) {
descriptorMappingToVCs[inputDescriptorId] = descriptorMappingToVCs[
inputDescriptorId
].filter(key => key !== vcKey); // remove the vcKey from the array
if (descriptorMappingToVCs[inputDescriptorId].length === 0) { // if the array is empty, remove the input descriptor id
delete descriptorMappingToVCs[inputDescriptorId];
}
}
}
setSelectedVCKeys(selectedVcs);
setInputDescriptorIdToSelectedVcKeys(descriptorMappingToVCs)
const {serviceRefs, wellknownResponse, ...vcData} =
vcRef.getSnapshot().context;
},
UNCHECK_ALL: () => {
setSelectedVCKeys({});
setInputDescriptorIdToSelectedVcKeys({})
},
CHECK_ALL: () => {
let updatedVCsList = {};
const updatedInputDescriptorToCredentialsMapping: Record<string, any[]> = {};
Object.entries(vcsMatchingAuthRequest).map(([inputDescriptorId, vcs]) => {
updatedInputDescriptorToCredentialsMapping[inputDescriptorId] = [];
vcs.map(vcData => {
const vcKey = VCMetadata.fromVcMetadataString(
vcData.vcMetadata,
).getVcKey();
updatedVCsList[vcKey] = inputDescriptorId;
updatedInputDescriptorToCredentialsMapping[inputDescriptorId].push(vcKey);
});
});
setSelectedVCKeys({...updatedVCsList});
setInputDescriptorIdToSelectedVcKeys({...updatedInputDescriptorToCredentialsMapping});
},
ACCEPT_REQUEST: (selectedDisclosuresByVc) => {