Skip to content

Commit 7db2a54

Browse files
Update React Native sample app to latest version
1 parent d17becc commit 7db2a54

8 files changed

Lines changed: 121 additions & 2076 deletions

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,55 +28,59 @@ jobs:
2828
create-release:
2929
name: Create GitHub Release
3030
runs-on: ubuntu-latest
31-
3231
steps:
3332
- name: Checkout code
3433
uses: actions/checkout@v4
3534
with:
36-
fetch-depth: 0 # Fetch all history for proper release notes
35+
fetch-depth: 0 # Fetch all history for proper release notes/changelog generation
3736

38-
- name: Extract version from tag or input
37+
- name: Extract version
3938
id: version
39+
env:
40+
INPUT_VERSION_ARG: ${{ github.event.inputs.version }}
4041
run: |
41-
if [ -n "${{ github.event.inputs.version }}" ]; then
42+
if [ -n "$INPUT_VERSION_ARG" ]; then
4243
# Manual trigger - use input version
43-
INPUT_VERSION="${{ github.event.inputs.version }}"
44-
# Ensure version starts with 'v'
44+
INPUT_VERSION="$INPUT_VERSION_ARG"
45+
# Ensure version starts with 'v' for the tag, but keep raw version clean
4546
if [[ "$INPUT_VERSION" == v* ]]; then
4647
TAG_NAME="$INPUT_VERSION"
4748
VERSION="${INPUT_VERSION#v}"
4849
else
4950
TAG_NAME="v$INPUT_VERSION"
5051
VERSION="$INPUT_VERSION"
5152
fi
52-
echo "Manual trigger with version: $VERSION"
53+
echo "Manual trigger detected."
5354
else
5455
# Tag push - extract from ref
5556
TAG_NAME=${GITHUB_REF#refs/tags/}
5657
VERSION=${TAG_NAME#v}
57-
echo "Tag push detected: $TAG_NAME"
58+
echo "Tag push detected."
5859
fi
60+
5961
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
6062
echo "version=$VERSION" >> $GITHUB_OUTPUT
61-
echo "Tag: $TAG_NAME"
62-
echo "Version: $VERSION"
63+
echo "Selected Tag: $TAG_NAME"
64+
echo "Selected Version: $VERSION"
6365
6466
- name: Check if pre-release
6567
id: prerelease
68+
env:
69+
INPUT_PRERELEASE: ${{ github.event.inputs.prerelease }}
6670
run: |
6771
# Check if manually triggered with prerelease flag
68-
if [ -n "${{ github.event.inputs.prerelease }}" ]; then
69-
echo "is_prerelease=${{ github.event.inputs.prerelease }}" >> $GITHUB_OUTPUT
70-
echo "Manual prerelease flag: ${{ github.event.inputs.prerelease }}"
72+
if [ "$INPUT_PRERELEASE" == "true" ]; then
73+
echo "is_prerelease=true" >> $GITHUB_OUTPUT
74+
echo "Manual prerelease flag set."
7175
else
72-
# Auto-detect from version string
76+
# Auto-detect from version string (works for both manual and auto triggers)
7377
VERSION="${{ steps.version.outputs.version }}"
7478
if [[ "$VERSION" =~ -(alpha|beta|rc|dev) ]]; then
7579
echo "is_prerelease=true" >> $GITHUB_OUTPUT
76-
echo "Auto-detected pre-release: $VERSION"
80+
echo "Auto-detected pre-release from version string."
7781
else
7882
echo "is_prerelease=false" >> $GITHUB_OUTPUT
79-
echo "Auto-detected stable release: $VERSION"
83+
echo "Auto-detected stable release."
8084
fi
8185
fi
8286
@@ -85,28 +89,25 @@ jobs:
8589
run: |
8690
TAG_NAME="${{ steps.version.outputs.tag }}"
8791
VERSION="${{ steps.version.outputs.version }}"
88-
89-
# Get the previous tag
90-
PREVIOUS_TAG=$(git describe --tags --abbrev=0 "$TAG_NAME^" 2>/dev/null || echo "")
91-
92-
# Create release notes
92+
93+
# Create release notes file
9394
cat > release_notes.md << EOF
9495
## 🚀 Release $VERSION
95-
96+
9697
### 📦 Installation
97-
98+
9899
\`\`\`bash
99100
npm install @entrust.corporation/idvsdk-reactnative@$VERSION
100101
\`\`\`
101-
102+
102103
or
103-
104+
104105
\`\`\`bash
105106
yarn add @entrust.corporation/idvsdk-reactnative@$VERSION
106107
\`\`\`
107-
108108
EOF
109109
110+
# Output for debugging
110111
cat release_notes.md
111112
112113
- name: Create Release
@@ -117,7 +118,9 @@ jobs:
117118
body_path: release_notes.md
118119
prerelease: ${{ steps.prerelease.outputs.is_prerelease }}
119120
draft: ${{ github.event.inputs.draft || 'false' }}
120-
generate_release_notes: true # Auto-generate from PRs and commits
121+
generate_release_notes: true
122+
# Make sure to create the tag if it doesn't exist (useful for manual triggers)
123+
target_commitish: ${{ github.sha }}
121124
env:
122125
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123126

SampleApp/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Xcode
66
#
77
build/
8+
Podfile.lock
89
*.pbxuser
910
!default.pbxuser
1011
*.mode1v3

SampleApp/App.tsx

Lines changed: 44 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,31 @@ import {
44
SafeAreaView,
55
StatusBar,
66
StyleSheet,
7-
useColorScheme,
87
View,
98
} from 'react-native';
109
import {EntrustIdv} from '@entrust.corporation/idvsdk-reactnative';
1110
import type {Callbacks} from '@entrust.corporation/idvsdk-reactnative/callbacks/callbacks';
1211
import {SafeAreaProvider} from 'react-native-safe-area-context';
1312
import {
14-
Welcome,
15-
FacePhoto,
16-
FaceMotion,
17-
type ClassicParameters,
18-
type Configuration,
13+
Configuration,
14+
StudioParameters,
15+
ClassicParameters,
16+
} from '@entrust.corporation/idvsdk-reactnative/SdkParameters';
17+
import {Document} from '@entrust.corporation/idvsdk-reactnative/steps/Document';
18+
import {FaceMotion} from '@entrust.corporation/idvsdk-reactnative/steps/Face';
19+
import {Welcome} from '@entrust.corporation/idvsdk-reactnative/steps/Welcome';
20+
import {
1921
Theme,
20-
MediaResult,
21-
} from '@entrust.corporation/idvsdk-reactnative/src/capture-api';
22-
import {ThemeMode} from "@entrust.corporation/idvsdk-reactnative/src/capture-api/theming/Theme.ts";
23-
import {ColorTokensKeys} from "@entrust.corporation/idvsdk-reactnative/src/capture-api/theming/ColorTokens.ts";
24-
25-
// Create a SDK token for this applicant in your backend and use it here
26-
const SDK_TOKEN = 'YOUR_SDK_TOKEN';
22+
ThemeMode,
23+
} from '@entrust.corporation/idvsdk-reactnative/theming/Theme';
2724

28-
// For Studio flows, create a Studio-type SDK token for this applicant instead (in your backend)
29-
// Workflow Run ID is required for Studio-type SDK tokens and it's embedded in the studio token
30-
// const STUDIO_TOKEN = 'YOUR_STUDIO_TOKEN';
25+
// For Studio flows, use the SDK token generated during the workflow creation process and use it here
26+
// The workflow run ID is no longer required when Studio-type SDK tokens are used as it is embedded in the Studio token
27+
const studioToken = '<Your Studio token>';
3128

32-
const classicSteps = [
33-
Welcome(),
34-
FacePhoto({showIntro: false}),
35-
FaceMotion({showIntro: false}),
36-
];
29+
// For 'classic' sessions that are yet to migrate to Workflow Studio, create a SDK token for this applicant
30+
// in your backend and use it here
31+
const sdkToken = '<Your SDK token>';
3732

3833
// Language keys: https://sdk.onfido.com/capture/i18n/index.json
3934
// Custom translations for a module name and a language: https://sdk.onfido.com/capture/i18n/welcome/en_US.min.json
@@ -51,36 +46,47 @@ const customTranslations = {
5146

5247
const customTheme: Theme = {
5348
mode: ThemeMode.Light,
49+
branding: {
50+
text: 'Brand Name',
51+
logo: 'https://commons.wikimedia.org/wiki/File:React-icon.svg', // URL to a publicly accessible SVG image
52+
},
5453
lightColors: {
55-
backgroundColorOverlay: '#10598A85', // pass RGBA HEX colors, we internally convert to ARGB
54+
backgroundColorOverlay: '#10598A85',
5655
},
5756
darkColors: {
58-
backgroundColorOverlay: '#10598A85', // pass RGBA HEX colors, we internally convert to ARGB
57+
backgroundColorOverlay: '#10598A85',
5958
},
6059
};
6160

6261
const configuration: Configuration = {
63-
disableAnalytics: false,
6462
theme: customTheme,
6563
localisation: customTranslations,
6664
};
6765

66+
const studioFlowParameters: StudioParameters = {
67+
sdkToken: studioToken,
68+
configuration: configuration,
69+
};
70+
71+
// 'Classic' flow example (unused)
72+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6873
const classicFlowParameters: ClassicParameters = {
69-
sdkToken: SDK_TOKEN,
70-
steps: classicSteps,
74+
sdkToken: sdkToken,
75+
steps: [Welcome(), Document(), FaceMotion()],
7176
configuration: configuration,
7277
};
7378

7479
export default function App() {
75-
const isDarkMode = useColorScheme() === 'dark';
76-
7780
const handleLaunchSDK = () => {
7881
const callbacks: Callbacks = {
79-
onComplete: (result) => {
80-
console.log('The onComplete callback has been called. Received:', result);
82+
onComplete: result => {
83+
console.log(
84+
'The onComplete callback has been called. Received:',
85+
result,
86+
);
8187
// Finish or navigate away
8288
},
83-
onError: (error) => {
89+
onError: error => {
8490
console.error('The onError callback has been called with:', error);
8591
Alert.alert('An error occurred', error.message, [
8692
{
@@ -91,36 +97,22 @@ export default function App() {
9197
},
9298
]);
9399
},
94-
onUserExit: (userAction) => {
95-
console.log('The onUserExit has been called with userAction:', userAction);
100+
onUserExit: userAction => {
101+
console.log(
102+
'The onUserExit has been called with userAction:',
103+
userAction,
104+
);
96105
// Finish or navigate away
97106
},
98-
onAnalytics: (event) => {
99-
console.log('The onAnalytics callback has been called with:', event);
100-
},
101-
onMedia: (media: MediaResult) => {
102-
console.log('The onMedia callback has been called with:', media);
103-
},
104-
biometricsTokenHandler: {
105-
onTokenGenerated: (customerUserHash, _encryptedBiometricToken) => {
106-
// Store the token securely (e.g., AsyncStorage, SecureStore)
107-
console.log('Token generated for:', customerUserHash);
108-
},
109-
onTokenRequested: (customerHash) => {
110-
// Retrieve the token from secure storage
111-
console.log('Token requested for:', customerHash);
112-
return ''; // Return the stored token or empty string
113-
},
114-
},
115107
};
116108

117109
const idv = new EntrustIdv(callbacks);
118-
idv.start(classicFlowParameters); // For studio flows, use studioFlowParameters instead
110+
idv.start(studioFlowParameters);
119111
};
120112

121113
return (
122114
<SafeAreaProvider>
123-
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
115+
<StatusBar />
124116
<SafeAreaView style={styles.container}>
125117
<View style={styles.content}>
126118
<Button title="Launch SDK" onPress={handleLaunchSDK} />

SampleApp/android/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,5 @@ apply plugin: "com.facebook.react.rootproject"
2323
allprojects {
2424
it.repositories {
2525
mavenLocal()
26-
maven {
27-
url "https://nexus.mgmt.onfido.xyz/repository/maven-releases/"
28-
}
2926
}
3027
}

0 commit comments

Comments
 (0)