Skip to content

Commit 43539b7

Browse files
Merge pull request #292 from doo/qa
[EPIC-5659] Scanbot Barcode Scanner SDK v7.0.0
2 parents 64df2fb + 328e823 commit 43539b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1358
-424
lines changed

App.tsx

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ import {
1212
} from '@context';
1313
import {COLORS, NavigationTheme} from '@theme';
1414
import {FILE_ENCRYPTION_ENABLED, Screens, ScreenTitles} from '@utils';
15-
import {BarcodeDocumentFormatsScreen} from './src/screens/BarcodeDocumentFormatsScreen.tsx';
16-
import {BarcodeCameraViewScreen} from './src/screens/BarcodeCameraViewScreen.tsx';
17-
import {BarcodeFormatsScreen} from './src/screens/BarcodeFormatsScreen.tsx';
18-
import {HomeScreen} from './src/screens/HomeScreen.tsx';
19-
import {ImageResultsScreen} from './src/screens/ImageResultsScreen.tsx';
20-
import {BarcodeResultScreen} from './src/screens/BarcodeResultScreen.tsx';
21-
import {BarcodeV2ResultsScreen} from './src/screens/BarcodeV2ResultsScreen.tsx';
15+
import {BarcodeDocumentFormatsScreen} from './src/screens/BarcodeDocumentFormatsScreen';
16+
import {BarcodeCameraViewScreen} from './src/screens/BarcodeCameraViewScreen';
17+
import {BarcodeFormatsScreen} from './src/screens/BarcodeFormatsScreen';
18+
import {HomeScreen} from './src/screens/HomeScreen';
19+
import {ImageResultsScreen} from './src/screens/ImageResultsScreen';
20+
import {BarcodeResultsScreen} from './src/screens/BarcodeResultsScreen';
2221

2322
import ScanbotBarcodeSDK, {
2423
ScanbotBarcodeSdkConfiguration,
@@ -63,10 +62,10 @@ export default function App() {
6362

6463
ScanbotBarcodeSDK.initializeSdk(configuration)
6564
.then(result => {
66-
console.log(result.data);
65+
console.log(result);
6766
})
6867
.catch(error => {
69-
console.log('Initialization error: ', error.message);
68+
console.error('Initialization error: ', error.message);
7069
});
7170

7271
console.log(`Using ${(global as any)?.nativeFabricUIManager ? 'New' : 'Old'} Architecture`);
@@ -94,11 +93,7 @@ export default function App() {
9493
component={BarcodeCameraViewScreen}
9594
/>
9695
<Stack.Screen name={Screens.IMAGE_RESULTS} component={ImageResultsScreen} />
97-
<Stack.Screen
98-
name={Screens.BARCODE_RESULTS_LEGACY}
99-
component={BarcodeResultScreen}
100-
/>
101-
<Stack.Screen name={Screens.BARCODE_RESULTS} component={BarcodeV2ResultsScreen} />
96+
<Stack.Screen name={Screens.BARCODE_RESULTS} component={BarcodeResultsScreen} />
10297
</Stack.Navigator>
10398
</NavigationContainer>
10499
<ActivityIndicator

Libraries.txt

Lines changed: 654 additions & 49 deletions
Large diffs are not rendered by default.

ios/Podfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ PODS:
16091609
- React-utils (= 0.77.0)
16101610
- RNFS (2.20.0):
16111611
- React-Core
1612-
- RNScanbotBarcodeSDK (6.2.1):
1612+
- RNScanbotBarcodeSDK (7.0.0):
16131613
- DoubleConversion
16141614
- glog
16151615
- hermes-engine
@@ -1629,7 +1629,7 @@ PODS:
16291629
- ReactCodegen
16301630
- ReactCommon/turbomodule/bridging
16311631
- ReactCommon/turbomodule/core
1632-
- ScanbotBarcodeSDKWrapper (= 6.2.0.1)
1632+
- ScanbotBarcodeSDKWrapper (= 7.0.2.4)
16331633
- Yoga
16341634
- RNScreens (4.6.0):
16351635
- DoubleConversion
@@ -1676,9 +1676,9 @@ PODS:
16761676
- ReactCommon/turbomodule/bridging
16771677
- ReactCommon/turbomodule/core
16781678
- Yoga
1679-
- ScanbotBarcodeScannerSDK (6.2.0)
1680-
- ScanbotBarcodeSDKWrapper (6.2.0.1):
1681-
- ScanbotBarcodeScannerSDK (= 6.2.0)
1679+
- ScanbotBarcodeScannerSDK (7.0.2)
1680+
- ScanbotBarcodeSDKWrapper (7.0.2.4):
1681+
- ScanbotBarcodeScannerSDK (= 7.0.2)
16821682
- SocketRocket (0.7.1)
16831683
- Yoga (0.0.0)
16841684

@@ -1981,10 +1981,10 @@ SPEC CHECKSUMS:
19811981
ReactCodegen: 1baa534318b19e95fb0f02db0a1ae1e3c271944d
19821982
ReactCommon: 6014af4276bb2debc350e2620ef1bd856b4d981c
19831983
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
1984-
RNScanbotBarcodeSDK: 1e2e37f4b76c5f228968f20a0b4e95867e336e00
1984+
RNScanbotBarcodeSDK: 68d0aeabf072bd070c9cf33d7bdd8f3daa40a05e
19851985
RNScreens: c8c0b69f667891d474ad1229054d514f06778772
1986-
ScanbotBarcodeScannerSDK: 8b46b7204d07b0f07bb1589aa625f48327e93aa2
1987-
ScanbotBarcodeSDKWrapper: 7b95221f5a068b97561f7e7f48e8a45adae56735
1986+
ScanbotBarcodeScannerSDK: 8e0449d0474243c8031285a3ba939ec43d7dcdfe
1987+
ScanbotBarcodeSDKWrapper: 1dfbd37d83e7c89dc6e0a10be2d5a4f75dfc3778
19881988
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
19891989
Yoga: c0d8564af14a858f962607cd7306539cb2ace926
19901990

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "ScanbotBarcodeExampleReact",
3-
"version": "6.2.1",
3+
"version": "7.0.0",
44
"private": true,
55
"scripts": {
66
"android": "react-native run-android --terminal ./",
77
"ios": "react-native run-ios --device --terminal ./",
88
"lint": " eslint --fix --ext .ts,.tsx .",
9+
"format": "prettier src --write",
910
"start": "react-native start",
1011
"clean": "npx react-native-clean-project",
1112
"set-new-architecture": "sh set-architecture.sh --new",
@@ -20,7 +21,7 @@
2021
"react-native-fs": "^2.20.0",
2122
"react-native-image-picker": "^7.1.2",
2223
"react-native-safe-area-context": "^5.1.0",
23-
"react-native-scanbot-barcode-scanner-sdk": "6.2.1",
24+
"react-native-scanbot-barcode-scanner-sdk": "7.0.0",
2425
"react-native-screens": "4.6.0"
2526
},
2627
"devDependencies": {

src/codeSnippets/initScanbotBarcodeScannerSdkWithCustomStorage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async function initScanbotBarcodeScannerSdkWithCustomStorage() {
99

1010
try {
1111
const result = await ScanbotBarcodeSDK.initializeSdk(config);
12-
console.log(result.data);
12+
console.log(result);
1313
} catch (error: any) {
1414
console.error(error);
1515
}

src/codeSnippets/initScanbotBarcodeScannerSdkWithEncryption.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function initScanbotBarcodeScannerSdkWithEncryption() {
1010

1111
try {
1212
const result = await ScanbotBarcodeSDK.initializeSdk(config);
13-
console.log(result.data);
13+
console.log(result);
1414
} catch (error: any) {
1515
console.error(error);
1616
}

src/codeSnippets/initScanbotBarcodeScannerSdkWithLicenseKey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function initScanbotBarcodeScannerSdkWithLicenseKey() {
2323

2424
try {
2525
const result = await ScanbotBarcodeSDK.initializeSdk(config);
26-
console.log(result.data);
26+
console.log(result);
2727
} catch (error: any) {
2828
console.error(error);
2929
}

src/codeSnippets/initScanbotBarcodeScannerSdkWithLogging.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function initScanbotBarcodeScannerSdkWithLogging() {
1010

1111
try {
1212
const result = await ScanbotBarcodeSDK.initializeSdk(config);
13-
console.log(result.data);
13+
console.log(result);
1414
} catch (error: any) {
1515
console.error(error);
1616
}

src/codeSnippets/rtuui/rtuUiV2ActionBarConfiguration.ts renamed to src/codeSnippets/rtuui/rtuUiActionBarConfiguration.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import {BarcodeScannerConfiguration} from 'react-native-scanbot-barcode-scanner-sdk/ui_v2';
1+
import {BarcodeScannerScreenConfiguration} from 'react-native-scanbot-barcode-scanner-sdk';
22

3-
function rtuUiV2ActionBarConfiguration() {
3+
function rtuUiActionBarConfiguration() {
44
// Create the default configuration object.
5-
const config = new BarcodeScannerConfiguration();
5+
const config = new BarcodeScannerScreenConfiguration();
66

77
// Configure the action bar.
88

9-
// Hide/unhide the flash button.
9+
// Hide/show the flash button.
1010
config.actionBar.flashButton.visible = true;
1111

1212
// Configure the inactive state of the flash button.
@@ -17,15 +17,15 @@ function rtuUiV2ActionBarConfiguration() {
1717
config.actionBar.flashButton.activeBackgroundColor = '#FFCE5C';
1818
config.actionBar.flashButton.activeForegroundColor = '#000000';
1919

20-
// Hide/unhide the zoom button.
20+
// Hide/show the zoom button.
2121
config.actionBar.zoomButton.visible = true;
2222

2323
// Configure the inactive state of the zoom button.
2424
config.actionBar.zoomButton.backgroundColor = '#0000007A';
2525
config.actionBar.zoomButton.foregroundColor = '#FFFFFF';
2626
// Zoom button has no active state - it only switches between zoom levels (for configuring those please refer to camera configuring).
2727

28-
// Hide/unhide the flip camera button.
28+
// Hide/show the flip camera button.
2929
config.actionBar.flipCameraButton.visible = true;
3030

3131
// Configure the inactive state of the flip camera button.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import ScanbotBarcodeSDK, {
2+
AAMVA,
3+
AAMVADocumentType,
4+
BarcodeScannerScreenConfiguration,
5+
BoardingPass,
6+
BoardingPassDocumentType,
7+
GS1,
8+
GS1DocumentType,
9+
HIBC,
10+
HIBCDocumentType,
11+
IDCardPDF417,
12+
IDCardPDF417DocumentType,
13+
MedicalCertificate,
14+
MedicalCertificateDocumentType,
15+
SEPA,
16+
SEPADocumentType,
17+
SwissQR,
18+
SwissQRDocumentType,
19+
VCard,
20+
VCardDocumentType,
21+
} from 'react-native-scanbot-barcode-scanner-sdk';
22+
23+
async function handleScanningResultWithDataParsers() {
24+
// Start the barcode RTU UI with default configuration
25+
const scanningResult = await ScanbotBarcodeSDK.startBarcodeScanner(
26+
new BarcodeScannerScreenConfiguration(),
27+
);
28+
29+
// Check if the status returned is ok and that the data is present
30+
if (scanningResult.status == 'OK' && scanningResult.data) {
31+
// Loop through the scanned barcode items and extract the desired barcode data
32+
const requiredBarcodeInfo = scanningResult.data.items.map(({barcode}) => {
33+
if (barcode.extractedDocument) {
34+
switch (barcode.extractedDocument.type.name) {
35+
case AAMVADocumentType:
36+
const aamvaDocument = new AAMVA(barcode.extractedDocument);
37+
return {
38+
issuerID: aamvaDocument.issuerIdentificationNumber,
39+
driverLicense: aamvaDocument.driverLicense,
40+
};
41+
case BoardingPassDocumentType:
42+
const boardingPassDocument = new BoardingPass(barcode.extractedDocument);
43+
return {
44+
name: boardingPassDocument.name,
45+
securityData: boardingPassDocument.securityData,
46+
};
47+
case GS1DocumentType:
48+
const gs1DocumentType = new GS1(barcode.extractedDocument);
49+
return {
50+
elements: gs1DocumentType.elements,
51+
};
52+
case IDCardPDF417DocumentType:
53+
const idCardPDF417Document = new IDCardPDF417(barcode.extractedDocument);
54+
return {
55+
firstName: idCardPDF417Document.firstName,
56+
documentCode: idCardPDF417Document.documentCode,
57+
};
58+
case MedicalCertificateDocumentType:
59+
const medicalCertificateDocument = new MedicalCertificate(barcode.extractedDocument);
60+
return {
61+
firstName: medicalCertificateDocument.firstName,
62+
diagnosedOn: medicalCertificateDocument.diagnosedOn,
63+
};
64+
case SEPADocumentType:
65+
const sepaDocument = new SEPA(barcode.extractedDocument);
66+
return {
67+
id: sepaDocument.identification,
68+
amount: sepaDocument.amount,
69+
};
70+
case SwissQRDocumentType:
71+
const swissQRDocument = new SwissQR(barcode.extractedDocument);
72+
return {
73+
name: swissQRDocument.payeeName,
74+
amount: swissQRDocument.amount,
75+
};
76+
case VCardDocumentType:
77+
const vCardDocument = new VCard(barcode.extractedDocument);
78+
return {
79+
name: vCardDocument.firstName,
80+
number: vCardDocument.telephoneNumber,
81+
};
82+
case HIBCDocumentType:
83+
const hibcDocument = new HIBC(barcode.extractedDocument);
84+
return {
85+
dateOfManufacture: hibcDocument.dateOfManufacture,
86+
primaryData: hibcDocument.hasPrimaryData,
87+
};
88+
}
89+
}
90+
});
91+
}
92+
}

0 commit comments

Comments
 (0)