@@ -44,37 +44,42 @@ export interface BarcodeScannerOptions {
4444}
4545
4646export interface BarcodeScanResult {
47- format : 'QR_CODE' | 'DATA_MATRIX' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'CODE_93' | 'CODABAR' | 'ITF' | 'RSS14' | 'RSS_EXPANDED' | 'PDF417 ' | 'AZTEC' | 'MSI' ;
47+ format : 'QR_CODE' | 'DATA_MATRIX' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'CODE_93' | 'CODABAR' | 'ITF' | 'RSS14' | 'RSS_EXPANDED' | 'PDF_417 ' | 'AZTEC' | 'MSI' ;
4848 cancelled : boolean ;
4949 text : string ;
5050}
5151
5252export class BarcodeScannerMock extends BarcodeScanner {
53- index : number = 0 ;
54- /**
55- * Open the barcode scanner.
56- * @param options {BarcodeScannerOptions} Optional options to pass to the scanner
57- * @returns {Promise<any> } Returns a Promise that resolves with scanner data, or rejects with an error.
58- */
59- scan ( options ?: BarcodeScannerOptions ) : Promise < BarcodeScanResult > {
60- let theResult : BarcodeScanResult = { format : 'QR_CODE' , cancelled : false , text : 'RESPONSE' } ;
53+ Encode : {
54+ TEXT_TYPE : string ;
55+ EMAIL_TYPE : string ;
56+ PHONE_TYPE : string ;
57+ SMS_TYPE : string ;
58+ } ;
6159
62- return new Promise ( ( resolve , reject ) => {
63- resolve ( theResult ) ;
64- } ) ;
65- }
66- /**
67- * Encodes data into a barcode.
68- * NOTE: not well supported on Android
69- * @param type {string} Type of encoding
70- * @param data {any} Data to encode
71- * @returns {Promise<any> }
72- */
73- encode ( type : string , data : any ) : Promise < any > {
74- return new Promise ( ( resolve , reject ) => {
75- resolve ( ) ;
76- } ) ;
77- }
78- }
60+ /**
61+ * Open the barcode scanner.
62+ * @param {BarcodeScannerOptions } [options] Optional options to pass to the scanner
63+ * @returns {Promise<any> } Returns a Promise that resolves with scanner data, or rejects with an error.
64+ */
65+ scan ( options ?: BarcodeScannerOptions ) : Promise < BarcodeScanResult > {
66+ let theResult : BarcodeScanResult = { format : 'QR_CODE' , cancelled : false , text : 'RESPONSE' } ;
7967
68+ return new Promise ( ( resolve , reject ) => {
69+ resolve ( theResult ) ;
70+ } ) ;
71+ }
8072
73+ /**
74+ * Encodes data into a barcode.
75+ * NOTE: not well supported on Android
76+ * @param {string } type Type of encoding
77+ * @param {any } data Data to encode
78+ * @returns {Promise<any> }
79+ */
80+ encode ( type : string , data : any ) : Promise < any > {
81+ return new Promise ( ( resolve , reject ) => {
82+ resolve ( ) ;
83+ } ) ;
84+ }
85+ }
0 commit comments