cronapp-cordova-plugin-barcodescanner 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +16 -0
- package/LICENSE.txt +22 -0
- package/README.md +52 -0
- package/hooks/windows/check-arch.js +52 -0
- package/package.json +37 -0
- package/plugin.xml +70 -0
- package/spec/helper/cordova.js +83 -0
- package/spec/index.spec.js +78 -0
- package/src/android/README.md +1 -0
- package/src/android/barcodescanner-release-2.1.5.aar +0 -0
- package/src/android/barcodescanner.gradle +17 -0
- package/src/android/com/phonegap/plugins/barcodescanner/BarcodeScanner.java +328 -0
- package/src/browser/BarcodeScannerProxy.js +24 -0
- package/src/ios/CDVBarcodeScanner.bundle/beep.caf +0 -0
- package/src/ios/CDVBarcodeScanner.bundle/torch.png +0 -0
- package/src/ios/CDVBarcodeScanner.bundle/torch@2x.png +0 -0
- package/src/ios/CDVBarcodeScanner.bundle/torch@3x.png +0 -0
- package/src/ios/CDVBarcodeScanner.mm +1072 -0
- package/src/ios/scannerOverlay.xib +185 -0
- package/src/windows/BarcodeScannerProxy.js +738 -0
- package/src/windows/assets/plugin-barcodeScanner.css +89 -0
- package/src/windows/lib/Properties/AssemblyInfo.cs +39 -0
- package/src/windows/lib/Reader.cs +173 -0
- package/src/windows/lib/WinRTBarcodeReader.csproj +137 -0
- package/src/windows/lib/ZXing.winmd +0 -0
- package/src/windows/lib.UW/ANY/ZXing.winmd +0 -0
- package/src/windows/lib.UW/ARM/ZXing.winmd +0 -0
- package/src/windows/lib.UW/x64/ZXing.winmd +0 -0
- package/src/windows/lib.UW/x86/ZXing.winmd +0 -0
- package/www/barcodescanner.js +156 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# This file is for unifying the coding style of different editors and IDEs.
|
|
2
|
+
# editorconfig.org
|
|
3
|
+
|
|
4
|
+
root = true
|
|
5
|
+
|
|
6
|
+
[*]
|
|
7
|
+
charset = utf-8
|
|
8
|
+
end_of_line = lf
|
|
9
|
+
indent_size = 4
|
|
10
|
+
indent_style = space
|
|
11
|
+
insert_final_newline = true
|
|
12
|
+
trim_trailing_whitespace = true
|
|
13
|
+
|
|
14
|
+
[*.json]
|
|
15
|
+
indent_size = 2
|
|
16
|
+
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright 2010 Matt Kane
|
|
2
|
+
Copyright 2011 IBM Corporation
|
|
3
|
+
Copyright 2012-2017 Adobe Systems
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# Cronapp Cordova Plugin BarcodeScanner
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
================================
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Cross-platform BarcodeScanner for Cordova / PhoneGap.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Follows the [Cordova Plugin spec](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html), so that it works with [Plugman](https://github.com/apache/cordova-plugman).
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
This plugin is a fork from https://github.com/phonegap/phonegap-plugin-barcodescanner
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
This plugin has minor changes for building on enviroment with Gradle 7.4+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Requirements
|
|
30
|
+
|
|
31
|
+
- `cordova-android@^11.0.0`
|
|
32
|
+
|
|
33
|
+
## Licence ##
|
|
34
|
+
|
|
35
|
+
The MIT License
|
|
36
|
+
|
|
37
|
+
Copyright (c) 2010 Matt Kane
|
|
38
|
+
|
|
39
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
|
|
40
|
+
in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
41
|
+
|
|
42
|
+
The above copyright notice and this permission notice shall be included in
|
|
43
|
+
all copies or substantial portions of the Software.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
47
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
48
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
49
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
50
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
51
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
52
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module.exports = function(ctx) {
|
|
2
|
+
if (ctx.opts && ctx.opts.platforms && ctx.opts.platforms.indexOf('windows') > -1
|
|
3
|
+
&& ctx.opts.options) {
|
|
4
|
+
var path = require('path');
|
|
5
|
+
var shell = require('shelljs');
|
|
6
|
+
var nopt = require('nopt');
|
|
7
|
+
|
|
8
|
+
// parse and validate args
|
|
9
|
+
var args = nopt({
|
|
10
|
+
'archs': [String],
|
|
11
|
+
'appx': String,
|
|
12
|
+
'phone': Boolean,
|
|
13
|
+
'win': Boolean,
|
|
14
|
+
'bundle': Boolean,
|
|
15
|
+
'packageCertificateKeyFile': String,
|
|
16
|
+
'packageThumbprint': String,
|
|
17
|
+
'publisherId': String,
|
|
18
|
+
'buildConfig': String
|
|
19
|
+
}, {}, ctx.opts.options.argv, 0);
|
|
20
|
+
|
|
21
|
+
// Check if --appx flag is passed so that we have a project build version override:
|
|
22
|
+
var isWin10 = args.appx && args.appx.toLowerCase() === 'uap';
|
|
23
|
+
|
|
24
|
+
// Else check "windows-target-version" preference:
|
|
25
|
+
if (!isWin10) {
|
|
26
|
+
var configXml = shell.ls(path.join(ctx.opts.projectRoot, 'config.xml'))[0];
|
|
27
|
+
|
|
28
|
+
var reTargetVersion = /<preference\s+name="windows-target-version"\s+value="(.+)"\s*\/>/i;
|
|
29
|
+
var targetVersion = shell.grep(reTargetVersion, configXml);
|
|
30
|
+
|
|
31
|
+
var result = reTargetVersion.exec(targetVersion);
|
|
32
|
+
if (result !== null) {
|
|
33
|
+
var match = result[1];
|
|
34
|
+
isWin10 = parseInt(match.split('.'), 10) > 8;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Non-AnyCPU arch is required for Windows 10 (UWP) projects only:
|
|
39
|
+
if (isWin10) {
|
|
40
|
+
var rawArchs = ctx.opts.options.archs || args.archs;
|
|
41
|
+
var archs = rawArchs ? rawArchs.split(' ') : [];
|
|
42
|
+
|
|
43
|
+
// Avoid "anycpu" arch:
|
|
44
|
+
if (archs.length === 0 || archs.some(function (item) {
|
|
45
|
+
return item.toLowerCase() === 'anycpu';
|
|
46
|
+
})) {
|
|
47
|
+
throw new Error('You must specify an architecture to include the proper ZXing library version.'
|
|
48
|
+
+ '\nUse \'cordova run windows -- --arch="x64"\' or \'cordova run windows -- --arch="arm" --phone --device\' for example.');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cronapp-cordova-plugin-barcodescanner",
|
|
3
|
+
"version": "2.8.0",
|
|
4
|
+
"description": "You can use the BarcodeScanner plugin to scan different types of barcodes (using the device's camera) and get the metadata encoded in them for processing within your application.",
|
|
5
|
+
"cordova": {
|
|
6
|
+
"id": "cronapp-cordova-plugin-barcodescanner",
|
|
7
|
+
"platforms": [
|
|
8
|
+
"ios",
|
|
9
|
+
"android",
|
|
10
|
+
"windows",
|
|
11
|
+
"browser"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"ecosystem:cordova",
|
|
16
|
+
"ecosystem:phonegap",
|
|
17
|
+
"cordova-ios",
|
|
18
|
+
"cordova-android",
|
|
19
|
+
"cordova-windows",
|
|
20
|
+
"cordova-browser",
|
|
21
|
+
"cordova:plugin"
|
|
22
|
+
],
|
|
23
|
+
"author": "",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"homepage": "https://github.com/cronapp-framework/cronapp-cordova-plugin#readme",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"test": "jasmine-node --color spec"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"jasmine-node": "1.14.5",
|
|
31
|
+
"pluginpub": "^0.0.9"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"nopt": "^4.0.1",
|
|
35
|
+
"shelljs": "^0.8.3"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/plugin.xml
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
+
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:rim="http://www.blackberry.com/ns/widgets" id="cronapp-cordova-plugin-barcodescanner" version="2.8.0">
|
|
3
|
+
<name>BarcodeScanner</name>
|
|
4
|
+
<description>You can use the BarcodeScanner plugin to scan different types of barcodes (using the device's camera) and get the metadata encoded in them for processing within your application.</description>
|
|
5
|
+
<license>MIT</license>
|
|
6
|
+
<repo>https://github.com/CronApp/cronapp-framework/</repo>
|
|
7
|
+
<issue>https://github.com/CronApp/cronapp-framework/issues</issue>
|
|
8
|
+
<js-module src="www/barcodescanner.js" name="BarcodeScanner">
|
|
9
|
+
<clobbers target="cordova.plugins.barcodeScanner"/>
|
|
10
|
+
</js-module>
|
|
11
|
+
<platform name="ios">
|
|
12
|
+
<config-file target="config.xml" parent="/*">
|
|
13
|
+
<feature name="BarcodeScanner">
|
|
14
|
+
<param name="ios-package" value="CDVBarcodeScanner"/>
|
|
15
|
+
</feature>
|
|
16
|
+
</config-file>
|
|
17
|
+
<resource-file src="src/ios/scannerOverlay.xib"/>
|
|
18
|
+
<resource-file src="src/ios/CDVBarcodeScanner.bundle"/>
|
|
19
|
+
<source-file src="src/ios/CDVBarcodeScanner.mm"/>
|
|
20
|
+
<!-- frameworks -->
|
|
21
|
+
<framework src="AVFoundation.framework" />
|
|
22
|
+
<framework src="AudioToolbox.framework" />
|
|
23
|
+
</platform>
|
|
24
|
+
<platform name="android">
|
|
25
|
+
<source-file src="src/android/com/phonegap/plugins/barcodescanner/BarcodeScanner.java" target-dir="src/com/phonegap/plugins/barcodescanner"/>
|
|
26
|
+
<config-file target="res/xml/config.xml" parent="/*">
|
|
27
|
+
<feature name="BarcodeScanner">
|
|
28
|
+
<param name="android-package" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"/>
|
|
29
|
+
</feature>
|
|
30
|
+
</config-file>
|
|
31
|
+
<config-file target="AndroidManifest.xml" parent="/manifest/application">
|
|
32
|
+
<activity android:name="com.google.zxing.client.android.CaptureActivity" android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden|screenSize" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden" android:exported="false"/>
|
|
33
|
+
<activity android:name="com.google.zxing.client.android.encode.EncodeActivity" android:label="Share"/>
|
|
34
|
+
</config-file>
|
|
35
|
+
<config-file target="AndroidManifest.xml" parent="/manifest">
|
|
36
|
+
<uses-permission android:name="android.permission.CAMERA"/>
|
|
37
|
+
<uses-permission android:name="android.permission.FLASHLIGHT"/>
|
|
38
|
+
<uses-feature android:name="android.hardware.camera" android:required="true"/>
|
|
39
|
+
</config-file>
|
|
40
|
+
<framework src="src/android/barcodescanner.gradle" custom="true" type="gradleReference"/>
|
|
41
|
+
<framework src="com.android.support:support-v4:$ANDROID_SUPPORT_V4_VERSION"/>
|
|
42
|
+
<lib-file src="src/android/barcodescanner-release-2.1.5.aar"/>
|
|
43
|
+
<preference name="ANDROID_SUPPORT_V4_VERSION" default="27.+"/>
|
|
44
|
+
</platform>
|
|
45
|
+
<platform name="windows">
|
|
46
|
+
<js-module src="src/windows/BarcodeScannerProxy.js" name="BarcodeScannerProxy">
|
|
47
|
+
<merges target=""/>
|
|
48
|
+
</js-module>
|
|
49
|
+
<config-file target="package.appxmanifest" parent="/Package/Capabilities">
|
|
50
|
+
<DeviceCapability Name="webcam"/>
|
|
51
|
+
</config-file>
|
|
52
|
+
<framework src="src/windows/lib.UW/x86/ZXing.winmd" target-dir="x86" arch="x86" custom="true" versions=">8.1"/>
|
|
53
|
+
<framework src="src/windows/lib.UW/x64/ZXing.winmd" target-dir="x64" arch="x64" custom="true" versions=">8.1"/>
|
|
54
|
+
<framework src="src/windows/lib.UW/ARM/ZXing.winmd" target-dir="ARM" arch="ARM" custom="true" versions=">8.1"/>
|
|
55
|
+
<framework src="src/windows/lib/WinRTBarcodeReader.csproj" custom="true" type="projectReference" versions="<=8.1"/>
|
|
56
|
+
<asset src="src/windows/assets/plugin-barcodeScanner.css" target="css/plugin-barcodeScanner.css"/>
|
|
57
|
+
<hook src="hooks/windows/check-arch.js" type="before_compile"/>
|
|
58
|
+
<hook src="hooks/windows/check-arch.js" type="before_run"/>
|
|
59
|
+
</platform>
|
|
60
|
+
<platform name="browser">
|
|
61
|
+
<config-file target="config.xml" parent="/*">
|
|
62
|
+
<feature name="BarcodeScanner">
|
|
63
|
+
<param name="browser-package" value="BarcodeScanner"/>
|
|
64
|
+
</feature>
|
|
65
|
+
</config-file>
|
|
66
|
+
<js-module src="src/browser/BarcodeScannerProxy.js" name="BarcodeScannerProxy">
|
|
67
|
+
<runs/>
|
|
68
|
+
</js-module>
|
|
69
|
+
</platform>
|
|
70
|
+
</plugin>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* global cordova:true */
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* Module dependencies.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* cordova.js for node.
|
|
9
|
+
*
|
|
10
|
+
* Think of this as cordova-node, which would be simliar to cordova-android
|
|
11
|
+
* or cordova-browser. The purpose of this module is to enable testing
|
|
12
|
+
* of a plugin's JavaScript interface.
|
|
13
|
+
*
|
|
14
|
+
* When this module is first required, it will insert a global cordova
|
|
15
|
+
* instance, which can hijack cordova-specific commands within the pluin's
|
|
16
|
+
* implementation.
|
|
17
|
+
*
|
|
18
|
+
* Remember to require this module before the plugin that you want to test.
|
|
19
|
+
*
|
|
20
|
+
* Example:
|
|
21
|
+
*
|
|
22
|
+
* var cordova = require('./helper/cordova'),
|
|
23
|
+
* myPlugin = require('../www/myPlugin');
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
module.exports = global.cordova = cordova = {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* cordova.require Mock.
|
|
30
|
+
*
|
|
31
|
+
* Hijacks all cordova.requires. By default, it returns an empty function.
|
|
32
|
+
* You can define your own implementation of each required module before
|
|
33
|
+
* or after it has been required.
|
|
34
|
+
*
|
|
35
|
+
* See `cordova.required` to learn how to add your own module implemtnation.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
require: function(moduleId) {
|
|
39
|
+
// define a default function if it doesn't exist
|
|
40
|
+
if (!cordova.required[moduleId]) {
|
|
41
|
+
cordova.required[moduleId] = function() {};
|
|
42
|
+
}
|
|
43
|
+
// create a new module mapping between the module Id and cordova.required.
|
|
44
|
+
return new ModuleMap(moduleId);
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Cordova module implementations.
|
|
49
|
+
*
|
|
50
|
+
* A key-value hash, where the key is the module such as 'cordova/exec'
|
|
51
|
+
* and the value is the function or object returned.
|
|
52
|
+
*
|
|
53
|
+
* For example:
|
|
54
|
+
*
|
|
55
|
+
* var exec = require('cordova/exec');
|
|
56
|
+
*
|
|
57
|
+
* Will map to:
|
|
58
|
+
*
|
|
59
|
+
* cordova.required['cordova/exec'];
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
required: {
|
|
63
|
+
// populated at runtime
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Module Mapper.
|
|
69
|
+
*
|
|
70
|
+
* Returns a function that when executed will lookup the implementation
|
|
71
|
+
* in cordova.required[id].
|
|
72
|
+
*
|
|
73
|
+
* @param {String} moduleId is the module name/path, such as 'cordova/exec'
|
|
74
|
+
* @return {Function}.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
function ModuleMap(moduleId) {
|
|
78
|
+
return function() {
|
|
79
|
+
// lookup and execute the module's mock implementation, passing
|
|
80
|
+
// in any parameters that were provided.
|
|
81
|
+
return cordova.required[moduleId].apply(this, arguments);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* globals require */
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* Module dependencies.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var cordova = require('./helper/cordova'),
|
|
8
|
+
BarcodeScanner = require('../www/barcodescanner'),
|
|
9
|
+
execSpy,
|
|
10
|
+
execWin,
|
|
11
|
+
options;
|
|
12
|
+
|
|
13
|
+
/*!
|
|
14
|
+
* Specification.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
describe('phonegap-plugin-barcodescanner', function () {
|
|
18
|
+
beforeEach(function () {
|
|
19
|
+
execWin = jasmine.createSpy();
|
|
20
|
+
execSpy = spyOn(cordova.required, 'cordova/exec').andCallFake(execWin);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('BarcodeScanner', function () {
|
|
24
|
+
it("BarcodeScanner plugin should exist", function() {
|
|
25
|
+
expect(BarcodeScanner).toBeDefined();
|
|
26
|
+
expect(typeof BarcodeScanner == 'object').toBe(true);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should contain a scan function", function() {
|
|
30
|
+
expect(BarcodeScanner.scan).toBeDefined();
|
|
31
|
+
expect(typeof BarcodeScanner.scan == 'function').toBe(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("should contain an encode function", function() {
|
|
35
|
+
expect(BarcodeScanner.encode).toBeDefined();
|
|
36
|
+
expect(typeof BarcodeScanner.encode == 'function').toBe(true);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("should contain three DestinationType constants", function() {
|
|
40
|
+
expect(BarcodeScanner.Encode.TEXT_TYPE).toBe("TEXT_TYPE");
|
|
41
|
+
expect(BarcodeScanner.Encode.EMAIL_TYPE).toBe("EMAIL_TYPE");
|
|
42
|
+
expect(BarcodeScanner.Encode.PHONE_TYPE).toBe("PHONE_TYPE");
|
|
43
|
+
expect(BarcodeScanner.Encode.SMS_TYPE).toBe("SMS_TYPE");
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('BarcodeScanner instance', function () {
|
|
48
|
+
describe('cordova.exec', function () {
|
|
49
|
+
it('should call cordova.exec on next process tick', function (done) {
|
|
50
|
+
BarcodeScanner.scan(function() {}, function() {}, {});
|
|
51
|
+
setTimeout(function () {
|
|
52
|
+
expect(execSpy).toHaveBeenCalledWith(
|
|
53
|
+
jasmine.any(Function),
|
|
54
|
+
jasmine.any(Function),
|
|
55
|
+
'BarcodeScanner',
|
|
56
|
+
'scan',
|
|
57
|
+
jasmine.any(Object)
|
|
58
|
+
);
|
|
59
|
+
done();
|
|
60
|
+
}, 100);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should call cordova.exec on next process tick', function (done) {
|
|
64
|
+
BarcodeScanner.encode("", "",function() {}, function() {}, {});
|
|
65
|
+
setTimeout(function () {
|
|
66
|
+
expect(execSpy).toHaveBeenCalledWith(
|
|
67
|
+
jasmine.any(Function),
|
|
68
|
+
jasmine.any(Function),
|
|
69
|
+
'BarcodeScanner',
|
|
70
|
+
'encode',
|
|
71
|
+
jasmine.any(Object)
|
|
72
|
+
);
|
|
73
|
+
done();
|
|
74
|
+
}, 100);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The Android .aar sources are [here](https://github.com/EddyVerbruggen/barcodescanner-lib-aar).
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
repositories{
|
|
2
|
+
jcenter()
|
|
3
|
+
flatDir{
|
|
4
|
+
dirs 'libs'
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
dependencies {
|
|
9
|
+
implementation(name:'barcodescanner-release-2.1.5', ext:'aar')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
android {
|
|
13
|
+
packagingOptions {
|
|
14
|
+
exclude 'META-INF/NOTICE'
|
|
15
|
+
exclude 'META-INF/LICENSE'
|
|
16
|
+
}
|
|
17
|
+
}
|