Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@ yarn-error.log
!.yarn/releases
!.yarn/sdks
!.yarn/versions

### Misc
licence.ts
28 changes: 12 additions & 16 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, {useEffect} from 'react';
import {Platform, StyleSheet} from 'react-native';
import {SafeAreaProvider, SafeAreaView} from 'react-native-safe-area-context';

import ScanbotSDK, {ScanbotSdkConfiguration} from 'react-native-scanbot-sdk';
import {DocumentDirectoryPath, ExternalDirectoryPath} from 'react-native-fs';
import ScanbotSDK, {SdkConfiguration} from 'react-native-scanbot-sdk';
import {DocumentDirectoryPath} from 'react-native-fs';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {
Expand All @@ -25,7 +25,6 @@ import {LoadingIndicator} from '@components';

import {HomeScreen} from './src/screens/HomeScreen';
import {MrzResultScreen} from './src/screens/MrzResultScreen';
import {MedicalCertificateResultScreen} from './src/screens/MedicalCertificateResultScreen';
import {DocumentDataExtractorResultScreen} from './src/screens/DocumentDataExtractorResultScreen';
import {CheckScannerResultScreen} from './src/screens/CheckScannerResultScreen';
import {PlainDataResultScreen} from './src/screens/PlainDataResultScreen';
Expand Down Expand Up @@ -57,7 +56,7 @@ const Stack = createNativeStackNavigator<PrimaryRoutesParamList>();
// - https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html
const storageBaseDirectory = Platform.select({
ios: DocumentDirectoryPath + '/my-custom-storage',
android: ExternalDirectoryPath + '/my-custom-storage',
android: DocumentDirectoryPath + '/my-custom-storage',
default: undefined,
});

Expand All @@ -69,27 +68,28 @@ const storageBaseDirectory = Platform.select({
* Please submit the trial license form (https://docs.scanbot.io/trial/) on our website by using
* the app identifier "io.scanbot.example.sdk.reactnative" of this example app.
*/
export const SDKInitializationOptions: ScanbotSdkConfiguration = {
export const initializationConfiguration = new SdkConfiguration({
//The Scanbot SDK License Key
licenseKey: '',
loggingEnabled: true, // Logging enabled. Consider switching logging OFF in production builds for security and performance reasons!
storageImageFormat: IMAGE_FILE_FORMAT, // Format of stored images
storageImageQuality: 80, // Quality of stored images
//storageBaseDirectory: storageBaseDirectory, // Uncomment this line to use a custom storage path
} as const;
// Optional custom storage directory
// storageBaseDirectory: storageBaseDirectory,
});

// Set the following properties to enable encryption.
if (FILE_ENCRYPTION_ENABLED) {
SDKInitializationOptions.fileEncryptionMode = 'AES256';
SDKInitializationOptions.fileEncryptionPassword =
initializationConfiguration.fileEncryptionMode = 'AES256';
initializationConfiguration.fileEncryptionPassword =
'SomeSecretPa$$w0rdForFileEncryption';
}

function App() {
useEffect(() => {
ScanbotSDK.initializeSDK(SDKInitializationOptions)
.then(message => {
console.log(message);
ScanbotSDK.initialize(initializationConfiguration)
.then(licenseInfo => {
console.log(licenseInfo);
})
.catch(error => {
console.error('Error initializing Scanbot SDK:', error.message);
Expand Down Expand Up @@ -119,10 +119,6 @@ function App() {
title: ScreenTitles[navigation.route.name as Screens],
})}>
<Stack.Screen name={Screens.HOME} component={HomeScreen} />
<Stack.Screen
name={Screens.MEDICAL_CERTIFICATE_RESULT}
component={MedicalCertificateResultScreen}
/>
<Stack.Screen
name={Screens.MRZ_RESULT}
component={MrzResultScreen}
Expand Down
Loading