Skip to content

Commit db57175

Browse files
Merge pull request #156 from Anyline/release/42.2.0
Release/42.2.0
2 parents 579f6cd + 71b5f96 commit db57175

File tree

13 files changed

+218
-138
lines changed

13 files changed

+218
-138
lines changed

example/RNExampleApp/android/.project

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
</natures>
1717
<filteredResources>
1818
<filter>
19-
<id>1644311700747</id>
19+
<id>1669021212230</id>
2020
<name></name>
2121
<type>30</type>
2222
<matcher>
2323
<id>org.eclipse.core.resources.regexFilterMatcher</id>
24-
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
24+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
2525
</matcher>
2626
</filter>
2727
</filteredResources>

example/RNExampleApp/android/app/.project

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
</natures>
2323
<filteredResources>
2424
<filter>
25-
<id>1644311700752</id>
25+
<id>1669021212234</id>
2626
<name></name>
2727
<type>30</type>
2828
<matcher>
2929
<id>org.eclipse.core.resources.regexFilterMatcher</id>
30-
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
30+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
3131
</matcher>
3232
</filter>
3333
</filteredResources>

example/RNExampleApp/android/app/build.gradle

+9-5
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ android {
103103
applicationId "com.anyline.example.reactnative"
104104
minSdkVersion rootProject.ext.minSdkVersion
105105
targetSdkVersion rootProject.ext.targetSdkVersion
106-
versionCode 4
107-
versionName "42.0.0"
106+
versionCode 5
107+
versionName "42.2.0"
108108
multiDexEnabled true
109109

110110
}
@@ -160,8 +160,6 @@ android {
160160
sourceCompatibility JavaVersion.VERSION_1_8
161161
targetCompatibility JavaVersion.VERSION_1_8
162162
}
163-
164-
165163
}
166164

167165

@@ -177,13 +175,19 @@ dependencies {
177175
else { implementation jscFlavor }
178176
implementation project(':anyline-ocr-react-native-module')
179177
implementation fileTree(dir: "libs", include: ["*.jar"])
180-
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
178+
implementation 'androidx.appcompat:appcompat:1.2.0'
181179
implementation "com.facebook.react:react-native:+" // From node_modules
182180

183181
implementation 'androidx.multidex:multidex:2.0.1'
184182

185183
}
186184

185+
configurations.all {
186+
resolutionStrategy {
187+
force 'androidx.core:core:1.5.0'
188+
}
189+
}
190+
187191
// Run this once to be able to run the application with BUCK
188192
// puts all compile dependencies into folder libs for BUCK to use
189193
task copyDownloadableDepsToLibs(type: Copy) {

example/RNExampleApp/android/app/src/main/AndroidManifest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
android:name=".MainActivity"
1818
android:label="@string/app_name"
1919
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
20-
android:windowSoftInputMode="adjustResize">
20+
android:windowSoftInputMode="adjustResize"
21+
android:exported="true">
2122
<intent-filter>
2223
<action android:name="android.intent.action.MAIN" />
2324
<category android:name="android.intent.category.LAUNCHER" />

example/RNExampleApp/android/build.gradle

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "29.0.3"
5+
buildToolsVersion = "33.0.0"
66
minSdkVersion = 21
7-
compileSdkVersion = 29
8-
targetSdkVersion = 29
9-
supportLibVersion = "28.0.0"
7+
compileSdkVersion = 31
8+
targetSdkVersion = 31
109
ndkVersion = "20.1.5948944"
1110
}
1211
repositories {

example/RNExampleApp/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

example/RNExampleApp/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "RNExampleApp",
3-
"version": "42.0.0",
3+
"version": "42.2.0",
44
"private": true,
55
"scripts": {
66
"start": "node node_modules/react-native/local-cli/cli.js start",
7-
"reinstall": "yarn remove anyline-ocr-react-native-module && yarn add ../../plugin && react-native link",
8-
"reinstall-pods": "cd ios/ && rm -rf Pods Podfile.lock && pod update --verbose && cd .. && react-native link",
7+
"reinstall": "yarn remove anyline-ocr-react-native-module && yarn add ../../plugin && yarn react-native link",
8+
"reinstall-pods": "cd ios/ && rm -rf Pods Podfile.lock && pod update --verbose && cd .. && yarn react-native link",
99
"test": "jest",
1010
"bundleAndroid": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/",
1111
"bundleiOS": "react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios"
@@ -16,7 +16,7 @@
1616
"hermes-engine": "^0.7.2",
1717
"jsc-android": "^241213.1.0",
1818
"react": "17.0.2",
19-
"react-native": "0.67.2"
19+
"react-native": "0.67.5"
2020
},
2121
"devDependencies": {
2222
"@babel/core": "^7.12.9",

example/RNExampleApp/src/Result.js

+76-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import React from 'react';
1+
import React, {
2+
Component,
3+
useState
4+
} from 'react';
25
import {
36
Button,
47
Image,
@@ -7,9 +10,12 @@ import {
710
Text,
811
View,
912
Dimensions,
13+
Platform,
1014
TouchableWithoutFeedback,
15+
TextInput,
1116
} from 'react-native';
1217
import {flattenObject} from './utils/utils';
18+
import AnylineOCR from 'anyline-ocr-react-native-module';
1319

1420
const withoutImagePaths = value =>
1521
value !== 'imagePath' && value !== 'fullImagePath';
@@ -23,6 +29,66 @@ export default function Result({
2329
hasBackButton,
2430
title = false,
2531
}) {
32+
33+
const [correctedResult, setCorrectedResult] = useState('');
34+
const [responseText, setResponseText] = useState('');
35+
36+
let onReportCorrectedResultResponseHandler = function(response) {
37+
/*
38+
The response is a string with the following style if it's an error:
39+
{
40+
"code": <Error code>,
41+
"message": {
42+
"code": <Error code>,
43+
"timestamp": <Timestamp>,
44+
"path": <Endpoint URL of our Api>,
45+
"method": <POST, GET etc.>,
46+
"message": <Error message>
47+
}
48+
}
49+
50+
If the response is successful it looks like this:
51+
{
52+
"code" : 201,
53+
"message" : {
54+
"message": "ok"
55+
}
56+
}
57+
*/
58+
var parsedResponse = JSON.parse(response);
59+
if(parsedResponse["code"] === 201){
60+
setResponseText("Sending corrected result was successful.");
61+
} else {
62+
setResponseText("Error while sending corrected result: " + parsedResponse["message"]);
63+
}
64+
}
65+
66+
let onReportCorrectedResultPressed = function() {
67+
let blobKey = result["blobKey"];
68+
69+
if(typeof blobKey === 'undefined' || blobKey === '' || blobKey === null){
70+
setResponseText("Only licenses with 'debugReporting' set to 'on' allow user corrected results.");
71+
} else if(correctedResult !== "") {
72+
setResponseText("Waiting for response...");
73+
AnylineOCR.reportCorrectedResult(result["blobKey"], correctedResult, onReportCorrectedResultResponseHandler);
74+
}
75+
};
76+
77+
let reportCorrectedResultButton = (
78+
<View
79+
style={styles.reportCorrectedResultButtonStyle}
80+
>
81+
<TextInput
82+
placeholder='Enter corrected result'
83+
backgroundColor='white'
84+
marginBottom={16}
85+
onChangeText={ newCorrectedResult => setCorrectedResult(newCorrectedResult) }
86+
/>
87+
<Button title={'Report corrected result'} onPress={onReportCorrectedResultPressed} />
88+
<Text style={styles.text}>{responseText}</Text>
89+
</View>
90+
);
91+
2692
let fullImage = <View />;
2793
let fullImageText = <View />;
2894
if (fullImagePath && fullImagePath !== '') {
@@ -90,6 +156,7 @@ export default function Result({
90156
</View>
91157
);
92158
})}
159+
{ Platform.OS === 'android' && reportCorrectedResultButton }
93160
{BackButton}
94161
</ScrollView>
95162
</View>
@@ -163,6 +230,14 @@ const styles = StyleSheet.create({
163230
alignSelf: 'center',
164231
},
165232

233+
reportCorrectedResultButtonStyle: {
234+
marginTop: 25,
235+
width: Dimensions.get('window').width,
236+
alignSelf: 'center',
237+
paddingLeft: 24,
238+
paddingRight: 24
239+
},
240+
166241
titleText: {
167242
color: '#0099FF',
168243
fontSize: 20

plugin/android/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ allprojects {
1919

2020

2121
android {
22-
compileSdkVersion 28
22+
compileSdkVersion rootProject.ext.compileSdkVersion
2323

2424
defaultConfig {
25-
minSdkVersion 21
26-
targetSdkVersion 28
25+
minSdkVersion rootProject.ext.minSdkVersion
26+
targetSdkVersion rootProject.ext.targetSdkVersion
2727
versionCode 1
2828
versionName "1.0"
2929
ndk {
@@ -65,7 +65,7 @@ repositories {
6565

6666
dependencies {
6767
implementation fileTree(dir: "libs", include: ["*.jar"])
68-
implementation 'io.anyline:anylinesdk:42.0.0'
68+
implementation 'io.anyline:anylinesdk:42.2.0'
6969
implementation "com.facebook.react:react-native:+" // from node_modules
7070
implementation("com.google.android.material:material:1.4.0-rc01")
7171
implementation 'androidx.multidex:multidex:2.0.1'

0 commit comments

Comments
 (0)