Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade peer dependencies to Capacitor V3, Update documentation #15

Open
wants to merge 10 commits into
base: feature/capacitor-v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 68 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,73 +19,92 @@ yarn add @idpass/smartscanner-capacitor
The plugin can be used through Capacitor's `Plugins` object, which is the registry of all available plugins.

```js
import { Plugins } from '@capacitor/core';

const { SmartScannerPlugin } = Plugins;
import { ScannerInputConfig, ScannerOptions, SmartScannerPlugin } from '@idpass/smartscanner-capacitor';
```

MRZ scanning example:

```js
const result = await SmartScannerPlugin.executeScanner({
const scannerOptions: ScannerOptions = {
mode: 'mrz',
config: {
background: '#89837c',
header: 'Sample Header',
subHeader: 'Sample SubHeader',
label: 'Sample Config Label',
isManualCapture: true,
branding: false
},
mrzFormat: 'MRTD_TD1',
}

const inputConfig: ScannerInputConfig = {
action: 'START_SCANNER',
options: {
mode: 'mrz',
mrzFormat: 'MRTD_TD1',
config: {
background: '#89837c',
branding: false,
isManualCapture: true,
},
},
});
options: scannerOptions
}

await SmartScannerPlugin.executeScanner(inputConfig);
```
NFC scanning example:

```js
const result = await SmartScannerPlugin.executeScanner({
const scannerOptions: ScannerOptions = {
mode: 'nfc-scan',
config: {
background: '#89837c',
header: 'Sample Header',
subHeader: 'Sample SubHeader',
label: 'Sample Config Label'
},
nfcOptions: {
label: 'This is a sample label',
withPhoto: true,
withMrzPhoto: false
}
}

const inputConfig: ScannerInputConfig = {
action: 'START_SCANNER',
options: {
mode: 'nfc-scan',
config: {
background: '#89837c',
branding: false,
isManualCapture: false,
},
},
});
options: scannerOptions
}


await SmartScannerPlugin.executeScanner(inputConfig);
```

Barcode scanning example:

```js
const result = await SmartScannerPlugin.executeScanner({
action: 'START_SCANNER',
options: {
mode: 'barcode',
barcodeOptions: {
barcodeFormats: [
'AZTEC',
'CODABAR',
'CODE_39',
'CODE_93',
'CODE_128',
'DATA_MATRIX',
'EAN_8',
'EAN_13',
'QR_CODE',
'UPC_A',
'UPC_E',
'PDF_417',
],
},
config: {
background: '#ffc234',
label: 'Sample Label',
},
const scannerOptions: ScannerOptions = {
mode: 'barcode',
barcodeOptions: {
barcodeFormats: [
'AZTEC',
'CODABAR',
'CODE_39',
'CODE_93',
'CODE_128',
'DATA_MATRIX',
'EAN_8',
'EAN_13',
'QR_CODE',
'UPC_A',
'UPC_E',
'PDF_417',
],
},
});
config: {
background: '#ffc234',
label: 'Sample Config Label',
}
}

const inputConfig: ScannerInputConfig = {
action: 'START_SCANNER',
options: scannerOptions
}

await SmartScannerPlugin.executeScanner(inputConfig);
```

Refer to the [API Reference](https://github.com/idpass/smartscanner-capacitor/wiki/API-Reference) for more information about the available API options and the returned result.
Expand Down
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
}
dependencies {
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down Expand Up @@ -79,9 +79,9 @@ dependencies {

implementation project(':capacitor-android')

debugImplementation files('aar/smartscannerlib-debug.aar')
releaseImplementation files('aar/smartscannerlib-release.aar')
implementation files('aar/smartscanner-mrz-parser.aar')
debugImplementation(name: 'smartscannerlib-debug', ext: 'aar')
releaseImplementation(name: 'smartscannerlib-release', ext: 'aar')
implementation(name: 'smartscanner-mrz-parser', ext: 'aar')

testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
Loading