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

[Wallet] Allow skipping verification if ODIS is down #5438

Merged
merged 2 commits into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
40 changes: 40 additions & 0 deletions packages/mobile/src/verify/VerificationEducationScreen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,44 @@ describe('VerificationEducationScreen', () => {
expect(queryByTestId('VerificationEducationContinue')).toBeFalsy()
expect(queryByTestId('VerificationEducationAlready')).toBeFalsy()
})

it('allows to skip if verification is loading', () => {
const defaultVerificationState = {
phoneHashDetails: {
e164Number: '',
phoneHash: '',
pepper: '',
},
actionableAttestations: [],
status: {
isVerified: false,
numAttestationsRemaining: 3,
total: 0,
completed: 0,
},
lastFetch: null,
}
const store = createMockStore({
stableToken: {
balance: '0',
},
identity: {
verificationState: {
...defaultVerificationState,
isLoading: true,
},
},
})
const { getByTestId, toJSON } = render(
<Provider store={store}>
<VerificationEducationScreen
{...getMockStackScreenProps(Screens.VerificationEducationScreen, {
showSkipDialog: true,
})}
/>
</Provider>
)
expect(toJSON()).toMatchSnapshot()
expect(getByTestId('VerificationSkipDialog').props.isVisible).toBe(true)
})
})
5 changes: 5 additions & 0 deletions packages/mobile/src/verify/VerificationEducationScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ function VerificationEducationScreen({ route, navigation }: Props) {
if (isLoading) {
return (
<View style={styles.loader}>
<VerificationSkipDialog
isVisible={showSkipDialog}
onPressCancel={onPressSkipCancel}
onPressConfirm={onPressSkipConfirm}
/>
<ActivityIndicator size="large" color={colors.greenBrand} />
</View>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,263 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`VerificationEducationScreen allows to skip if verification is loading 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#F9F6F0",
"flex": 1,
"justifyContent": "center",
}
}
>
<Modal
animationType="none"
hardwareAccelerated={false}
hideModalContentWhileAnimating={false}
onModalHide={[Function]}
onModalWillHide={[Function]}
onModalWillShow={[Function]}
onRequestClose={[Function]}
scrollHorizontal={false}
scrollOffset={0}
scrollOffsetMax={0}
scrollTo={null}
statusBarTranslucent={true}
supportedOrientations={
Array [
"portrait",
"landscape",
]
}
swipeThreshold={100}
transparent={true}
visible={true}
>
<View
accessible={true}
focusable={true}
forwardedRef={[Function]}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"backgroundColor": "black",
"bottom": 0,
"height": 1334,
"left": 0,
"opacity": 0,
"position": "absolute",
"right": 0,
"top": 0,
"width": 750,
}
}
/>
<View
forwardedRef={[Function]}
hideModalContentWhileAnimating={false}
onModalHide={[Function]}
onModalWillHide={[Function]}
onModalWillShow={[Function]}
pointerEvents="box-none"
scrollHorizontal={false}
scrollOffset={0}
scrollOffsetMax={0}
scrollTo={null}
statusBarTranslucent={true}
style={
Object {
"flex": 1,
"justifyContent": "center",
"margin": 37.5,
"transform": Array [
Object {
"translateY": 1334,
},
],
}
}
supportedOrientations={
Array [
"portrait",
"landscape",
]
}
swipeThreshold={100}
>
<RNCSafeAreaView>
<View
style={
Array [
Object {
"backgroundColor": "#FFFFFF",
"padding": 16,
},
Object {
"borderRadius": 8,
},
Object {
"elevation": 12,
"shadowColor": "rgba(156, 164, 169, 0.4)",
"shadowOffset": Object {
"height": 2,
"width": 0,
},
"shadowOpacity": 1,
"shadowRadius": 12,
},
Array [
Object {
"backgroundColor": "#FFFFFF",
"maxHeight": "100%",
"padding": 24,
},
undefined,
],
]
}
>
<RCTScrollView
contentContainerStyle={
Object {
"alignItems": "center",
}
}
>
<View>
<Text
style={
Object {
"color": "#2E3338",
"fontFamily": "Jost-Medium",
"fontSize": 22,
"lineHeight": 28,
"marginBottom": 12,
"textAlign": "center",
}
}
>
verificationSkipDialog.title
</Text>
<Text
style={
Object {
"color": "#2E3338",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"lineHeight": 22,
"marginBottom": 24,
"textAlign": "center",
}
}
>
verificationSkipDialog.body
</Text>
</View>
</RCTScrollView>
<View
style={
Object {
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "space-around",
"maxWidth": "100%",
}
}
>
<View
accessible={true}
focusable={true}
nativeBackgroundAndroid={
Object {
"attribute": "selectableItemBackgroundBorderless",
"type": "ThemeAttrAndroid",
}
}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
testID="VerificationSkipDialog/SecondaryAction"
>
<Text
style={
Array [
Object {
"color": "#1AB775",
"fontFamily": "Inter-SemiBold",
"fontSize": 16,
"lineHeight": 22,
},
Object {
"color": "#9CA4A9",
"paddingTop": 16,
},
]
}
>
verificationSkipDialog.cancel
</Text>
</View>
<View
accessible={true}
focusable={true}
nativeBackgroundAndroid={
Object {
"attribute": "selectableItemBackgroundBorderless",
"type": "ThemeAttrAndroid",
}
}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
testID="VerificationSkipDialog/PrimaryAction"
>
<Text
style={
Array [
Object {
"color": "#1AB775",
"fontFamily": "Inter-SemiBold",
"fontSize": 16,
"lineHeight": 22,
},
Object {
"paddingTop": 16,
},
]
}
>
verificationSkipDialog.confirm
</Text>
</View>
</View>
</View>
</RNCSafeAreaView>
</View>
</Modal>
<ActivityIndicator
animating={true}
color="#42D689"
hidesWhenStopped={true}
size="large"
/>
</View>
`;

exports[`VerificationEducationScreen shows the \`continue\` button when the user is not already verified and has enough balance 1`] = `
<View
style={
Expand Down