[INJIMOB-2526] update logic for vc search in homescreen (#1736)

* [INJIMOB-2522] fix backup restore duplicate key in vc screen

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

* [INJIMOB-2526] update logic for vc search in homescreen

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

---------

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
This commit is contained in:
abhip2565
2024-12-11 11:17:03 +05:30
committed by GitHub
parent 8fe100eebc
commit c8a8d97e56
8 changed files with 17 additions and 9 deletions

View File

@@ -409,7 +409,7 @@
}
},
"MyVcsTab": {
"searchByName": "البحث عن طريق الإسم",
"searchByName": "يبحث",
"bringYourDigitalID": "أحضر هويتك الرقمية",
"generateVcDescription": "اضغط على \"إضافة بطاقة \" أدناه لتنزيل بطاقتك",
"generateVcFABDescription": "اضغط على \"+\" أدناه لتنزيل بطاقتك",

View File

@@ -410,7 +410,7 @@
}
},
"MyVcsTab": {
"searchByName": "Search by name",
"searchByName": "Search",
"bringYourDigitalID": "Bring your digital identity",
"generateVcDescription": "Tap on \"Download card\" below to download your card",
"generateVcFABDescription": "Tap on \"+\" below to download your card",

View File

@@ -409,7 +409,7 @@
}
},
"MyVcsTab": {
"searchByName": "Maghanap ayon sa pangalan",
"searchByName": "Maghanap",
"bringYourDigitalID": "Dalhin ang Iyong Digital ID",
"generateVcDescription": "Upang i-download ang iyong card i-tap ang I-download card sa ibaba",
"generateVcFABDescription": "Upang i-download ang iyong card i-tap ang + sa ibaba",

View File

@@ -410,7 +410,7 @@
}
},
"MyVcsTab": {
"searchByName": "नाम से खोजें",
"searchByName": "खोजें",
"downloadCard": "डाउनलोड कार्ड",
"bringYourDigitalID": "अपनी डिजिटल आईडी लाओ",
"generateVcDescription": "अपना कार्ड डाउनलोड करने के लिए नीचे डाउनलोड कार्ड टैप करें",

View File

@@ -409,7 +409,7 @@
}
},
"MyVcsTab": {
"searchByName": "ಹೆಸರಿನಿಂದ ಹುಡುಕಿ",
"searchByName": "ಹುಡುಕ",
"downloadCard": "ಕಾರ್ಡ್ ಡೌನ್‌ಲೋಡ್ ಮಾಡಿ",
"bringYourDigitalID": "ನಿಮ್ಮ ಡಿಜಿಟಲ್ ಐಡಿ ತನ್ನಿ",
"generateVcDescription": "ನಿಮ್ಮ ಕಾರ್ಡ್ ಅನ್ನು ಡೌನ್‌ಲೋಡ್ ಮಾಡಲು ಕೆಳಗಿನ ಡೌನ್‌ಲೋಡ್ ಕಾರ್ಡ್ ಅನ್ನು ಟ್ಯಾಪ್ ಮಾಡಿ",

View File

@@ -409,7 +409,7 @@
}
},
"MyVcsTab": {
"searchByName": "பெயரால் தேடுங்கள்",
"searchByName": "தேடு",
"bringYourDigitalID": "உங்கள் டிஜிட்டல் ஐடியைக் கொண்டு வாருங்கள்",
"generateVcDescription": "உங்கள் அட்டை ஐப் பதிவிறக்க, கீழே உள்ள பதிவிறக்கு அட்டை என்பதைத் தட்டவும்",
"generateVcFABDescription": "உங்கள் அட்டை ஐப் பதிவிறக்க, கீழே உள்ள + என்பதைத் தட்டவும்",

View File

@@ -84,8 +84,9 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = props => {
const credentialSubject =
vc.verifiableCredential.credentialSubject ||
vc.verifiableCredential.credential.credentialSubject;
if (credentialSubject) {
if(isStringAndContains(searchText,vc['vcMetadata'].credentialType))
isVcFound=true
else if (credentialSubject) {
isVcFound = searchNestedCredentialFields(
searchTextLower,
credentialSubject,

View File

@@ -1,5 +1,6 @@
import {
Credential,
CredentialTypes,
VC,
VcIdType,
VerifiableCredential,
@@ -8,6 +9,7 @@ import {Protocols} from './openId4VCI/Utils';
import {getMosipIdentifier} from './commonUtil';
import {VCFormat} from './VCFormat';
import {isMosipVC} from './Utils';
import { getCredentialType } from '../components/VC/common/VCUtils';
const VC_KEY_PREFIX = 'VC';
const VC_ITEM_STORE_KEY_REGEX = '^VC_[a-zA-Z0-9_-]+$';
@@ -27,6 +29,7 @@ export class VCMetadata {
isExpired: boolean = false;
downloadKeyType: string = '';
credentialType: string = '';
constructor({
idType = '',
requestId = '',
@@ -40,6 +43,7 @@ export class VCMetadata {
format = '',
downloadKeyType = '',
isExpired = false,
credentialType = '',
} = {}) {
this.idType = idType;
this.requestId = requestId;
@@ -53,6 +57,7 @@ export class VCMetadata {
this.format = format;
this.downloadKeyType = downloadKeyType;
this.isExpired = isExpired;
this.credentialType = credentialType
}
//TODO: Remove any typing and use appropriate typing
@@ -74,6 +79,7 @@ export class VCMetadata {
? vc.vcMetadata.mosipIndividualId
: getMosipIndividualId(vc.verifiableCredential, vc.issuer),
downloadKeyType: vc.downloadKeyType,
credentialType: vc.credentialType
});
}
@@ -113,7 +119,7 @@ export function parseMetadatas(metadataStrings: object[]) {
return metadataStrings.map(o => new VCMetadata(o));
}
export const getVCMetadata = (context: object, keyType: string) => {
export const getVCMetadata = (context: object, keyType: string, credType: CredentialTypes) => {
const [issuer, protocol, credentialId] =
context.credentialWrapper?.identifier.split(':');
@@ -131,6 +137,7 @@ export const getVCMetadata = (context: object, keyType: string) => {
),
format: context['credentialWrapper'].format,
downloadKeyType: keyType,
credentialType: getCredentialType(context.selectedCredentialType)
});
};