Skip to content

Commit

Permalink
added getLicenseExpiryDate function
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslaux committed May 3, 2018
1 parent 48787af commit 94bbdfc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 20 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Your BundleIdentifier of your app has to match with your bundleID from your Anyl

### 4. Import the plugin to your JavaScript file
```
import Anyline from 'anyline-ocr-react-native-module';
import AnylineOCR from 'anyline-ocr-react-native-module';
```
### 5. Import the config file
```
Expand Down Expand Up @@ -241,6 +241,20 @@ More information about the simultaneous barcode scanning [here](https://document
Callback -> String
- String errorMessage

## Additional Functions

#### getLicenseExpiryDate
Check till when the provided License is or was valid. Returns a string.
```
import AnylineOCR, { getLicenseExpiryDate } from 'anyline-ocr-react-native-module';
...
console.log(getLicenseExpiryDate(myLicenseString)); // 'YYYY-MM-DD'
...
```


## Images

Keep in mind, all the images are saved in the cache directory of the app. For performance reasons, we only provide the
Expand Down
2 changes: 1 addition & 1 deletion example/RNExampleApp/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 26
buildToolsVersion '27.0.1'
buildToolsVersion '27.0.3'

defaultConfig {
applicationId "com.anyline.example.reactnative"
Expand Down
18 changes: 1 addition & 17 deletions example/RNExampleApp/ios/RNExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
E72E52A52B43B6D2673433A2 /* [CP] Embed Pods Frameworks */,
7A287B5DB7A3FB65D24E8143 /* [CP] Copy Pods Resources */,
);
buildRules = (
Expand Down Expand Up @@ -988,7 +987,7 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-RNExampleApp/Pods-RNExampleApp-resources.sh",
"${PODS_ROOT}/Anyline/AnylineSDK_iOS_3.22.0/Framework/AnylineResources.bundle",
"${PODS_ROOT}/Anyline/AnylineSDK_iOS_3.23.0/Framework/AnylineResources.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
Expand All @@ -999,21 +998,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RNExampleApp/Pods-RNExampleApp-resources.sh\"\n";
showEnvVarsInLog = 0;
};
E72E52A52B43B6D2673433A2 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RNExampleApp/Pods-RNExampleApp-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
12 changes: 11 additions & 1 deletion plugin/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import {NativeModules} from 'react-native';

export default NativeModules.AnylineSDKPlugin;
const Buffer = require('buffer/').Buffer;

export default NativeModules.AnylineSDKPlugin;


export const getLicenseExpiryDate = (License) => {
const licenseString = Buffer.from(License, 'base64').toString('ascii');
const licenseJsonString = licenseString.substr(0, licenseString.lastIndexOf('}')+1);
const licenseJson = JSON.parse(licenseJsonString);
return licenseJson.valid;
};
3 changes: 3 additions & 0 deletions plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
],
"directories": {
"example": "examples"
},
"dependencies": {
"buffer": "^5.1.0"
}
}

0 comments on commit 94bbdfc

Please sign in to comment.