Skip to content

Commit f982961

Browse files
authored
Release 55.5.0 (#194)
1 parent 28365db commit f982961

Some content is hidden

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

48 files changed

+686
-2643
lines changed

example/RNExampleApp/app.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "RNExampleApp",
44
"description": "Anyline RN Dev Examples",
55
"slug": "RNExampleApp",
6-
"version": "55.2.1",
6+
"version": "55.5.0",
77
"orientation": "portrait",
88
"icon": "./assets/images/icon.png",
99
"splash": {
@@ -20,6 +20,17 @@
2020
"appleTeamId": "35RHL53WRE",
2121
"infoPlist": {
2222
"NSCameraUsageDescription": "Allow Anyline to access your camera?",
23+
"UISupportedInterfaceOrientations": [
24+
"UIInterfaceOrientationPortrait",
25+
"UIInterfaceOrientationLandscapeLeft",
26+
"UIInterfaceOrientationLandscapeRight"
27+
],
28+
"UISupportedInterfaceOrientations~ipad": [
29+
"UIInterfaceOrientationLandscapeLeft",
30+
"UIInterfaceOrientationLandscapeRight",
31+
"UIInterfaceOrientationPortrait",
32+
"UIInterfaceOrientationPortraitUpsideDown"
33+
],
2334
"ITSAppUsesNonExemptEncryption": false,
2435
"NSAppTransportSecurity": {
2536
"NSAllowsArbitraryLoads": true,
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
export default {
2+
"viewPluginConfig": {
3+
"pluginConfig": {
4+
"id": "barcode",
5+
"barcodeConfig": {
6+
"fastProcessMode": true,
7+
"parseAAMVA": false,
8+
"barcodeFormats": [
9+
"ALL"
10+
]
11+
},
12+
"consecutiveEqualResultFilter": -1,
13+
"cancelOnResult": false,
14+
"startScanDelay": 1000
15+
},
16+
"cutoutConfig": {
17+
"animation": "none",
18+
"maxWidthPercent": "70%",
19+
"maxHeightPercent": "70%",
20+
"alignment": "center",
21+
"ratioFromSize": {
22+
"width": 3,
23+
"height": 2
24+
},
25+
"offset": {
26+
"x": 0,
27+
"y": 0
28+
},
29+
"cropOffset": {
30+
"x": 0,
31+
"y": 0
32+
},
33+
"cropPadding": {
34+
"x": 0,
35+
"y": 0
36+
},
37+
"cornerRadius": 4,
38+
"strokeColor": "0099ff",
39+
"strokeWidth": 2,
40+
"outerColor": "000000",
41+
"feedbackStrokeColor": "0099FF",
42+
"outerAlpha": 0.3
43+
},
44+
"scanFeedbackConfig": {
45+
"style": "rect",
46+
"strokeWidth": 0,
47+
"strokeColor": "0099FF",
48+
"fillColor": "330099FF",
49+
"beepOnResult": false,
50+
"vibrateOnResult": false,
51+
"blinkAnimationOnResult": false
52+
},
53+
"uiFeedbackConfig": {
54+
"presets": [
55+
{
56+
"presetName": "simple_instruction_label",
57+
"presetAttributes": [
58+
{
59+
"attributeName": "instruction_text",
60+
"attributeValue": "Scanning will stop after the first ten different barcodes."
61+
}
62+
]
63+
}
64+
]
65+
}
66+
},
67+
"options": {
68+
"doneButtonConfig": {
69+
"title": "OK",
70+
"type": "rect",
71+
"cornerRadius": 0,
72+
"textColor": "FFFFFF",
73+
"textColorHighlighted": "CCCCCC",
74+
"fontSize": 33,
75+
"fontName": "HelveticaNeue",
76+
"positionXAlignment": "center",
77+
"positionYAlignment": "bottom",
78+
"offset": {
79+
"x": 0,
80+
"y": -88
81+
}
82+
}
83+
}
84+
}

example/RNExampleApp/config/OtaConfig.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

example/RNExampleApp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-example-app",
3-
"version": "55.2.1",
3+
"version": "55.5.0",
44
"private": true,
55
"scripts": {
66
"initProject": "yarn add expo && yarn add ../../plugin",

example/RNExampleApp/src/Overview.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ export default function Overview({ updateAnyline, disabled }) {
2828
}} />
2929
</View>
3030

31+
<View style={styles.buttons}>
32+
<Button style={styles.buttons} title={'Barcode Continuous'} color="#0099FF"
33+
disabled={disabled}
34+
onPress={() => {
35+
platformPermissionCheck('BARCODE_CONTINUOUS')
36+
}} />
37+
</View>
38+
3139
<Text style={styles.text}>METER READING</Text>
3240

3341
<View style={styles.buttons}>

example/RNExampleApp/src/index.js

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import {
88
StyleSheet,
99
Text,
1010
View,
11+
NativeModules,
12+
Platform,
13+
NativeEventEmitter,
14+
DeviceEventEmitter,
1115
} from 'react-native';
1216

1317
import AnylineOCR from 'anyline-ocr-react-native-module';
@@ -34,16 +38,14 @@ import TireMakeConfig from '../config/TireMakeConfig';
3438
import TireSizeConfig from '../config/TireSizeConfig';
3539
import CommercialTireIdConfig from '../config/CommercialTireIdConfig';
3640
import OdometerConfig from '../config/OdometerConfig';
37-
import OtaConfig from '../config/OtaConfig';
38-
import { DeviceEventEmitter } from 'react-native';
39-
import { Platform } from 'react-native';
4041
import VRCConfig from '../config/VRCConfig';
4142
import DialMeterConfig from '../config/DialMeterConfig';
4243
import LicensePlateConfigEU from '../config/LicensePlateConfigEU';
4344
import LicensePlateConfigUS from '../config/LicensePlateConfigUS';
4445
import LicensePlateConfigAF from '../config/LicensePlateConfigAF';
4546
import TINUniversalConfig from '../config/TINUniversalConfig';
4647
import TINDOTConfig from '../config/TINDOTConfig';
48+
import BarcodeContinuousConfig from "../config/BarcodeContinuousConfig";
4749
const { license } = require('./license.js');
4850

4951
// Disable Warnings
@@ -53,8 +55,14 @@ const scrollRef = React.createRef();
5355

5456
const demoAppLicenseKey = license;
5557

58+
function getPlatformEventEmitter() {
59+
return Platform.select({
60+
ios: new NativeEventEmitter(NativeModules),
61+
android: DeviceEventEmitter,
62+
});
63+
}
64+
5665
class Anyline extends Component {
57-
overTheAirUpdateIsEnabled = false;
5866

5967
state = {
6068
hasScanned: false,
@@ -66,6 +74,7 @@ class Anyline extends Component {
6674
SDKVersion: '',
6775
pluginVersion: '',
6876
hasMultipleResults: false,
77+
hasContinuousResults: false,
6978
licenseMessage: '',
7079
titles: [],
7180
};
@@ -99,27 +108,7 @@ class Anyline extends Component {
99108
}
100109

101110
updateAnyline = async type => {
102-
if (Platform.OS === 'android' && this.overTheAirUpdateIsEnabled == true) {
103-
let otaConfig = OtaConfig;
104-
105-
AnylineOCR.initSdk(otaConfig.license);
106-
const onSessionConnect = (event) => {
107-
console.log(event.progress);
108-
};
109-
DeviceEventEmitter.addListener('ota_progress_update_event', onSessionConnect);
110-
AnylineOCR.update(
111-
JSON.stringify(otaConfig),
112-
(message) => {
113-
console.log(`Error: ${message}`);
114-
},
115-
() => {
116-
console.log(`DONE`);
117-
this.openAnyline(type)
118-
}
119-
)
120-
} else {
121-
this.openAnyline(type);
122-
}
111+
this.openAnyline(type);
123112
};
124113

125114
_openAnyline = async (type) => {
@@ -131,6 +120,7 @@ class Anyline extends Component {
131120
this.setState({
132121
currentScanMode: type,
133122
hasMultipleResults: false,
123+
hasContinuousResults: false,
134124
});
135125

136126
switch (type) {
@@ -146,6 +136,10 @@ class Anyline extends Component {
146136
case 'BARCODE':
147137
config = BarcodeConfig;
148138
break;
139+
case 'BARCODE_CONTINUOUS':
140+
this.setState({ hasContinuousResults: true });
141+
config = BarcodeContinuousConfig;
142+
break;
149143
case 'BARCODE_PDF417':
150144
config = BarcodePDF417Config;
151145
break;
@@ -241,17 +235,48 @@ class Anyline extends Component {
241235
}
242236
this.setState({ titles });
243237
try {
238+
const anylineOCRResultEventName = 'onResultCallback';
239+
const maxContinuousResultCount = 10;
240+
const continuousResultListener = (response) => {
241+
console.log(`AnylineOCR.onResult: ` + response);
242+
if (continuousResults !== "") {
243+
continuousResults = continuousResults + ", ";
244+
}
245+
continuousResults = continuousResults + response;
246+
continuousCount++;
247+
if (continuousCount > maxContinuousResultCount) {
248+
AnylineOCR.tryStopScan(null);
249+
}
250+
}
251+
252+
let continuousResults = "";
253+
let continuousCount = 0;
254+
244255
const isInitialized = await AnylineOCR.isInitialized();
245256
console.log(`AnylineOCR.initialized: ` + isInitialized);
246257
if (!isInitialized) {
247258
await AnylineOCR.setupAnylineSDK(demoAppLicenseKey);
248259
}
249260

250261
console.log(`AnylineOCR.setupPromise`);
251-
const result = await AnylineOCR.setupPromise(
252-
JSON.stringify(config),
253-
'scan'
254-
);
262+
let result = "";
263+
if (!this.state.hasContinuousResults) {
264+
result = await AnylineOCR.setupPromise(
265+
JSON.stringify(config),
266+
'scan'
267+
);
268+
} else {
269+
continuousResults = "";
270+
continuousCount = 0;
271+
getPlatformEventEmitter().addListener(anylineOCRResultEventName, continuousResultListener);
272+
result = await AnylineOCR.setupPromiseWithScanCallbackConfig(
273+
JSON.stringify(config),
274+
'scan',
275+
'{ "onResultEventName": "' + anylineOCRResultEventName + '" }'
276+
);
277+
result = "[" + continuousResults + "]";
278+
getPlatformEventEmitter().removeAllListeners(anylineOCRResultEventName)
279+
}
255280

256281
console.log('scan result: ' + result);
257282

@@ -320,6 +345,7 @@ class Anyline extends Component {
320345
pluginVersion,
321346
licenseMessage,
322347
hasMultipleResults,
348+
hasContinuousResults,
323349
titles,
324350
} = this.state;
325351

@@ -338,7 +364,7 @@ class Anyline extends Component {
338364
contentContainerStyle={styles.ContainerContent}>
339365
<Text style={styles.headline}>Anyline React-Native Example</Text>
340366
{hasScanned ? (
341-
hasMultipleResults ? (
367+
hasMultipleResults || hasContinuousResults ? (
342368
Object.keys(result).map((key, index) => {
343369
return (
344370
<Result

plugin/AnylineReact.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
1818
s.source = { :git => "https://github.com/Anyline/anyline-ocr-react-native-module.git", :tag => "#{s.version}" }
1919

2020
s.source_files = 'ios/**/*.{h,m,swift}'
21-
s.dependency "Anyline", "55.2.1"
21+
s.dependency "Anyline", "55.5.0"
2222
s.dependency "React"
2323

2424
end

plugin/android/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ repositories {
6161

6262
dependencies {
6363
implementation fileTree(dir: "libs", include: ["*.jar"])
64-
implementation 'io.anyline:anylinesdk:55.2.1'
64+
implementation 'io.anyline:anylinesdk:55.5.0'
6565
implementation "com.facebook.react:react-native:+"
66-
implementation("com.google.android.material:material:1.9.0")
67-
implementation 'androidx.multidex:multidex:2.0.1'
6866
}

plugin/android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
<uses-permission android:name="android.permission.CAMERA" />
77

88
<application>
9-
<activity
10-
android:name=".ScanActivity"
11-
android:screenOrientation="portrait" />
9+
1210
</application>
1311
</manifest>

0 commit comments

Comments
 (0)