feat(regula-document-reader): separate initialization and scanning, add android (#2013)

This commit is contained in:
Dmitry Smolyakov 2017-10-06 06:23:51 +03:00 committed by Ibby Hadeed
parent e65406cc2f
commit 2179699622

View File

@ -13,7 +13,8 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
* import { RegulaDocumentReader } from '@ionic-native/regula-document-reader'; * import { RegulaDocumentReader } from '@ionic-native/regula-document-reader';
* *
* let license; // read regula.license file * let license; // read regula.license file
* RegulaDocumentReader.scanDocument(license).then((result) => { * RegulaDocumentReader.initReader(license); // initialize reader
* RegulaDocumentReader.scanDocument().then((result) => {
* // read result * // read result
* }) * })
* ``` * ```
@ -23,17 +24,23 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
plugin: 'cordova-plugin-documentreader', plugin: 'cordova-plugin-documentreader',
pluginRef: 'DocumentReader', pluginRef: 'DocumentReader',
repo: 'https://github.com/regulaforensics/cordova-plugin-documentreader.git', repo: 'https://github.com/regulaforensics/cordova-plugin-documentreader.git',
platforms: ['iOS'], platforms: ['iOS', 'Android'],
install: 'ionic plugin add cordova-plugin-documentreader --variable CAMERA_USAGE_DESCRIPTION="To take photo"', install: 'ionic plugin add cordova-plugin-documentreader --variable CAMERA_USAGE_DESCRIPTION="To take photo"',
}) })
@Injectable() @Injectable()
export class RegulaDocumentReader extends IonicNativePlugin { export class RegulaDocumentReader extends IonicNativePlugin {
/** /**
* Run the scanner * Initialize the scanner
* @param license {any} License data * @param license {any} License data
*/
@Cordova()
initReader(license: any): void {}
/**
* Run the scanner
* @return {Promise<string[]>} Returns a promise that resolves when results was got, and fails when not * @return {Promise<string[]>} Returns a promise that resolves when results was got, and fails when not
*/ */
@Cordova() @Cordova()
scanDocument(license: any): Promise<string[]> { return; } scanDocument(): Promise<string[]> { return; }
} }