Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INJIMOB-1194]: render the QR code component from VC credential subject if present #1438

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions components/QrCodeOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import testIDProps from '../shared/commonUtil';
import {SvgImage} from './ui/svg';
// @ts-ignore
import {generateQRData} from '@mosip/pixelpass';
import {VerifiableCredential} from '../machines/VerifiableCredential/VCMetaMachine/vc';
import {Credential} from '../machines/VerifiableCredential/VCMetaMachine/vc';
import RNSecureKeyStore, {ACCESSIBLE} from 'react-native-secure-key-store';
import {DEFAULT_ECL} from '../shared/constants';
import {VCMetadata} from '../shared/VCMetadata';
Expand All @@ -21,6 +21,10 @@ export const QrCodeOverlay: React.FC<QrCodeOverlayProps> = props => {

async function getQRData(): Promise<string> {
let qrData: string;

if (props.verifiableCredential.credentialSubject.QR)
return props.verifiableCredential.credentialSubject.QR;

try {
qrData = await RNSecureKeyStore.get(props.meta.id);
} catch {
Expand Down Expand Up @@ -109,6 +113,6 @@ export const QrCodeOverlay: React.FC<QrCodeOverlayProps> = props => {
};

interface QrCodeOverlayProps {
verifiableCredential: VerifiableCredential;
verifiableCredential: Credential;
meta: VCMetadata;
}
4 changes: 2 additions & 2 deletions components/VC/Views/VCDetailView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {useTranslation} from 'react-i18next';
import {Image, ImageBackground, View} from 'react-native';
import {
VerifiableCredential,
Credential,
WalletBindingResponse,
} from '../../../machines/VerifiableCredential/VCMetaMachine/vc';
import {Button, Column, Row, Text} from '../../ui';
Expand Down Expand Up @@ -217,7 +217,7 @@ export const VCDetailView: React.FC<VCItemDetailsProps> = props => {
export interface VCItemDetailsProps {
fields: any[];
wellknown: any;
credential: VerifiableCredential | Credential;
credential: Credential;
verifiableCredentialData: any;
walletBindingResponse?: WalletBindingResponse;
onBinding?: () => void;
Expand Down
1 change: 1 addition & 0 deletions machines/VerifiableCredential/VCMetaMachine/vc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface CredentialSubject {
id: string;
phone: string;
face: string;
QR?: string;
}

type VCContext = (string | Record<string, unknown>)[];
Expand Down
5 changes: 2 additions & 3 deletions screens/Home/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ import {ReceivedVcsTab} from './ReceivedVcsTab';
import {ViewVcModal} from './ViewVcModal';
import {useHomeScreen} from './HomeScreenController';
import {TabRef} from './HomeScreenMachine';
import {useTranslation} from 'react-i18next';
import {ActorRefFrom} from 'xstate';
import LinearGradient from 'react-native-linear-gradient';
import {ErrorMessageOverlay} from '../../components/MessageOverlay';
import {Pressable} from 'react-native';
import testIDProps from '../../shared/commonUtil';
import {BannerNotificationContainer} from '../../components/BannerNotificationContainer';
import {VCItemMachine} from '../../machines/VerifiableCredential/VCItemMachine/VCItemMachine';
import {VerifiableCredential} from '../../machines/VerifiableCredential/VCMetaMachine/vc';
import {Credential} from '../../machines/VerifiableCredential/VCMetaMachine/vc';

export const HomeScreen: React.FC<HomeRouteProps> = props => {
const controller = useHomeScreen(props);
Expand Down Expand Up @@ -108,5 +107,5 @@ export interface HomeScreenTabProps {
isVisible: boolean;
service: TabRef;
vcItemActor: ActorRefFrom<typeof VCItemMachine>;
vc: VerifiableCredential | Credential;
vc: Credential;
}
4 changes: 2 additions & 2 deletions screens/VerifyIdentityOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {FaceScanner} from '../components/FaceScanner';
import {Column} from '../components/ui';
import {Theme} from '../components/ui/styleUtils';
import {VerifiableCredential} from '../machines/VerifiableCredential/VCMetaMachine/vc';
import {Credential} from '../machines/VerifiableCredential/VCMetaMachine/vc';
import {Modal} from '../components/ui/Modal';
import {useTranslation} from 'react-i18next';

Expand Down Expand Up @@ -38,7 +38,7 @@ export const VerifyIdentityOverlay: React.FC<
};

export interface VerifyIdentityOverlayProps {
credential?: VerifiableCredential | Credential;
credential?: Credential;
verifiableCredentialData: any;
isVerifyingIdentity: boolean;
onCancel: () => void;
Expand Down
Loading