Skip to content

Commit

Permalink
added new SDK and Doc postProcessing
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslaux committed May 14, 2018
1 parent 94bbdfc commit 643b385
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/RNExampleApp/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ allprojects {
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://anylinesdk.blob.core.windows.net/maven/'
url 'https://anylinesdk.blob.core.windows.net/testing/'
}
maven {
url 'https://maven.google.com/'
Expand Down
4 changes: 2 additions & 2 deletions plugin/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ repositories {
dirs 'libs'
}
maven {
url 'https://anylinesdk.blob.core.windows.net/maven/'
url 'https://anylinesdk.blob.core.windows.net/testing/'
}
}

dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'io.anyline:anylinesdk:3.23.0@aar'
compile 'io.anyline:anylinesdk:3.24.0-RC4@aar'
compile 'com.google.android.gms:play-services-vision:12.0.1'
compile 'com.android.support:design:26.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 @@ -52,6 +52,7 @@ public class DocumentActivity extends AnylineBaseActivity implements CameraOpenL
private TextView errorMessage;
private long lastErrorRecieved = 0;
private int quality = 100;
private boolean postProcessing = false;

private Double maxDocumentOutputResolutionWidth = null;
private Double maxDocumentOutputResolutionHeight = null;
Expand Down Expand Up @@ -121,6 +122,7 @@ protected void onCreate(Bundle savedInstanceState) {
this.maxDocumentOutputResolutionHeight = documentConfig.getJSONObject("maxOutputResolution").getDouble("height");
this.ratios = getArrayListFromJsonArray(documentConfig.getJSONObject("ratio").getJSONArray("ratios"));
this.ratioDeviation = documentConfig.getJSONObject("ratio").getDouble("deviation");
this.postProcessing = documentConfig.getBoolean("postProcessing");
} catch (JSONException e) {
Log.e(TAG, e.getMessage());
}
Expand All @@ -147,6 +149,9 @@ protected void onCreate(Bundle savedInstanceState) {
documentScanView.setMaxDocumentOutputResolution(maxDocumentOutputResolutionWidth, maxDocumentOutputResolutionHeight);
}

// Set PostProcessing
documentScanView.setPostProcessingEnabled(this.postProcessing);

// initialize Anyline with the license key and a Listener that is called if a result is found
documentScanView.initAnyline(licenseKey, new DocumentResultListener() {
@Override
Expand Down
6 changes: 5 additions & 1 deletion plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ const Buffer = require('buffer/').Buffer;

export default NativeModules.AnylineSDKPlugin;


/**
* Decrypts the License and returns the date till it's valid
*
* @param License
*/
export const getLicenseExpiryDate = (License) => {
const licenseString = Buffer.from(License, 'base64').toString('ascii');
const licenseJsonString = licenseString.substr(0, licenseString.lastIndexOf('}')+1);
Expand Down
8 changes: 8 additions & 0 deletions plugin/ios/AnylineDocumentScanViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@
@property (nonatomic, strong) NSArray *ratios;
@property (nonatomic, assign) CGFloat ratioDeviation;

/**
* Document PostProcessing
* @warning Parameter can only be changed when the scanning is not running.
*
* @since 3.24
*/
@property (nonatomic, strong) Boolean postProcessing;

@end
3 changes: 3 additions & 0 deletions plugin/ios/AnylineDocumentScanViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ - (void)viewDidLoad {
[docModuleView setDocumentRatios:self.ratios];
docModuleView.maxDocumentRatioDeviation = [NSNumber numberWithDouble:self.ratioDeviation];

// Set PostProcessing of the
[docModuleView setPostProcessingEnabled:self.postProcessing];

// Set max Output Resolution
if(!CGSizeEqualToSize(CGSizeZero, self.maxOutputResolution)){
docModuleView.maxOutputResolution = self.maxOutputResolution;
Expand Down
7 changes: 7 additions & 0 deletions plugin/ios/AnylineSDKPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ - (AnylineBaseScanViewController *)ViewControllerFromScanMode:(NSString *)scanMo
docVC.quality = 100;
}

// Check for Document PostProcessing and set it
if([docConfig valueForKey:@"postProcessing"]){
docVC.postProcessing = [[docConfig valueForKey:@"postProcessing"] boolValue];
} else {
docVC.postProcessing = false;
}

// Check for Document Max Output Config and set it
if([docConfig valueForKey:@"maxOutputResoultion"]){
NSDictionary *maxOutputResoultionConfig = [docConfig valueForKey:@"maxOutputResoultion"];
Expand Down

0 comments on commit 643b385

Please sign in to comment.