-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0b04fe
commit be47d99
Showing
17 changed files
with
262 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
diff --git a/node_modules/react-native/React/CoreModules/RCTActionSheetManager.mm b/node_modules/react-native/React/CoreModules/RCTActionSheetManager.mm | ||
index 5cd782e..15d33e2 100644 | ||
--- a/node_modules/react-native/React/CoreModules/RCTActionSheetManager.mm | ||
+++ b/node_modules/react-native/React/CoreModules/RCTActionSheetManager.mm | ||
@@ -95,7 +95,7 @@ - (void)presentViewController:(UIViewController *)alertController | ||
NSNumber *anchor = [RCTConvert NSNumber:options.anchor() ? @(*options.anchor()) : nil]; | ||
UIColor *tintColor = [RCTConvert UIColor:options.tintColor() ? @(*options.tintColor()) : nil]; | ||
UIColor *cancelButtonTintColor = | ||
- [RCTConvert UIColor:options.cancelButtonTintColor() ? @(*options.cancelButtonTintColor()) : nil]; | ||
+ [RCTConvert UIColor:options.tintColor() ? @(*options.tintColor()) : nil]; | ||
|
||
if (controller == nil) { | ||
RCTLogError( | ||
diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env | ||
new file mode 100644 | ||
index 0000000..361f5fb | ||
--- /dev/null | ||
+++ b/node_modules/react-native/scripts/.packager.env | ||
@@ -0,0 +1 @@ | ||
+export RCT_METRO_PORT=8081 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import React, { useState, useRef, useEffect } from 'react'; | ||
import { Button } from 'react-native'; | ||
import { StyleSheet, View } from 'react-native'; | ||
import Footer from 'components/Footer'; | ||
import { VouchedIdCamera, VouchedUtils } from '@vouched.id/vouched-react-native'; | ||
import { getSession} from '../common/session' | ||
|
||
const BackIDScreen = ({ navigation, route }) => { | ||
const cameraRef = useRef(null); | ||
const [message, setMessage] = useState('loading...'); | ||
const [showNextButton, setShowNextButton] = useState(false); | ||
const [session] = useState(getSession()); | ||
const [params] = useState({}); | ||
|
||
const messageByInsight = (insight) => { | ||
switch (insight) { | ||
case "NON_GLARE": | ||
return "image has glare"; | ||
case "QUALITY": | ||
return "image is blurry"; | ||
case "BRIGHTNESS": | ||
return "image needs to be brighter"; | ||
case "FACE": | ||
return "image is missing required visual markers"; | ||
case "GLASSES": | ||
return "please take off your glasses"; | ||
case "UNKNOWN": | ||
default: | ||
return "Unknown Error"; | ||
} | ||
} | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<View style={styles.camera}> | ||
<VouchedIdCamera | ||
ref={cameraRef} | ||
enableDistanceCheck={false} | ||
onIdStream={async (cardDetectionResult) => { | ||
const { instruction, step } = cardDetectionResult; | ||
|
||
if (step === "POSTABLE") { | ||
cameraRef.current.stop(); | ||
setMessage("Processing"); | ||
try { | ||
let job = await session.postBackId(cardDetectionResult, params); | ||
let insights = await VouchedUtils.extractInsights(job); | ||
if (insights != null && insights.length > 0) { | ||
setMessage(messageByInsight(insights[0])); | ||
setTimeout(() => { | ||
cameraRef.current.restart(); | ||
}, 5000); | ||
} else { | ||
setMessage("Please continue to next step"); | ||
setShowNextButton(true); | ||
} | ||
} catch (e) { | ||
console.error(e) | ||
} | ||
} else { | ||
setMessage(instruction) | ||
} | ||
}} | ||
/> | ||
</View> | ||
{ showNextButton && | ||
<View style={styles.nextButton}> | ||
<Button title="Next Step: Face" onPress={() => navigation.navigate('Face')} /> | ||
</View> | ||
} | ||
<Footer message={message} showHome={true} navigation={navigation} /> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
camera: { | ||
flex: 3, | ||
flexDirection: 'column' | ||
}, | ||
nextButton: { | ||
flex: 1, | ||
flexDirection: 'column' | ||
}, | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
flexDirection: 'column' | ||
} | ||
}); | ||
|
||
export default BackIDScreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.