Feat(Inji-344): Fix Remove VC failure due to json parsing (#849)

* feat(inji-344): Use VC Key class instead of separate functions for managing vc key

* feat(inji-344): Use properties from VcKey Class instead of reading from vckey string

* feat(inji-344): Rename vcKey to vcMetadata

* feat(inji-344): Use vc's unique id or vckey instead of joined string of vc metadata

* feat(inji-344): Use vc key instead of unique id to avoid confusion. Fix issues reg parsing vc metadata

* feat(inji-344):fix redownloading issue

Co-authored-by: Tilak <tilakpuli15@gmail.com>

* feat(inji-344): Remove vc getting stored on update of pin status

* feat(inji-344): update other vc's pin status to false when any vc is pinned

* feat(inji-344): remove hash ID for UIN

* feat(inji-344): revert google services json

* feat(inji-344): remove mmkv logs added for debugging

* feat(inji-344): fix received vcs not getting displayed on reopen of app

* feat(inji-344): fix id not shown in revoke component

* feat(inji-344): fix remove VC getting failed due to json parse issue

* Merge branch 'develop' of https://github.com/mosip/inji

---------

Co-authored-by: Sri Kanth Kola <srikanthsri7447@gmail.com>
This commit is contained in:
Tilak Puli
2023-09-22 18:03:29 +05:30
committed by GitHub
parent f38ef74f9f
commit a20a01a8b0
42 changed files with 13 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -552,14 +552,14 @@ export async function updateItem(
value: string,
encryptionKey: string,
) {
// Used for updating VC metadata in the list. Prepends the passed vcmetadata in value and sets ispinned of other vc metadata to false
// Used for updating VC metadata in the list. Prepends the passed vcmetadata in value
try {
const list = await getItem(key, [], encryptionKey);
const list = (await getItem(key, [], encryptionKey)) as Object[];
const updatedMetaData = VCMetadata.fromVcMetadataString(value);
const newList = [
value,
...list.map(metadataStr => {
const metaData = VCMetadata.fromVcMetadataString(metadataStr);
...list.map(metadataObj => {
const metaData = new VCMetadata(metadataObj);
if (metaData.getVcKey() !== updatedMetaData.getVcKey()) {
return JSON.stringify(metaData);
}
@@ -585,9 +585,9 @@ export async function removeItem(
} else if (key === MY_VCS_STORE_KEY) {
const data = await Storage.getItem(key, encryptionKey);
const decryptedData = await decryptJson(encryptionKey, data);
const list = JSON.parse(decryptedData) as string[];
const newList = list.filter((str: string) => {
return VCMetadata.fromVcMetadataString(str).getVcKey() !== value;
const list = JSON.parse(decryptedData) as Object[];
const newList = list.filter((vcMetadataObject: Object) => {
return new VCMetadata(vcMetadataObject).getVcKey() !== value;
});
await setItem(key, newList, encryptionKey);
@@ -607,9 +607,9 @@ export async function removeVCMetaData(
try {
const data = await Storage.getItem(key, encryptionKey);
const decryptedData = await decryptJson(encryptionKey, data);
const list = JSON.parse(decryptedData) as string[];
const newList = list.filter((str: string) => {
return VCMetadata.fromVcMetadataString(str).getVcKey() !== vcKey;
const list = JSON.parse(decryptedData) as Object[];
const newList = list.filter((vcMetadataObject: Object) => {
return new VCMetadata(vcMetadataObject).getVcKey() !== vcKey;
});
await setItem(key, newList, encryptionKey);
@@ -627,10 +627,10 @@ export async function removeItems(
try {
const data = await Storage.getItem(key, encryptionKey);
const decryptedData = await decryptJson(encryptionKey, data);
const list = JSON.parse(decryptedData) as string[];
const list = JSON.parse(decryptedData) as Object[];
const newList = list.filter(
(str: string) =>
!values.includes(VCMetadata.fromVcMetadataString(str).getVcKey()),
(vcMetadataObject: Object) =>
!values.includes(new VCMetadata(vcMetadataObject).getVcKey()),
);
await setItem(key, newList, encryptionKey);