Skip to content

Commit

Permalink
Anyline 3.21
Browse files Browse the repository at this point in the history
- added Austrian Driving License example
- Serial Number Validation and Whitelist
  • Loading branch information
Jonas committed Feb 16, 2018
1 parent 5569b6c commit 4c778b2
Show file tree
Hide file tree
Showing 25 changed files with 237 additions and 30 deletions.

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions example/RNExampleApp/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:2.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -24,6 +27,9 @@ allprojects {
maven {
url 'https://anylinesdk.blob.core.windows.net/maven/'
}
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Dec 06 14:22:57 CET 2017
#Mon Jan 22 14:27:09 CET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-4.4-20171031235950+0000-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
57 changes: 57 additions & 0 deletions example/RNExampleApp/config/DrivingLicenseConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
export default {
license:'eyAiYW5kcm9pZElkZW50aWZpZXIiOiBbICJjb20uYW55bGluZS5leGFtcGxlLnJl\n' +
'YWN0bmF0aXZlIiBdLCAiZGVidWdSZXBvcnRpbmciOiAib24iLCAiaW9zSWRlbnRp\n' +
'ZmllciI6IFsgImNvbS5hbnlsaW5lLmV4YW1wbGUucmVhY3RuYXRpdmUiIF0sICJs\n' +
'aWNlbnNlS2V5VmVyc2lvbiI6IDIsICJtYWpvclZlcnNpb24iOiAiMyIsICJwaW5n\n' +
'UmVwb3J0aW5nIjogdHJ1ZSwgInBsYXRmb3JtIjogWyAiaU9TIiwgIkFuZHJvaWQi\n' +
'IF0sICJzY29wZSI6IFsgIkFMTCIgXSwgInNob3dQb3BVcEFmdGVyRXhwaXJ5Ijog\n' +
'ZmFsc2UsICJzaG93V2F0ZXJtYXJrIjogdHJ1ZSwgInRvbGVyYW5jZURheXMiOiA5\n' +
'MCwgInZhbGlkIjogIjIwMjAtMTItMzEiIH0KUlliRzFBbFgwempXZTVLYkdtK000\n' +
'SXFXME5jWUdTZWNBU0t6M3k0QnQ3VGFjMWgrVEpveHlIVXFTb1JxWFZKNgpXRlhH\n' +
'N2kvVjFqNjVTTEgyS0V4NUpoRlZKT0Y1UDhJR1VLak9CY1ozR2o5WHRTLzdub3Ni\n' +
'ZHoxTTlqZWlJRWJYCjZ1ZXFyVmtyNGRpRVJsOWNDQ01kOWRvTG80dnJiMGpIbzZ0\n' +
'bk12d2VrWFdUaUFnSlNjNXB5MGlOc2F6MjRKZFYKa3dEWnY2dG9Oa1NIdjhRWTVj\n' +
'U3laSWdNSHFsRTZBUkVxcG5oNlA5THh3aWF1Sm5Sd2o4OWFWVCt4ZkoyaFdLbgpU\n' +
'NE9tUzVraWdNUVZLaW8vaWlJS2tIVEVUdUxjYWJEWWtacExZdVR2YnU1S1hIc0R6\n' +
'b1NxUUJTL3ZFS3VYUHhhCjNnanZnS285M3lrSjJKQjVBZjZiSkE9PQo=',
options: {
"captureResolution":"720p",
"cutout": {
"style": "rect",
"maxWidthPercent": "100%",
"maxHeightPercent": "100%",
"alignment": "center",
"ratioFromSize" : {
"width": 125,
"height": 85
},
"strokeWidth": 2,
"cornerRadius": 4,
"strokeColor": "FFFFFF",
"outerColor": "000000",
"outerAlpha": 0.3,
"feedbackStrokeColor": "0099FF"
},
"flash": {
"mode": "manual",
"alignment": "bottom_right",
"imageOn": "flash_on",
"imageOff": "flash_off"
},
"beepOnResult": true,
"vibrateOnResult": true,
"blinkAnimationOnResult": true,
"cancelOnResult": true,
"visualFeedback": {
"style": "CONTOUR_POINT",
"strokeColor": "0099FF",
"strokeWidth": 2
}
},
ocr: {
"scanMode": "AUTO",
"aleFile": "anyline_austrian_driving_license.ale",
"tesseractLanguages": ["eng_no_dict", "deu"],
"traineddataFiles": ["tessdata/eng_no_dict.traineddata", "tessdata/deu.traineddata"],
}
}
45 changes: 45 additions & 0 deletions example/RNExampleApp/config/SerialNumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
export default {
license: 'eyAiYW5kcm9pZElkZW50aWZpZXIiOiBbICJjb20uYW55bGluZS5leGFtcGxlLnJl\n' +
'YWN0bmF0aXZlIiBdLCAiZGVidWdSZXBvcnRpbmciOiAib24iLCAiaW9zSWRlbnRp\n' +
'ZmllciI6IFsgImNvbS5hbnlsaW5lLmV4YW1wbGUucmVhY3RuYXRpdmUiIF0sICJs\n' +
'aWNlbnNlS2V5VmVyc2lvbiI6IDIsICJtYWpvclZlcnNpb24iOiAiMyIsICJwaW5n\n' +
'UmVwb3J0aW5nIjogdHJ1ZSwgInBsYXRmb3JtIjogWyAiaU9TIiwgIkFuZHJvaWQi\n' +
'IF0sICJzY29wZSI6IFsgIkFMTCIgXSwgInNob3dQb3BVcEFmdGVyRXhwaXJ5Ijog\n' +
'ZmFsc2UsICJzaG93V2F0ZXJtYXJrIjogdHJ1ZSwgInRvbGVyYW5jZURheXMiOiA5\n' +
'MCwgInZhbGlkIjogIjIwMjAtMTItMzEiIH0KUlliRzFBbFgwempXZTVLYkdtK000\n' +
'SXFXME5jWUdTZWNBU0t6M3k0QnQ3VGFjMWgrVEpveHlIVXFTb1JxWFZKNgpXRlhH\n' +
'N2kvVjFqNjVTTEgyS0V4NUpoRlZKT0Y1UDhJR1VLak9CY1ozR2o5WHRTLzdub3Ni\n' +
'ZHoxTTlqZWlJRWJYCjZ1ZXFyVmtyNGRpRVJsOWNDQ01kOWRvTG80dnJiMGpIbzZ0\n' +
'bk12d2VrWFdUaUFnSlNjNXB5MGlOc2F6MjRKZFYKa3dEWnY2dG9Oa1NIdjhRWTVj\n' +
'U3laSWdNSHFsRTZBUkVxcG5oNlA5THh3aWF1Sm5Sd2o4OWFWVCt4ZkoyaFdLbgpU\n' +
'NE9tUzVraWdNUVZLaW8vaWlJS2tIVEVUdUxjYWJEWWtacExZdVR2YnU1S1hIc0R6\n' +
'b1NxUUJTL3ZFS3VYUHhhCjNnanZnS285M3lrSjJKQjVBZjZiSkE9PQo=',
options: {
"captureResolution": '1080p',
"cutout": {
"style": 'rect',
"alignment": 'top_half',
"strokeWidth": 2,
"cornerRadius": 4,
"strokeColor": 'FFFFFF',
"outerColor": '000000',
"outerAlpha": 0.3,
},
"flash": {
"mode": 'manual',
"alignment": 'bottom_right',
},
"beepOnResult": true,
"vibrateOnResult": true,
"blinkAnimationOnResult": true,
"cancelOnResult": true,
"reportingEnabled": true,
"visualFeedback": {
"style": "CONTOUR_RECT"
},
"serialNumber": {
"numberCharWhitelist": '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',
"validationRegex": '^[0-9A-Z]{5,}$'
}
}
}
12 changes: 9 additions & 3 deletions example/RNExampleApp/ios/RNExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
1ED0E5D62036F84D0030B0EF /* ale in Resources */ = {isa = PBXBuildFile; fileRef = 1ED0E5D52036F84D0030B0EF /* ale */; };
1ED294162035FCEA00CD1B8B /* tessdata in Resources */ = {isa = PBXBuildFile; fileRef = 1ED294152035FCE900CD1B8B /* tessdata */; };
2461A0FE4220A12E83C78AAA /* libPods-RNExampleApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA0049A81087564E18C8F99C /* libPods-RNExampleApp.a */; };
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
Expand Down Expand Up @@ -282,7 +284,6 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = "<group>"; };
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = "<group>"; };
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
Expand All @@ -301,6 +302,8 @@
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RNExampleApp/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = RNExampleApp/main.m; sourceTree = "<group>"; };
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
1ED0E5D52036F84D0030B0EF /* ale */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ale; sourceTree = "<group>"; };
1ED294152035FCE900CD1B8B /* tessdata */ = {isa = PBXFileReference; lastKnownFileType = folder; path = tessdata; sourceTree = "<group>"; };
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -416,7 +419,6 @@
13B07FAE1A68108700A75B9A /* RNExampleApp */ = {
isa = PBXGroup;
children = (
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.m */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
Expand Down Expand Up @@ -497,6 +499,8 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
1ED0E5D52036F84D0030B0EF /* ale */,
1ED294152035FCE900CD1B8B /* tessdata */,
13B07FAE1A68108700A75B9A /* RNExampleApp */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* RNExampleAppTests */,
Expand Down Expand Up @@ -904,7 +908,9 @@
buildActionMask = 2147483647;
files = (
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
1ED0E5D62036F84D0030B0EF /* ale in Resources */,
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
1ED294162035FCEA00CD1B8B /* tessdata in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -950,7 +956,7 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-RNExampleApp/Pods-RNExampleApp-resources.sh",
"${PODS_ROOT}/Anyline/AnylineSDK_iOS_3.20.0/Framework/AnylineResources.bundle",
"${PODS_ROOT}/Anyline/AnylineSDK_iOS_3.21.0/Framework/AnylineResources.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
Expand Down
3 changes: 2 additions & 1 deletion example/RNExampleApp/ios/RNExampleApp/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
{
NSURL *jsCodeLocation;

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
// jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"RNExampleApp"
Expand Down
10 changes: 5 additions & 5 deletions example/RNExampleApp/ios/RNExampleApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.19.1</string>
<string>3.21.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand All @@ -35,10 +37,10 @@
</dict>
</dict>
</dict>
<key>NSCameraUsageDescription</key>
<string>Allow Anyline to access you camera?</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand All @@ -52,7 +54,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSCameraUsageDescription</key>
<string>Allow Anyline to access you camera?</string>
</dict>
</plist>

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/RNExampleApp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "RNExampleApp",
"version": "3.20.0",
"version": "3.21.0",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
Expand Down
8 changes: 8 additions & 0 deletions example/RNExampleApp/src/Overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ export default function Overview({openAnyline, checkCameraPermissionAndOpen, dis
platformPermissionCheck('VOUCHER')
}}/>

</View>
<View style={styles.buttons}>
<Button style={styles.buttons} title={' Austrian Driving License'} color="#0099FF"
disabled={disabled}
onPress={() => {
platformPermissionCheck('DRIVING_LICENSE')
}}/>

</View>
<Text style={styles.text}>OTHER</Text>

Expand Down
16 changes: 14 additions & 2 deletions example/RNExampleApp/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
PermissionsAndroid,
ScrollView,
StyleSheet,
Text
Text,
Platform
} from 'react-native';

import AnylineOCR from 'anyline-ocr-react-native-module';
Expand All @@ -21,7 +22,9 @@ import MRZConfig from '../config/MRZConfig';
import AutoEnergyConfig from '../config/AutoEnergyConfig';
import IBANConfig from '../config/IbanConfig';
import VoucherConfig from '../config/VoucherConfig';
import DrivingLicenseConfig from '../config/DrivingLicenseConfig';
import LicensePlateConfig from '../config/LicensePlateConfig';
import SerialNumberConfig from '../config/SerialNumber';


class Anyline extends Component {
Expand Down Expand Up @@ -55,7 +58,7 @@ class Anyline extends Component {
config = AutoEnergyConfig;
break;
case 'SERIAL_NUMBER':
config = AutoEnergyConfig;
config = SerialNumberConfig;
break;
case 'DOT_MATRIX_METER':
config = AutoEnergyConfig;
Expand All @@ -71,6 +74,10 @@ class Anyline extends Component {
type = 'ANYLINE_OCR';
config = VoucherConfig;
break;
case 'DRIVING_LICENSE':
type = 'ANYLINE_OCR';
config = DrivingLicenseConfig;
break;
case 'MRZ':
config = MRZConfig;
break;
Expand All @@ -89,6 +96,11 @@ class Anyline extends Component {
break;
}

// Force set captureResolution to 1080 on iOS @TODO remove, if fixed
if(Platform.OS === 'ios') {
config.options.captureResolution = '1080p';
}


try {
const result = await AnylineOCR.setupPromise(JSON.stringify(config), type);
Expand Down
2 changes: 1 addition & 1 deletion example/RNExampleApp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ ansi@^0.3.0, ansi@~0.3.1:
resolved "https://registry.yarnpkg.com/ansi/-/ansi-0.3.1.tgz#0c42d4fb17160d5a9af1e484bace1c66922c1b21"

anyline-ocr-react-native-module@../../plugin:
version "3.20.0"
version "3.21.0"

anymatch@^1.3.0:
version "1.3.2"
Expand Down
2 changes: 1 addition & 1 deletion plugin/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ repositories {
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'io.anyline:anylinesdk:3.20.0@aar'
compile 'io.anyline:anylinesdk:3.21.0@aar'
compile 'com.google.android.gms:play-services-vision:10.0.1'
compile 'com.android.support:design:25.1.0'
compile "com.facebook.react:react-native:+" // From node_modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void finishWithError(String errorMessage) {
Intent data = new Intent();
data.putExtra(AnylineSDKPlugin.EXTRA_ERROR_MESSAGE, errorMessage);
setResult(AnylineSDKPlugin.RESULT_ERROR, data);
ResultReporter.onError(errorMessage);
ResultReporter.onError(errorMessage);
finish();
}

Expand Down
Loading

0 comments on commit 4c778b2

Please sign in to comment.