Skip to content

Commit

Permalink
Merge pull request #264 from idpass/fix/mosip-276-unused-prop-crash
Browse files Browse the repository at this point in the history
fix(mosip#276): crash due to undefined function
  • Loading branch information
pmigueld authored Nov 30, 2022
2 parents f44558c + ab7fcd0 commit b50b137
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 44 deletions.
13 changes: 9 additions & 4 deletions components/SingleVcItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,17 @@ export const SingleVcItem: React.FC<VcItemProps> = (props) => {
? ''
: getLocalizedField(verifiableCredential.credentialSubject.fullName);

const selectableOrCheck = props.selectable ? null : null;
const selectableOrCheck = props.selectable ? (
<CheckBox
checked={props.selected}
checkedIcon={<Icon name="radio-button-checked" />}
uncheckedIcon={<Icon name="radio-button-unchecked" />}
onPress={() => props.onPress(service)}
/>
) : null;

return (
<Column
onShow={props.onShow(service)}
style={Theme.Styles.closeCardBgContainer}>
<Column style={Theme.Styles.closeCardBgContainer}>
<ImageBackground
source={!verifiableCredential ? null : Theme.CloseCard}
resizeMode="stretch"
Expand Down
31 changes: 9 additions & 22 deletions machines/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ const model = createModel(
SELECT_VC: (vc: VC) => ({ vc }),
SCAN: (params: string) => ({ params }),
ACCEPT_REQUEST: (shouldVerifySender: boolean) => ({ shouldVerifySender }),
VERIFY_AND_ACCEPT_REQUEST: (shouldVerifySender: boolean) => ({
shouldVerifySender,
}),
VERIFY_AND_ACCEPT_REQUEST: () => ({}),
VC_ACCEPTED: () => ({}),
VC_REJECTED: () => ({}),
CANCEL: () => ({}),
Expand Down Expand Up @@ -252,22 +250,13 @@ export const scanMachine = model.createMachine(
SELECT_VC: {
actions: ['setSelectedVc'],
},
VERIFY_AND_ACCEPT_REQUEST: [
{
cond: 'shouldVerifySender',
target: 'verifyingIdentity',
},
{
target: 'verifyingIdentity',
},
],
ACCEPT_REQUEST: [
{
cond: 'shouldVerifySender',
actions: 'setShouldVerifyPresence',
target: 'sendingVc',
},
],
VERIFY_AND_ACCEPT_REQUEST: {
target: 'verifyingIdentity',
},
ACCEPT_REQUEST: {
actions: 'setShouldVerifyPresence',
target: 'sendingVc',
},
CANCEL: '#scan.reviewing.cancelling',
},
},
Expand Down Expand Up @@ -480,7 +469,7 @@ export const scanMachine = model.createMachine(
setShouldVerifyPresence: assign({
selectedVc: (context) => ({
...context.selectedVc,
shouldVerifyPresence: true,
shouldVerifyPresence: context.shouldVerifySender,
}),
}),
},
Expand Down Expand Up @@ -675,8 +664,6 @@ export const scanMachine = model.createMachine(
return false;
}
},

shouldVerifySender: (_context, event) => event.shouldVerifySender,
},

delays: {
Expand Down
1 change: 0 additions & 1 deletion machines/scan.typegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export interface Typegen0 {
'eventsCausingGuards': {
isQrOffline: 'SCAN';
isQrOnline: 'SCAN';
shouldVerifySender: 'ACCEPT_REQUEST' | 'VERIFY_AND_ACCEPT_REQUEST';
};
'eventsCausingDelays': {
CANCEL_TIMEOUT: 'CANCEL';
Expand Down
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"react-native-simple-markdown": "^1.1.0",
"react-native-svg": "12.1.1",
"react-native-swipe-gestures": "^1.0.5",
"react-native-system-setting": "^1.7.6",
"react-native-uuid": "^2.0.1",
"react-native-vector-icons": "^8.1.0",
"xstate": "^4.26.0"
Expand Down Expand Up @@ -101,4 +100,4 @@
"react": "17.0.1",
"react-native": "0.64.4"
}
}
}
2 changes: 1 addition & 1 deletion screens/Home/ViewVcModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const ViewVcModal: React.FC<ViewVcModalProps> = (props) => {
<Modal
isVisible={props.isVisible}
onDismiss={props.onDismiss}
headerTitle={controller.vc.tag || controller.vc.id}
headerTitle={controller.vc.id}
headerElevation={2}
headerRight={
<DropdownIcon
Expand Down
4 changes: 1 addition & 3 deletions screens/Scan/SendVcScreenController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ export function useSendVcScreen() {
ACCEPT_REQUEST: () =>
scanService.send(ScanEvents.ACCEPT_REQUEST(shouldVerifySender)),
VERIFY_AND_ACCEPT_REQUEST: () =>
scanService.send(
ScanEvents.VERIFY_AND_ACCEPT_REQUEST(shouldVerifySender)
),
scanService.send(ScanEvents.VERIFY_AND_ACCEPT_REQUEST()),
DISMISS: () => scanService.send(ScanEvents.DISMISS()),
UPDATE_REASON: (reason: string) =>
scanService.send(ScanEvents.UPDATE_REASON(reason)),
Expand Down

0 comments on commit b50b137

Please sign in to comment.