Skip to content

Commit

Permalink
fixed language/ale loading bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslaux committed Dec 7, 2018
1 parent ee2177d commit 1a5e749
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 43 deletions.
67 changes: 30 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ If you prefer downloading a package, use the provided `zip` package on the [rele
##### 2. Plugin Usage

```javaScript
cordova.exec(onResult, onError, "AnylineSDK", scanMode, config);
cordova.exec(onResult, onError, "AnylineSDK", "scan", config);
```

- <b>onResult</b>: a function that is called on a scan result
Expand All @@ -88,68 +88,61 @@ cordova.exec(onResult, onError, "AnylineSDK", scanMode, config);
* <b>config[0]</b>: the license key
* <b>config[1]</b>: the [view config](https://documentation.anyline.com/toc/view_configuration/)

> Example for **config** from MRZ:

##### OCR sample configuration
For more examples, check the [example configurations](https://github.com/Anyline/anyline-ocr-cordova-module/tree/master/example/www/js).

```json
[
"YOUR_LICENSE_KEY",
{
"YOUR_LICENSE_KEY",
{
"camera": {
"captureResolution": "1080p"
"captureResolution": "1080"
},
"flash": {
"mode": "manual",
"alignment": "bottom_left"
"alignment": "bottom_right"
},
"viewPlugin": {
"plugin": {
"id": "IDPlugin_ID",
"idPlugin": {
"mrzConfig": {
"strictMode": false,
"cropAndTransformID": false
}
"plugin" : {
"id" : "OCR_VC",
"ocrPlugin" : {
"scanMode" : "AUTO",
"languages" : ["www/assets/anyline_capitals.traineddata"],
"charWhitelist": "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
"validationRegex": "[A-Z0-9]{8}$",
"minConfidence": 85

}
},
"cutoutConfig": {
"style": "rect",
"maxWidthPercent": "90%",
"maxHeightPercent": "90%",
"maxWidthPercent": "80%",
"maxHeightPercent": "80%",
"alignment": "center",
"width": 540,
"ratioFromSize": {
"width": 125,
"height": 85
"width": 5,
"height": 1
},
"strokeWidth": 2,
"cornerRadius": 4,
"cornerRadius": 10,
"strokeColor": "FFFFFF",
"outerColor": "000000",
"outerAlpha": 0.3,
"cropPadding": {
"x": 0,
"y": 0
},
"cropOffset": {
"x": 0,
"y": 0
},
"feedbackStrokeColor": "0099FF",
"offset": {
"x": 0,
"y": 30
}
"feedbackStrokeColor": "0099FF"
},
"scanFeedback": {
"style": "rect",
"style": "contour_point",
"strokeWidth": 3,
"strokeColor": "0099FF",
"strokeWidth": 2,
"blinkOnResult": true,
"fillColor": "220099FF",
"beepOnResult": true,
"vibrateOnResult": true
"vibrateOnResult": true,
"blinkAnimationOnResult": true
},
"cancelOnResult": true
},
"cropAndTransformErrorMessage": "Edges are not detected"
}
}
]
```
Expand Down
4 changes: 2 additions & 2 deletions example/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<content src="index.html" />
<access origin="*" />
<icon src="www/img/ic_launcher.png" />
<engine name="android" spec="latest" />
<engine name="ios" spec="latest" />
<plugin name="io-anyline-cordova" spec="../plugin" />
<engine name="ios" spec="^4.5.5" />
<engine name="android" spec="^7.1.4" />
</widget>
4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"io-anyline-cordova": {}
},
"platforms": [
"android",
"ios"
"ios",
"android"
]
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static JSONObject setLanguages(JSONObject json, Context context){
}
newLanguagesArray.put(languages[i]);
Log.d("languages", languages[i]);
AssetUtil.copyAssetFileWithoutPath(context, "www/" + traineddataFilePath, dirToCopy, false);
AssetUtil.copyAssetFileWithoutPath(context, traineddataFilePath, dirToCopy, false);
Log.v(TAG, "Copy traineddata duration: " + (System.currentTimeMillis() - start));
}
//ocrConfig.setLanguages(languages);
Expand Down
3 changes: 2 additions & 1 deletion plugin/src/ios/ALPluginScanViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ - (instancetype)initWithLicensekey:(NSString *)licensekey
return self;
}


NSString *vinAny = [[NSBundle mainBundle] pathForResource:@"vin" ofType:@"any"];
[config setLanguages:@[vinAny] error:nil];

- (void)viewDidLoad {
[super viewDidLoad];
Expand Down

0 comments on commit 1a5e749

Please sign in to comment.